From fb3ad9c2808a387e2076e86048a53dab323f3824 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 10:52:37 -0500 Subject: [PATCH 01/23] feat(codegen): fixed-length Array ABI type support --- sdk/python/aleo/codegen/_emit.py | 30 ++++++++++++++++----- sdk/python/aleo/codegen/runtime.py | 9 +++++++ sdk/python/tests/test_codegen_emit.py | 34 ++++++++++++++++++++++++ sdk/python/tests/test_codegen_runtime.py | 14 ++++++++++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/sdk/python/aleo/codegen/_emit.py b/sdk/python/aleo/codegen/_emit.py index 08cd8108..4928be82 100644 --- a/sdk/python/aleo/codegen/_emit.py +++ b/sdk/python/aleo/codegen/_emit.py @@ -75,6 +75,17 @@ def resolve_ty(ty: Any) -> PyType: lambda e: f"{e}.to_plaintext()", lambda e, n=name: f"{n}.from_decoded({e})", ) + if isinstance(ty, dict) and "Array" in ty: + elem = resolve_ty(ty["Array"]["element"]) + length = int(ty["Array"]["length"]) + needs_decode = elem.decode_expr("_x") != "_x" + return PyType( + f"list[{elem.annotation}]", + lambda e, el=elem, n=length: + f"fmt_array({e}, lambda _x: {el.encode_expr('_x')}, {n})", + (lambda e, el=elem: f"[{el.decode_expr('_x')} for _x in {e}]") + if needs_decode else (lambda e: e), + ) raise ValueError(f"Unsupported ABI type: {ty!r}") @@ -125,16 +136,23 @@ def emit_struct(struct: dict[str, Any]) -> str: "from dataclasses import dataclass\n" "from typing import Any, Callable, Optional\n" "from aleo.codegen.runtime import (parse_plaintext, fmt_int, fmt_bool," - " fmt_fieldlike, fmt_address)\n\n" + " fmt_fieldlike, fmt_address, fmt_array)\n\n" ) +def _iter_struct_refs(ty: Any): + """Yield every ``{"Struct": ...}`` reference in a ty tree (arrays included).""" + if isinstance(ty, dict) and "Struct" in ty: + yield ty + elif isinstance(ty, dict) and "Array" in ty: + yield from _iter_struct_refs(ty["Array"]["element"]) + + def _struct_deps(struct: dict[str, Any]) -> set[str]: deps: set[str] = set() for f in struct["fields"]: - ty = f["ty"] - if isinstance(ty, dict) and "Struct" in ty: - deps.add(ty["Struct"]["path"][-1]) + for ref in _iter_struct_refs(f["ty"]): + deps.add(ref["Struct"]["path"][-1]) return deps @@ -206,8 +224,8 @@ class that is never generated (NameError at import/decode time), and two local = set(names) def check(ty: Any, context: str) -> None: - if isinstance(ty, dict) and "Struct" in ty: - ref = ty["Struct"] + for entry in _iter_struct_refs(ty): + ref = entry["Struct"] name, prog = ref["path"][-1], ref.get("program", program) if name not in local or prog != program: raise ValueError( diff --git a/sdk/python/aleo/codegen/runtime.py b/sdk/python/aleo/codegen/runtime.py index 34688ed0..8d657c33 100644 --- a/sdk/python/aleo/codegen/runtime.py +++ b/sdk/python/aleo/codegen/runtime.py @@ -156,3 +156,12 @@ def fmt_address(v: object) -> str: if not (isinstance(v, str) and v.startswith("aleo1")): raise ValueError(f"Expected an aleo1… address literal, got {v!r}") return v + + +def fmt_array(v: object, encode_one: Any, length: int) -> str: + """Format a fixed-length list as an Aleo array literal.""" + if not isinstance(v, list): + raise ValueError(f"Expected a list of length {length}, got {type(v).__name__}") + if len(v) != length: + raise ValueError(f"Expected a list of length {length}, got length {len(v)}") + return "[" + ", ".join(encode_one(x) for x in v) + "]" diff --git a/sdk/python/tests/test_codegen_emit.py b/sdk/python/tests/test_codegen_emit.py index 3bc3b736..401a345c 100644 --- a/sdk/python/tests/test_codegen_emit.py +++ b/sdk/python/tests/test_codegen_emit.py @@ -138,3 +138,37 @@ def test_emit_module_rejects_unresolvable_struct_refs(): {"path": ["Inner"], "fields": [{"name": "b", "ty": {"Primitive": "Boolean"}}]}]) with pytest.raises(ValueError, match="Inner"): emit_module(duped) + + +def test_array_struct_roundtrip(): + abi = { + "program": "arr_test.aleo", + "structs": [{"path": ["MerkleProof"], "fields": [ + {"name": "siblings", "ty": {"Array": {"element": {"Primitive": "Field"}, "length": 3}}}, + {"name": "leaf_index", "ty": {"Primitive": {"UInt": "U32"}}}, + ]}], + "records": [], "mappings": [], "functions": [], + } + ns: dict = {} + exec(compile(emit_module(abi), "", "exec"), ns) + mp = ns["MerkleProof"](siblings=["0field", "1field", "2field"], leaf_index=1) + text = mp.to_plaintext() + assert text == "{ siblings: [0field, 1field, 2field], leaf_index: 1u32 }" + assert ns["MerkleProof"].from_plaintext(text) == mp + + +def test_array_of_structs_decodes_elementwise(): + abi = { + "program": "arr_test.aleo", + "structs": [ + {"path": ["Inner"], "fields": [{"name": "x", "ty": {"Primitive": {"UInt": "U8"}}}]}, + {"path": ["Outer"], "fields": [{"name": "pair", "ty": {"Array": { + "element": {"Struct": {"path": ["Inner"], "program": "arr_test.aleo"}}, "length": 2}}}]}, + ], + "records": [], "mappings": [], "functions": [], + } + ns: dict = {} + exec(compile(emit_module(abi), "", "exec"), ns) + o = ns["Outer"].from_plaintext("{ pair: [{ x: 1u8 }, { x: 2u8 }] }") + assert o.pair == [ns["Inner"](x=1), ns["Inner"](x=2)] + assert o.to_plaintext() == "{ pair: [{ x: 1u8 }, { x: 2u8 }] }" diff --git a/sdk/python/tests/test_codegen_runtime.py b/sdk/python/tests/test_codegen_runtime.py index 16811b94..9ea638fc 100644 --- a/sdk/python/tests/test_codegen_runtime.py +++ b/sdk/python/tests/test_codegen_runtime.py @@ -86,3 +86,17 @@ def test_fmt_fieldlike_and_address(): assert fmt_address("aleo1abc") == "aleo1abc" with pytest.raises(ValueError): fmt_address("0xdeadbeef") + + +def test_fmt_array_encodes_fixed_length_list(): + from aleo.codegen.runtime import fmt_array + out = fmt_array(["1field", "2field"], lambda x: fmt_fieldlike(x, "field"), 2) + assert out == "[1field, 2field]" + + +def test_fmt_array_rejects_wrong_length_and_type(): + from aleo.codegen.runtime import fmt_array + with pytest.raises(ValueError, match="length 2"): + fmt_array(["1field"], str, 2) + with pytest.raises(ValueError, match="Expected a list"): + fmt_array("1field", str, 2) From 3d5fbd5f3290501f1b99b04b9724f19f3e7d0a1b Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 10:53:44 -0500 Subject: [PATCH 02/23] feat(shield-swap): regenerate wire layer from deployed shield_swap.aleo --- shield-swap-sdk/codegen/regen-abi.sh | 2 +- shield-swap-sdk/codegen/shield_swap.abi.json | 791 ++++++++++++------ .../python/aleo_shield_swap/_generated.py | 157 ++-- shield-swap-sdk/tests/test_generated.py | 54 +- 4 files changed, 662 insertions(+), 342 deletions(-) diff --git a/shield-swap-sdk/codegen/regen-abi.sh b/shield-swap-sdk/codegen/regen-abi.sh index 04464556..376be119 100755 --- a/shield-swap-sdk/codegen/regen-abi.sh +++ b/shield-swap-sdk/codegen/regen-abi.sh @@ -3,7 +3,7 @@ # Run from anywhere; requires the aleo + aleo-contract-abi-generator packages on python3's path. set -euo pipefail cd "$(dirname "$0")" -PROGRAM="${1:-shield_swap_v3.aleo}" +PROGRAM="${1:-shield_swap.aleo}" PYTHON="${PYTHON:-python3}" "$PYTHON" - "$PROGRAM" <<'EOF' import json diff --git a/shield-swap-sdk/codegen/shield_swap.abi.json b/shield-swap-sdk/codegen/shield_swap.abi.json index c7d2fa8b..1dabb03c 100644 --- a/shield-swap-sdk/codegen/shield_swap.abi.json +++ b/shield-swap-sdk/codegen/shield_swap.abi.json @@ -1,6 +1,29 @@ { - "program": "shield_swap_v3.aleo", + "program": "shield_swap.aleo", "structs": [ + { + "path": [ + "U256__8JquwLopp8" + ], + "fields": [ + { + "name": "hi", + "ty": { + "Primitive": { + "UInt": "U128" + } + } + }, + { + "name": "lo", + "ty": { + "Primitive": { + "UInt": "U128" + } + } + } + ] + }, { "path": [ "SwapRequest" @@ -37,8 +60,11 @@ { "name": "sqrt_price_limit", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -86,8 +112,11 @@ { "name": "sqrt_price_limit", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } } @@ -139,7 +168,7 @@ "path": [ "SwapHop" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -150,7 +179,7 @@ "path": [ "SwapHop" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -161,7 +190,7 @@ "path": [ "SwapHop" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -274,6 +303,32 @@ } ] }, + { + "path": [ + "MerkleProof" + ], + "fields": [ + { + "name": "siblings", + "ty": { + "Array": { + "element": { + "Primitive": "Field" + }, + "length": 16 + } + } + }, + { + "name": "leaf_index", + "ty": { + "Primitive": { + "UInt": "U32" + } + } + } + ] + }, { "path": [ "PoolState" @@ -304,22 +359,6 @@ "ty": { "Primitive": "Boolean" } - }, - { - "name": "scale0", - "ty": { - "Primitive": { - "UInt": "U128" - } - } - }, - { - "name": "scale1", - "ty": { - "Primitive": { - "UInt": "U128" - } - } } ] }, @@ -347,8 +386,11 @@ { "name": "sqrt_price", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -369,34 +411,24 @@ } }, { - "name": "fee_growth_global0_x_64", - "ty": { - "Primitive": { - "UInt": "U128" - } - } - }, - { - "name": "fee_growth_global1_x_64", - "ty": { - "Primitive": { - "UInt": "U128" - } - } - }, - { - "name": "fee_residual0_x_64", + "name": "fee_growth_global0_x_128", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, { - "name": "fee_residual1_x_64", + "name": "fee_growth_global1_x_128", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -478,18 +510,24 @@ } }, { - "name": "fee_growth_outside0_64", + "name": "fee_growth_outside0_x_128", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, { - "name": "fee_growth_outside1_64", + "name": "fee_growth_outside1_x_128", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -553,18 +591,24 @@ } }, { - "name": "fee_growth_inside0_last_64", + "name": "fee_growth_inside0_last_x_128", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, { - "name": "fee_growth_inside1_last_64", + "name": "fee_growth_inside1_last_x_128", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -619,8 +663,11 @@ { "name": "lim", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -643,16 +690,22 @@ { "name": "slot_fg0", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, { "name": "slot_fg1", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } } @@ -666,8 +719,11 @@ { "name": "sp", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -690,8 +746,11 @@ { "name": "fg", "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } } }, @@ -740,14 +799,6 @@ "Int": "I32" } } - }, - { - "name": "resid", - "ty": { - "Primitive": { - "UInt": "U128" - } - } } ] }, @@ -795,34 +846,6 @@ "UInt": "U128" } } - }, - { - "name": "token_in_1", - "ty": { - "Primitive": "Field" - } - }, - { - "name": "amount_remaining_1", - "ty": { - "Primitive": { - "UInt": "U128" - } - } - }, - { - "name": "token_in_2", - "ty": { - "Primitive": "Field" - } - }, - { - "name": "amount_remaining_2", - "ty": { - "Primitive": { - "UInt": "U128" - } - } } ] } @@ -840,6 +863,13 @@ }, "mode": "Public" }, + { + "name": "withdrawal", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, { "name": "token_id", "ty": { @@ -928,7 +958,7 @@ "path": [ "SwapRequest" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Private" @@ -940,6 +970,13 @@ }, "mode": "Private" }, + { + "name": "signer", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, { "name": "blinded_address", "ty": { @@ -975,7 +1012,7 @@ "path": [ "SwapMultiHopRequest" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Private" @@ -987,6 +1024,13 @@ }, "mode": "Private" }, + { + "name": "signer", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, { "name": "blinded_address", "ty": { @@ -1029,6 +1073,13 @@ }, "mode": "Private" }, + { + "name": "nonce", + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + }, { "name": "request", "ty": { @@ -1036,7 +1087,7 @@ "path": [ "MintPositionRequest" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Private" @@ -1048,12 +1099,26 @@ }, "mode": "Private" }, + { + "name": "signer", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + }, { "name": "recipient", "ty": { "Primitive": "Address" }, "mode": "Private" + }, + { + "name": "withdrawal", + "ty": { + "Primitive": "Address" + }, + "mode": "Private" } ] } @@ -1069,7 +1134,7 @@ "path": [ "PoolState" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -1083,7 +1148,7 @@ "path": [ "Slot" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -1097,7 +1162,7 @@ "path": [ "Tick" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -1155,7 +1220,7 @@ "path": [ "Position" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -1169,7 +1234,7 @@ "path": [ "SwapOutput" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } }, @@ -1200,17 +1265,6 @@ "Primitive": "Boolean" } }, - { - "name": "token_decimals", - "key": { - "Primitive": "Field" - }, - "value": { - "Primitive": { - "UInt": "U8" - } - } - }, { "name": "pool_creation_is_open", "key": { @@ -1254,7 +1308,7 @@ "path": [ "PairKey" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "value": { @@ -1271,6 +1325,24 @@ "UInt": "U32" } } + }, + { + "name": "from_wrapper_token_id", + "key": { + "Primitive": "Field" + }, + "value": { + "Primitive": "Field" + } + }, + { + "name": "to_wrapper_token_id", + "key": { + "Primitive": "Field" + }, + "value": { + "Primitive": "Field" + } } ], "storage_variables": [], @@ -1362,32 +1434,6 @@ "Final" ] }, - { - "name": "set_token_decimals", - "inputs": [ - { - "Plaintext": { - "ty": { - "Primitive": "Field" - }, - "mode": "Public" - } - }, - { - "Plaintext": { - "ty": { - "Primitive": { - "UInt": "U8" - } - }, - "mode": "Public" - } - } - ], - "outputs": [ - "Final" - ] - }, { "name": "set_pool_enabled", "inputs": [ @@ -1454,8 +1500,16 @@ }, "mode": "Public" } - } - ], + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + } + ], "outputs": [ "Final" ] @@ -1666,8 +1720,11 @@ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -1735,6 +1792,14 @@ "mode": "Private" } }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, { "Plaintext": { "ty": { @@ -1742,7 +1807,7 @@ "path": [ "MintPositionRequest" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -1763,6 +1828,60 @@ }, "mode": "Public" } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } } ], "outputs": [ @@ -1779,7 +1898,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "DynamicRecord", @@ -1789,7 +1908,7 @@ "path": [ "MintComplianceRecord" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "Final" @@ -1803,7 +1922,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, { @@ -1851,7 +1970,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "Final" @@ -1865,7 +1984,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "DynamicRecord", @@ -1961,7 +2080,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "DynamicRecord", @@ -1977,7 +2096,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, { @@ -2019,7 +2138,35 @@ { "Plaintext": { "ty": { - "Primitive": "Address" + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } }, "mode": "Private" } @@ -2031,7 +2178,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "DynamicRecord", @@ -2047,7 +2194,7 @@ "path": [ "PositionNFT" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } } ], @@ -2060,14 +2207,6 @@ "mode": "Public" } }, - { - "Plaintext": { - "ty": { - "Primitive": "Address" - }, - "mode": "Public" - } - }, "Final" ] }, @@ -2130,8 +2269,11 @@ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2189,7 +2331,7 @@ "path": [ "SwapComplianceRecord" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "Final" @@ -2257,6 +2399,24 @@ }, "mode": "Public" } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } } ], "outputs": [ @@ -2328,7 +2488,7 @@ "path": [ "SwapHop" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2341,7 +2501,7 @@ "path": [ "SwapHop" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2354,7 +2514,7 @@ "path": [ "SwapHop" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2406,35 +2566,56 @@ "path": [ "MultiHopSwapComplianceRecord" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "Final" ] - }, + } + ], + "views": [ { - "name": "claim_multi_hop_output", + "name": "view_sqrt_price_at_tick_x128", "inputs": [ { "Plaintext": { "ty": { - "Primitive": "Field" + "Primitive": { + "Int": "I32" + } }, - "mode": "Private" + "mode": "Public" } - }, + } + ], + "outputs": [ { "Plaintext": { "ty": { - "Primitive": "Address" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } }, "mode": "Public" } - }, + } + ] + }, + { + "name": "view_mul_div", + "inputs": [ { "Plaintext": { "ty": { - "Primitive": "Field" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } }, "mode": "Public" } @@ -2442,7 +2623,12 @@ { "Plaintext": { "ty": { - "Primitive": "Field" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } }, "mode": "Public" } @@ -2450,7 +2636,12 @@ { "Plaintext": { "ty": { - "Primitive": "Field" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } }, "mode": "Public" } @@ -2458,18 +2649,39 @@ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Primitive": "Boolean" + }, + "mode": "Public" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" } - }, + } + ] + }, + { + "name": "view_swap_iteration", + "inputs": [ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "SwapIterCfg" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2478,7 +2690,9 @@ { "Plaintext": { "ty": { - "Primitive": "Field" + "Primitive": { + "Int": "I32" + } }, "mode": "Public" } @@ -2486,8 +2700,11 @@ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2496,7 +2713,12 @@ { "Plaintext": { "ty": { - "Primitive": "Field" + "Struct": { + "path": [ + "Tick" + ], + "program": "shield_swap.aleo" + } }, "mode": "Public" } @@ -2504,8 +2726,11 @@ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "SwapIterState" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2513,35 +2738,27 @@ } ], "outputs": [ - "DynamicRecord", - "DynamicRecord", - "DynamicRecord", - "DynamicRecord", - "Final" - ] - } - ], - "views": [ - { - "name": "view_sqrt_price_at_tick", - "inputs": [ { "Plaintext": { "ty": { - "Primitive": { - "Int": "I32" + "Struct": { + "path": [ + "SwapIterState" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" } - } - ], - "outputs": [ + }, { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "Tick" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2550,8 +2767,21 @@ ] }, { - "name": "view_amounts_for_liquidity", + "name": "view_bounded_partial", "inputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, { "Plaintext": { "ty": { @@ -2582,6 +2812,19 @@ "mode": "Public" } }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, { "Plaintext": { "ty": { @@ -2595,18 +2838,34 @@ { "Plaintext": { "ty": { - "Primitive": "Boolean" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } }, "mode": "Public" } - } - ], - "outputs": [ + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, { "Plaintext": { "ty": { "Primitive": { - "UInt": "U128" + "UInt": "U32" } }, "mode": "Public" @@ -2616,22 +2875,30 @@ "Plaintext": { "ty": { "Primitive": { - "UInt": "U128" + "UInt": "U8" } }, "mode": "Public" } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Boolean" + }, + "mode": "Public" + } } - ] - }, - { - "name": "view_liquidity_for_amounts", - "inputs": [ + ], + "outputs": [ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2660,8 +2927,11 @@ { "Plaintext": { "ty": { - "Primitive": { - "UInt": "U128" + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2676,14 +2946,12 @@ }, "mode": "Public" } - } - ], - "outputs": [ + }, { "Plaintext": { "ty": { "Primitive": { - "UInt": "U128" + "Int": "I32" } }, "mode": "Public" @@ -2692,16 +2960,16 @@ ] }, { - "name": "view_swap_iteration", + "name": "resolve_stored_tick", "inputs": [ { "Plaintext": { "ty": { "Struct": { "path": [ - "SwapIterCfg" + "U256__8JquwLopp8" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2722,9 +2990,9 @@ "ty": { "Struct": { "path": [ - "Tick" + "U256__8JquwLopp8" ], - "program": "shield_swap_v3.aleo" + "program": "shield_swap.aleo" } }, "mode": "Public" @@ -2733,39 +3001,28 @@ { "Plaintext": { "ty": { - "Struct": { - "path": [ - "SwapIterState" - ], - "program": "shield_swap_v3.aleo" + "Primitive": { + "Int": "I32" } }, "mode": "Public" } - } - ], - "outputs": [ + }, { "Plaintext": { "ty": { - "Struct": { - "path": [ - "SwapIterState" - ], - "program": "shield_swap_v3.aleo" - } + "Primitive": "Boolean" }, "mode": "Public" } - }, + } + ], + "outputs": [ { "Plaintext": { "ty": { - "Struct": { - "path": [ - "Tick" - ], - "program": "shield_swap_v3.aleo" + "Primitive": { + "Int": "I32" } }, "mode": "Public" diff --git a/shield-swap-sdk/python/aleo_shield_swap/_generated.py b/shield-swap-sdk/python/aleo_shield_swap/_generated.py index a2f07f4c..5a6ea65b 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/_generated.py +++ b/shield-swap-sdk/python/aleo_shield_swap/_generated.py @@ -1,9 +1,30 @@ # Generated by aleo.codegen — DO NOT EDIT. from dataclasses import dataclass from typing import Any, Callable, Optional -from aleo.codegen.runtime import (parse_plaintext, fmt_int, fmt_bool, fmt_fieldlike, fmt_address) +from aleo.codegen.runtime import (parse_plaintext, fmt_int, fmt_bool, fmt_fieldlike, fmt_address, fmt_array) + +PROGRAM_ID = "shield_swap.aleo" + +@dataclass(frozen=True) +class U256__8JquwLopp8: + hi: int + lo: int + + def to_plaintext(self) -> str: + parts = [ + "hi: " + fmt_int(self.hi, 'u128'), + "lo: " + fmt_int(self.lo, 'u128'), + ] + return "{ " + ", ".join(parts) + " }" + + @classmethod + def from_decoded(cls, d: dict) -> "U256__8JquwLopp8": + return cls(hi=d['hi'], lo=d['lo']) + + @classmethod + def from_plaintext(cls, text: str) -> "U256__8JquwLopp8": + return cls.from_decoded(parse_plaintext(text)) -PROGRAM_ID = "shield_swap_v3.aleo" @dataclass(frozen=True) class SwapRequest: @@ -11,7 +32,7 @@ class SwapRequest: zero_for_one: bool amount_in: int amount_out_min: int - sqrt_price_limit: int + sqrt_price_limit: U256__8JquwLopp8 recipient: str nonce: int deadline: int @@ -22,7 +43,7 @@ def to_plaintext(self) -> str: "zero_for_one: " + fmt_bool(self.zero_for_one), "amount_in: " + fmt_int(self.amount_in, 'u128'), "amount_out_min: " + fmt_int(self.amount_out_min, 'u128'), - "sqrt_price_limit: " + fmt_int(self.sqrt_price_limit, 'u128'), + "sqrt_price_limit: " + self.sqrt_price_limit.to_plaintext(), "recipient: " + fmt_address(self.recipient), "nonce: " + fmt_int(self.nonce, 'u64'), "deadline: " + fmt_int(self.deadline, 'u32'), @@ -31,7 +52,7 @@ def to_plaintext(self) -> str: @classmethod def from_decoded(cls, d: dict) -> "SwapRequest": - return cls(pool=d['pool'], zero_for_one=d['zero_for_one'], amount_in=d['amount_in'], amount_out_min=d['amount_out_min'], sqrt_price_limit=d['sqrt_price_limit'], recipient=d['recipient'], nonce=d['nonce'], deadline=d['deadline']) + return cls(pool=d['pool'], zero_for_one=d['zero_for_one'], amount_in=d['amount_in'], amount_out_min=d['amount_out_min'], sqrt_price_limit=U256__8JquwLopp8.from_decoded(d['sqrt_price_limit']), recipient=d['recipient'], nonce=d['nonce'], deadline=d['deadline']) @classmethod def from_plaintext(cls, text: str) -> "SwapRequest": @@ -42,19 +63,19 @@ def from_plaintext(cls, text: str) -> "SwapRequest": class SwapHop: pool: str zero_for_one: bool - sqrt_price_limit: int + sqrt_price_limit: U256__8JquwLopp8 def to_plaintext(self) -> str: parts = [ "pool: " + fmt_fieldlike(self.pool, 'field'), "zero_for_one: " + fmt_bool(self.zero_for_one), - "sqrt_price_limit: " + fmt_int(self.sqrt_price_limit, 'u128'), + "sqrt_price_limit: " + self.sqrt_price_limit.to_plaintext(), ] return "{ " + ", ".join(parts) + " }" @classmethod def from_decoded(cls, d: dict) -> "SwapHop": - return cls(pool=d['pool'], zero_for_one=d['zero_for_one'], sqrt_price_limit=d['sqrt_price_limit']) + return cls(pool=d['pool'], zero_for_one=d['zero_for_one'], sqrt_price_limit=U256__8JquwLopp8.from_decoded(d['sqrt_price_limit'])) @classmethod def from_plaintext(cls, text: str) -> "SwapHop": @@ -137,14 +158,33 @@ def from_plaintext(cls, text: str) -> "MintPositionRequest": return cls.from_decoded(parse_plaintext(text)) +@dataclass(frozen=True) +class MerkleProof: + siblings: list[str] + leaf_index: int + + def to_plaintext(self) -> str: + parts = [ + "siblings: " + fmt_array(self.siblings, lambda _x: fmt_fieldlike(_x, 'field'), 16), + "leaf_index: " + fmt_int(self.leaf_index, 'u32'), + ] + return "{ " + ", ".join(parts) + " }" + + @classmethod + def from_decoded(cls, d: dict) -> "MerkleProof": + return cls(siblings=d['siblings'], leaf_index=d['leaf_index']) + + @classmethod + def from_plaintext(cls, text: str) -> "MerkleProof": + return cls.from_decoded(parse_plaintext(text)) + + @dataclass(frozen=True) class PoolState: token0: str token1: str fee: int enabled: bool - scale0: int - scale1: int def to_plaintext(self) -> str: parts = [ @@ -152,14 +192,12 @@ def to_plaintext(self) -> str: "token1: " + fmt_fieldlike(self.token1, 'field'), "fee: " + fmt_int(self.fee, 'u16'), "enabled: " + fmt_bool(self.enabled), - "scale0: " + fmt_int(self.scale0, 'u128'), - "scale1: " + fmt_int(self.scale1, 'u128'), ] return "{ " + ", ".join(parts) + " }" @classmethod def from_decoded(cls, d: dict) -> "PoolState": - return cls(token0=d['token0'], token1=d['token1'], fee=d['fee'], enabled=d['enabled'], scale0=d['scale0'], scale1=d['scale1']) + return cls(token0=d['token0'], token1=d['token1'], fee=d['fee'], enabled=d['enabled']) @classmethod def from_plaintext(cls, text: str) -> "PoolState": @@ -170,13 +208,11 @@ def from_plaintext(cls, text: str) -> "PoolState": class Slot: tick: int tick_spacing: int - sqrt_price: int + sqrt_price: U256__8JquwLopp8 fee_protocol: int liquidity: int - fee_growth_global0_x_64: int - fee_growth_global1_x_64: int - fee_residual0_x_64: int - fee_residual1_x_64: int + fee_growth_global0_x_128: U256__8JquwLopp8 + fee_growth_global1_x_128: U256__8JquwLopp8 max_liquidity_per_tick: int protocol_fees0: int protocol_fees1: int @@ -187,13 +223,11 @@ def to_plaintext(self) -> str: parts = [ "tick: " + fmt_int(self.tick, 'i32'), "tick_spacing: " + fmt_int(self.tick_spacing, 'u32'), - "sqrt_price: " + fmt_int(self.sqrt_price, 'u128'), + "sqrt_price: " + self.sqrt_price.to_plaintext(), "fee_protocol: " + fmt_int(self.fee_protocol, 'u8'), "liquidity: " + fmt_int(self.liquidity, 'u128'), - "fee_growth_global0_x_64: " + fmt_int(self.fee_growth_global0_x_64, 'u128'), - "fee_growth_global1_x_64: " + fmt_int(self.fee_growth_global1_x_64, 'u128'), - "fee_residual0_x_64: " + fmt_int(self.fee_residual0_x_64, 'u128'), - "fee_residual1_x_64: " + fmt_int(self.fee_residual1_x_64, 'u128'), + "fee_growth_global0_x_128: " + self.fee_growth_global0_x_128.to_plaintext(), + "fee_growth_global1_x_128: " + self.fee_growth_global1_x_128.to_plaintext(), "max_liquidity_per_tick: " + fmt_int(self.max_liquidity_per_tick, 'u128'), "protocol_fees0: " + fmt_int(self.protocol_fees0, 'u128'), "protocol_fees1: " + fmt_int(self.protocol_fees1, 'u128'), @@ -204,7 +238,7 @@ def to_plaintext(self) -> str: @classmethod def from_decoded(cls, d: dict) -> "Slot": - return cls(tick=d['tick'], tick_spacing=d['tick_spacing'], sqrt_price=d['sqrt_price'], fee_protocol=d['fee_protocol'], liquidity=d['liquidity'], fee_growth_global0_x_64=d['fee_growth_global0_x_64'], fee_growth_global1_x_64=d['fee_growth_global1_x_64'], fee_residual0_x_64=d['fee_residual0_x_64'], fee_residual1_x_64=d['fee_residual1_x_64'], max_liquidity_per_tick=d['max_liquidity_per_tick'], protocol_fees0=d['protocol_fees0'], protocol_fees1=d['protocol_fees1'], next_init_below=d['next_init_below'], next_init_above=d['next_init_above']) + return cls(tick=d['tick'], tick_spacing=d['tick_spacing'], sqrt_price=U256__8JquwLopp8.from_decoded(d['sqrt_price']), fee_protocol=d['fee_protocol'], liquidity=d['liquidity'], fee_growth_global0_x_128=U256__8JquwLopp8.from_decoded(d['fee_growth_global0_x_128']), fee_growth_global1_x_128=U256__8JquwLopp8.from_decoded(d['fee_growth_global1_x_128']), max_liquidity_per_tick=d['max_liquidity_per_tick'], protocol_fees0=d['protocol_fees0'], protocol_fees1=d['protocol_fees1'], next_init_below=d['next_init_below'], next_init_above=d['next_init_above']) @classmethod def from_plaintext(cls, text: str) -> "Slot": @@ -217,8 +251,8 @@ class Tick: liquidity_net: int liquidity_gross: int tick: int - fee_growth_outside0_64: int - fee_growth_outside1_64: int + fee_growth_outside0_x_128: U256__8JquwLopp8 + fee_growth_outside1_x_128: U256__8JquwLopp8 prev: int next: int @@ -228,8 +262,8 @@ def to_plaintext(self) -> str: "liquidity_net: " + fmt_int(self.liquidity_net, 'i128'), "liquidity_gross: " + fmt_int(self.liquidity_gross, 'u128'), "tick: " + fmt_int(self.tick, 'i32'), - "fee_growth_outside0_64: " + fmt_int(self.fee_growth_outside0_64, 'u128'), - "fee_growth_outside1_64: " + fmt_int(self.fee_growth_outside1_64, 'u128'), + "fee_growth_outside0_x_128: " + self.fee_growth_outside0_x_128.to_plaintext(), + "fee_growth_outside1_x_128: " + self.fee_growth_outside1_x_128.to_plaintext(), "prev: " + fmt_int(self.prev, 'i32'), "next: " + fmt_int(self.next, 'i32'), ] @@ -237,7 +271,7 @@ def to_plaintext(self) -> str: @classmethod def from_decoded(cls, d: dict) -> "Tick": - return cls(pool=d['pool'], liquidity_net=d['liquidity_net'], liquidity_gross=d['liquidity_gross'], tick=d['tick'], fee_growth_outside0_64=d['fee_growth_outside0_64'], fee_growth_outside1_64=d['fee_growth_outside1_64'], prev=d['prev'], next=d['next']) + return cls(pool=d['pool'], liquidity_net=d['liquidity_net'], liquidity_gross=d['liquidity_gross'], tick=d['tick'], fee_growth_outside0_x_128=U256__8JquwLopp8.from_decoded(d['fee_growth_outside0_x_128']), fee_growth_outside1_x_128=U256__8JquwLopp8.from_decoded(d['fee_growth_outside1_x_128']), prev=d['prev'], next=d['next']) @classmethod def from_plaintext(cls, text: str) -> "Tick": @@ -251,8 +285,8 @@ class Position: tick_lower: int tick_upper: int liquidity: int - fee_growth_inside0_last_64: int - fee_growth_inside1_last_64: int + fee_growth_inside0_last_x_128: U256__8JquwLopp8 + fee_growth_inside1_last_x_128: U256__8JquwLopp8 tokens_owed0: int tokens_owed1: int @@ -263,8 +297,8 @@ def to_plaintext(self) -> str: "tick_lower: " + fmt_int(self.tick_lower, 'i32'), "tick_upper: " + fmt_int(self.tick_upper, 'i32'), "liquidity: " + fmt_int(self.liquidity, 'u128'), - "fee_growth_inside0_last_64: " + fmt_int(self.fee_growth_inside0_last_64, 'u128'), - "fee_growth_inside1_last_64: " + fmt_int(self.fee_growth_inside1_last_64, 'u128'), + "fee_growth_inside0_last_x_128: " + self.fee_growth_inside0_last_x_128.to_plaintext(), + "fee_growth_inside1_last_x_128: " + self.fee_growth_inside1_last_x_128.to_plaintext(), "tokens_owed0: " + fmt_int(self.tokens_owed0, 'u128'), "tokens_owed1: " + fmt_int(self.tokens_owed1, 'u128'), ] @@ -272,7 +306,7 @@ def to_plaintext(self) -> str: @classmethod def from_decoded(cls, d: dict) -> "Position": - return cls(token_id=d['token_id'], pool=d['pool'], tick_lower=d['tick_lower'], tick_upper=d['tick_upper'], liquidity=d['liquidity'], fee_growth_inside0_last_64=d['fee_growth_inside0_last_64'], fee_growth_inside1_last_64=d['fee_growth_inside1_last_64'], tokens_owed0=d['tokens_owed0'], tokens_owed1=d['tokens_owed1']) + return cls(token_id=d['token_id'], pool=d['pool'], tick_lower=d['tick_lower'], tick_upper=d['tick_upper'], liquidity=d['liquidity'], fee_growth_inside0_last_x_128=U256__8JquwLopp8.from_decoded(d['fee_growth_inside0_last_x_128']), fee_growth_inside1_last_x_128=U256__8JquwLopp8.from_decoded(d['fee_growth_inside1_last_x_128']), tokens_owed0=d['tokens_owed0'], tokens_owed1=d['tokens_owed1']) @classmethod def from_plaintext(cls, text: str) -> "Position": @@ -303,26 +337,26 @@ def from_plaintext(cls, text: str) -> "PairKey": @dataclass(frozen=True) class SwapIterCfg: z: bool - lim: int + lim: U256__8JquwLopp8 fee_pips: int fee_protocol: int - slot_fg0: int - slot_fg1: int + slot_fg0: U256__8JquwLopp8 + slot_fg1: U256__8JquwLopp8 def to_plaintext(self) -> str: parts = [ "z: " + fmt_bool(self.z), - "lim: " + fmt_int(self.lim, 'u128'), + "lim: " + self.lim.to_plaintext(), "fee_pips: " + fmt_int(self.fee_pips, 'u32'), "fee_protocol: " + fmt_int(self.fee_protocol, 'u8'), - "slot_fg0: " + fmt_int(self.slot_fg0, 'u128'), - "slot_fg1: " + fmt_int(self.slot_fg1, 'u128'), + "slot_fg0: " + self.slot_fg0.to_plaintext(), + "slot_fg1: " + self.slot_fg1.to_plaintext(), ] return "{ " + ", ".join(parts) + " }" @classmethod def from_decoded(cls, d: dict) -> "SwapIterCfg": - return cls(z=d['z'], lim=d['lim'], fee_pips=d['fee_pips'], fee_protocol=d['fee_protocol'], slot_fg0=d['slot_fg0'], slot_fg1=d['slot_fg1']) + return cls(z=d['z'], lim=U256__8JquwLopp8.from_decoded(d['lim']), fee_pips=d['fee_pips'], fee_protocol=d['fee_protocol'], slot_fg0=U256__8JquwLopp8.from_decoded(d['slot_fg0']), slot_fg1=U256__8JquwLopp8.from_decoded(d['slot_fg1'])) @classmethod def from_plaintext(cls, text: str) -> "SwapIterCfg": @@ -331,37 +365,35 @@ def from_plaintext(cls, text: str) -> "SwapIterCfg": @dataclass(frozen=True) class SwapIterState: - sp: int + sp: U256__8JquwLopp8 rem: int out: int - fg: int + fg: U256__8JquwLopp8 liq: int tk: int crossed: bool pf: int nb: int na: int - resid: int def to_plaintext(self) -> str: parts = [ - "sp: " + fmt_int(self.sp, 'u128'), + "sp: " + self.sp.to_plaintext(), "rem: " + fmt_int(self.rem, 'u128'), "out: " + fmt_int(self.out, 'u128'), - "fg: " + fmt_int(self.fg, 'u128'), + "fg: " + self.fg.to_plaintext(), "liq: " + fmt_int(self.liq, 'u128'), "tk: " + fmt_int(self.tk, 'i32'), "crossed: " + fmt_bool(self.crossed), "pf: " + fmt_int(self.pf, 'u128'), "nb: " + fmt_int(self.nb, 'i32'), "na: " + fmt_int(self.na, 'i32'), - "resid: " + fmt_int(self.resid, 'u128'), ] return "{ " + ", ".join(parts) + " }" @classmethod def from_decoded(cls, d: dict) -> "SwapIterState": - return cls(sp=d['sp'], rem=d['rem'], out=d['out'], fg=d['fg'], liq=d['liq'], tk=d['tk'], crossed=d['crossed'], pf=d['pf'], nb=d['nb'], na=d['na'], resid=d['resid']) + return cls(sp=U256__8JquwLopp8.from_decoded(d['sp']), rem=d['rem'], out=d['out'], fg=U256__8JquwLopp8.from_decoded(d['fg']), liq=d['liq'], tk=d['tk'], crossed=d['crossed'], pf=d['pf'], nb=d['nb'], na=d['na']) @classmethod def from_plaintext(cls, text: str) -> "SwapIterState": @@ -376,10 +408,6 @@ class SwapOutput: token_out: str amount_out: int amount_remaining: int - token_in_1: str - amount_remaining_1: int - token_in_2: str - amount_remaining_2: int def to_plaintext(self) -> str: parts = [ @@ -389,16 +417,12 @@ def to_plaintext(self) -> str: "token_out: " + fmt_fieldlike(self.token_out, 'field'), "amount_out: " + fmt_int(self.amount_out, 'u128'), "amount_remaining: " + fmt_int(self.amount_remaining, 'u128'), - "token_in_1: " + fmt_fieldlike(self.token_in_1, 'field'), - "amount_remaining_1: " + fmt_int(self.amount_remaining_1, 'u128'), - "token_in_2: " + fmt_fieldlike(self.token_in_2, 'field'), - "amount_remaining_2: " + fmt_int(self.amount_remaining_2, 'u128'), ] return "{ " + ", ".join(parts) + " }" @classmethod def from_decoded(cls, d: dict) -> "SwapOutput": - return cls(recipient=d['recipient'], caller=d['caller'], token_in=d['token_in'], token_out=d['token_out'], amount_out=d['amount_out'], amount_remaining=d['amount_remaining'], token_in_1=d['token_in_1'], amount_remaining_1=d['amount_remaining_1'], token_in_2=d['token_in_2'], amount_remaining_2=d['amount_remaining_2']) + return cls(recipient=d['recipient'], caller=d['caller'], token_in=d['token_in'], token_out=d['token_out'], amount_out=d['amount_out'], amount_remaining=d['amount_remaining']) @classmethod def from_plaintext(cls, text: str) -> "SwapOutput": @@ -408,6 +432,7 @@ def from_plaintext(cls, text: str) -> "SwapOutput": @dataclass(frozen=True) class PositionNFT: owner: str + withdrawal: str token_id: str token0_id: str token1_id: str @@ -418,7 +443,7 @@ class PositionNFT: @classmethod def from_decoded(cls, d: dict) -> "PositionNFT": - return cls(owner=d['owner'], token_id=d['token_id'], token0_id=d['token0_id'], token1_id=d['token1_id'], pool=d['pool'], tick_lower=d['tick_lower'], tick_upper=d['tick_upper'], _nonce=d.get('_nonce')) + return cls(owner=d['owner'], withdrawal=d['withdrawal'], token_id=d['token_id'], token0_id=d['token0_id'], token1_id=d['token1_id'], pool=d['pool'], tick_lower=d['tick_lower'], tick_upper=d['tick_upper'], _nonce=d.get('_nonce')) @classmethod def from_plaintext(cls, text: str) -> "PositionNFT": @@ -433,12 +458,13 @@ class SwapComplianceRecord: token_out: str request: SwapRequest caller: str + signer: str blinded_address: str _nonce: Optional[str] = None @classmethod def from_decoded(cls, d: dict) -> "SwapComplianceRecord": - return cls(owner=d['owner'], swap_id=d['swap_id'], token_in=d['token_in'], token_out=d['token_out'], request=SwapRequest.from_decoded(d['request']), caller=d['caller'], blinded_address=d['blinded_address'], _nonce=d.get('_nonce')) + return cls(owner=d['owner'], swap_id=d['swap_id'], token_in=d['token_in'], token_out=d['token_out'], request=SwapRequest.from_decoded(d['request']), caller=d['caller'], signer=d['signer'], blinded_address=d['blinded_address'], _nonce=d.get('_nonce')) @classmethod def from_plaintext(cls, text: str) -> "SwapComplianceRecord": @@ -451,12 +477,13 @@ class MultiHopSwapComplianceRecord: swap_id: str request: SwapMultiHopRequest caller: str + signer: str blinded_address: str _nonce: Optional[str] = None @classmethod def from_decoded(cls, d: dict) -> "MultiHopSwapComplianceRecord": - return cls(owner=d['owner'], swap_id=d['swap_id'], request=SwapMultiHopRequest.from_decoded(d['request']), caller=d['caller'], blinded_address=d['blinded_address'], _nonce=d.get('_nonce')) + return cls(owner=d['owner'], swap_id=d['swap_id'], request=SwapMultiHopRequest.from_decoded(d['request']), caller=d['caller'], signer=d['signer'], blinded_address=d['blinded_address'], _nonce=d.get('_nonce')) @classmethod def from_plaintext(cls, text: str) -> "MultiHopSwapComplianceRecord": @@ -469,14 +496,17 @@ class MintComplianceRecord: token_id: str token0_id: str token1_id: str + nonce: str request: MintPositionRequest caller: str + signer: str recipient: str + withdrawal: str _nonce: Optional[str] = None @classmethod def from_decoded(cls, d: dict) -> "MintComplianceRecord": - return cls(owner=d['owner'], token_id=d['token_id'], token0_id=d['token0_id'], token1_id=d['token1_id'], request=MintPositionRequest.from_decoded(d['request']), caller=d['caller'], recipient=d['recipient'], _nonce=d.get('_nonce')) + return cls(owner=d['owner'], token_id=d['token_id'], token0_id=d['token0_id'], token1_id=d['token1_id'], nonce=d['nonce'], request=MintPositionRequest.from_decoded(d['request']), caller=d['caller'], signer=d['signer'], recipient=d['recipient'], withdrawal=d['withdrawal'], _nonce=d.get('_nonce')) @classmethod def from_plaintext(cls, text: str) -> "MintComplianceRecord": @@ -496,13 +526,14 @@ def from_plaintext(cls, text: str) -> "MintComplianceRecord": "admin": parse_plaintext, "pending_admin": parse_plaintext, "used_blinded_addresses": parse_plaintext, - "token_decimals": parse_plaintext, "pool_creation_is_open": parse_plaintext, "global_paused": parse_plaintext, "token_allowed": parse_plaintext, "token_paused": parse_plaintext, "pair_paused": parse_plaintext, "frozen_position": parse_plaintext, + "from_wrapper_token_id": parse_plaintext, + "to_wrapper_token_id": parse_plaintext, } -ABI: dict = {'program': 'shield_swap_v3.aleo', 'structs': [{'path': ['SwapRequest'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'zero_for_one', 'ty': {'Primitive': 'Boolean'}}, {'name': 'amount_in', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount_out_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'sqrt_price_limit', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'recipient', 'ty': {'Primitive': 'Address'}}, {'name': 'nonce', 'ty': {'Primitive': {'UInt': 'U64'}}}, {'name': 'deadline', 'ty': {'Primitive': {'UInt': 'U32'}}}]}, {'path': ['SwapHop'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'zero_for_one', 'ty': {'Primitive': 'Boolean'}}, {'name': 'sqrt_price_limit', 'ty': {'Primitive': {'UInt': 'U128'}}}]}, {'path': ['SwapMultiHopRequest'], 'fields': [{'name': 'token_in', 'ty': {'Primitive': 'Field'}}, {'name': 'token_out', 'ty': {'Primitive': 'Field'}}, {'name': 'amount_in', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount_out_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'recipient', 'ty': {'Primitive': 'Address'}}, {'name': 'hop0', 'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'hop1', 'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'hop2', 'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'hop_count', 'ty': {'Primitive': {'UInt': 'U8'}}}, {'name': 'nonce', 'ty': {'Primitive': {'UInt': 'U64'}}}, {'name': 'deadline', 'ty': {'Primitive': {'UInt': 'U32'}}}, {'name': 'caller', 'ty': {'Primitive': 'Address'}}]}, {'path': ['MintPositionRequest'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'tick_lower', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_upper', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'amount0_desired', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount1_desired', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount0_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount1_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tick_lower_hint', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_upper_hint', 'ty': {'Primitive': {'Int': 'I32'}}}]}, {'path': ['PoolState'], 'fields': [{'name': 'token0', 'ty': {'Primitive': 'Field'}}, {'name': 'token1', 'ty': {'Primitive': 'Field'}}, {'name': 'fee', 'ty': {'Primitive': {'UInt': 'U16'}}}, {'name': 'enabled', 'ty': {'Primitive': 'Boolean'}}, {'name': 'scale0', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'scale1', 'ty': {'Primitive': {'UInt': 'U128'}}}]}, {'path': ['Slot'], 'fields': [{'name': 'tick', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_spacing', 'ty': {'Primitive': {'UInt': 'U32'}}}, {'name': 'sqrt_price', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_protocol', 'ty': {'Primitive': {'UInt': 'U8'}}}, {'name': 'liquidity', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_growth_global0_x_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_growth_global1_x_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_residual0_x_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_residual1_x_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'max_liquidity_per_tick', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'protocol_fees0', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'protocol_fees1', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'next_init_below', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'next_init_above', 'ty': {'Primitive': {'Int': 'I32'}}}]}, {'path': ['Tick'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'liquidity_net', 'ty': {'Primitive': {'Int': 'I128'}}}, {'name': 'liquidity_gross', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tick', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'fee_growth_outside0_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_growth_outside1_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'prev', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'next', 'ty': {'Primitive': {'Int': 'I32'}}}]}, {'path': ['Position'], 'fields': [{'name': 'token_id', 'ty': {'Primitive': 'Field'}}, {'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'tick_lower', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_upper', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'liquidity', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_growth_inside0_last_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_growth_inside1_last_64', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tokens_owed0', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tokens_owed1', 'ty': {'Primitive': {'UInt': 'U128'}}}]}, {'path': ['PairKey'], 'fields': [{'name': 'token0', 'ty': {'Primitive': 'Field'}}, {'name': 'token1', 'ty': {'Primitive': 'Field'}}]}, {'path': ['SwapIterCfg'], 'fields': [{'name': 'z', 'ty': {'Primitive': 'Boolean'}}, {'name': 'lim', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_pips', 'ty': {'Primitive': {'UInt': 'U32'}}}, {'name': 'fee_protocol', 'ty': {'Primitive': {'UInt': 'U8'}}}, {'name': 'slot_fg0', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'slot_fg1', 'ty': {'Primitive': {'UInt': 'U128'}}}]}, {'path': ['SwapIterState'], 'fields': [{'name': 'sp', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'rem', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'out', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fg', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'liq', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tk', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'crossed', 'ty': {'Primitive': 'Boolean'}}, {'name': 'pf', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'nb', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'na', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'resid', 'ty': {'Primitive': {'UInt': 'U128'}}}]}, {'path': ['SwapOutput'], 'fields': [{'name': 'recipient', 'ty': {'Primitive': 'Address'}}, {'name': 'caller', 'ty': {'Primitive': 'Address'}}, {'name': 'token_in', 'ty': {'Primitive': 'Field'}}, {'name': 'token_out', 'ty': {'Primitive': 'Field'}}, {'name': 'amount_out', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount_remaining', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'token_in_1', 'ty': {'Primitive': 'Field'}}, {'name': 'amount_remaining_1', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'token_in_2', 'ty': {'Primitive': 'Field'}}, {'name': 'amount_remaining_2', 'ty': {'Primitive': {'UInt': 'U128'}}}]}], 'records': [{'path': ['PositionNFT'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'token_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token0_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token1_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'pool', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'tick_lower', 'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Private'}, {'name': 'tick_upper', 'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Private'}]}, {'path': ['SwapComplianceRecord'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'swap_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token_in', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token_out', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'request', 'ty': {'Struct': {'path': ['SwapRequest'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Private'}, {'name': 'caller', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'blinded_address', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}]}, {'path': ['MultiHopSwapComplianceRecord'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'swap_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'request', 'ty': {'Struct': {'path': ['SwapMultiHopRequest'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Private'}, {'name': 'caller', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'blinded_address', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}]}, {'path': ['MintComplianceRecord'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'token_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token0_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token1_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'request', 'ty': {'Struct': {'path': ['MintPositionRequest'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Private'}, {'name': 'caller', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'recipient', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}]}], 'mappings': [{'name': 'pools', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['PoolState'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'slots', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['Slot'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'ticks', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['Tick'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'initialized_pools', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'tick_spacings', 'key': {'Primitive': {'UInt': 'U32'}}, 'value': {'Primitive': 'Boolean'}}, {'name': 'fee_tiers', 'key': {'Primitive': {'UInt': 'U16'}}, 'value': {'Primitive': 'Boolean'}}, {'name': 'fee_to_tick_spacing', 'key': {'Primitive': {'UInt': 'U16'}}, 'value': {'Primitive': {'UInt': 'U32'}}}, {'name': 'positions', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['Position'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'swap_outputs', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['SwapOutput'], 'program': 'shield_swap_v3.aleo'}}}, {'name': 'admin', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Address'}}, {'name': 'pending_admin', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Address'}}, {'name': 'used_blinded_addresses', 'key': {'Primitive': 'Address'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'token_decimals', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': {'UInt': 'U8'}}}, {'name': 'pool_creation_is_open', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'global_paused', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'token_allowed', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'token_paused', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'pair_paused', 'key': {'Struct': {'path': ['PairKey'], 'program': 'shield_swap_v3.aleo'}}, 'value': {'Primitive': 'Boolean'}}, {'name': 'frozen_position', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': {'UInt': 'U32'}}}], 'storage_variables': [], 'functions': [{'name': 'transfer_admin', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'accept_admin', 'inputs': [], 'outputs': ['Final']}, {'name': 'add_tick_spacing', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'add_fee_tier', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U16'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'bind_fee_to_tick_spacing', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U16'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_token_decimals', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U8'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_pool_enabled', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_pool_creation_is_open', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_global_paused', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'allow_token', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_token_paused', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_pair_paused', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'freeze_position', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'unfreeze_position', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_fee_protocol', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U8'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'collect_protocol', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'create_pool', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U16'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, 'Final']}, {'name': 'mint', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, 'DynamicRecord', 'DynamicRecord', {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Struct': {'path': ['MintPositionRequest'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}, 'DynamicRecord', 'DynamicRecord', {'Record': {'path': ['MintComplianceRecord'], 'program': 'shield_swap_v3.aleo'}}, 'Final']}, {'name': 'decrease_liquidity', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}, 'Final']}, {'name': 'increase_liquidity', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}, 'DynamicRecord', 'DynamicRecord', {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}, 'DynamicRecord', 'DynamicRecord', 'Final']}, {'name': 'collect', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Private'}}], 'outputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}, 'DynamicRecord', 'DynamicRecord', 'Final']}, {'name': 'burn', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap_v3.aleo'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, 'Final']}, {'name': 'swap', 'inputs': ['DynamicRecord', {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U64'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, 'DynamicRecord', {'Record': {'path': ['SwapComplianceRecord'], 'program': 'shield_swap_v3.aleo'}}, 'Final']}, {'name': 'claim_swap_output', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}], 'outputs': ['DynamicRecord', 'DynamicRecord', 'Final']}, {'name': 'swap_multi_hop', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, 'DynamicRecord', {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U8'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U64'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, 'DynamicRecord', {'Record': {'path': ['MultiHopSwapComplianceRecord'], 'program': 'shield_swap_v3.aleo'}}, 'Final']}, {'name': 'claim_multi_hop_output', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}], 'outputs': ['DynamicRecord', 'DynamicRecord', 'DynamicRecord', 'DynamicRecord', 'Final']}], 'views': [{'name': 'view_sqrt_price_at_tick', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}]}, {'name': 'view_amounts_for_liquidity', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}]}, {'name': 'view_liquidity_for_amounts', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}]}, {'name': 'view_swap_iteration', 'inputs': [{'Plaintext': {'ty': {'Struct': {'path': ['SwapIterCfg'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['Tick'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapIterState'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Struct': {'path': ['SwapIterState'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['Tick'], 'program': 'shield_swap_v3.aleo'}}, 'mode': 'Public'}}]}]} +ABI: dict = {'program': 'shield_swap.aleo', 'structs': [{'path': ['U256__8JquwLopp8'], 'fields': [{'name': 'hi', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'lo', 'ty': {'Primitive': {'UInt': 'U128'}}}]}, {'path': ['SwapRequest'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'zero_for_one', 'ty': {'Primitive': 'Boolean'}}, {'name': 'amount_in', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount_out_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'sqrt_price_limit', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'recipient', 'ty': {'Primitive': 'Address'}}, {'name': 'nonce', 'ty': {'Primitive': {'UInt': 'U64'}}}, {'name': 'deadline', 'ty': {'Primitive': {'UInt': 'U32'}}}]}, {'path': ['SwapHop'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'zero_for_one', 'ty': {'Primitive': 'Boolean'}}, {'name': 'sqrt_price_limit', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}]}, {'path': ['SwapMultiHopRequest'], 'fields': [{'name': 'token_in', 'ty': {'Primitive': 'Field'}}, {'name': 'token_out', 'ty': {'Primitive': 'Field'}}, {'name': 'amount_in', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount_out_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'recipient', 'ty': {'Primitive': 'Address'}}, {'name': 'hop0', 'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap.aleo'}}}, {'name': 'hop1', 'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap.aleo'}}}, {'name': 'hop2', 'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap.aleo'}}}, {'name': 'hop_count', 'ty': {'Primitive': {'UInt': 'U8'}}}, {'name': 'nonce', 'ty': {'Primitive': {'UInt': 'U64'}}}, {'name': 'deadline', 'ty': {'Primitive': {'UInt': 'U32'}}}, {'name': 'caller', 'ty': {'Primitive': 'Address'}}]}, {'path': ['MintPositionRequest'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'tick_lower', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_upper', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'amount0_desired', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount1_desired', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount0_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount1_min', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tick_lower_hint', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_upper_hint', 'ty': {'Primitive': {'Int': 'I32'}}}]}, {'path': ['MerkleProof'], 'fields': [{'name': 'siblings', 'ty': {'Array': {'element': {'Primitive': 'Field'}, 'length': 16}}}, {'name': 'leaf_index', 'ty': {'Primitive': {'UInt': 'U32'}}}]}, {'path': ['PoolState'], 'fields': [{'name': 'token0', 'ty': {'Primitive': 'Field'}}, {'name': 'token1', 'ty': {'Primitive': 'Field'}}, {'name': 'fee', 'ty': {'Primitive': {'UInt': 'U16'}}}, {'name': 'enabled', 'ty': {'Primitive': 'Boolean'}}]}, {'path': ['Slot'], 'fields': [{'name': 'tick', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_spacing', 'ty': {'Primitive': {'UInt': 'U32'}}}, {'name': 'sqrt_price', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'fee_protocol', 'ty': {'Primitive': {'UInt': 'U8'}}}, {'name': 'liquidity', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_growth_global0_x_128', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'fee_growth_global1_x_128', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'max_liquidity_per_tick', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'protocol_fees0', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'protocol_fees1', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'next_init_below', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'next_init_above', 'ty': {'Primitive': {'Int': 'I32'}}}]}, {'path': ['Tick'], 'fields': [{'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'liquidity_net', 'ty': {'Primitive': {'Int': 'I128'}}}, {'name': 'liquidity_gross', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tick', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'fee_growth_outside0_x_128', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'fee_growth_outside1_x_128', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'prev', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'next', 'ty': {'Primitive': {'Int': 'I32'}}}]}, {'path': ['Position'], 'fields': [{'name': 'token_id', 'ty': {'Primitive': 'Field'}}, {'name': 'pool', 'ty': {'Primitive': 'Field'}}, {'name': 'tick_lower', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'tick_upper', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'liquidity', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fee_growth_inside0_last_x_128', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'fee_growth_inside1_last_x_128', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'tokens_owed0', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tokens_owed1', 'ty': {'Primitive': {'UInt': 'U128'}}}]}, {'path': ['PairKey'], 'fields': [{'name': 'token0', 'ty': {'Primitive': 'Field'}}, {'name': 'token1', 'ty': {'Primitive': 'Field'}}]}, {'path': ['SwapIterCfg'], 'fields': [{'name': 'z', 'ty': {'Primitive': 'Boolean'}}, {'name': 'lim', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'fee_pips', 'ty': {'Primitive': {'UInt': 'U32'}}}, {'name': 'fee_protocol', 'ty': {'Primitive': {'UInt': 'U8'}}}, {'name': 'slot_fg0', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'slot_fg1', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}]}, {'path': ['SwapIterState'], 'fields': [{'name': 'sp', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'rem', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'out', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'fg', 'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}}, {'name': 'liq', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'tk', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'crossed', 'ty': {'Primitive': 'Boolean'}}, {'name': 'pf', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'nb', 'ty': {'Primitive': {'Int': 'I32'}}}, {'name': 'na', 'ty': {'Primitive': {'Int': 'I32'}}}]}, {'path': ['SwapOutput'], 'fields': [{'name': 'recipient', 'ty': {'Primitive': 'Address'}}, {'name': 'caller', 'ty': {'Primitive': 'Address'}}, {'name': 'token_in', 'ty': {'Primitive': 'Field'}}, {'name': 'token_out', 'ty': {'Primitive': 'Field'}}, {'name': 'amount_out', 'ty': {'Primitive': {'UInt': 'U128'}}}, {'name': 'amount_remaining', 'ty': {'Primitive': {'UInt': 'U128'}}}]}], 'records': [{'path': ['PositionNFT'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'withdrawal', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'token_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token0_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token1_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'pool', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'tick_lower', 'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Private'}, {'name': 'tick_upper', 'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Private'}]}, {'path': ['SwapComplianceRecord'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'swap_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token_in', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token_out', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'request', 'ty': {'Struct': {'path': ['SwapRequest'], 'program': 'shield_swap.aleo'}}, 'mode': 'Private'}, {'name': 'caller', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'signer', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'blinded_address', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}]}, {'path': ['MultiHopSwapComplianceRecord'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'swap_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'request', 'ty': {'Struct': {'path': ['SwapMultiHopRequest'], 'program': 'shield_swap.aleo'}}, 'mode': 'Private'}, {'name': 'caller', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'signer', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'blinded_address', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}]}, {'path': ['MintComplianceRecord'], 'fields': [{'name': 'owner', 'ty': {'Primitive': 'Address'}, 'mode': 'Public'}, {'name': 'token_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token0_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'token1_id', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'nonce', 'ty': {'Primitive': 'Field'}, 'mode': 'Private'}, {'name': 'request', 'ty': {'Struct': {'path': ['MintPositionRequest'], 'program': 'shield_swap.aleo'}}, 'mode': 'Private'}, {'name': 'caller', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'signer', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'recipient', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}, {'name': 'withdrawal', 'ty': {'Primitive': 'Address'}, 'mode': 'Private'}]}], 'mappings': [{'name': 'pools', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['PoolState'], 'program': 'shield_swap.aleo'}}}, {'name': 'slots', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['Slot'], 'program': 'shield_swap.aleo'}}}, {'name': 'ticks', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['Tick'], 'program': 'shield_swap.aleo'}}}, {'name': 'initialized_pools', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'tick_spacings', 'key': {'Primitive': {'UInt': 'U32'}}, 'value': {'Primitive': 'Boolean'}}, {'name': 'fee_tiers', 'key': {'Primitive': {'UInt': 'U16'}}, 'value': {'Primitive': 'Boolean'}}, {'name': 'fee_to_tick_spacing', 'key': {'Primitive': {'UInt': 'U16'}}, 'value': {'Primitive': {'UInt': 'U32'}}}, {'name': 'positions', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['Position'], 'program': 'shield_swap.aleo'}}}, {'name': 'swap_outputs', 'key': {'Primitive': 'Field'}, 'value': {'Struct': {'path': ['SwapOutput'], 'program': 'shield_swap.aleo'}}}, {'name': 'admin', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Address'}}, {'name': 'pending_admin', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Address'}}, {'name': 'used_blinded_addresses', 'key': {'Primitive': 'Address'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'pool_creation_is_open', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'global_paused', 'key': {'Primitive': 'Boolean'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'token_allowed', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'token_paused', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Boolean'}}, {'name': 'pair_paused', 'key': {'Struct': {'path': ['PairKey'], 'program': 'shield_swap.aleo'}}, 'value': {'Primitive': 'Boolean'}}, {'name': 'frozen_position', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': {'UInt': 'U32'}}}, {'name': 'from_wrapper_token_id', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Field'}}, {'name': 'to_wrapper_token_id', 'key': {'Primitive': 'Field'}, 'value': {'Primitive': 'Field'}}], 'storage_variables': [], 'functions': [{'name': 'transfer_admin', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'accept_admin', 'inputs': [], 'outputs': ['Final']}, {'name': 'add_tick_spacing', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'add_fee_tier', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U16'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'bind_fee_to_tick_spacing', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'UInt': 'U16'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_pool_enabled', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_pool_creation_is_open', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_global_paused', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'allow_token', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_token_paused', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_pair_paused', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'freeze_position', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'unfreeze_position', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'set_fee_protocol', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U8'}}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'collect_protocol', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}], 'outputs': ['Final']}, {'name': 'create_pool', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U16'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, 'Final']}, {'name': 'mint', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, 'DynamicRecord', 'DynamicRecord', {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Struct': {'path': ['MintPositionRequest'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Array': {'element': {'Struct': {'path': ['MerkleProof'], 'program': 'shield_swap.aleo'}}, 'length': 2}}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Array': {'element': {'Struct': {'path': ['MerkleProof'], 'program': 'shield_swap.aleo'}}, 'length': 2}}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Array': {'element': {'Struct': {'path': ['MerkleProof'], 'program': 'shield_swap.aleo'}}, 'length': 2}}, 'mode': 'Private'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}, 'DynamicRecord', 'DynamicRecord', {'Record': {'path': ['MintComplianceRecord'], 'program': 'shield_swap.aleo'}}, 'Final']}, {'name': 'decrease_liquidity', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}, 'Final']}, {'name': 'increase_liquidity', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}, 'DynamicRecord', 'DynamicRecord', {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}, 'DynamicRecord', 'DynamicRecord', 'Final']}, {'name': 'collect', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Array': {'element': {'Struct': {'path': ['MerkleProof'], 'program': 'shield_swap.aleo'}}, 'length': 2}}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Array': {'element': {'Struct': {'path': ['MerkleProof'], 'program': 'shield_swap.aleo'}}, 'length': 2}}, 'mode': 'Private'}}], 'outputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}, 'DynamicRecord', 'DynamicRecord', 'Final']}, {'name': 'burn', 'inputs': [{'Record': {'path': ['PositionNFT'], 'program': 'shield_swap.aleo'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, 'Final']}, {'name': 'swap', 'inputs': ['DynamicRecord', {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U64'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, 'DynamicRecord', {'Record': {'path': ['SwapComplianceRecord'], 'program': 'shield_swap.aleo'}}, 'Final']}, {'name': 'claim_swap_output', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Array': {'element': {'Struct': {'path': ['MerkleProof'], 'program': 'shield_swap.aleo'}}, 'length': 2}}, 'mode': 'Private'}}], 'outputs': ['DynamicRecord', 'DynamicRecord', 'Final']}, {'name': 'swap_multi_hop', 'inputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Private'}}, {'Plaintext': {'ty': {'Primitive': 'Address'}, 'mode': 'Public'}}, 'DynamicRecord', {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapHop'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U8'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U64'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': 'Field'}, 'mode': 'Public'}}, 'DynamicRecord', {'Record': {'path': ['MultiHopSwapComplianceRecord'], 'program': 'shield_swap.aleo'}}, 'Final']}], 'views': [{'name': 'view_sqrt_price_at_tick_x128', 'inputs': [{'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}]}, {'name': 'view_mul_div', 'inputs': [{'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}]}, {'name': 'view_swap_iteration', 'inputs': [{'Plaintext': {'ty': {'Struct': {'path': ['SwapIterCfg'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['Tick'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['SwapIterState'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Struct': {'path': ['SwapIterState'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['Tick'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}]}, {'name': 'view_bounded_partial', 'inputs': [{'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U8'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'UInt': 'U128'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}]}, {'name': 'resolve_stored_tick', 'inputs': [{'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Struct': {'path': ['U256__8JquwLopp8'], 'program': 'shield_swap.aleo'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}, {'Plaintext': {'ty': {'Primitive': 'Boolean'}, 'mode': 'Public'}}], 'outputs': [{'Plaintext': {'ty': {'Primitive': {'Int': 'I32'}}, 'mode': 'Public'}}]}]} diff --git a/shield-swap-sdk/tests/test_generated.py b/shield-swap-sdk/tests/test_generated.py index 1fc01f90..3ff4b5df 100644 --- a/shield-swap-sdk/tests/test_generated.py +++ b/shield-swap-sdk/tests/test_generated.py @@ -2,32 +2,64 @@ from aleo_shield_swap import _generated as g -def test_program_id(): - assert g.PROGRAM_ID == "shield_swap_v3.aleo" +def test_program_id_is_new_core(): + assert g.PROGRAM_ID == "shield_swap.aleo" -def test_slot_decode(): +def test_u256_roundtrip(): + u = g.U256__8JquwLopp8(hi=1, lo=17013693014354590797691252010145372) + text = u.to_plaintext() + assert text == "{ hi: 1u128, lo: 17013693014354590797691252010145372u128 }" + assert g.U256__8JquwLopp8.from_plaintext(text) == u + + +def test_merkle_proof_roundtrip(): + p = g.MerkleProof(siblings=["0field"] * 16, leaf_index=1) + assert g.MerkleProof.from_plaintext(p.to_plaintext()) == p + + +def test_pool_state_has_no_scales(): + names = set(g.PoolState.__dataclass_fields__) + assert names == {"token0", "token1", "fee", "enabled"} + + +def test_slot_decode_with_u256_prices(): slot = g.Slot.from_plaintext( - "{ tick: 4055i32, tick_spacing: 60i32, sqrt_price: 22526123159817891330747538u128, " - "fee_protocol: 0u8, liquidity: 183051202759u128, fee_growth_global0_x_64: 0u128, " - "fee_growth_global1_x_64: 0u128, fee_residual0_x_64: 0u128, fee_residual1_x_64: 0u128, " - "max_liquidity_per_tick: 1000u128, protocol_fees0: 0u128, protocol_fees1: 0u128, " - "next_init_below: 3960i32, next_init_above: 4080i32 }") + "{ tick: 4055i32, tick_spacing: 60u32, " + "sqrt_price: { hi: 1u128, lo: 22526123159817891330747538u128 }, " + "fee_protocol: 0u8, liquidity: 183051202759u128, " + "fee_growth_global0_x_128: { hi: 0u128, lo: 0u128 }, " + "fee_growth_global1_x_128: { hi: 0u128, lo: 0u128 }, " + "max_liquidity_per_tick: 1000u128, protocol_fees0: 0u128, " + "protocol_fees1: 0u128, next_init_below: 3960i32, next_init_above: 4080i32 }") assert slot.tick == 4055 and slot.tick_spacing == 60 - assert slot.sqrt_price == 22526123159817891330747538 + assert slot.sqrt_price == g.U256__8JquwLopp8(hi=1, lo=22526123159817891330747538) + assert "fee_residual0_x_64" not in g.Slot.__dataclass_fields__ + + +def test_position_nft_has_withdrawal(): + assert "withdrawal" in g.PositionNFT.__dataclass_fields__ def test_mapping_decoder_table_covers_key_mappings(): - for name in ("slots", "pools", "swap_outputs", "fee_tiers", "used_blinded_addresses"): + for name in ("slots", "pools", "swap_outputs", "fee_tiers", + "used_blinded_addresses", "from_wrapper_token_id"): assert name in g.MAPPING_VALUE_DECODERS, name def test_abi_constant_carries_key_types(): - assert g.ABI["program"] == "shield_swap_v3.aleo" + assert g.ABI["program"] == "shield_swap.aleo" slots = next(m for m in g.ABI["mappings"] if m["name"] == "slots") assert slots["key"] == {"Primitive": "Field"} +def test_removed_functions_gone(): + names = {fn["name"] for fn in g.ABI["functions"]} + assert "claim_multi_hop_output" not in names + assert "set_token_decimals" not in names + assert {"swap", "claim_swap_output", "mint", "collect", "allow_token"} <= names + + def test_mint_request_encodes(): req_kwargs = {} for f in g.MintPositionRequest.__dataclass_fields__.values(): From af1aaca79e6e9554d9258c3c62110a940c3100e3 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 10:55:16 -0500 Subject: [PATCH 03/23] feat(shield-swap): Q128.128 tick math + U256 helpers --- .../python/aleo_shield_swap/tick_math.py | 96 ++++++++++++------- shield-swap-sdk/tests/test_tick_math.py | 72 +++++++++----- 2 files changed, 108 insertions(+), 60 deletions(-) diff --git a/shield-swap-sdk/python/aleo_shield_swap/tick_math.py b/shield-swap-sdk/python/aleo_shield_swap/tick_math.py index 95c896d7..d14904ca 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/tick_math.py +++ b/shield-swap-sdk/python/aleo_shield_swap/tick_math.py @@ -1,47 +1,67 @@ -"""Q64 fixed-point tick math, ported from the TS SDK (utils/tick-math.ts), -which mirrors the on-chain tick_math table in shield_swap. The magic -constants ARE the contract's — do not "improve" them; a one-off value -produces prices the finalize asserts against. +"""Q128.128 fixed-point tick math, mirroring the on-chain *_X128 table in +shield_swap.aleo (amm-v3 src/main.leo @ development). The magic constants +ARE the contract's — do not "improve" them; a one-off value produces prices +the finalize asserts against. Amounts are raw native units; the AMM no +longer scales by token decimals. """ from __future__ import annotations -Q64 = 9223372036854775808 # 2**63 — the contract's sqrt-price scale +from typing import Any + +Q128 = 1 << 128 MIN_TICK = -400000 MAX_TICK = 400000 # sqrt price at MIN_TICK / MAX_TICK — the bounds the swap finalize accepts. -MIN_SQRT_PRICE = 19029805711 -MAX_SQRT_PRICE = 4470386772317930780047134862 - -# sqrt(1.0001^-bit) in Q64 for each power-of-two tick component. -_MAGIC = { - 1: 9222910902837697536, 2: 9222449791875588096, 3: 9221988703967300608, - 4: 9221527639111677952, 8: 9219683610192801792, 16: 9215996658532725760, - 32: 9208627177859081216, 64: 9193905890596798464, 128: 9164533880601766912, - 256: 9106071067403056128, 512: 8990261907820801024, 1024: 8763043369415622656, - 2048: 8325689215117605888, 4096: 7515375139346884608, 8192: 6123667489441693696, - 16384: 4065682634442729984, 32768: 1792161827361994496, 65536: 348228825923923264, - 131072: 13147394978735516, 262144: 18740867660568, 524288: 38079361, +MIN_SQRT_RATIO_X128 = 702075911466779181339691826087 +MAX_SQRT_RATIO_X128 = 484680305 * Q128 + 8756686347225649145659787327114459760 + +_TWO_256_MINUS_1 = (1 << 256) - 1 + +# round(2^128 / sqrt(1.0001^n)) for each power-of-two tick component. +_MAGIC_X128 = { + 1: 340265354078544963557816517032075149313, + 2: 340248342086729790484326174814286782778, + 3: 340231330945450418515964920540021147199, + 4: 340214320654664324051920982716015181260, + 8: 340146287995602323631171512101879684304, + 16: 340010263488231146823593991679159461444, + 32: 339738377640345403697157401104375502016, + 64: 339195258003219555707034227454543997025, + 128: 338111622100601834656805679988414885971, + 256: 335954724994790223023589805789778977700, + 512: 331682121138379247127172139078559817300, + 1024: 323299236684853023288211250268160618739, + 2048: 307163716377032989948697243942600083929, + 4096: 277268403626896220162999269216087595045, + 8192: 225923453940442621947126027127485391333, + 16384: 149997214084966997727330242082538205943, + 32768: 66119101136024775622716233608466517926, + 65536: 12847376061809297530290974190478138313, + 131072: 485053260817066172746253684029974020, + 262144: 691415978906521570653435304214168, } _BITS = (4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, - 16384, 32768, 65536, 131072, 262144, 524288) + 16384, 32768, 65536, 131072, 262144) + +def get_sqrt_price_at_tick_x128(tick: int) -> int: + """Q128.128 sqrt price at *tick* as the full 256-bit integer. -def get_sqrt_price_at_tick(tick: int) -> int: - """Q64 sqrt price at *tick*, matching the contract's table.""" + Exact mirror of the contract's ``get_sqrt_price_at_tick_x128``: apply the + *_X128 magic constants via ``(ratio * MAGIC) >> 128``, then invert + ``(2^256 - 1) // lo`` for positive ticks. + """ if tick < MIN_TICK or tick > MAX_TICK: raise ValueError(f"Tick {tick} out of range [{MIN_TICK}, {MAX_TICK}]") - if tick == 0: - return Q64 abs_tick = abs(tick) low_bits = abs_tick & 0x3 - ratio = Q64 if low_bits == 0 else _MAGIC[low_bits] + ratio = Q128 if low_bits == 0 else _MAGIC_X128[low_bits] for bit in _BITS: if abs_tick & bit: - ratio = (ratio * _MAGIC[bit]) >> 63 - # The table encodes negative ticks; invert for positive ones. - if tick < 0: - return ratio - return (Q64 * Q64) // ratio + ratio = (ratio * _MAGIC_X128[bit]) >> 128 + if tick > 0: + ratio = _TWO_256_MINUS_1 // (ratio & (Q128 - 1)) + return ratio def round_tick_to_spacing(tick: int, spacing: int) -> int: @@ -49,10 +69,18 @@ def round_tick_to_spacing(tick: int, spacing: int) -> int: return (tick // spacing) * spacing -def dust_scale(decimals: int) -> int: - """Divisor the contract normalizes a token's raw amounts by. +def u256_to_int(v: Any) -> int: + """Full integer value of a wire U256: generated struct, decoded dict, + or already-an-int.""" + if isinstance(v, int): + return v + if isinstance(v, dict): + return (int(v["hi"]) << 128) | int(v["lo"]) + return (int(v.hi) << 128) | int(v.lo) - shield_swap accounts in 9-decimal-normalized units: raw inputs must - satisfy ``raw % dust_scale(decimals) == 0`` or the contract rejects them. - """ - return 10 ** (decimals - 9) if decimals > 9 else 1 + +def int_to_u256_plaintext(value: int) -> str: + """A 256-bit integer as the contract's ``{ hi, lo }`` struct literal.""" + if not 0 <= value < (1 << 256): + raise ValueError(f"{value} out of range for U256") + return f"{{ hi: {value >> 128}u128, lo: {value & (Q128 - 1)}u128 }}" diff --git a/shield-swap-sdk/tests/test_tick_math.py b/shield-swap-sdk/tests/test_tick_math.py index 2c2497be..21144d72 100644 --- a/shield-swap-sdk/tests/test_tick_math.py +++ b/shield-swap-sdk/tests/test_tick_math.py @@ -1,47 +1,67 @@ import pytest from aleo_shield_swap.tick_math import ( - MAX_SQRT_PRICE, + MAX_SQRT_RATIO_X128, MAX_TICK, - MIN_SQRT_PRICE, + MIN_SQRT_RATIO_X128, MIN_TICK, - Q64, - dust_scale, - get_sqrt_price_at_tick, + Q128, + get_sqrt_price_at_tick_x128, + int_to_u256_plaintext, round_tick_to_spacing, + u256_to_int, ) +# Vectors from the reference implementation (amm-v3 ts-tests/src/utils/math.ts +# @ development c32a5e3), which mirrors the contract's *_X128 constants. +VECTORS = { + 0: Q128, + 1: 340299380613952818054172298683778356828, + -1: 340265354078544963557816517032075149313, + 100: 341987953891916247014855103371247308527, + -100: 338585286176225270960996223397573581044, + MIN_TICK: 702075911466779181339691826087, + MAX_TICK: 164928161394119051704885410204944470744913033840, +} -def test_constants(): - assert Q64 == 9223372036854775808 == 2**63 + +def test_sqrt_price_x128_vectors(): + for tick, expected in VECTORS.items(): + assert get_sqrt_price_at_tick_x128(tick) == expected, tick + + +def test_bounds_are_the_tick_extremes(): assert (MIN_TICK, MAX_TICK) == (-400000, 400000) - assert MIN_SQRT_PRICE == 19029805711 - assert MAX_SQRT_PRICE == 4470386772317930780047134862 + assert get_sqrt_price_at_tick_x128(MIN_TICK) == MIN_SQRT_RATIO_X128 + assert get_sqrt_price_at_tick_x128(MAX_TICK) == MAX_SQRT_RATIO_X128 -def test_sqrt_price_boundaries(): - assert get_sqrt_price_at_tick(0) == Q64 - assert get_sqrt_price_at_tick(MIN_TICK) == MIN_SQRT_PRICE - assert get_sqrt_price_at_tick(MAX_TICK) == MAX_SQRT_PRICE +def test_out_of_range_tick_rejects(): with pytest.raises(ValueError): - get_sqrt_price_at_tick(MAX_TICK + 1) + get_sqrt_price_at_tick_x128(MAX_TICK + 1) with pytest.raises(ValueError): - get_sqrt_price_at_tick(MIN_TICK - 1) + get_sqrt_price_at_tick_x128(MIN_TICK - 1) -def test_sqrt_price_symmetry(): - # positive ticks invert the negative-tick table entry - neg = get_sqrt_price_at_tick(-600) - pos = get_sqrt_price_at_tick(600) - assert pos == (Q64 * Q64) // neg - # monotonic: higher tick, higher price - assert get_sqrt_price_at_tick(600) > get_sqrt_price_at_tick(0) > neg +def test_monotonic_around_zero(): + assert (get_sqrt_price_at_tick_x128(600) + > get_sqrt_price_at_tick_x128(0) + > get_sqrt_price_at_tick_x128(-600)) -def test_rounding_and_dust(): +def test_round_tick_to_spacing(): + assert round_tick_to_spacing(4055, 60) == 4020 assert round_tick_to_spacing(-62215, 200) == -62400 assert round_tick_to_spacing(199, 200) == 0 assert round_tick_to_spacing(-1, 200) == -200 - assert dust_scale(18) == 10**9 - assert dust_scale(9) == 1 - assert dust_scale(6) == 1 + + +def test_u256_helpers(): + class _U: # duck-typed like the generated struct + hi, lo = 1, 5 + assert u256_to_int(_U()) == (1 << 128) + 5 + assert u256_to_int({"hi": 0, "lo": 7}) == 7 + assert u256_to_int(9) == 9 + assert int_to_u256_plaintext((1 << 128) + 5) == "{ hi: 1u128, lo: 5u128 }" + with pytest.raises(ValueError): + int_to_u256_plaintext(1 << 256) From c3576577bcd69d205f183f67606faa49dbe16911 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 10:59:33 -0500 Subject: [PATCH 04/23] feat(shield-swap): raw-amount swap resolution, X128 limits, freezelist proof defaults --- .../python/aleo_shield_swap/_core.py | 80 +++++++++++-------- shield-swap-sdk/tests/test_core.py | 67 ++++++++++++---- 2 files changed, 98 insertions(+), 49 deletions(-) diff --git a/shield-swap-sdk/python/aleo_shield_swap/_core.py b/shield-swap-sdk/python/aleo_shield_swap/_core.py index c1ac735f..052975fe 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/_core.py +++ b/shield-swap-sdk/python/aleo_shield_swap/_core.py @@ -16,7 +16,7 @@ from aleo.codegen.runtime import parse_plaintext from .errors import InsufficientRecordsError -from .tick_math import MAX_SQRT_PRICE, MIN_SQRT_PRICE, Q64 +from .tick_math import MAX_SQRT_RATIO_X128, MIN_SQRT_RATIO_X128, u256_to_int @dataclass(frozen=True) @@ -41,55 +41,40 @@ def resolve_swap_params( ) -> ResolvedSwap: """Resolve a swap intent against live pool state. - Determines direction from the pool's token ordering, validates the - amount against the contract's no-dust rule, and computes - ``amount_out_min`` from the slippage tolerance. Without *expected_out* - a spot estimate from ``slot.sqrt_price`` is used — it ignores price - impact and fees, so pass a real quote for anything beyond a tiny trade. - Pure and local. + Amounts are raw native token units end to end — the new AMM does no + decimal scaling and has no dust rule. Without *expected_out* a spot + estimate from the Q128.128 ``slot.sqrt_price`` is used — it ignores + price impact and fees, so pass a real quote for anything beyond a tiny + trade. Pure and local. """ if not 0 <= slippage_bps <= 10_000: raise ValueError(f"slippage_bps must be within [0, 10000], got {slippage_bps}") token0, token1 = str(pool.token0), str(pool.token1) - scale0, scale1 = int(pool.scale0), int(pool.scale1) - zero_for_one = token_in_id == token0 if not zero_for_one and token_in_id != token1: raise ValueError(f"Token {token_in_id} is not in this pool ({token0} / {token1})") token_out_id = token1 if zero_for_one else token0 - # The contract normalizes amounts by the token's scale and asserts - # raw % scale == 0 — reject dust here instead of paying for a revert. - scale_in = scale0 if zero_for_one else scale1 - if amount_in % scale_in != 0: - raise ValueError( - f"amount_in {amount_in} is not a multiple of the token's scale " - f"{scale_in} — the contract rejects amounts with non-zero dust digits" - ) - expected = expected_out if expected is None: - # Spot estimate in normalized units: price = (sqrtP/Q64)^2 token1/token0. - scale_out = scale1 if zero_for_one else scale0 - norm_in = amount_in // scale_in - sq = int(slot.sqrt_price) + # Spot estimate: price = (sqrt_price / 2^128)^2 token1-per-token0. + sq = u256_to_int(slot.sqrt_price) if zero_for_one: - norm_out = (norm_in * sq * sq) // (Q64 * Q64) + expected = (amount_in * sq * sq) >> 256 else: - norm_out = (norm_in * Q64 * Q64) // (sq * sq) - expected = norm_out * scale_out + expected = (amount_in << 256) // (sq * sq) amount_out_min = (expected * (10_000 - slippage_bps)) // 10_000 # Default price bound: the directional extreme — amount_out_min is the # real protection; a tight sqrt limit turns into partial fills instead. - default_limit = MIN_SQRT_PRICE if zero_for_one else MAX_SQRT_PRICE + default_limit = MIN_SQRT_RATIO_X128 if zero_for_one else MAX_SQRT_RATIO_X128 limit = sqrt_price_limit if sqrt_price_limit is not None else default_limit - if not MIN_SQRT_PRICE <= limit <= MAX_SQRT_PRICE: + if not MIN_SQRT_RATIO_X128 <= limit <= MAX_SQRT_RATIO_X128: raise ValueError( f"sqrt_price_limit {limit} outside the contract's accepted range " - f"[{MIN_SQRT_PRICE}, {MAX_SQRT_PRICE}]" + f"[{MIN_SQRT_RATIO_X128}, {MAX_SQRT_RATIO_X128}]" ) return ResolvedSwap(zero_for_one, token_out_id, amount_out_min, limit) @@ -115,6 +100,23 @@ def generate_field_nonce() -> str: return f"{secrets.randbits(248)}field" +# ── Freezelist proofs ──────────────────────────────────────────────────────── +# +# mint / claim_swap_output / collect prove signer (and recipient/withdrawal) +# non-inclusion in the AMM freezelist; routed calls additionally carry +# wrapper-freezelist proofs. While a freezelist is empty, the contract +# accepts two copies of the empty-tree proof below (the credits wrapper +# ignores its proof input entirely). Building real proofs against a +# populated tree is deferred until a list is non-empty. + +EMPTY_MERKLE_PROOF = "{ siblings: [" + ", ".join(["0field"] * 16) + "], leaf_index: 1u32 }" + + +def default_merkle_proofs() -> str: + """The ``[MerkleProof; 2]`` literal accepted while the freezelist is empty.""" + return f"[{EMPTY_MERKLE_PROOF}, {EMPTY_MERKLE_PROOF}]" + + # ── Shared pure helpers (sync + async clients) ─────────────────────────────── def normalize_mapping_value(raw: Any) -> Optional[str]: @@ -148,6 +150,8 @@ def pick_covering_record(records: Any, *, min_amount: int, info = parse_token_record_info(plaintext) if info is None or info["amount"] < min_amount: continue + if info["recipient_bound"]: + continue # bound wrapper records unwrap only to their bound recipient if token_id is not None and "token_id" in info and info["token_id"] != token_id: continue candidates.append((info["amount"], plaintext)) @@ -269,19 +273,27 @@ def ensure_programs(aleo: Any, program_ids: list[str], # ── Token record selection ─────────────────────────────────────────────────── def parse_token_record_info(plaintext: str) -> Optional[dict[str, Any]]: - """Decode a token record's ``amount`` (and ``token_id`` when present). + """Decode a token record's spendable amount (and ``token_id`` when present). - Handles both registry-token records (``owner``, ``amount``, ``token_id``, - …) and ARC-20 wrapper-program records (``owner``, ``amount`` only). - Returns ``None`` when the plaintext has no ``amount`` — not a token record. + Handles registry-token records (``owner, amount, token_id, …``), ARC-20 + wrapper/underlying records (``owner, amount``), and native credits + records (``owner, microcredits``). Recipient-bound wrapper records are + flagged — they can only be unwrapped to their bound recipient, never + spent freely. Returns ``None`` when neither amount field is present. """ try: decoded = parse_plaintext(plaintext) except (ValueError, TypeError): return None - if not isinstance(decoded, dict) or not isinstance(decoded.get("amount"), int): + if not isinstance(decoded, dict): + return None + amount = decoded.get("amount") + if not isinstance(amount, int): + amount = decoded.get("microcredits") + if not isinstance(amount, int): return None - info: dict[str, Any] = {"amount": decoded["amount"]} + info: dict[str, Any] = {"amount": amount, + "recipient_bound": decoded.get("recipient_bound") is True} if isinstance(decoded.get("token_id"), str): info["token_id"] = decoded["token_id"] return info diff --git a/shield-swap-sdk/tests/test_core.py b/shield-swap-sdk/tests/test_core.py index e4474f29..8338057b 100644 --- a/shield-swap-sdk/tests/test_core.py +++ b/shield-swap-sdk/tests/test_core.py @@ -1,35 +1,51 @@ +from types import SimpleNamespace as NS + import pytest from aleo_shield_swap._core import ( + EMPTY_MERKLE_PROOF, + default_merkle_proofs, generate_field_nonce, generate_swap_nonce, parse_token_record_info, + pick_covering_record, resolve_imports, resolve_swap_params, select_token_record, ) from aleo_shield_swap.errors import InsufficientRecordsError -from aleo_shield_swap.tick_math import MAX_SQRT_PRICE, MIN_SQRT_PRICE, Q64 +from aleo_shield_swap.tick_math import MAX_SQRT_RATIO_X128, MIN_SQRT_RATIO_X128 class _Pool: # duck-typed: only the fields resolve_swap_params reads token0 = "1field" token1 = "2field" - scale0 = 10**9 - scale1 = 1 class _Slot: - sqrt_price = Q64 # price 1.0 in normalized units + sqrt_price = NS(hi=1, lo=0) # 1.0 in Q128.128 — price 1.0, raw units def test_direction_and_spot_estimate(): r = resolve_swap_params(pool=_Pool(), slot=_Slot(), token_in_id="1field", - amount_in=10**9, slippage_bps=50) + amount_in=1000, slippage_bps=50) assert r.zero_for_one is True and r.token_out_id == "2field" - # spot: norm_in=1, price 1.0, scale_out=1 → expected 1; 1*9950//10000 == 0 - assert r.amount_out_min == 0 - assert r.sqrt_price_limit == MIN_SQRT_PRICE + # spot at price 1.0: expected 1000 raw; 1000*9950//10000 == 995 + assert r.amount_out_min == 995 + assert r.sqrt_price_limit == MIN_SQRT_RATIO_X128 + + +def test_spot_estimate_uses_x128_price(): + pool = NS(token0="1field", token1="2field") + # sqrt_price = 2.0 in Q128.128 → price 4.0 token1/token0, raw units. + slot = NS(sqrt_price=NS(hi=2, lo=0)) + r = resolve_swap_params(pool=pool, slot=slot, token_in_id="1field", + amount_in=100, slippage_bps=0) + assert r.zero_for_one is True and r.amount_out_min == 400 + # reverse direction: price 1/4 + r2 = resolve_swap_params(pool=pool, slot=slot, token_in_id="2field", + amount_in=100, slippage_bps=0) + assert r2.zero_for_one is False and r2.amount_out_min == 25 def test_explicit_quote_and_reverse_direction(): @@ -37,13 +53,10 @@ def test_explicit_quote_and_reverse_direction(): amount_in=5, slippage_bps=100, expected_out=10**9) assert r.zero_for_one is False and r.token_out_id == "1field" assert r.amount_out_min == 10**9 * 9900 // 10000 - assert r.sqrt_price_limit == MAX_SQRT_PRICE + assert r.sqrt_price_limit == MAX_SQRT_RATIO_X128 def test_rejections(): - with pytest.raises(ValueError, match="dust"): - resolve_swap_params(pool=_Pool(), slot=_Slot(), token_in_id="1field", - amount_in=10**9 + 1, slippage_bps=50) with pytest.raises(ValueError, match="not in this pool"): resolve_swap_params(pool=_Pool(), slot=_Slot(), token_in_id="9field", amount_in=10**9, slippage_bps=50) @@ -53,7 +66,31 @@ def test_rejections(): with pytest.raises(ValueError, match="sqrt_price_limit"): resolve_swap_params(pool=_Pool(), slot=_Slot(), token_in_id="1field", amount_in=10**9, slippage_bps=0, - sqrt_price_limit=MIN_SQRT_PRICE - 1) + sqrt_price_limit=MIN_SQRT_RATIO_X128 - 1) + + +def test_default_merkle_proofs_shape(): + assert EMPTY_MERKLE_PROOF == ( + "{ siblings: [" + ", ".join(["0field"] * 16) + "], leaf_index: 1u32 }" + ) + assert default_merkle_proofs() == f"[{EMPTY_MERKLE_PROOF}, {EMPTY_MERKLE_PROOF}]" + + +def test_credits_record_amount_parses(): + info = parse_token_record_info( + "{ owner: aleo1me.private, microcredits: 5000000u64.private, _nonce: 7group.public }") + assert info == {"amount": 5000000, "recipient_bound": False} + + +def test_bound_wrapper_records_are_never_selected(): + bound = ("{ owner: aleo1me.private, amount: 900u128.private, " + "recipient_bound: true.private, bound_recipient: aleo1other.private, " + "_nonce: 7group.public }") + free = ("{ owner: aleo1me.private, amount: 900u128.private, " + "recipient_bound: false.private, bound_recipient: aleo1me.private, " + "_nonce: 8group.public }") + recs = [{"record_plaintext": bound}, {"record_plaintext": free}] + assert pick_covering_record(recs, min_amount=100, token_id=None) == free def test_nonces(): @@ -65,11 +102,11 @@ def test_nonces(): def test_parse_token_record_info(): assert parse_token_record_info( "{ owner: aleo1me.private, amount: 5000u128.private, _nonce: 1group.public }" - ) == {"amount": 5000} + ) == {"amount": 5000, "recipient_bound": False} info = parse_token_record_info( "{ owner: aleo1me.private, amount: 7u128.private, token_id: 9field.private, " "_nonce: 1group.public }") - assert info == {"amount": 7, "token_id": "9field"} + assert info == {"amount": 7, "token_id": "9field", "recipient_bound": False} assert parse_token_record_info("{ owner: aleo1me.private, _nonce: 1group.public }") is None assert parse_token_record_info("garbage {") is None From beef4b1a3703ffbb373471b3474eced8147eab34 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 11:01:16 -0500 Subject: [PATCH 05/23] feat(shield-swap): X128 slot price, new default program for derivations --- .../python/aleo_shield_swap/derivations.py | 11 ++--- .../python/aleo_shield_swap/types.py | 19 ++++---- shield-swap-sdk/tests/test_blinding.py | 43 ++++++++++++++++--- shield-swap-sdk/tests/test_types.py | 27 ++++++++---- 4 files changed, 70 insertions(+), 30 deletions(-) diff --git a/shield-swap-sdk/python/aleo_shield_swap/derivations.py b/shield-swap-sdk/python/aleo_shield_swap/derivations.py index f1b7a7d0..7a3a7927 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/derivations.py +++ b/shield-swap-sdk/python/aleo_shield_swap/derivations.py @@ -64,15 +64,16 @@ def derive_tick_key(pool: str, tick: int, *, network: str = "testnet") -> str: # ── Blinded identity ───────────────────────────────────────────────────────── # -# Port of amm-v3-tests src/client/amm-client.ts (feat/q128) via the TS SDK's -# utils/blinding/identity.ts. The domain separators are pinned from the -# reference client; CLAIM_OR_SWAP_DOMAIN must match the literal the program -# hashes in verify_blinded_address. +# Port of the reference client in amm-v3 ts-tests/src/client/amm-client.ts +# (@ development) via the TS SDK's utils/blinding/identity.ts. The domain +# separators are pinned from the reference client; CLAIM_OR_SWAP_DOMAIN must +# match the literal the program hashes in verify_blinded_address (confirmed +# unchanged in the deployed shield_swap.aleo bytecode). BLINDING_FACTOR_DOMAIN = "42815354924796718559205719970686750292466968495484257field" CLAIM_OR_SWAP_DOMAIN = "11835072102227764468342786961086432175093421716844963782363567713633field" -DEFAULT_PROGRAM = "shield_swap_v3.aleo" +DEFAULT_PROGRAM = "shield_swap.aleo" @dataclass(frozen=True) diff --git a/shield-swap-sdk/python/aleo_shield_swap/types.py b/shield-swap-sdk/python/aleo_shield_swap/types.py index 368130d8..89bc8948 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/types.py +++ b/shield-swap-sdk/python/aleo_shield_swap/types.py @@ -2,7 +2,7 @@ The generated ``_generated.py`` classes carry the wire shapes; the classes here carry meaning: the persistable swap handle, typed verb results, and a -``Slot`` view with Q64 price math and range helpers. +``Slot`` view with Q128.128 price math and range helpers. """ from __future__ import annotations @@ -12,7 +12,7 @@ from typing import Optional from ._generated import Slot -from .tick_math import Q64, round_tick_to_spacing +from .tick_math import Q128, round_tick_to_spacing, u256_to_int @dataclass(frozen=True) @@ -70,8 +70,8 @@ class TxResult: class SlotView: """A :class:`~aleo_shield_swap._generated.Slot` plus meaning. - Delegates every field to the wrapped slot and adds the Q64 fixed-point - conversions callers would otherwise re-derive subtly wrong. + Delegates every field to the wrapped slot and adds the Q128.128 + fixed-point conversions callers would otherwise re-derive subtly wrong. """ def __init__(self, slot: Slot) -> None: @@ -90,13 +90,12 @@ def raw(self) -> Slot: def price(self, decimals0: int, decimals1: int) -> Decimal: """Spot price of token1 per 1.0 token0, decimal-adjusted. - ``sqrt_price`` encodes ``sqrt(token1_norm / token0_norm)`` in Q64 - over the contract's 9-decimal-normalized units; the human price - re-applies ``10^(min(d0,9) - min(d1,9))``. + ``sqrt_price`` encodes ``sqrt(token1_raw / token0_raw)`` in Q128.128 + over raw native units; the human price re-applies + ``10^(decimals0 - decimals1)``. """ - sqrt = Decimal(self._slot.sqrt_price) / Decimal(Q64) - shift = Decimal(10) ** (min(decimals0, 9) - min(decimals1, 9)) - return sqrt * sqrt * shift + sqrt = Decimal(u256_to_int(self._slot.sqrt_price)) / Decimal(Q128) + return sqrt * sqrt * Decimal(10) ** (decimals0 - decimals1) def tick_range(self, width: int) -> tuple[int, int]: """A spacing-aligned mint range of ±*width* spacings around the diff --git a/shield-swap-sdk/tests/test_blinding.py b/shield-swap-sdk/tests/test_blinding.py index 2e56b8a0..5b3bf317 100644 --- a/shield-swap-sdk/tests/test_blinding.py +++ b/shield-swap-sdk/tests/test_blinding.py @@ -1,10 +1,16 @@ -"""Blinded identity derivation vs golden vectors from the TS SDK -(test/utils/blinding/identity.test.ts), which pin the reference derivation in -amm-v3-tests. The program's verify_blinded_address re-computes this hash and -rejects any deviation — the vectors must reproduce exactly.""" +"""Blinded identity derivation vs golden vectors. + +The v3 vectors come from the TS SDK (test/utils/blinding/identity.test.ts), +which pins the reference derivation; they still verify the ALGORITHM (the +domain separators are unchanged in the new deployment) via an explicit +program argument. The shield_swap.aleo vectors pin the DEFAULT program's +derivation — the program address feeds both hashes, so every address changed +with the cutover. The program's verify_blinded_address re-computes this +hash and rejects any deviation — the vectors must reproduce exactly.""" import pytest from aleo_shield_swap.derivations import ( + DEFAULT_PROGRAM, BlindedIdentity, derive_blinded_address, derive_blinding_factor, @@ -13,7 +19,9 @@ VIEW_KEY_SCALAR = "334926304971763782347498121479281870911723639068413954564748091722770623877scalar" SIGNER = "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px" -VECTORS = [ + +# Pinned for shield_swap_v3.aleo by the TS SDK reference suite. +V3_VECTORS = [ (0, "4588552248780721950435785476596782217652350429588181106944985529417784595808field", "aleo1tucdl48jvu54emu9atq3vf0rslwtdpze83zcc2jrc8zxema0r5gq3zd76l"), (1, "6996211042158127437642182917952771252908546914090630418129936449807650494378field", @@ -22,6 +30,29 @@ "aleo1jjq9qtr2uv86pans7f7v3tgcesg0autqhhu2cp2eecfxhtv4acgskyz80k"), ] +# Derived once for shield_swap.aleo (same algorithm, new program address). +VECTORS = [ + (0, "1084832000575072863530983109046262857691989153364570676666410266416291033880field", + "aleo15mstsvdtzqf5nw8rfzx8mrllwxt907amfpt8nx3p8cskj4wd3uxq4uywn9"), + (1, "5141395481140237504655245554781696675111779262144509416611105050866132602799field", + "aleo1kafjl7kvfh8dwtqdwgje2maw5ugkm63pph5qt5d503yt8spg3u8s38haku"), + (2, "4321510616277470162720724734723311517413314117144969624035468325948186568504field", + "aleo13rmacw9jk943wwg4s6t5yxcycvl3ud356l3cyzgav8hw9fkcjsqsgt4vy3"), + (7, "3586646586411194490118647465634943263277589324082503715221872233042073645843field", + "aleo1xfe9cwtftdg5fhkcmtjh4xnuuqjlwqgzk5hz762rf7zef088tqzqgvpkj6"), +] + + +def test_default_program_is_new_core(): + assert DEFAULT_PROGRAM == "shield_swap.aleo" + + +@pytest.mark.parametrize("counter,bf,ba", V3_VECTORS) +def test_v3_algorithm_vectors(counter, bf, ba): + assert derive_blinding_factor(VIEW_KEY_SCALAR, counter, + "shield_swap_v3.aleo") == bf + assert derive_blinded_address(bf, SIGNER, "shield_swap_v3.aleo") == ba + @pytest.mark.parametrize("counter,bf,ba", VECTORS) def test_golden_vectors(counter, bf, ba): @@ -110,7 +141,7 @@ class _Aleo: def programs(self): # any chain probe is a bug raise AssertionError("blinded_identity_at must not touch the chain") - for counter, bf, ba in VECTORS: + for counter, bf, ba in V3_VECTORS: ident = blinded_identity_at(_Aleo(), _Acct(), "shield_swap_v3.aleo", counter) assert (ident.counter, ident.blinding_factor, diff --git a/shield-swap-sdk/tests/test_types.py b/shield-swap-sdk/tests/test_types.py index 11834e2b..a9f1b834 100644 --- a/shield-swap-sdk/tests/test_types.py +++ b/shield-swap-sdk/tests/test_types.py @@ -1,15 +1,18 @@ from decimal import Decimal -from aleo_shield_swap._generated import Slot -from aleo_shield_swap.tick_math import Q64 +from aleo_shield_swap._generated import Slot, U256__8JquwLopp8 as U256 from aleo_shield_swap.types import SlotView, SwapHandle +def _u(value: int) -> U256: + return U256(hi=value >> 128, lo=value & ((1 << 128) - 1)) + + def _slot(**over): - base = dict(tick=4055, tick_spacing=60, sqrt_price=Q64, fee_protocol=0, - liquidity=0, fee_growth_global0_x_64=0, fee_growth_global1_x_64=0, - fee_residual0_x_64=0, fee_residual1_x_64=0, max_liquidity_per_tick=0, - protocol_fees0=0, protocol_fees1=0, next_init_below=0, next_init_above=0) + base = dict(tick=4055, tick_spacing=60, sqrt_price=_u(1 << 128), fee_protocol=0, + liquidity=0, fee_growth_global0_x_128=_u(0), fee_growth_global1_x_128=_u(0), + max_liquidity_per_tick=0, protocol_fees0=0, protocol_fees1=0, + next_init_below=0, next_init_above=0) base.update(over) return Slot(**base) @@ -17,19 +20,25 @@ def _slot(**over): def test_swap_handle_json_roundtrip(): h = SwapHandle(swap_id="1field", blinding_factor="2field", blinded_address="aleo1x", token_in_id="3field", token_out_id="4field", pool_key="5field", - amount_in=10**18, transaction_id="at1abc", program="shield_swap_v3.aleo") + amount_in=10**18, transaction_id="at1abc", program="shield_swap.aleo") assert SwapHandle.from_json(h.to_json()) == h -def test_slot_price_at_q64_is_one(): +def test_slot_price_at_q128_is_one(): v = SlotView(_slot()) assert v.price(9, 9) == Decimal(1) assert v.price(6, 6) == Decimal(1) # equal decimals cancel - assert v.price(18, 6) == Decimal(1000) # norm-capped: min(18,9)-min(6,9) = 3 + assert v.price(18, 6) == Decimal(10) ** 12 # raw units: 10^(18-6) assert v.tick == 4055 # attribute delegation assert v.raw is v._slot +def test_slot_price_x128_sqrt_two(): + # sqrt_price = 2.0 in Q128.128 → price 4.0 (token1 per token0, raw units) + v = SlotView(_slot(sqrt_price=_u(2 << 128))) + assert v.price(9, 6) == Decimal(4) * Decimal(10) ** 3 + + def test_tick_range_alignment(): v = SlotView(_slot(tick=4055, tick_spacing=60)) lo, hi = v.tick_range(10) From dec769c49a42db5659c02606914ad2b6b23ee68f Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 11:04:18 -0500 Subject: [PATCH 06/23] =?UTF-8?q?feat(shield-swap):=20new-stack=20write=20?= =?UTF-8?q?verbs=20=E2=80=94=20U256=20prices,=20proofs,=20withdrawal=20add?= =?UTF-8?q?ress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shield-swap-sdk/AGENTS.md | 13 +++-- .../python/aleo_shield_swap/AGENTS.md | 13 +++-- .../python/aleo_shield_swap/client.py | 41 ++++++++------ shield-swap-sdk/tests/conftest.py | 24 ++++----- shield-swap-sdk/tests/test_claim.py | 4 +- shield-swap-sdk/tests/test_client_reads.py | 2 +- shield-swap-sdk/tests/test_collect_all.py | 7 +-- shield-swap-sdk/tests/test_liquidity.py | 54 ++++++++++++++----- shield-swap-sdk/tests/test_swap.py | 10 ++-- 9 files changed, 106 insertions(+), 62 deletions(-) diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index 1bcdc78f..50bfff8d 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -282,7 +282,7 @@ Use with journal-reserved counters for concurrent swaps; :func:`next_blinded_identity` (probe-based) remains the recovery path when no journal exists. -### `next_blinded_identity(aleo: 'Any', account: 'Any', program: 'str' = 'shield_swap_v3.aleo', *, start_counter: 'int' = 0, max_scan: 'int' = 64) -> 'BlindedIdentity'` +### `next_blinded_identity(aleo: 'Any', account: 'Any', program: 'str' = 'shield_swap.aleo', *, start_counter: 'int' = 0, max_scan: 'int' = 64) -> 'BlindedIdentity'` First unused single-use identity for *account*. @@ -333,12 +333,14 @@ The fee tier must be registered with the program (validated before submission); tick spacing defaults to the tier's on-chain binding and the opening price to the tick's sqrt price. -### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, nonce: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` +### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, withdrawal: 'Optional[str]' = None, nonce: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` Mint a concentrated-liquidity position as a private PositionNFT. Tick bounds are rounded to the pool's spacing; insert hints derive -from the slot's neighbors unless given explicitly. +from the slot's neighbors unless given explicitly. *withdrawal* is +the immutable payout address stored on the NFT — ``collect`` always +pays it and it can never be changed; defaults to *recipient*. ### `increase_liquidity(self, *, pool_key: 'str', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, position_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` @@ -348,10 +350,13 @@ Add funds to an existing position (range fixed at mint). Remove liquidity from a position; owed amounts become collectable. -### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', recipient: 'Optional[str]' = None, position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` +### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Collect owed token amounts from a position. +The payout always goes to the position's immutable ``withdrawal`` +address — set at mint, not redirectable here. + ### `burn(self, *, pool_key: 'str', position_record: 'Optional[str]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Burn an empty position NFT. diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index 1bcdc78f..50bfff8d 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -282,7 +282,7 @@ Use with journal-reserved counters for concurrent swaps; :func:`next_blinded_identity` (probe-based) remains the recovery path when no journal exists. -### `next_blinded_identity(aleo: 'Any', account: 'Any', program: 'str' = 'shield_swap_v3.aleo', *, start_counter: 'int' = 0, max_scan: 'int' = 64) -> 'BlindedIdentity'` +### `next_blinded_identity(aleo: 'Any', account: 'Any', program: 'str' = 'shield_swap.aleo', *, start_counter: 'int' = 0, max_scan: 'int' = 64) -> 'BlindedIdentity'` First unused single-use identity for *account*. @@ -333,12 +333,14 @@ The fee tier must be registered with the program (validated before submission); tick spacing defaults to the tier's on-chain binding and the opening price to the tick's sqrt price. -### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, nonce: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` +### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, withdrawal: 'Optional[str]' = None, nonce: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` Mint a concentrated-liquidity position as a private PositionNFT. Tick bounds are rounded to the pool's spacing; insert hints derive -from the slot's neighbors unless given explicitly. +from the slot's neighbors unless given explicitly. *withdrawal* is +the immutable payout address stored on the NFT — ``collect`` always +pays it and it can never be changed; defaults to *recipient*. ### `increase_liquidity(self, *, pool_key: 'str', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, position_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` @@ -348,10 +350,13 @@ Add funds to an existing position (range fixed at mint). Remove liquidity from a position; owed amounts become collectable. -### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', recipient: 'Optional[str]' = None, position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` +### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Collect owed token amounts from a position. +The payout always goes to the position's immutable ``withdrawal`` +address — set at mint, not redirectable here. + ### `burn(self, *, pool_key: 'str', position_record: 'Optional[str]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Burn an empty position NFT. diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index ffba529d..b18dbdc3 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -14,6 +14,7 @@ from . import _generated as g from ._core import ( + default_merkle_proofs, ensure_programs, find_position_plaintext, pick_covering_record, @@ -62,7 +63,8 @@ from .tick_math import ( MAX_TICK, MIN_TICK, - get_sqrt_price_at_tick, + get_sqrt_price_at_tick_x128, + int_to_u256_plaintext, round_tick_to_spacing, ) @@ -454,7 +456,7 @@ def swap( resolved.zero_for_one, f"{amount_in}u128", f"{resolved.amount_out_min}u128", - f"{resolved.sqrt_price_limit}u128", + int_to_u256_plaintext(resolved.sqrt_price_limit), f"{swap_nonce}u64", f"{deadline}u32", pool.token0, @@ -532,6 +534,7 @@ def claim_swap_output( out.token_out, f"{out.amount_out}u128", f"{out.amount_remaining}u128", + default_merkle_proofs(), ] bound = self._aleo.programs.get(self.program).functions.claim_swap_output(*inputs) @@ -712,13 +715,12 @@ def collect_all(self, account: Any = None) -> CollectReport: pos = self._position_state(view.position_token_id) if pos is None or (pos.tokens_owed0 == 0 and pos.tokens_owed1 == 0): continue - pool = self.get_pool(view.pool_key) - # The contract asserts requested <= owed and requested % scale == 0; - # owed is stored in scaled units, so request exactly owed * scale. + # The contract asserts requested <= owed; owed is stored in raw + # native units, so request exactly what the chain reports. res = self.collect( pool_key=view.pool_key, - amount0_requested=pos.tokens_owed0 * pool.scale0, - amount1_requested=pos.tokens_owed1 * pool.scale1, + amount0_requested=pos.tokens_owed0, + amount1_requested=pos.tokens_owed1, account=acct, ).delegate(acct) fees.append({"position_token_id": view.position_token_id, @@ -761,14 +763,14 @@ def create_pool( ) spacing = int(raw.removesuffix("u32")) sqrt_price = (initial_sqrt_price if initial_sqrt_price is not None - else get_sqrt_price_at_tick(initial_tick)) + else get_sqrt_price_at_tick_x128(initial_tick)) self._ensure([], imports) inputs = [ token0_id, token1_id, f"{fee}u16", - f"{sqrt_price}u128", + int_to_u256_plaintext(sqrt_price), f"{spacing}u32", f"{initial_tick}i32", ] @@ -810,6 +812,7 @@ def mint( tick_lower_hint: Optional[int] = None, tick_upper_hint: Optional[int] = None, recipient: Optional[str] = None, + withdrawal: Optional[str] = None, nonce: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None, @@ -817,7 +820,9 @@ def mint( """Mint a concentrated-liquidity position as a private PositionNFT. Tick bounds are rounded to the pool's spacing; insert hints derive - from the slot's neighbors unless given explicitly. + from the slot's neighbors unless given explicitly. *withdrawal* is + the immutable payout address stored on the NFT — ``collect`` always + pays it and it can never be changed; defaults to *recipient*. """ acct = self._account(account) @@ -855,8 +860,11 @@ def mint( field_nonce = nonce if nonce is not None else generate_field_nonce() to = recipient or str(acct.address) + payout = withdrawal or to + proofs = default_merkle_proofs() - inputs = [field_nonce, record0, record1, to, request, pool.token0, pool.token1] + inputs = [field_nonce, record0, record1, to, payout, request, + pool.token0, pool.token1, proofs, proofs, proofs] bound = self._aleo.programs.get(self.program).functions.mint(*inputs) base_build = self._position_result(MintResult) @@ -947,12 +955,15 @@ def collect( pool_key: str, amount0_requested: int, amount1_requested: int, - recipient: Optional[str] = None, position_record: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None, ) -> DexCall[TxResult]: - """Collect owed token amounts from a position.""" + """Collect owed token amounts from a position. + + The payout always goes to the position's immutable ``withdrawal`` + address — set at mint, not redirectable here. + """ acct = self._account(account) pool = self.get_pool(pool_key) position = position_record or self._select_position_record(pool_key, acct) @@ -965,9 +976,9 @@ def collect( except ValueError: pass self._ensure(token_programs, imports) - to = recipient or str(acct.address) + proofs = default_merkle_proofs() inputs = [position, f"{amount0_requested}u128", f"{amount1_requested}u128", - pool.token0, pool.token1, to] + pool.token0, pool.token1, proofs, proofs] bound = self._aleo.programs.get(self.program).functions.collect(*inputs) # collect's first output is the re-issued PositionNFT record, not a # public field — there is no positional id to read back. diff --git a/shield-swap-sdk/tests/conftest.py b/shield-swap-sdk/tests/conftest.py index f8dda67e..9574dbf2 100644 --- a/shield-swap-sdk/tests/conftest.py +++ b/shield-swap-sdk/tests/conftest.py @@ -10,28 +10,28 @@ import pytest -from aleo_shield_swap.tick_math import Q64 - -SLOT_TEXT = ("{ tick: 4055i32, tick_spacing: 60i32, sqrt_price: " + str(Q64) + "u128, " - "fee_protocol: 0u8, liquidity: 1000u128, fee_growth_global0_x_64: 0u128, " - "fee_growth_global1_x_64: 0u128, fee_residual0_x_64: 0u128, " - "fee_residual1_x_64: 0u128, max_liquidity_per_tick: 0u128, " +SLOT_TEXT = ("{ tick: 4055i32, tick_spacing: 60u32, " + "sqrt_price: { hi: 1u128, lo: 0u128 }, " + "fee_protocol: 0u8, liquidity: 1000u128, " + "fee_growth_global0_x_128: { hi: 0u128, lo: 0u128 }, " + "fee_growth_global1_x_128: { hi: 0u128, lo: 0u128 }, " + "max_liquidity_per_tick: 0u128, " "protocol_fees0: 0u128, protocol_fees1: 0u128, " "next_init_below: 3960i32, next_init_above: 4080i32 }") -POOL_TEXT = ("{ token0: 1field, token1: 2field, fee: 3000u16, enabled: true, " - "scale0: 1000000000u128, scale1: 1u128 }") +POOL_TEXT = "{ token0: 1field, token1: 2field, fee: 3000u16, enabled: true }" RECORD_TEXT = ("{ owner: aleo1me.private, amount: 2000000000u128.private, " "_nonce: 7group.public }") -# Vector account from test_blinding.py — next_blinded_identity derives real values. +# Vector account from test_blinding.py — next_blinded_identity derives real +# values. Counter-0 identity pinned for shield_swap.aleo. VIEW_KEY_SCALAR = "334926304971763782347498121479281870911723639068413954564748091722770623877scalar" SIGNER = "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px" -BLINDING_FACTOR_0 = "4588552248780721950435785476596782217652350429588181106944985529417784595808field" -BLINDED_ADDRESS_0 = "aleo1tucdl48jvu54emu9atq3vf0rslwtdpze83zcc2jrc8zxema0r5gq3zd76l" +BLINDING_FACTOR_0 = "1084832000575072863530983109046262857691989153364570676666410266416291033880field" +BLINDED_ADDRESS_0 = "aleo15mstsvdtzqf5nw8rfzx8mrllwxt907amfpt8nx3p8cskj4wd3uxq4uywn9" -PROGRAM_ID = "shield_swap_v3.aleo" +PROGRAM_ID = "shield_swap.aleo" # A decoy child transition emitting a field output — root-scoped harvesting # must NEVER pick this up. diff --git a/shield-swap-sdk/tests/test_claim.py b/shield-swap-sdk/tests/test_claim.py index 25438ee1..84ff9ab4 100644 --- a/shield-swap-sdk/tests/test_claim.py +++ b/shield-swap-sdk/tests/test_claim.py @@ -3,6 +3,7 @@ amount_out u128, amount_remaining u128]""" import pytest +from aleo_shield_swap._core import default_merkle_proofs from aleo_shield_swap.client import ShieldSwap from aleo_shield_swap.errors import SwapOutputNotFinalizedError from aleo_shield_swap.types import ClaimResult, SwapHandle @@ -39,7 +40,8 @@ def test_claim_builds_exact_inputs_and_result(): fn, args = stub.last_call assert fn == "claim_swap_output" assert args == ["11field", "aleo1blinded", "77field", - "1field", "2field", "990000u128", "0u128"] + "1field", "2field", "990000u128", "0u128", + default_merkle_proofs()] assert result == ClaimResult("at1stubtx", 990000, 0) diff --git a/shield-swap-sdk/tests/test_client_reads.py b/shield-swap-sdk/tests/test_client_reads.py index 9388ac0f..ad77b2b1 100644 --- a/shield-swap-sdk/tests/test_client_reads.py +++ b/shield-swap-sdk/tests/test_client_reads.py @@ -20,7 +20,7 @@ def test_get_slot_returns_slotview(stub_aleo): def test_get_pool_returns_poolstate(stub_aleo): pool = ShieldSwap(stub_aleo).get_pool("5field") assert pool.token0 == "1field" and pool.fee == 3000 - assert pool.scale0 == 10**9 + assert pool.enabled is True def test_missing_pool_raises(stub_aleo): diff --git a/shield-swap-sdk/tests/test_collect_all.py b/shield-swap-sdk/tests/test_collect_all.py index a7432806..e31868eb 100644 --- a/shield-swap-sdk/tests/test_collect_all.py +++ b/shield-swap-sdk/tests/test_collect_all.py @@ -75,17 +75,12 @@ class _Pos: tokens_owed0 = 3 tokens_owed1 = 0 - class _Pool: - scale0 = 1000 - scale1 = 10 - monkeypatch.setattr(ShieldSwap, "get_positions", lambda self, account=None: [ PositionView("11field", "1field", "journal"), PositionView("22field", "2field", "scanned"), # skipped: no journal context ]) monkeypatch.setattr(ShieldSwap, "_position_state", lambda self, pid: _Pos() if pid == "11field" else None) - monkeypatch.setattr(ShieldSwap, "get_pool", lambda self, key: _Pool()) collected = [] def fake_collect(self, *, pool_key, amount0_requested, amount1_requested, @@ -99,7 +94,7 @@ def delegate(inner, account=None): monkeypatch.setattr(ShieldSwap, "collect", fake_collect) report = dex.collect_all() - assert collected == [("1field", 3000, 0)] # owed * scale, exactly + assert collected == [("1field", 3, 0)] # exactly owed, raw units assert report.fees == [{"position_token_id": "11field", "pool_key": "1field", "transaction_id": "txf"}] diff --git a/shield-swap-sdk/tests/test_liquidity.py b/shield-swap-sdk/tests/test_liquidity.py index 51399c70..c130a622 100644 --- a/shield-swap-sdk/tests/test_liquidity.py +++ b/shield-swap-sdk/tests/test_liquidity.py @@ -1,20 +1,25 @@ -"""Liquidity verbs — exact input orders per the TS actions: -create_pool: [token0, token1, fee u16, sqrt_price u128, spacing u32, tick i32] -mint: [nonce field, record0, record1, recipient, MintPositionRequest, token0, token1] +"""Liquidity verbs — exact input orders per the deployed shield_swap.aleo: +create_pool: [token0, token1, fee u16, sqrt_price U256, spacing u32, tick i32] +mint: [nonce field, record0, record1, recipient, withdrawal, + MintPositionRequest, token0, token1, signer_proofs, + recipient_proofs, withdrawal_proofs] increase: [position, record0, record1, a0 u128, a1 u128, a0min u128, a1min u128, token0, token1, lo_hint i32, hi_hint i32] decrease: [position, liquidity u128, a0min u128, a1min u128] -collect: [position, a0req u128, a1req u128, token0, token1, recipient] +collect: [position, a0req u128, a1req u128, token0, token1, + owner_proofs, withdrawal_proofs] burn: [position]""" import pytest +from aleo_shield_swap._core import default_merkle_proofs from aleo_shield_swap.client import ShieldSwap from aleo_shield_swap.errors import InsufficientRecordsError, InvalidFeeTierError -from aleo_shield_swap.tick_math import get_sqrt_price_at_tick +from aleo_shield_swap.tick_math import get_sqrt_price_at_tick_x128, int_to_u256_plaintext from .conftest import POOL_TEXT, SIGNER, SLOT_TEXT, StubAleo -POSITION_TEXT = ("{ owner: aleo1me.private, token_id: 42field.private, " +POSITION_TEXT = ("{ owner: aleo1me.private, withdrawal: aleo1me.private, " + "token_id: 42field.private, " "token0_id: 1field.private, token1_id: 2field.private, " "pool: 5field.private, tick_lower: -4080i32.private, " "tick_upper: 4080i32.private, liquidity: 500u128.private, " @@ -45,7 +50,8 @@ def test_create_pool_inputs_and_validation(): fn, args = stub.last_call assert fn == "create_pool" assert args == ["1field", "2field", "3000u16", - f"{get_sqrt_price_at_tick(0)}u128", "60u32", "0i32"] + int_to_u256_plaintext(get_sqrt_price_at_tick_x128(0)), + "60u32", "0i32"] assert result.transaction_id == "at1stubtx" with pytest.raises(InvalidFeeTierError): @@ -71,18 +77,32 @@ def test_mint_inputs_rounding_and_request(): nonce="9field") fn, args = stub.last_call assert fn == "mint" - assert len(args) == 7 + assert len(args) == 11 assert args[0] == "9field" assert args[1] == TOKEN0_RECORD and args[2] == TOKEN0_RECORD assert args[3] == SIGNER # recipient defaults to signer + assert args[4] == SIGNER # withdrawal defaults to recipient # ticks rounded to spacing 60: -4055 -> -4080, 4055 -> 4020 - assert "tick_lower: -4080i32" in args[4] - assert "tick_upper: 4020i32" in args[4] - assert "amount0_desired: 1000000000u128" in args[4] + assert "tick_lower: -4080i32" in args[5] + assert "tick_upper: 4020i32" in args[5] + assert "amount0_desired: 1000000000u128" in args[5] # slot neighbors: below=3960, above=4080; lower hint for -4080 (< tick) is 3960? # pick_insert_hint(-4080 <= 4055) -> next_init_below = 3960 - assert "tick_lower_hint: 3960i32" in args[4] - assert args[5] == "1field" and args[6] == "2field" + assert "tick_lower_hint: 3960i32" in args[5] + assert args[6] == "1field" and args[7] == "2field" + proofs = default_merkle_proofs() + assert args[8] == proofs and args[9] == proofs and args[10] == proofs + + +def test_mint_explicit_withdrawal_address(): + stub = _stub() + ShieldSwap(stub).mint(pool_key="5field", tick_lower=-4080, tick_upper=4080, + amount0_desired=10**9, amount1_desired=100, + token0_program="tok0.aleo", token1_program="tok1.aleo", + withdrawal="aleo1coldwallet") + _, args = stub.last_call + assert args[3] == SIGNER # recipient still the signer + assert args[4] == "aleo1coldwallet" # immutable payout address def test_mint_default_nonce_is_generated(): @@ -127,10 +147,16 @@ def test_decrease_collect_burn_inputs(): result = dex.collect(pool_key="5field", amount0_requested=7, amount1_requested=8).transact() fn, args = stub.last_call + proofs = default_merkle_proofs() assert (fn, args) == ("collect", [POSITION_TEXT, "7u128", "8u128", - "1field", "2field", SIGNER]) + "1field", "2field", proofs, proofs]) assert result.position_token_id is None # collect re-issues privately + # The payout goes to nft.withdrawal — there is no recipient input anymore. + with pytest.raises(TypeError): + dex.collect(pool_key="5field", amount0_requested=1, + amount1_requested=1, recipient=SIGNER) + dex.burn(pool_key="5field") assert stub.last_call == ("burn", [POSITION_TEXT]) diff --git a/shield-swap-sdk/tests/test_swap.py b/shield-swap-sdk/tests/test_swap.py index 6cc96430..c2646d0b 100644 --- a/shield-swap-sdk/tests/test_swap.py +++ b/shield-swap-sdk/tests/test_swap.py @@ -1,13 +1,13 @@ """swap() against the stubbed facade — asserts the exact positional input -list (order from the TS reference src/actions/swap/swap.ts): +list (order from the deployed shield_swap.aleo bytecode): [record, blinding_factor, blinded_address, pool_key, zero_for_one, - amount_in u128, amount_out_min u128, sqrt_price_limit u128, nonce u64, + amount_in u128, amount_out_min u128, sqrt_price_limit U256, nonce u64, deadline u32, token0, token1]""" import pytest from aleo_shield_swap.client import ShieldSwap from aleo_shield_swap.errors import InsufficientRecordsError -from aleo_shield_swap.tick_math import MIN_SQRT_PRICE +from aleo_shield_swap.tick_math import MIN_SQRT_RATIO_X128, int_to_u256_plaintext from aleo_shield_swap.types import SwapHandle from .conftest import ( @@ -40,14 +40,14 @@ def test_swap_builds_exact_inputs(stub_aleo): assert args[4] is True # zero_for_one assert args[5] == f"{10**9}u128" assert args[6] == f"{1_000_000 * 9950 // 10000}u128" # slippage applied - assert args[7] == f"{MIN_SQRT_PRICE}u128" # directional default + assert args[7] == int_to_u256_plaintext(MIN_SQRT_RATIO_X128) # directional default assert args[8] == "123u64" assert args[9] == "11000u32" # height 1000 + 10_000 (DPS latency) assert args[10] == "1field" and args[11] == "2field" assert len(args) == 12 # Dynamic dispatch: the DEX program and the token wrapper program must be # registered with the process before authorization. - assert "shield_swap_v3.aleo" in stub_aleo.registered_programs + assert "shield_swap.aleo" in stub_aleo.registered_programs assert "tok.aleo" in stub_aleo.registered_programs From b073bae1259425f4d540c0dc3d6dbb379336df18 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 11:13:02 -0500 Subject: [PATCH 07/23] feat(shield-swap): automatic router dispatch for wrapped assets --- shield-swap-sdk/AGENTS.md | 27 ++- .../python/aleo_shield_swap/AGENTS.md | 27 ++- .../python/aleo_shield_swap/_routing.py | 57 +++++ .../python/aleo_shield_swap/client.py | 210 +++++++++++++++--- shield-swap-sdk/tests/conftest.py | 27 ++- shield-swap-sdk/tests/test_claim.py | 55 ++++- shield-swap-sdk/tests/test_gen_context.py | 4 +- shield-swap-sdk/tests/test_liquidity.py | 86 +++++++ shield-swap-sdk/tests/test_routing.py | 37 +++ shield-swap-sdk/tests/test_swap.py | 42 ++++ 10 files changed, 502 insertions(+), 70 deletions(-) create mode 100644 shield-swap-sdk/python/aleo_shield_swap/_routing.py create mode 100644 shield-swap-sdk/tests/test_routing.py diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index 50bfff8d..7b039ec9 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -292,10 +292,13 @@ fast when something is systematically wrong (e.g. wrong program). ### Chain verbs -### `swap(self, *, pool_key: 'str', token_in_id: 'str', amount_in: 'int', slippage_bps: 'int' = 50, expected_out: 'Optional[int]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle]'` +### `swap(self, *, pool_key: 'str', token_in_id: 'str', amount_in: 'int', slippage_bps: 'int' = 50, expected_out: 'Optional[int]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle]'` Request a private swap — phase one of the two-transaction flow. +Wrapped inputs route via the swap router automatically; fund them +with UNDERLYING records — the deposit happens in-transaction. + Resolves the intent against live pool state, derives a single-use blinded identity from the signer's view key, selects an unspent token record (or takes *token_record* verbatim), and returns a prepared @@ -311,15 +314,18 @@ on-chain probe — required for concurrent swaps. The default proving latency; a tight deadline aborts at finalize when proving outlives it. -### `claim_swap_output(self, handle: 'SwapHandle', *, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[ClaimResult]'` +### `claim_swap_output(self, handle: 'SwapHandle', *, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[ClaimResult]'` Claim a private swap's output — phase two of the lifecycle. Reads the chain-computed result from ``swap_outputs`` (never an off-chain service — these amounts gate money movement), proves -ownership of the blinded identity, and prepares ``claim_swap_output``. -The output and any refund arrive as private records owned by the -signer; the mapping entry is consumed. +ownership of the blinded identity, and claims. A wrapped output or +refund routes automatically through the router, which unwraps to +the signer in the same transaction — even for swaps that started +as direct core calls. The output and any refund arrive as private +records owned by the signer (output first, refund second); the +mapping entry is consumed. Raises :class:`SwapOutputNotFinalizedError` **at prepare time** when the output is not readable yet (retry after a few blocks) or was @@ -333,7 +339,7 @@ The fee tier must be registered with the program (validated before submission); tick spacing defaults to the tier's on-chain binding and the opening price to the tick's sqrt price. -### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, withdrawal: 'Optional[str]' = None, nonce: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` +### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, withdrawal: 'Optional[str]' = None, nonce: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` Mint a concentrated-liquidity position as a private PositionNFT. @@ -341,21 +347,24 @@ Tick bounds are rounded to the pool's spacing; insert hints derive from the slot's neighbors unless given explicitly. *withdrawal* is the immutable payout address stored on the NFT — ``collect`` always pays it and it can never be changed; defaults to *recipient*. +Wrapped pool sides route via the LP router; fund with UNDERLYING records. -### `increase_liquidity(self, *, pool_key: 'str', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, position_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` +### `increase_liquidity(self, *, pool_key: 'str', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, position_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Add funds to an existing position (range fixed at mint). +Wrapped pool sides route via the LP router; fund with UNDERLYING records. ### `decrease_liquidity(self, *, pool_key: 'str', liquidity_to_remove: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Remove liquidity from a position; owed amounts become collectable. -### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` +### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', position_record: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Collect owed token amounts from a position. The payout always goes to the position's immutable ``withdrawal`` -address — set at mint, not redirectable here. +address — set at mint, not redirectable here. Wrapped pool sides +route via the LP router, unwrapping to that address in-transaction. ### `burn(self, *, pool_key: 'str', position_record: 'Optional[str]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index 50bfff8d..7b039ec9 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -292,10 +292,13 @@ fast when something is systematically wrong (e.g. wrong program). ### Chain verbs -### `swap(self, *, pool_key: 'str', token_in_id: 'str', amount_in: 'int', slippage_bps: 'int' = 50, expected_out: 'Optional[int]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle]'` +### `swap(self, *, pool_key: 'str', token_in_id: 'str', amount_in: 'int', slippage_bps: 'int' = 50, expected_out: 'Optional[int]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle]'` Request a private swap — phase one of the two-transaction flow. +Wrapped inputs route via the swap router automatically; fund them +with UNDERLYING records — the deposit happens in-transaction. + Resolves the intent against live pool state, derives a single-use blinded identity from the signer's view key, selects an unspent token record (or takes *token_record* verbatim), and returns a prepared @@ -311,15 +314,18 @@ on-chain probe — required for concurrent swaps. The default proving latency; a tight deadline aborts at finalize when proving outlives it. -### `claim_swap_output(self, handle: 'SwapHandle', *, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[ClaimResult]'` +### `claim_swap_output(self, handle: 'SwapHandle', *, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[ClaimResult]'` Claim a private swap's output — phase two of the lifecycle. Reads the chain-computed result from ``swap_outputs`` (never an off-chain service — these amounts gate money movement), proves -ownership of the blinded identity, and prepares ``claim_swap_output``. -The output and any refund arrive as private records owned by the -signer; the mapping entry is consumed. +ownership of the blinded identity, and claims. A wrapped output or +refund routes automatically through the router, which unwraps to +the signer in the same transaction — even for swaps that started +as direct core calls. The output and any refund arrive as private +records owned by the signer (output first, refund second); the +mapping entry is consumed. Raises :class:`SwapOutputNotFinalizedError` **at prepare time** when the output is not readable yet (retry after a few blocks) or was @@ -333,7 +339,7 @@ The fee tier must be registered with the program (validated before submission); tick spacing defaults to the tier's on-chain binding and the opening price to the tick's sqrt price. -### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, withdrawal: 'Optional[str]' = None, nonce: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` +### `mint(self, *, pool_key: 'str', tick_lower: 'int', tick_upper: 'int', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, recipient: 'Optional[str]' = None, withdrawal: 'Optional[str]' = None, nonce: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[MintResult]'` Mint a concentrated-liquidity position as a private PositionNFT. @@ -341,21 +347,24 @@ Tick bounds are rounded to the pool's spacing; insert hints derive from the slot's neighbors unless given explicitly. *withdrawal* is the immutable payout address stored on the NFT — ``collect`` always pays it and it can never be changed; defaults to *recipient*. +Wrapped pool sides route via the LP router; fund with UNDERLYING records. -### `increase_liquidity(self, *, pool_key: 'str', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, position_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` +### `increase_liquidity(self, *, pool_key: 'str', amount0_desired: 'int', amount1_desired: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, token0_program: 'Optional[str]' = None, token1_program: 'Optional[str]' = None, token0_record: 'Optional[str]' = None, token1_record: 'Optional[str]' = None, position_record: 'Optional[str]' = None, tick_lower_hint: 'Optional[int]' = None, tick_upper_hint: 'Optional[int]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Add funds to an existing position (range fixed at mint). +Wrapped pool sides route via the LP router; fund with UNDERLYING records. ### `decrease_liquidity(self, *, pool_key: 'str', liquidity_to_remove: 'int', amount0_min: 'int' = 0, amount1_min: 'int' = 0, position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Remove liquidity from a position; owed amounts become collectable. -### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', position_record: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` +### `collect(self, *, pool_key: 'str', amount0_requested: 'int', amount1_requested: 'int', position_record: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` Collect owed token amounts from a position. The payout always goes to the position's immutable ``withdrawal`` -address — set at mint, not redirectable here. +address — set at mint, not redirectable here. Wrapped pool sides +route via the LP router, unwrapping to that address in-transaction. ### `burn(self, *, pool_key: 'str', position_record: 'Optional[str]' = None, account: 'Any' = None) -> 'DexCall[TxResult]'` diff --git a/shield-swap-sdk/python/aleo_shield_swap/_routing.py b/shield-swap-sdk/python/aleo_shield_swap/_routing.py new file mode 100644 index 00000000..42edecf0 --- /dev/null +++ b/shield-swap-sdk/python/aleo_shield_swap/_routing.py @@ -0,0 +1,57 @@ +"""Pure routing decisions for the shield_swap stack (migration guide §6). + +Wrapped assets must enter and leave the AMM through the routers; plain +ARC-20s call the core directly. A plain-input swap that OUTPUTS a wrapped +token starts on the core and claims through the router — the claim route +depends only on the finalized SwapOutput's token shapes. +""" +from __future__ import annotations + +from typing import NamedTuple + +from ._generated import PROGRAM_ID + +ROUTER_ID = "shield_swap_router.aleo" +LP_ROUTER_ID = "shield_swap_lp_router.aleo" + + +class Route(NamedTuple): + program: str + function: str + + +def swap_route(input_wrapped: bool) -> Route: + return (Route(ROUTER_ID, "swap_from_wrapped") if input_wrapped + else Route(PROGRAM_ID, "swap")) + + +def claim_route(output_wrapped: bool, refund_wrapped: bool) -> Route: + if output_wrapped and refund_wrapped: + return Route(ROUTER_ID, "claim_to_wrapped_refund_wrapped") + if output_wrapped: + return Route(ROUTER_ID, "claim_to_wrapped_refund_arc20") + if refund_wrapped: + return Route(ROUTER_ID, "claim_to_arc20_refund_wrapped") + return Route(PROGRAM_ID, "claim_swap_output") + + +def _lp_route(w0: bool, w1: bool, stem: str, core_fn: str) -> Route: + if w0 and w1: + return Route(LP_ROUTER_ID, f"{stem}_wrapped_wrapped") + if w0: + return Route(LP_ROUTER_ID, f"{stem}_wrapped_arc20") + if w1: + return Route(LP_ROUTER_ID, f"{stem}_arc20_wrapped") + return Route(PROGRAM_ID, core_fn) + + +def mint_route(w0: bool, w1: bool) -> Route: + return _lp_route(w0, w1, "mint_from", "mint") + + +def increase_route(w0: bool, w1: bool) -> Route: + return _lp_route(w0, w1, "increase_from", "increase_liquidity") + + +def collect_route(w0: bool, w1: bool) -> Route: + return _lp_route(w0, w1, "collect_to", "collect") diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index b18dbdc3..63174af5 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -59,6 +59,13 @@ TxResult, ) from ._calls import DexCall +from ._routing import ( + claim_route, + collect_route, + increase_route, + mint_route, + swap_route, +) from .tick_hints import pick_insert_hint from .tick_math import ( MAX_TICK, @@ -86,6 +93,9 @@ def __init__(self, aleo: Any, *, program: str = g.PROGRAM_ID, self.api = ApiClient(api_url) self.profile: Any = None # set by from_profile() self.journal: Any = None # set by from_profile() + # allow_token relationships are immutable — cache probes for the + # client's lifetime. + self._wrapped_cache: dict[str, bool] = {} def __repr__(self) -> str: return f"ShieldSwap(program={self.program!r}, api={self.api.base_url!r})" @@ -382,6 +392,21 @@ def _ensure(self, token_programs: list[str], pids = [self.program, *token_programs, *(imports or {})] ensure_programs(self._aleo, pids, imports) + def _lp_programs(self, route: Any, program0: str, program1: str, + pool: Any, w0: bool, w1: bool) -> list[str]: + """Programs a (possibly routed) LP call touches: both funding + programs, the LP router when routed, and each wrapped side's + wrapper program (the router's dynamic-dispatch callee).""" + pids = [program0, program1] + if route.program != self.program: + pids.append(route.program) + for token_id, wrapped in ((pool.token0, w0), (pool.token1, w1)): + if wrapped: + wrapper = self._amm_token_program(str(token_id)) + if wrapper: + pids.append(wrapper) + return pids + def swap( self, *, @@ -396,11 +421,15 @@ def swap( identity: Optional[BlindedIdentity] = None, token_in_program: Optional[str] = None, token_record: Optional[str] = None, + wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None, ) -> DexCall[SwapHandle]: """Request a private swap — phase one of the two-transaction flow. + Wrapped inputs route via the swap router automatically; fund them + with UNDERLYING records — the deposit happens in-transaction. + Resolves the intent against live pool state, derives a single-use blinded identity from the signer's view key, selects an unspent token record (or takes *token_record* verbatim), and returns a prepared @@ -428,25 +457,26 @@ def swap( swap_nonce = nonce if nonce is not None else generate_swap_nonce() identity = identity or next_blinded_identity(self._aleo, acct, self.program) + # An explicit record still needs its program registered with the + # prover — resolve it unless the caller named one. + program = token_in_program or self._token_program(token_in_id) record = token_record if record is None: - program = token_in_program or self._token_program(token_in_id) record = select_token_record( self._aleo, program=program, min_amount=amount_in, token_id=token_in_id, account=acct, ) - token_programs = [program] - else: - # An explicit record still needs its program registered with the - # prover — resolve it unless the caller named one. - program = token_in_program or self._token_program(token_in_id) - token_programs = [program] - # Dynamic dispatch: the prover cannot discover token callees - # statically — register the DEX program and the involved token - # programs with the process before authorization. - self._ensure(token_programs, imports) - # Input order per the contract's swap entrypoint (mirrors the TS SDK): + route = swap_route(self._is_wrapped(token_in_id)) + # Dynamic dispatch: the prover cannot discover token callees + # statically — register the DEX program, the involved token + # programs, and (for routed swaps) the router + wrapper with the + # process before authorization. + extra = [route.program] if route.program != self.program else [] + wrapper = self._amm_token_program(token_in_id) if extra else None + self._ensure([p for p in (program, wrapper, *extra) if p], imports) + + # Core input order per the contract's swap entrypoint: # record, blinding slots, then pool/direction/amounts/bounds/timing/tokens. inputs = [ record, @@ -462,7 +492,17 @@ def swap( pool.token0, pool.token1, ] - bound = self._aleo.programs.get(self.program).functions.swap(*inputs) + if route.program != self.program: + # Router deposits the underlying, swaps, and burns the empty + # wrapper change record in one transaction. + if resolved.amount_out_min <= 0: + raise ValueError( + "routed swaps require amount_out_min > 0 — pass " + "expected_out or a slippage below 100%") + inputs = [record, wrapper_proofs or default_merkle_proofs(), + *inputs[1:]] + bound = getattr(self._aleo.programs.get(route.program).functions, + route.function)(*inputs) def build_result(tx_id: str, outputs: list[Any]) -> SwapHandle: swap_id = next( @@ -487,6 +527,7 @@ def claim_swap_output( self, handle: SwapHandle, *, + wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None, ) -> DexCall[ClaimResult]: @@ -494,9 +535,12 @@ def claim_swap_output( Reads the chain-computed result from ``swap_outputs`` (never an off-chain service — these amounts gate money movement), proves - ownership of the blinded identity, and prepares ``claim_swap_output``. - The output and any refund arrive as private records owned by the - signer; the mapping entry is consumed. + ownership of the blinded identity, and claims. A wrapped output or + refund routes automatically through the router, which unwraps to + the signer in the same transaction — even for swaps that started + as direct core calls. The output and any refund arrive as private + records owned by the signer (output first, refund second); the + mapping entry is consumed. Raises :class:`SwapOutputNotFinalizedError` **at prepare time** when the output is not readable yet (retry after a few blocks) or was @@ -516,10 +560,17 @@ def claim_swap_output( ) # Trust-critical read: the amounts the claim moves come from the chain. out = self.get_swap_output(handle.swap_id) - # The claim dynamically calls BOTH token programs (payout + refund) — - # register them; a fresh process has neither cached. - token_programs = [] + w_out = self._is_wrapped(str(out.token_out)) + w_in = self._is_wrapped(str(out.token_in)) + route = claim_route(w_out, w_in) + # The claim dynamically calls BOTH token programs (payout + refund), + # and a routed claim additionally calls the router + wrapper(s) — + # register them; a fresh process has none cached. + token_programs = [route.program] if route.program != self.program else [] for token_id in (out.token_in, out.token_out): + wrapper = self._amm_token_program(str(token_id)) + if wrapper: + token_programs.append(wrapper) try: token_programs.append(self._token_program(str(token_id))) except ValueError: @@ -536,23 +587,69 @@ def claim_swap_output( f"{out.amount_remaining}u128", default_merkle_proofs(), ] - bound = self._aleo.programs.get(self.program).functions.claim_swap_output(*inputs) + wp = wrapper_proofs or default_merkle_proofs() + if w_out and w_in: + inputs += [wp, wp] # wp for the output, then the refund + elif w_out or w_in: + inputs += [wp] + bound = getattr(self._aleo.programs.get(route.program).functions, + route.function)(*inputs) def build_result(tx_id: str, outputs: list[Any]) -> ClaimResult: return ClaimResult(tx_id, out.amount_out, out.amount_remaining) return DexCall(self._aleo, bound, build_result) - def _token_program(self, token_id: str) -> str: - """Wrapper program holding a token's records, from the API registry.""" + def _is_wrapped(self, token_id: str) -> bool: + """True when the AMM registers *token_id* as a wrapper. + + Chain probe of ``from_wrapper_token_id`` (the source of truth), cached + for the client's lifetime. A transport error propagates — silently + classifying a wrapped token as plain would route a wrapped swap to + the core AMM and burn a proof on a guaranteed revert. + """ + tid = str(token_id) + if tid not in self._wrapped_cache: + raw = self._aleo.programs.get(self.program) \ + .mapping("from_wrapper_token_id").get(tid) + self._wrapped_cache[tid] = normalize_mapping_value(raw) is not None + return self._wrapped_cache[tid] + + def _registry_row(self, token_id: str) -> Any: for tok in self.api.get_tokens(): - if tok.address == token_id and tok.wrapper_program: - return tok.wrapper_program + if tok.address == token_id: + return tok + return None + + def _token_program(self, token_id: str) -> str: + """Program holding the records that FUND a token — the underlying + program for wrapped assets (users hold underlying records; wrapping + happens inside the routed transaction), the ARC-20 program itself + for plain tokens.""" + tok = self._registry_row(token_id) + prog = tok and (getattr(tok, "underlying_program", None) + or getattr(tok, "amm_token_program", None) + or getattr(tok, "wrapper_program", None)) + if prog: + return prog raise ValueError( - f"Cannot resolve the wrapper program for {token_id} — pass " + f"Cannot resolve the record program for {token_id} — pass " "token_in_program= (or token_record=) explicitly." ) + def _amm_token_program(self, token_id: str) -> Optional[str]: + """The wrapper program the AMM stores balances in — needed to + register the dynamic-dispatch callee of routed calls with the + prover. Best-effort: None when the registry has no row or is + unreachable (callers can pass imports= instead); routing itself + never depends on this.""" + try: + tok = self._registry_row(token_id) + except Exception: + return None + return tok and (getattr(tok, "amm_token_program", None) + or getattr(tok, "wrapper_program", None)) + # ── Liquidity ──────────────────────────────────────────────────────────── def _token_decimals(self, token_id: str) -> Optional[int]: @@ -814,6 +911,7 @@ def mint( recipient: Optional[str] = None, withdrawal: Optional[str] = None, nonce: Optional[str] = None, + wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None, ) -> DexCall[MintResult]: @@ -823,6 +921,7 @@ def mint( from the slot's neighbors unless given explicitly. *withdrawal* is the immutable payout address stored on the NFT — ``collect`` always pays it and it can never be changed; defaults to *recipient*. + Wrapped pool sides route via the LP router; fund with UNDERLYING records. """ acct = self._account(account) @@ -856,16 +955,27 @@ def mint( record1 = token1_record or select_token_record( self._aleo, program=program1, min_amount=amount1_desired, token_id=pool.token1, account=acct) - self._ensure([program0, program1], imports) + + w0 = self._is_wrapped(str(pool.token0)) + w1 = self._is_wrapped(str(pool.token1)) + route = mint_route(w0, w1) + self._ensure(self._lp_programs(route, program0, program1, pool, w0, w1), + imports) field_nonce = nonce if nonce is not None else generate_field_nonce() to = recipient or str(acct.address) payout = withdrawal or to proofs = default_merkle_proofs() + wp = wrapper_proofs or default_merkle_proofs() - inputs = [field_nonce, record0, record1, to, payout, request, + # Wrapper proofs sit directly after their wrapped-side record + # (deployed LP-router input order). + rec0 = [record0, wp] if w0 else [record0] + rec1 = [record1, wp] if w1 else [record1] + inputs = [field_nonce, *rec0, *rec1, to, payout, request, pool.token0, pool.token1, proofs, proofs, proofs] - bound = self._aleo.programs.get(self.program).functions.mint(*inputs) + bound = getattr(self._aleo.programs.get(route.program).functions, + route.function)(*inputs) base_build = self._position_result(MintResult) @@ -893,10 +1003,12 @@ def increase_liquidity( position_record: Optional[str] = None, tick_lower_hint: Optional[int] = None, tick_upper_hint: Optional[int] = None, + wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None, ) -> DexCall[TxResult]: - """Add funds to an existing position (range fixed at mint).""" + """Add funds to an existing position (range fixed at mint). + Wrapped pool sides route via the LP router; fund with UNDERLYING records.""" acct = self._account(account) pool = self.get_pool(pool_key) @@ -917,16 +1029,25 @@ def increase_liquidity( record1 = token1_record or select_token_record( self._aleo, program=program1, min_amount=amount1_desired, token_id=pool.token1, account=acct) - self._ensure([program0, program1], imports) + w0 = self._is_wrapped(str(pool.token0)) + w1 = self._is_wrapped(str(pool.token1)) + route = increase_route(w0, w1) + self._ensure(self._lp_programs(route, program0, program1, pool, w0, w1), + imports) + + wp = wrapper_proofs or default_merkle_proofs() + rec0 = [record0, wp] if w0 else [record0] + rec1 = [record1, wp] if w1 else [record1] inputs = [ - position, record0, record1, + position, *rec0, *rec1, f"{amount0_desired}u128", f"{amount1_desired}u128", f"{amount0_min}u128", f"{amount1_min}u128", pool.token0, pool.token1, f"{lo_hint}i32", f"{hi_hint}i32", ] - bound = self._aleo.programs.get(self.program).functions.increase_liquidity(*inputs) + bound = getattr(self._aleo.programs.get(route.program).functions, + route.function)(*inputs) return DexCall(self._aleo, bound, self._position_result(TxResult)) def decrease_liquidity( @@ -956,30 +1077,45 @@ def collect( amount0_requested: int, amount1_requested: int, position_record: Optional[str] = None, + wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None, ) -> DexCall[TxResult]: """Collect owed token amounts from a position. The payout always goes to the position's immutable ``withdrawal`` - address — set at mint, not redirectable here. + address — set at mint, not redirectable here. Wrapped pool sides + route via the LP router, unwrapping to that address in-transaction. """ acct = self._account(account) pool = self.get_pool(pool_key) position = position_record or self._select_position_record(pool_key, acct) + w0 = self._is_wrapped(str(pool.token0)) + w1 = self._is_wrapped(str(pool.token1)) + route = collect_route(w0, w1) # The collect transition pays out via dynamic token-program calls — - # both programs must be registered with the prover. - token_programs = [] - for token_id in (pool.token0, pool.token1): + # every involved program must be registered with the prover. + token_programs = [route.program] if route.program != self.program else [] + for token_id, wrapped in ((pool.token0, w0), (pool.token1, w1)): + if wrapped: + wrapper = self._amm_token_program(str(token_id)) + if wrapper: + token_programs.append(wrapper) try: token_programs.append(self._token_program(str(token_id))) except ValueError: pass self._ensure(token_programs, imports) proofs = default_merkle_proofs() + wp = wrapper_proofs or default_merkle_proofs() inputs = [position, f"{amount0_requested}u128", f"{amount1_requested}u128", pool.token0, pool.token1, proofs, proofs] - bound = self._aleo.programs.get(self.program).functions.collect(*inputs) + if w0: + inputs.append(wp) + if w1: + inputs.append(wp) + bound = getattr(self._aleo.programs.get(route.program).functions, + route.function)(*inputs) # collect's first output is the re-issued PositionNFT record, not a # public field — there is no positional id to read back. return DexCall(self._aleo, bound, diff --git a/shield-swap-sdk/tests/conftest.py b/shield-swap-sdk/tests/conftest.py index 9574dbf2..111356c1 100644 --- a/shield-swap-sdk/tests/conftest.py +++ b/shield-swap-sdk/tests/conftest.py @@ -83,8 +83,9 @@ class _Tx: id = "at1stubtx" raw = object() - def __init__(self, fn): + def __init__(self, fn, pid=PROGRAM_ID): self._fn = fn + self._pid = pid @property def outputs(self): @@ -92,39 +93,42 @@ def outputs(self): def decoded(self): return [dict(CHILD_TRANSITION), - {"program": PROGRAM_ID, "function": self._fn, + {"program": self._pid, "function": self._fn, "outputs": [{"value": "77field"}]}] def transitions(self): return [_StubTransition("tok.aleo", "transfer", ["999field"]), - _StubTransition(PROGRAM_ID, self._fn, ["77field"])] + _StubTransition(self._pid, self._fn, ["77field"])] class _BoundCall: - def __init__(self, recorder, fn, args): - self.program_id = PROGRAM_ID + def __init__(self, recorder, fn, args, pid=PROGRAM_ID): + self.program_id = pid self.function_name = fn self._recorder = recorder self._recorder.last_call = (fn, list(args)) + self._recorder.last_program = pid def simulate(self, account=None): return "simulated" def build_transaction(self, account=None, **kw): - return _Tx(self.function_name) + return _Tx(self.function_name, self.program_id) def delegate(self, account=None, **kw): self._recorder.delegated_fn = self.function_name + self._recorder.delegated_program = self.program_id return {"transaction_id": "at1delegated"} class _Functions: - def __init__(self, recorder): + def __init__(self, recorder, pid): self._recorder = recorder + self._pid = pid def __getattr__(self, fn): def call(*args): - return _BoundCall(self._recorder, fn, args) + return _BoundCall(self._recorder, fn, args, self._pid) return call @@ -132,7 +136,7 @@ class _Program: def __init__(self, recorder, mappings, pid): self._recorder = recorder self._mappings = mappings - self.functions = _Functions(recorder) + self.functions = _Functions(recorder, pid) self.source = _valid_source(pid) def mapping(self, name): @@ -178,7 +182,8 @@ def wait_for_transaction(self, tx_id, **kw): return {"status": "confirmed"} def get_transaction_object(self, tx_id): - return _Tx(self._recorder.delegated_fn) + return _Tx(self._recorder.delegated_fn, + self._recorder.delegated_program or PROGRAM_ID) class _Provider: @@ -196,7 +201,9 @@ class StubAleo: def __init__(self, mappings=None, records=None): self.last_call = None + self.last_program = None self.delegated_fn = None + self.delegated_program = None self.submitted = [] self.waited = [] self.fetched_programs = [] diff --git a/shield-swap-sdk/tests/test_claim.py b/shield-swap-sdk/tests/test_claim.py index 84ff9ab4..0e9a8db9 100644 --- a/shield-swap-sdk/tests/test_claim.py +++ b/shield-swap-sdk/tests/test_claim.py @@ -1,9 +1,12 @@ -"""claim_swap_output() — input order per TS claimSwapOutput.ts: +"""claim_swap_output() — input order per the deployed shield_swap.aleo: [blinding_factor, blinded_address, swap_id, token_in, token_out, - amount_out u128, amount_remaining u128]""" + amount_out u128, amount_remaining u128, signer_proofs]. +Wrapped output/refund tokens dispatch to the router claim variants with +trailing wrapper-proof arrays.""" import pytest from aleo_shield_swap._core import default_merkle_proofs +from aleo_shield_swap._routing import ROUTER_ID from aleo_shield_swap.client import ShieldSwap from aleo_shield_swap.errors import SwapOutputNotFinalizedError from aleo_shield_swap.types import ClaimResult, SwapHandle @@ -12,8 +15,7 @@ SWAP_OUTPUT_TEXT = ( "{ recipient: 3field, caller: 4field, token_in: 1field, token_out: 2field, " - "amount_out: 990000u128, amount_remaining: 0u128, token_in_1: 1field, " - "amount_remaining_1: 0u128, token_in_2: 1field, amount_remaining_2: 0u128 }" + "amount_out: 990000u128, amount_remaining: 0u128 }" ) @@ -58,3 +60,48 @@ def test_claim_incomplete_handle_raises(): ShieldSwap(stub).claim_swap_output(_handle(swap_id=None)) with pytest.raises(ValueError, match="blinding_factor"): ShieldSwap(stub).claim_swap_output(_handle(blinding_factor=None)) + + +def _stub_wrapped(swap_outputs, wrapped): + """Stub with the given token ids marked wrapped on chain.""" + return StubAleo(mappings={ + "pools": {"5field": POOL_TEXT}, + "slots": {"5field": SLOT_TEXT}, + "swap_outputs": swap_outputs, + "from_wrapper_token_id": {t: "9field" for t in wrapped}, + }) + + +def test_claim_wrapped_output_routes_through_router(): + stub = _stub_wrapped({"77field": SWAP_OUTPUT_TEXT}, wrapped={"2field"}) + ShieldSwap(stub).claim_swap_output(_handle()).transact() + fn, args = stub.last_call + assert stub.last_program == ROUTER_ID + assert fn == "claim_to_wrapped_refund_arc20" + assert len(args) == 9 # + amm proofs + wrapper proofs + assert args[7] == default_merkle_proofs() # AMM signer proofs + assert args[8] == default_merkle_proofs() # wrapper proofs + + +def test_claim_wrapped_refund_routes_through_router(): + stub = _stub_wrapped({"77field": SWAP_OUTPUT_TEXT}, wrapped={"1field"}) + ShieldSwap(stub).claim_swap_output(_handle()).transact() + fn, args = stub.last_call + assert (stub.last_program, fn) == (ROUTER_ID, "claim_to_arc20_refund_wrapped") + assert len(args) == 9 + + +def test_claim_both_wrapped_routes_with_two_proof_arrays(): + stub = _stub_wrapped({"77field": SWAP_OUTPUT_TEXT}, wrapped={"1field", "2field"}) + ShieldSwap(stub).claim_swap_output(_handle()).transact() + fn, args = stub.last_call + assert (stub.last_program, fn) == (ROUTER_ID, "claim_to_wrapped_refund_wrapped") + assert len(args) == 10 + assert args[8] == args[9] == default_merkle_proofs() + + +def test_claim_plain_stays_on_core(): + stub = _stub_wrapped({"77field": SWAP_OUTPUT_TEXT}, wrapped=set()) + ShieldSwap(stub).claim_swap_output(_handle()).transact() + fn, _ = stub.last_call + assert (stub.last_program, fn) == ("shield_swap.aleo", "claim_swap_output") diff --git a/shield-swap-sdk/tests/test_gen_context.py b/shield-swap-sdk/tests/test_gen_context.py index 307c7192..64ead9dc 100644 --- a/shield-swap-sdk/tests/test_gen_context.py +++ b/shield-swap-sdk/tests/test_gen_context.py @@ -42,4 +42,6 @@ def test_committed_page_is_current(): def test_page_stays_compact(): - assert len(_render()) < 20_000 # ~5k tokens — cheap context, enforced + # ~5k tokens — cheap context, enforced. Raised 20k → 22k with the + # router-dispatch surface (wrapper_proofs / withdrawal params). + assert len(_render()) < 22_000 diff --git a/shield-swap-sdk/tests/test_liquidity.py b/shield-swap-sdk/tests/test_liquidity.py index c130a622..a1b39940 100644 --- a/shield-swap-sdk/tests/test_liquidity.py +++ b/shield-swap-sdk/tests/test_liquidity.py @@ -180,3 +180,89 @@ def test_mint_journals_position(stub_aleo, tmp_path): assert result.position_token_id assert dex.journal.open_positions() == [ {"position_token_id": result.position_token_id, "pool_key": "5field"}] + + +# ── LP router dispatch (wrapped pool sides) ────────────────────────────────── + +def _wrapped_stub(wrapped): + """Standard LP stub with the given token ids marked wrapped on chain.""" + mappings = { + "pools": {"5field": POOL_TEXT}, + "slots": {"5field": SLOT_TEXT}, + "fee_tiers": {"3000u16": "true"}, + "fee_to_tick_spacing": {"3000u16": "60u32"}, + "used_blinded_addresses": {}, + "from_wrapper_token_id": {t: "9field" for t in wrapped}, + } + return StubAleo(mappings=mappings, + records=[{"record_plaintext": TOKEN0_RECORD}, + {"record_plaintext": POSITION_TEXT}]) + + +def test_mint_wrapped_token0_routes_through_lp_router(): + from aleo_shield_swap._routing import LP_ROUTER_ID + stub = _wrapped_stub({"1field"}) + ShieldSwap(stub).mint(pool_key="5field", tick_lower=-4080, tick_upper=4080, + amount0_desired=10**9, amount1_desired=100, + token0_program="credits.aleo", token1_program="tok1.aleo", + nonce="9field") + fn, args = stub.last_call + assert stub.last_program == LP_ROUTER_ID + assert fn == "mint_from_wrapped_arc20" + assert len(args) == 12 + assert args[1] == TOKEN0_RECORD # underlying record0 + assert args[2] == default_merkle_proofs() # wp0 right after record0 + assert args[3] == TOKEN0_RECORD # plain record1 + assert args[4] == SIGNER and args[5] == SIGNER # recipient, withdrawal + assert "shield_swap_lp_router.aleo" in stub.registered_programs + + +def test_mint_both_wrapped_interleaves_proofs(): + stub = _wrapped_stub({"1field", "2field"}) + ShieldSwap(stub).mint(pool_key="5field", tick_lower=-4080, tick_upper=4080, + amount0_desired=10**9, amount1_desired=100, + token0_program="credits.aleo", + token1_program="usdcx.aleo", nonce="9field") + fn, args = stub.last_call + assert fn == "mint_from_wrapped_wrapped" + assert len(args) == 13 + wp = default_merkle_proofs() + assert args[2] == wp and args[4] == wp # wp0 / wp1 after each record + + +def test_increase_wrapped_token1_routes_through_lp_router(): + from aleo_shield_swap._routing import LP_ROUTER_ID + stub = _wrapped_stub({"2field"}) + ShieldSwap(stub).increase_liquidity( + pool_key="5field", amount0_desired=10**9, amount1_desired=100, + token0_program="tok0.aleo", token1_program="usdcx.aleo") + fn, args = stub.last_call + assert (stub.last_program, fn) == (LP_ROUTER_ID, "increase_from_arc20_wrapped") + assert len(args) == 12 + assert args[3] == default_merkle_proofs() # wp1 right after record1 + + +def test_collect_wrapped_sides_append_wrapper_proofs(): + from aleo_shield_swap._routing import LP_ROUTER_ID + stub = _wrapped_stub({"1field"}) + ShieldSwap(stub).collect(pool_key="5field", amount0_requested=7, + amount1_requested=8) + fn, args = stub.last_call + assert (stub.last_program, fn) == (LP_ROUTER_ID, "collect_to_wrapped_arc20") + assert len(args) == 8 # + trailing wp0 + + stub = _wrapped_stub({"1field", "2field"}) + ShieldSwap(stub).collect(pool_key="5field", amount0_requested=7, + amount1_requested=8) + fn, args = stub.last_call + assert fn == "collect_to_wrapped_wrapped" + assert len(args) == 9 # + wp0 + wp1 + + +def test_decrease_and_burn_always_direct(): + stub = _wrapped_stub({"1field", "2field"}) + dex = ShieldSwap(stub) + dex.decrease_liquidity(pool_key="5field", liquidity_to_remove=500) + assert stub.last_program == "shield_swap.aleo" + dex.burn(pool_key="5field") + assert stub.last_program == "shield_swap.aleo" diff --git a/shield-swap-sdk/tests/test_routing.py b/shield-swap-sdk/tests/test_routing.py new file mode 100644 index 00000000..b2980457 --- /dev/null +++ b/shield-swap-sdk/tests/test_routing.py @@ -0,0 +1,37 @@ +"""Pure route table — program/function per token shape (guide §6).""" +from aleo_shield_swap._routing import ( + LP_ROUTER_ID, + ROUTER_ID, + claim_route, + collect_route, + increase_route, + mint_route, + swap_route, +) + +CORE = "shield_swap.aleo" + + +def test_swap_route(): + assert swap_route(False) == (CORE, "swap") + assert swap_route(True) == (ROUTER_ID, "swap_from_wrapped") + + +def test_claim_route_covers_all_shapes(): + assert claim_route(False, False) == (CORE, "claim_swap_output") + assert claim_route(True, False) == (ROUTER_ID, "claim_to_wrapped_refund_arc20") + assert claim_route(False, True) == (ROUTER_ID, "claim_to_arc20_refund_wrapped") + assert claim_route(True, True) == (ROUTER_ID, "claim_to_wrapped_refund_wrapped") + + +def test_lp_routes(): + assert mint_route(False, False) == (CORE, "mint") + assert mint_route(True, False) == (LP_ROUTER_ID, "mint_from_wrapped_arc20") + assert mint_route(False, True) == (LP_ROUTER_ID, "mint_from_arc20_wrapped") + assert mint_route(True, True) == (LP_ROUTER_ID, "mint_from_wrapped_wrapped") + assert increase_route(True, False) == (LP_ROUTER_ID, "increase_from_wrapped_arc20") + assert increase_route(False, True) == (LP_ROUTER_ID, "increase_from_arc20_wrapped") + assert increase_route(False, False) == (CORE, "increase_liquidity") + assert collect_route(False, True) == (LP_ROUTER_ID, "collect_to_arc20_wrapped") + assert collect_route(True, True) == (LP_ROUTER_ID, "collect_to_wrapped_wrapped") + assert collect_route(False, False) == (CORE, "collect") diff --git a/shield-swap-sdk/tests/test_swap.py b/shield-swap-sdk/tests/test_swap.py index c2646d0b..2ac7dba4 100644 --- a/shield-swap-sdk/tests/test_swap.py +++ b/shield-swap-sdk/tests/test_swap.py @@ -93,3 +93,45 @@ def test_swap_no_covering_record_raises(): ) with pytest.raises(InsufficientRecordsError): _swap_call(stub) + + +def _wrapped_stub(records=None): + """token 1field is wrapped (maps to underlying 9field on chain).""" + return StubAleo( + mappings={ + "pools": {"5field": POOL_TEXT}, + "slots": {"5field": SLOT_TEXT}, + "used_blinded_addresses": {}, + "from_wrapper_token_id": {"1field": "9field"}, + }, + records=records, + ) + + +def test_swap_wrapped_input_routes_through_router(): + from aleo_shield_swap._routing import ROUTER_ID + stub = _wrapped_stub() + _swap_call(stub, token_in_program="credits.aleo") + fn, args = stub.last_call + assert stub.last_program == ROUTER_ID + assert fn == "swap_from_wrapped" + assert len(args) == 13 + assert args[0] == RECORD_TEXT # UNDERLYING record + assert args[1].startswith("[{ siblings: [0field") # wrapper proofs + assert args[2] == BLINDING_FACTOR_0 # core order follows + # router + underlying registered with the prover + assert "shield_swap_router.aleo" in stub.registered_programs + assert "credits.aleo" not in stub.registered_programs # credits is preloaded + assert "shield_swap.aleo" in stub.registered_programs + + +def test_routed_swap_rejects_zero_min_out(): + stub = _wrapped_stub() + with pytest.raises(ValueError, match="amount_out_min > 0"): + _swap_call(stub, token_in_program="credits.aleo", + expected_out=0, slippage_bps=10_000) + + +def test_plain_swap_stays_on_core(stub_aleo): + _swap_call(stub_aleo) + assert stub_aleo.last_program == "shield_swap.aleo" From 755e086dc1662fcc691a9c78586e0784a911298c Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 11:15:09 -0500 Subject: [PATCH 08/23] feat(shield-swap): mirror new-stack verbs and routing in async client --- .../python/aleo_shield_swap/async_client.py | 92 ++++++++++++++++--- shield-swap-sdk/tests/test_async_client.py | 69 +++++++++++--- 2 files changed, 138 insertions(+), 23 deletions(-) diff --git a/shield-swap-sdk/python/aleo_shield_swap/async_client.py b/shield-swap-sdk/python/aleo_shield_swap/async_client.py index f1c750d1..9f9541bb 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/async_client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/async_client.py @@ -12,6 +12,7 @@ from . import _generated as g from ._calls import extract_tx_id, root_outputs from ._core import ( + default_merkle_proofs, find_position_plaintext, normalize_mapping_value, generate_swap_nonce, @@ -21,7 +22,9 @@ register_program_sources, resolve_swap_params, ) +from ._routing import claim_route, swap_route from .api import AsyncApiClient, DEFAULT_API_URL +from .tick_math import int_to_u256_plaintext from .derivations import ( BlindedIdentity, derive_blinded_address, @@ -83,6 +86,9 @@ def __init__(self, aleo: Any, *, program: str = g.PROGRAM_ID, self._aleo = aleo self.program = program self.api = AsyncApiClient(api_url) + # allow_token relationships are immutable — cache probes for the + # client's lifetime. + self._wrapped_cache: dict[str, bool] = {} def __repr__(self) -> str: return f"AsyncShieldSwap(program={self.program!r}, api={self.api.base_url!r})" @@ -186,14 +192,47 @@ async def _ensure(self, token_programs: list, imports=None) -> None: stack.extend(program_imports(sources[pid])) register_program_sources(self._aleo, sources) - async def _token_program(self, token_id: str) -> str: + async def _is_wrapped(self, token_id: str) -> bool: + """True when the AMM registers *token_id* as a wrapper (chain probe + of ``from_wrapper_token_id``, cached; transport errors propagate — + see the sync client).""" + tid = str(token_id) + if tid not in self._wrapped_cache: + prog = await self._aleo.programs.get(self.program) + raw = await prog.mapping("from_wrapper_token_id").get(tid) + self._wrapped_cache[tid] = normalize_mapping_value(raw) is not None + return self._wrapped_cache[tid] + + async def _registry_row(self, token_id: str) -> Any: for tok in await self.api.get_tokens(): - if tok.address == token_id and tok.wrapper_program: - return tok.wrapper_program + if tok.address == token_id: + return tok + return None + + async def _token_program(self, token_id: str) -> str: + """Program holding the records that FUND a token — the underlying + program for wrapped assets, the ARC-20 program itself for plain.""" + tok = await self._registry_row(token_id) + prog = tok and (getattr(tok, "underlying_program", None) + or getattr(tok, "amm_token_program", None) + or getattr(tok, "wrapper_program", None)) + if prog: + return prog raise ValueError( - f"Cannot resolve the wrapper program for {token_id} — pass " + f"Cannot resolve the record program for {token_id} — pass " "token_in_program= (or token_record=) explicitly.") + async def _amm_token_program(self, token_id: str) -> Optional[str]: + """Wrapper program the AMM stores balances in (routed calls' + dynamic-dispatch callee). Best-effort — None when the registry + has no row or is unreachable; routing never depends on this.""" + try: + tok = await self._registry_row(token_id) + except Exception: + return None + return tok and (getattr(tok, "amm_token_program", None) + or getattr(tok, "wrapper_program", None)) + def _account(self, account: Any = None) -> Any: acct = account if account is not None else self._aleo.default_account if acct is None: @@ -253,6 +292,7 @@ async def swap(self, *, pool_key: str, token_in_id: str, amount_in: int, nonce: Optional[int] = None, token_in_program: Optional[str] = None, token_record: Optional[str] = None, + wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None) -> AsyncDexCall[SwapHandle]: acct = self._account(account) @@ -275,18 +315,32 @@ async def swap(self, *, pool_key: str, token_in_id: str, amount_in: int, token_programs = [program] else: token_programs = [token_in_program] if token_in_program else [] + + route = swap_route(await self._is_wrapped(token_in_id)) + if route.program != self.program: + token_programs.append(route.program) + wrapper = await self._amm_token_program(token_in_id) + if wrapper: + token_programs.append(wrapper) await self._ensure(token_programs, imports) inputs = [ record, identity.blinding_factor, identity.blinded_address, pool_key, resolved.zero_for_one, f"{amount_in}u128", f"{resolved.amount_out_min}u128", - f"{resolved.sqrt_price_limit}u128", + int_to_u256_plaintext(resolved.sqrt_price_limit), f"{swap_nonce}u64", f"{deadline}u32", pool.token0, pool.token1, ] - prog = await self._aleo.programs.get(self.program) - bound = prog.functions.swap(*inputs) + if route.program != self.program: + if resolved.amount_out_min <= 0: + raise ValueError( + "routed swaps require amount_out_min > 0 — pass " + "expected_out or a slippage below 100%") + inputs = [record, wrapper_proofs or default_merkle_proofs(), + *inputs[1:]] + prog = await self._aleo.programs.get(route.program) + bound = getattr(prog.functions, route.function)(*inputs) def build_result(tx_id: str, outputs: list[Any]) -> SwapHandle: swap_id = next((o for o in outputs @@ -302,6 +356,7 @@ def build_result(tx_id: str, outputs: list[Any]) -> SwapHandle: return AsyncDexCall(self._aleo, bound, build_result) async def claim_swap_output(self, handle: SwapHandle, *, + wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None) -> AsyncDexCall[ClaimResult]: self._account(account) @@ -312,12 +367,27 @@ async def claim_swap_output(self, handle: SwapHandle, *, raise ValueError("Claims need handle.blinding_factor and " "handle.blinded_address (set by swap()).") out = await self.get_swap_output(handle.swap_id) - await self._ensure([], imports) + w_out = await self._is_wrapped(str(out.token_out)) + w_in = await self._is_wrapped(str(out.token_in)) + route = claim_route(w_out, w_in) + token_programs = [route.program] if route.program != self.program else [] + for token_id, wrapped in ((out.token_in, w_in), (out.token_out, w_out)): + if wrapped: + wrapper = await self._amm_token_program(str(token_id)) + if wrapper: + token_programs.append(wrapper) + await self._ensure(token_programs, imports) inputs = [handle.blinding_factor, handle.blinded_address, handle.swap_id, out.token_in, out.token_out, - f"{out.amount_out}u128", f"{out.amount_remaining}u128"] - prog = await self._aleo.programs.get(self.program) - bound = prog.functions.claim_swap_output(*inputs) + f"{out.amount_out}u128", f"{out.amount_remaining}u128", + default_merkle_proofs()] + wp = wrapper_proofs or default_merkle_proofs() + if w_out and w_in: + inputs += [wp, wp] # wp for the output, then the refund + elif w_out or w_in: + inputs += [wp] + prog = await self._aleo.programs.get(route.program) + bound = getattr(prog.functions, route.function)(*inputs) return AsyncDexCall(self._aleo, bound, lambda tx_id, _o: ClaimResult(tx_id, out.amount_out, out.amount_remaining)) diff --git a/shield-swap-sdk/tests/test_async_client.py b/shield-swap-sdk/tests/test_async_client.py index 960accec..65de8b35 100644 --- a/shield-swap-sdk/tests/test_async_client.py +++ b/shield-swap-sdk/tests/test_async_client.py @@ -4,7 +4,7 @@ from aleo_shield_swap.async_client import AsyncShieldSwap from aleo_shield_swap.errors import SwapOutputNotFinalizedError -from aleo_shield_swap.tick_math import MIN_SQRT_PRICE +from aleo_shield_swap.tick_math import MIN_SQRT_RATIO_X128, int_to_u256_plaintext from .conftest import ( BLINDED_ADDRESS_0, @@ -35,8 +35,9 @@ class _Tx: id = "at1asynctx" raw = object() - def __init__(self, fn): + def __init__(self, fn, pid=PROGRAM_ID): self._fn = fn + self._pid = pid @property def outputs(self): @@ -45,46 +46,49 @@ def outputs(self): def decoded(self): return [{"program": "tok.aleo", "function": "transfer", "outputs": [{"value": "999field"}]}, - {"program": PROGRAM_ID, "function": self._fn, + {"program": self._pid, "function": self._fn, "outputs": [{"value": "88field"}]}] def transitions(self): return [_StubTransition("tok.aleo", "transfer", ["999field"]), - _StubTransition(PROGRAM_ID, self._fn, ["88field"])] + _StubTransition(self._pid, self._fn, ["88field"])] class _AsyncBoundCall: - def __init__(self, recorder, fn, args): - self.program_id = PROGRAM_ID + def __init__(self, recorder, fn, args, pid=PROGRAM_ID): + self.program_id = pid self.function_name = fn self._recorder = recorder recorder.last_call = (fn, list(args)) + recorder.last_program = pid def simulate(self, account=None): return "simulated" async def build_transaction(self, account=None, **kw): - return _Tx(self.function_name) + return _Tx(self.function_name, self.program_id) async def delegate(self, account=None, **kw): self._recorder.delegated_fn = self.function_name + self._recorder.delegated_program = self.program_id return {"transaction_id": "at1delegated"} class _AsyncFunctions: - def __init__(self, recorder): + def __init__(self, recorder, pid): self._recorder = recorder + self._pid = pid def __getattr__(self, fn): def call(*args): - return _AsyncBoundCall(self._recorder, fn, args) + return _AsyncBoundCall(self._recorder, fn, args, self._pid) return call class _AsyncProgram: def __init__(self, recorder, mappings, pid): self._mappings = mappings - self.functions = _AsyncFunctions(recorder) + self.functions = _AsyncFunctions(recorder, pid) self.source = _valid_source(pid) def mapping(self, name): @@ -115,7 +119,8 @@ async def wait_for_transaction(self, tx_id, **kw): self._recorder.waited.append(tx_id) async def get_transaction_object(self, tx_id): - return _Tx(self._recorder.delegated_fn) + return _Tx(self._recorder.delegated_fn, + self._recorder.delegated_program or PROGRAM_ID) class _AsyncProvider: @@ -131,7 +136,9 @@ class AsyncStubAleo: def __init__(self, mappings=None, records=None): self.last_call = None + self.last_program = None self.delegated_fn = None + self.delegated_program = None self.submitted = [] self.waited = [] self.registered_programs = [] @@ -172,7 +179,7 @@ async def test_async_swap_inputs_and_handle(astub): assert fn == "swap" and len(args) == 12 assert args[0] == RECORD_TEXT assert args[1] == BLINDING_FACTOR_0 and args[2] == BLINDED_ADDRESS_0 - assert args[7] == f"{MIN_SQRT_PRICE}u128" + assert args[7] == int_to_u256_plaintext(MIN_SQRT_RATIO_X128) assert args[9] == "1100u32" handle = await call.transact() @@ -190,3 +197,41 @@ async def test_async_delegate_waits_and_recovers(astub): assert handle.transaction_id == "at1delegated" assert handle.swap_id == "88field" assert astub.waited == ["at1delegated"] + + +async def test_async_swap_wrapped_routes_through_router(): + from aleo_shield_swap._routing import ROUTER_ID + astub = AsyncStubAleo(mappings={ + "pools": {"5field": POOL_TEXT}, + "slots": {"5field": SLOT_TEXT}, + "used_blinded_addresses": {}, + "from_wrapper_token_id": {"1field": "9field"}, + }) + dex = AsyncShieldSwap(astub) + await dex.swap(pool_key="5field", token_in_id="1field", amount_in=10**9, + expected_out=1_000_000, token_in_program="credits.aleo") + fn, args = astub.last_call + assert (astub.last_program, fn) == (ROUTER_ID, "swap_from_wrapped") + assert len(args) == 13 + assert args[1].startswith("[{ siblings: [0field") + + +async def test_async_claim_wrapped_output_routes_through_router(): + from aleo_shield_swap._routing import ROUTER_ID + from aleo_shield_swap.types import SwapHandle + out_text = ("{ recipient: 3field, caller: 4field, token_in: 1field, " + "token_out: 2field, amount_out: 990000u128, amount_remaining: 0u128 }") + astub = AsyncStubAleo(mappings={ + "pools": {"5field": POOL_TEXT}, + "slots": {"5field": SLOT_TEXT}, + "swap_outputs": {"77field": out_text}, + "from_wrapper_token_id": {"2field": "9field"}, + }) + handle = SwapHandle(swap_id="77field", blinding_factor="11field", + blinded_address="aleo1blinded", token_in_id="1field", + token_out_id="2field", pool_key="5field", amount_in=1, + transaction_id="at1req", program="shield_swap.aleo") + await AsyncShieldSwap(astub).claim_swap_output(handle) + fn, args = astub.last_call + assert (astub.last_program, fn) == (ROUTER_ID, "claim_to_wrapped_refund_arc20") + assert len(args) == 9 From 94fb73c376dfddfa593d8d45b59a1e9e0a426dd9 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 11:19:47 -0500 Subject: [PATCH 09/23] feat(shield-swap): cut API layer over to the staging Shield Swap API --- shield-swap-sdk/AGENTS.md | 6 +- shield-swap-sdk/codegen/amm_api.openapi.json | 3768 +++++++++++------ shield-swap-sdk/codegen/regen-openapi.sh | 4 +- .../python/aleo_shield_swap/AGENTS.md | 6 +- .../python/aleo_shield_swap/_api_models.py | 274 +- .../python/aleo_shield_swap/api.py | 29 +- .../python/aleo_shield_swap/async_client.py | 6 +- .../python/aleo_shield_swap/client.py | 6 +- .../python/aleo_shield_swap/lifecycle.py | 8 +- .../tests/fixtures/pools_response.json | 328 +- shield-swap-sdk/tests/test_api_client.py | 25 +- shield-swap-sdk/tests/test_api_models.py | 6 +- shield-swap-sdk/tests/test_lifecycle.py | 5 +- 13 files changed, 3188 insertions(+), 1283 deletions(-) diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index 7b039ec9..7e4ded8e 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -229,7 +229,11 @@ Whether this authenticated account has redeemed an invite code. ### `api.redeem_code(self, code: 'str') -> 'models.AccessRedeemResponse'` -Redeem an invite code; adopts the fresh token the API returns. +Redeem an invite code. + +The staging API no longer returns a session token here (sessions +moved to the ``/auth/*`` endpoints) — re-authenticate after +redeeming. A token is still adopted if the API resurrects one. ### `api.request_airdrop(self, address: 'str') -> 'models.AirdropStartResult'` diff --git a/shield-swap-sdk/codegen/amm_api.openapi.json b/shield-swap-sdk/codegen/amm_api.openapi.json index b5039ddd..f6a68313 100644 --- a/shield-swap-sdk/codegen/amm_api.openapi.json +++ b/shield-swap-sdk/codegen/amm_api.openapi.json @@ -1,10 +1,10 @@ { "openapi": "3.1.0", "info": { - "title": "Aleo AMM API", - "description": "REST API for the Aleo concentrated-liquidity AMM. Serves indexed pool / position / swap data, routing, swap quotes, swap-settlement status, and on-chain input schemas for building transactions against the deployment-configured shield_swap program and `token_registry.aleo`.\n\n## Numeric wire format\n\nExact financial values are JSON strings, not JSON numbers. Unsigned decimal inputs use ASCII digits and an optional `.` fraction, for example `\"1234.50\"`; base-unit integers use ASCII digits only. Grouping separators, localized decimal commas, signs, exponent notation, whitespace, Unicode digits, and redundant leading zeros are not accepted for those inputs. Signed response metrics may include a leading `-`. Clients should localize only for display and convert user input back to this canonical form before sending it.\n\n## Authentication\n\nExcept for `/health`, `/metrics`, `/auth/*`, `/compliance*`, `GET /tokens*`, and the pool metadata reads (`GET /pools`, `GET /pools/stats`, `GET /pools/{key}`), every endpoint requires `Authorization: Bearer ` from an invited wallet. The credential is either a session JWT from `/auth/verify` (24h) or a long-lived API token (`ss_\u2026`) minted at `POST /api-tokens`. API tokens cover the data and trading surface; token management, code redemption, and admin endpoints accept JWTs only.\n\n## Real-time WebSocket feed\n\nLive updates are pushed over a WebSocket served by the **indexer** service at `GET /ws` (a WebSocket upgrade \u2014 a separate service from this REST API, not one of the paths below). Clients manage subscriptions with JSON frames:\n\n```json\n{\"action\": \"authenticate\", \"token\": \"\"}\n{\"action\": \"subscribe\", \"room\": \"trades:\"}\n{\"action\": \"unsubscribe\", \"room\": \"trades:\"}\n```\n\nThe authentication frame must be first. Balance rooms are restricted to the JWT subject.\n\nRooms:\n- `pool_launches` \u2014 newly created pools\n- `pool_stats:` \u2014 price & liquidity updates\n- `ohlcv:` \u2014 candle updates\n- `trades:` \u2014 swaps / mints / burns\n- `balances:
` \u2014 balance-change hints for an address\n\nEach pushed message is `{\"type\": , \"data\": { \u2026 }}`, where `type` is one of `PoolLaunch`, `PoolStats`, `Ohlcv`, `Trade`, `BalanceChange`. Financial fields use the same exact string format.", + "title": "Shield Swap API", + "description": "Shield Swap REST API for pools, positions, swaps, routes, quotes, settlement status, and transaction input schemas. Transactions target the configured shield_swap program and `token_registry.aleo`.\n\n## Numeric wire format\n\nExact financial values are JSON strings, not JSON numbers. Unsigned decimal inputs use ASCII digits and an optional `.` fraction, for example `\"1234.50\"`; base-unit integers use ASCII digits only. Grouping separators, localized decimal commas, signs, exponent notation, whitespace, Unicode digits, and redundant leading zeros are not accepted for those inputs. Signed response metrics may include a leading `-`. Clients should localize only for display and convert user input back to this canonical form before sending it.\n\n## Authentication\n\nMost endpoints require credentials from an invited wallet. Public routes are `/health`, `/ready`, `/metrics`, `/auth/*`, `/protocol/state`, `/compliance*`, `GET /tokens*`, `GET /pools`, `GET /pools/stats`, and `GET /pools/{key}`.\n\nBrowsers use HTTP-only session cookies issued by `/auth/verify`. Access sessions last 15 minutes and are renewed through `/auth/refresh`. Programmatic clients use a long-lived token from `POST /api-tokens` as `Authorization: Bearer ss_\u2026`. API tokens cover data and trading routes and can request WebSocket tickets. Token management, code redemption, and admin routes require a browser session.\n\n## WebSocket feed\n\nThe live feed runs on the separate websocket gateway at `GET /ws`.\n\n1. Request a ticket from `GET /auth/ws-ticket` using a browser session or API token.\n2. Open the socket and send the `authenticate` frame within 5 seconds.\n3. Subscribe to each required room.\n4. Before the 60-second ticket expires, request a new ticket and send another `authenticate` frame.\n\nThe socket accepts WebSocket tickets only. Session JWTs and API tokens are rejected.\n\n```json\n{\"action\": \"authenticate\", \"token\": \"\"}\n{\"action\": \"subscribe\", \"room\": \"trades:\"}\n{\"action\": \"unsubscribe\", \"room\": \"\"}\n{\"action\": \"synchronize\"}\n```\n\nAfter reconnecting, resend subscriptions and then send `synchronize`. The gateway replies `{\"control\": \"synchronized\"}` when those subscriptions are active. Refetch any REST data that depends on the stream after receiving the reply.\n\nEach connection allows 32 rooms, 240 client frames per minute, and 2 KB per frame. A client may subscribe only to the balance room for its ticket subject.\n\nRooms:\n- `pool_launches` \u2014 newly created pools\n- `pool_stats:` \u2014 price & liquidity updates\n- `ohlcv:` \u2014 candle updates\n- `trades:` \u2014 swaps / mints / burns\n- `balances:
` \u2014 balance-change hints for an address\n\n- `protocol_config` \u2014 revisioned protocol-configuration invalidations\n\nServer messages are either events (`{\"type\": , \"data\": { \u2026 }}`) or control messages (`{\"control\": }`). Event types are `PoolLaunch`, `PoolStats`, `Ohlcv`, `Trade`, `BalanceChange`, and `ProtocolConfigChanged`. Its data contains `revision`, `observed_block`, and the changed `scope`/`key` pairs. Financial fields use the numeric format described above.\n\nTreat `ProtocolConfigChanged` as an invalidation, not as the new configuration. Fetch `GET /protocol/state?minimum_revision=`; retry a `503 protocol_revision_pending` after the advertised `Retry-After`; and discard or requote any `/route` result whose `protocol_revision` is older. Subscribe to `pool_stats:` separately when live price and liquidity updates matter.\n\nThe gateway currently sends `synchronized` and `resync_required` controls. `resync_required` means the stream may have missed updates, so refetch affected data over REST. Ignore unknown control values.\n\nEvent delivery is at most once. Treat REST as the source of truth. During a deployment the gateway may close the socket with code 1012 (service restart); reconnect and restore the subscriptions.", "contact": { - "name": "Aleo AMM" + "name": "Shield Swap" }, "license": { "name": "" @@ -350,13 +350,118 @@ ] } }, + "/admin/sessions/revoke": { + "post": { + "tags": [ + "auth" + ], + "operationId": "admin_revoke_sessions", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RevokeSessionsRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All of the wallet's sessions revoked", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RevokeSessionsResponseDoc" + } + } + } + }, + "400": { + "description": "Malformed JSON or invalid address", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "401": { + "description": "Authentication required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "403": { + "description": "Administrator authorization required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "413": { + "description": "Request body too large", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "415": { + "description": "Content-Type must be application/json", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "422": { + "description": "Request body does not match schema", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, "/airdrop": { "post": { "tags": [ "airdrop" ], "summary": "POST /airdrop", - "description": "Delivers ~$10 worth each of wALEO, wUSDCx, and wETH to the given address as\nprivate records via `transfer_public_to_private`, spent from the\ntreasury's wrapped public balance in each program. One claim per\nrecipient address per 15 minutes (429 after that).\n\nProving each token takes ~15-30s, so this returns immediately with\n`status: \"running\"` + a `job_id`. The transfers run in a detached worker\n(capped concurrency, per-token timeout); poll `GET /airdrop/{job_id}` until\n`status == \"complete\"` to read per-token results.\n\nRequired env: `DEPLOYER_PRIVATE_KEY` (the treasury key whose public wrapped\nbalance funds every airdrop; `AIRDROP_PRIVATE_KEY` honored as a fallback),\n`RPC_URLS` (first entry used).", + "description": "Delivers ~$10 worth each of ALEO, USDCx, and ETH to the given address as\nprivate records via `transfer_public_to_private`, spent from the\ntreasury's public balance in each target's underlying program. One claim\nper recipient address per 15 minutes (429 after that).\n\nProving each token takes ~15-30s, so this returns immediately with\n`status: \"running\"` + a `job_id`. The transfers run in a detached worker\n(capped concurrency, per-token timeout); poll `GET /airdrop/{job_id}` until\n`status == \"complete\"` to read per-token results.\n\nRequired env: `DEPLOYER_PRIVATE_KEY` (the treasury key whose public balances\nfund every airdrop; `AIRDROP_PRIVATE_KEY` honored as a fallback),\n`RPC_URLS` (first entry used).", "operationId": "airdrop", "requestBody": { "content": { @@ -870,35 +975,25 @@ } } }, - "/auth/verify": { + "/auth/logout": { "post": { "tags": [ "auth" ], - "operationId": "verify", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VerifyRequestDoc" - } - } - }, - "required": true - }, + "operationId": "logout", "responses": { "200": { - "description": "JWT bearer token", + "description": "Presented refresh-token family ended", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthTokenResponseDoc" + "$ref": "#/components/schemas/LogoutResponseDoc" } } } }, "400": { - "description": "Malformed JSON", + "description": "Invalid session binding", "content": { "application/json": { "schema": { @@ -907,8 +1002,8 @@ } } }, - "401": { - "description": "Invalid / expired signature", + "403": { + "description": "Missing or invalid CSRF token", "content": { "application/json": { "schema": { @@ -917,8 +1012,8 @@ } } }, - "413": { - "description": "Request body too large", + "409": { + "description": "Session identity changed", "content": { "application/json": { "schema": { @@ -927,8 +1022,8 @@ } } }, - "415": { - "description": "JSON content type required", + "429": { + "description": "Rate limit exceeded", "content": { "application/json": { "schema": { @@ -937,8 +1032,8 @@ } } }, - "422": { - "description": "Request body schema mismatch", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -946,9 +1041,29 @@ } } } + } + } + } + }, + "/auth/logout-all": { + "post": { + "tags": [ + "auth" + ], + "operationId": "logout_all", + "responses": { + "200": { + "description": "Every wallet session revoked", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LogoutAllResponseDoc" + } + } + } }, - "429": { - "description": "Rate limit exceeded", + "401": { + "description": "No valid session", "content": { "application/json": { "schema": { @@ -957,8 +1072,8 @@ } } }, - "500": { - "description": "Internal error", + "403": { + "description": "Missing or invalid CSRF token", "content": { "application/json": { "schema": { @@ -966,29 +1081,19 @@ } } } - } - } - } - }, - "/balances": { - "get": { - "tags": [ - "balances" - ], - "operationId": "list_balances", - "responses": { - "200": { - "description": "Per-token on-chain authorized balances", + }, + "409": { + "description": "Session identity changed", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BalanceListResponseDoc" + "$ref": "#/components/schemas/ErrorResponseDoc" } } } }, - "401": { - "description": "Authentication required", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -997,8 +1102,8 @@ } } }, - "500": { - "description": "Internal database or RPC error", + "503": { + "description": "Session revocation state unavailable", "content": { "application/json": { "schema": { @@ -1007,33 +1112,28 @@ } } } - }, - "security": [ - { - "bearer_auth": [] - } - ] + } } }, - "/compliance": { - "get": { + "/auth/refresh": { + "post": { "tags": [ - "compliance" + "auth" ], - "operationId": "get_config", + "operationId": "refresh", "responses": { "200": { - "description": "Global pause / pool-creation gating state", + "description": "Refresh token rotated; fresh access + refresh cookies set", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GlobalConfigResponseDoc" + "$ref": "#/components/schemas/SessionResponseDoc" } } } }, - "500": { - "description": "Internal error", + "401": { + "description": "Missing, invalid, expired, or revoked refresh token", "content": { "application/json": { "schema": { @@ -1041,43 +1141,23 @@ } } } - } - } - } - }, - "/compliance/pairs/{token0}/{token1}": { - "get": { - "tags": [ - "compliance" - ], - "operationId": "get_pair_status", - "parameters": [ - { - "name": "token0", - "in": "path", - "description": "First token id (Aleo field)", - "required": true, - "schema": { - "type": "string" - } }, - { - "name": "token1", - "in": "path", - "description": "Second token id (Aleo field)", - "required": true, - "schema": { - "type": "string" + "409": { + "description": "Session identity changed or a concurrent refresh already rotated this token", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } } - } - ], - "responses": { - "200": { - "description": "Pause state for a token pair (order-independent)", + }, + "429": { + "description": "Rate limit exceeded", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PairComplianceResponseDoc" + "$ref": "#/components/schemas/ErrorResponseDoc" } } } @@ -1095,36 +1175,25 @@ } } }, - "/compliance/tokens/{token_id}": { + "/auth/session": { "get": { "tags": [ - "compliance" - ], - "operationId": "get_token_status", - "parameters": [ - { - "name": "token_id", - "in": "path", - "description": "On-chain token id (Aleo field)", - "required": true, - "schema": { - "type": "string" - } - } + "auth" ], + "operationId": "session", "responses": { "200": { - "description": "Allowlist / pause state for a single token", + "description": "Current session identity + access expiry; re-seeds the CSRF token", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TokenComplianceResponseDoc" + "$ref": "#/components/schemas/SessionResponseDoc" } } } }, - "500": { - "description": "Internal error", + "401": { + "description": "No valid session", "content": { "application/json": { "schema": { @@ -1132,49 +1201,9 @@ } } } - } - } - } - }, - "/debug/pool": { - "get": { - "tags": [ - "debug" - ], - "operationId": "pool_debug", - "parameters": [ - { - "name": "pool_key", - "in": "query", - "description": "Pool key", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "ticks", - "in": "query", - "description": "Comma-separated list of tick values to verify", - "required": false, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Raw on-chain pool slot + optional tick statuses", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PoolDebugResponseDoc" - } - } - } }, - "400": { - "description": "Invalid query parameters", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -1183,8 +1212,8 @@ } } }, - "500": { - "description": "Internal RPC error", + "503": { + "description": "Session revocation state unavailable", "content": { "application/json": { "schema": { @@ -1193,33 +1222,28 @@ } } } - }, - "security": [ - { - "bearer_auth": [] - } - ] + } } }, - "/fee-tiers": { + "/auth/sessions": { "get": { "tags": [ - "protocol" + "auth" ], - "operationId": "list_fee_tiers", + "operationId": "list_sessions", "responses": { "200": { - "description": "Registered fee tiers", + "description": "Active sessions for the signed-in wallet", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FeeTierListResponseDoc" + "$ref": "#/components/schemas/ActiveSessionsResponseDoc" } } } }, - "500": { - "description": "Internal error", + "401": { + "description": "Missing or invalid session", "content": { "application/json": { "schema": { @@ -1227,56 +1251,19 @@ } } } - } - }, - "security": [ - { - "bearer_auth": [] - } - ] - } - }, - "/pools": { - "get": { - "tags": [ - "pools" - ], - "operationId": "list_pools", - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "Page size (1-100)", - "required": false, - "schema": { - "type": "integer", - "format": "int64" - } }, - { - "name": "offset", - "in": "query", - "description": "Page offset", - "required": false, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "Paginated pools with token metadata", + "429": { + "description": "Session management rate limit exceeded", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PoolListResponseDoc" + "$ref": "#/components/schemas/ErrorResponseDoc" } } } }, - "400": { - "description": "Invalid query parameters", + "500": { + "description": "Session lookup failed", "content": { "application/json": { "schema": { @@ -1285,8 +1272,8 @@ } } }, - "500": { - "description": "Internal error", + "503": { + "description": "Session validation unavailable", "content": { "application/json": { "schema": { @@ -1298,38 +1285,36 @@ } } }, - "/pools/stats": { - "get": { + "/auth/sessions/{session_id}/revoke": { + "post": { "tags": [ - "pools" + "auth" ], - "summary": "`GET /pools/stats?keys=key1,key2,\u2026`", - "description": "Batched rolling-24h stats for many pools in one request. Used by the\npools-table page to populate per-row volume / fees / APR without doing\n`N + 1` round-trips. Missing keys are silently dropped from the response\n(they just won't appear in the returned map); the caller treats absence\nas \"no stats yet\" rather than an error.\n\nCap: hard limit of 100 keys per request to avoid run-away DB load.", - "operationId": "get_pool_24h_stats_batch", + "operationId": "revoke_session", "parameters": [ { - "name": "keys", - "in": "query", - "description": "Comma-separated pool keys (max 100)", + "name": "session_id", + "in": "path", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], "responses": { "200": { - "description": "Map of pool key \u2192 24h stats; failed or unknown keys may be omitted", + "description": "Session revoked, or already inactive", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PoolStats24hBatchResponseDoc" + "$ref": "#/components/schemas/RevokeSessionResponseDoc" } } } }, - "400": { - "description": "Empty / too-large keys list", + "401": { + "description": "Missing or invalid session", "content": { "application/json": { "schema": { @@ -1337,40 +1322,19 @@ } } } - } - } - } - }, - "/pools/{key}": { - "get": { - "tags": [ - "pools" - ], - "operationId": "get_pool", - "parameters": [ - { - "name": "key", - "in": "path", - "description": "On-chain pool field key", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Pool state + stats + token metadata", + }, + "403": { + "description": "Missing or mismatched CSRF token", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PoolWithStatsResponseDoc" + "$ref": "#/components/schemas/ErrorResponseDoc" } } } }, - "404": { - "description": "Pool not found", + "429": { + "description": "Session management rate limit exceeded", "content": { "application/json": { "schema": { @@ -1380,7 +1344,17 @@ } }, "500": { - "description": "Internal error", + "description": "Revocation failed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "503": { + "description": "Session validation unavailable", "content": { "application/json": { "schema": { @@ -1392,38 +1366,35 @@ } } }, - "/pools/{key}/initialized-ticks": { - "get": { + "/auth/verify": { + "post": { "tags": [ - "pools" + "auth" ], - "summary": "Returns the full sorted list of *initialized* ticks for the given pool \u2014 every\n`tick_lower` and `tick_upper` across all non-burned positions, deduplicated.", - "description": "Used by the frontend mint flow to compute the correct\n`tick_lower_hint` / `tick_upper_hint` for the AMM's hint-walk asserts.", - "operationId": "get_pool_initialized_ticks", - "parameters": [ - { - "name": "key", - "in": "path", - "description": "Pool key", - "required": true, - "schema": { - "type": "string" + "operationId": "verify", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VerifyRequestDoc" + } } - } - ], + }, + "required": true + }, "responses": { "200": { - "description": "Sorted initialized ticks", + "description": "Session established via httpOnly cookies; body carries the CSRF token", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/InitializedTicksResponseDoc" + "$ref": "#/components/schemas/SessionResponseDoc" } } } }, - "404": { - "description": "Pool not found", + "400": { + "description": "Malformed JSON", "content": { "application/json": { "schema": { @@ -1432,8 +1403,8 @@ } } }, - "500": { - "description": "Internal error", + "401": { + "description": "Invalid / expired signature", "content": { "application/json": { "schema": { @@ -1441,45 +1412,29 @@ } } } - } - }, - "security": [ - { - "bearer_auth": [] - } - ] - } - }, - "/pools/{key}/liquidity-distribution": { - "get": { - "tags": [ - "pools" - ], - "operationId": "get_pool_liquidity_distribution", - "parameters": [ - { - "name": "key", - "in": "path", - "description": "Pool key", - "required": true, - "schema": { - "type": "string" + }, + "409": { + "description": "Session state changed during verification", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } } - } - ], - "responses": { - "200": { - "description": "Initialized tick liquidity deltas", + }, + "413": { + "description": "Request body too large", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LiquidityDistributionResponseDoc" + "$ref": "#/components/schemas/ErrorResponseDoc" } } } }, - "404": { - "description": "Pool not found", + "415": { + "description": "JSON content type required", "content": { "application/json": { "schema": { @@ -1488,8 +1443,8 @@ } } }, - "500": { - "description": "Internal error", + "422": { + "description": "Request body schema mismatch", "content": { "application/json": { "schema": { @@ -1497,74 +1452,9 @@ } } } - } - }, - "security": [ - { - "bearer_auth": [] - } - ] - } - }, - "/pools/{key}/ohlcv": { - "get": { - "tags": [ - "pools" - ], - "operationId": "get_pool_ohlcv", - "parameters": [ - { - "name": "key", - "in": "path", - "description": "Pool key", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "granularity", - "in": "query", - "description": "Candle bucket", - "required": true, - "schema": { - "$ref": "#/components/schemas/GranularityDoc" - } - }, - { - "name": "from", - "in": "query", - "description": "Inclusive unix-second start", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "to", - "in": "query", - "description": "Exclusive unix-second end", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "OHLCV candles for the range", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OhlcvResponseDoc" - } - } - } }, - "400": { - "description": "Invalid granularity", + "429": { + "description": "Rate limit exceeded", "content": { "application/json": { "schema": { @@ -1583,44 +1473,28 @@ } } } - }, - "security": [ - { - "bearer_auth": [] - } - ] + } } }, - "/pools/{key}/stats": { + "/auth/ws-ticket": { "get": { "tags": [ - "pools" - ], - "operationId": "get_pool_24h_stats", - "parameters": [ - { - "name": "key", - "in": "path", - "description": "Pool key", - "required": true, - "schema": { - "type": "string" - } - } + "auth" ], + "operationId": "ws_ticket", "responses": { "200": { - "description": "Rolling 24h price/volume summary", + "description": "Short-lived (60s) JWT the WebSocket client presents in its authenticate frame", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PoolStats24hResponseDoc" + "$ref": "#/components/schemas/AuthTokenResponseDoc" } } } }, - "404": { - "description": "Pool not found", + "400": { + "description": "Invalid identity binding", "content": { "application/json": { "schema": { @@ -1629,8 +1503,8 @@ } } }, - "500": { - "description": "Internal error", + "401": { + "description": "No valid session or API token", "content": { "application/json": { "schema": { @@ -1638,74 +1512,19 @@ } } } - } - }, - "security": [ - { - "bearer_auth": [] - } - ] - } - }, - "/pools/{key}/trades": { - "get": { - "tags": [ - "pools" - ], - "operationId": "get_pool_trades", - "parameters": [ - { - "name": "key", - "in": "path", - "description": "Pool key", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "Page size (1-100)", - "required": false, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "offset", - "in": "query", - "description": "Page offset", - "required": false, - "schema": { - "type": "integer", - "format": "int64" - } }, - { - "name": "trade_type", - "in": "query", - "description": "Indexed pool trade type filter", - "required": false, - "schema": { - "$ref": "#/components/schemas/PoolTradeFilterDoc" - } - } - ], - "responses": { - "200": { - "description": "Paginated trade history", + "409": { + "description": "Credential identity changed", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PoolTradesResponseDoc" + "$ref": "#/components/schemas/ErrorResponseDoc" } } } }, - "400": { - "description": "Invalid query parameters", + "429": { + "description": "API token rate limit exceeded", "content": { "application/json": { "schema": { @@ -1714,8 +1533,8 @@ } } }, - "404": { - "description": "Pool not found", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -1724,8 +1543,8 @@ } } }, - "500": { - "description": "Internal error", + "503": { + "description": "Session revocation state unavailable", "content": { "application/json": { "schema": { @@ -1734,59 +1553,22 @@ } } } - }, - "security": [ - { - "bearer_auth": [] - } - ] + } } }, - "/positions": { + "/balances": { "get": { "tags": [ - "positions" - ], - "operationId": "list_positions", - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "Page size (1-100)", - "required": false, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "offset", - "in": "query", - "description": "Page offset", - "required": false, - "schema": { - "type": "integer", - "format": "int64" - } - } + "balances" ], + "operationId": "list_balances", "responses": { "200": { - "description": "Paginated LP positions", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PositionListResponseDoc" - } - } - } - }, - "400": { - "description": "Invalid query parameters", + "description": "Per-token on-chain authorized balances", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/BalanceListResponseDoc" } } } @@ -1802,7 +1584,7 @@ } }, "500": { - "description": "Internal error", + "description": "Internal database or RPC error", "content": { "application/json": { "schema": { @@ -1819,46 +1601,25 @@ ] } }, - "/positions/{token_id}": { + "/compliance": { "get": { "tags": [ - "positions" - ], - "operationId": "get_position", - "parameters": [ - { - "name": "token_id", - "in": "path", - "description": "On-chain position NFT token_id", - "required": true, - "schema": { - "type": "string" - } - } + "compliance" ], + "operationId": "get_config", "responses": { "200": { - "description": "Position details", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PositionResponseDoc" - } - } - } - }, - "401": { - "description": "Authentication required", + "description": "Global pause / pool-creation gating state", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/GlobalConfigResponseDoc" } } } }, - "404": { - "description": "Position not found", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -1866,44 +1627,49 @@ } } } - }, - "500": { - "description": "Internal error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } - } - } - }, - "security": [ - { - "bearer_auth": [] } - ] + } } }, - "/referral/admin": { + "/compliance/pairs/{token0}/{token1}": { "get": { "tags": [ - "referral" + "compliance" + ], + "operationId": "get_pair_status", + "parameters": [ + { + "name": "token0", + "in": "path", + "description": "First token id (Aleo field)", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "token1", + "in": "path", + "description": "Second token id (Aleo field)", + "required": true, + "schema": { + "type": "string" + } + } ], - "operationId": "admin_check", "responses": { "200": { - "description": "Wallet administrator status", + "description": "Pause state for a token pair (order-independent)", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ReferralAdminResponseDoc" + "$ref": "#/components/schemas/PairComplianceResponseDoc" } } } }, - "401": { - "description": "Authentication required", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -1911,9 +1677,40 @@ } } } + } + } + } + }, + "/compliance/tokens/{token_id}": { + "get": { + "tags": [ + "compliance" + ], + "operationId": "get_token_status", + "parameters": [ + { + "name": "token_id", + "in": "path", + "description": "On-chain token id (Aleo field)", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Allowlist / pause state for a single token", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenComplianceResponseDoc" + } + } + } }, - "403": { - "description": "Invite access required", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -1922,49 +1719,42 @@ } } } - }, - "security": [ - { - "bearer_auth": [] - } - ] + } } }, - "/referral/codes": { + "/debug/pool": { "get": { "tags": [ - "referral" + "debug" ], - "operationId": "referral_list_codes", + "operationId": "pool_debug", "parameters": [ { - "name": "limit", + "name": "pool_key", "in": "query", - "description": "Page size (1-2000)", - "required": false, + "description": "Pool key", + "required": true, "schema": { - "type": "integer", - "format": "int64" + "type": "string" } }, { - "name": "offset", + "name": "ticks", "in": "query", - "description": "Page offset", + "description": "Comma-separated list of tick values to verify", "required": false, "schema": { - "type": "integer", - "format": "int64" + "type": "string" } } ], "responses": { "200": { - "description": "Referral-code inventory", + "description": "Raw on-chain pool slot + optional tick statuses", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ReferralListResponseDoc" + "$ref": "#/components/schemas/PoolDebugResponseDoc" } } } @@ -1979,8 +1769,8 @@ } } }, - "401": { - "description": "Authentication required", + "500": { + "description": "Internal RPC error", "content": { "application/json": { "schema": { @@ -1988,13 +1778,28 @@ } } } - }, - "403": { - "description": "Administrator authorization required", + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/fee-tiers": { + "get": { + "tags": [ + "protocol" + ], + "operationId": "list_fee_tiers", + "responses": { + "200": { + "description": "Registered fee tiers and current tick-spacing bindings", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/FeeTierListResponseDoc" } } } @@ -2017,35 +1822,47 @@ ] } }, - "/referral/generate": { - "post": { + "/pools": { + "get": { "tags": [ - "referral" + "pools" ], - "operationId": "referral_generate", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReferralGenerateRequest" - } + "operationId": "list_pools", + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "Page size (1-100)", + "required": false, + "schema": { + "type": "integer", + "format": "int64" } }, - "required": true - }, + { + "name": "offset", + "in": "query", + "description": "Page offset", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], "responses": { "200": { - "description": "Generated referral codes", + "description": "Paginated pools with token metadata", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ReferralGenerateResponseDoc" + "$ref": "#/components/schemas/PoolListResponseDoc" } } } }, "400": { - "description": "Malformed JSON request", + "description": "Invalid query parameters", "content": { "application/json": { "schema": { @@ -2054,8 +1871,8 @@ } } }, - "401": { - "description": "Authentication required", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -2063,19 +1880,42 @@ } } } - }, - "403": { - "description": "Administrator authorization required", + } + } + } + }, + "/pools/stats": { + "get": { + "tags": [ + "pools" + ], + "summary": "`GET /pools/stats?keys=key1,key2,\u2026`", + "description": "Batched rolling-24h stats for many pools in one request. Used by the\npools-table page to populate per-row volume / fees / APR without doing\n`N + 1` round-trips. Missing keys are silently dropped from the response\n(they just won't appear in the returned map); the caller treats absence\nas \"no stats yet\" rather than an error.\n\nCap: hard limit of 100 keys per request to avoid run-away DB load.", + "operationId": "get_pool_24h_stats_batch", + "parameters": [ + { + "name": "keys", + "in": "query", + "description": "Comma-separated pool keys (max 100)", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Map of pool key \u2192 24h stats; failed or unknown keys may be omitted", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/PoolStats24hBatchResponseDoc" } } } }, - "413": { - "description": "Request body too large", + "400": { + "description": "Empty / too-large keys list", "content": { "application/json": { "schema": { @@ -2083,19 +1923,40 @@ } } } - }, - "415": { - "description": "Content-Type must be application/json", + } + } + } + }, + "/pools/{key}": { + "get": { + "tags": [ + "pools" + ], + "operationId": "get_pool", + "parameters": [ + { + "name": "key", + "in": "path", + "description": "On-chain pool field key", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Pool state + stats + token metadata", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/PoolWithStatsResponseDoc" } } } }, - "422": { - "description": "Request body does not match schema", + "404": { + "description": "Pool not found", "content": { "application/json": { "schema": { @@ -2114,43 +1975,41 @@ } } } - }, - "security": [ - { - "bearer_auth": [] - } - ] + } } }, - "/referral/my-codes": { + "/pools/{key}/initialized-ticks": { "get": { "tags": [ - "referral" + "pools" + ], + "summary": "Returns the full sorted list of *initialized* ticks for the given pool \u2014 every\n`tick_lower` and `tick_upper` across all non-burned positions, deduplicated.", + "description": "Used by the frontend mint flow to compute the correct\n`tick_lower_hint` / `tick_upper_hint` for the AMM's hint-walk asserts.", + "operationId": "get_pool_initialized_ticks", + "parameters": [ + { + "name": "key", + "in": "path", + "description": "Pool key", + "required": true, + "schema": { + "type": "string" + } + } ], - "operationId": "my_codes", "responses": { "200": { - "description": "Codes issued to the wallet", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReferralMyCodesResponseDoc" - } - } - } - }, - "401": { - "description": "Authentication required", + "description": "Sorted initialized ticks", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/InitializedTicksResponseDoc" } } } }, - "403": { - "description": "Invite access required", + "404": { + "description": "Pool not found", "content": { "application/json": { "schema": { @@ -2177,35 +2036,36 @@ ] } }, - "/referral/redeem": { - "post": { + "/pools/{key}/liquidity-distribution": { + "get": { "tags": [ - "referral" + "pools" ], - "operationId": "referral_redeem", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReferralRedeemRequest" - } + "operationId": "get_pool_liquidity_distribution", + "parameters": [ + { + "name": "key", + "in": "path", + "description": "Pool key", + "required": true, + "schema": { + "type": "string" } - }, - "required": true - }, + } + ], "responses": { "200": { - "description": "Referral code redeemed", + "description": "Initialized tick liquidity deltas", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ReferralRedeemResponseDoc" + "$ref": "#/components/schemas/LiquidityDistributionResponseDoc" } } } }, - "400": { - "description": "Invalid, used, or capacity-limited code", + "404": { + "description": "Pool not found", "content": { "application/json": { "schema": { @@ -2214,8 +2074,8 @@ } } }, - "401": { - "description": "Authentication required", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -2223,39 +2083,83 @@ } } } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/pools/{key}/ohlcv": { + "get": { + "tags": [ + "pools" + ], + "operationId": "get_pool_ohlcv", + "parameters": [ + { + "name": "key", + "in": "path", + "description": "Pool key", + "required": true, + "schema": { + "type": "string" + } }, - "413": { - "description": "Request body too large", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } + { + "name": "granularity", + "in": "query", + "description": "Candle bucket", + "required": true, + "schema": { + "$ref": "#/components/schemas/GranularityDoc" } }, - "415": { - "description": "Content-Type must be application/json", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } + { + "name": "from", + "in": "query", + "description": "Inclusive unix-second start", + "required": true, + "schema": { + "type": "integer", + "format": "int64" } }, - "422": { - "description": "Request body does not match schema", + { + "name": "to", + "in": "query", + "description": "Exclusive unix-second end", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "orientation", + "in": "query", + "description": "`raw` (default) keeps stored token1-per-token0 prices; `display` inverts candles when the pool's canonical display orientation is flipped", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OHLCV candles for the range", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/OhlcvResponseDoc" } } } }, - "429": { - "description": "Rate limit exceeded", + "400": { + "description": "Invalid granularity", "content": { "application/json": { "schema": { @@ -2282,35 +2186,36 @@ ] } }, - "/referral/settings": { + "/pools/{key}/stats": { "get": { "tags": [ - "referral" + "pools" + ], + "operationId": "get_pool_24h_stats", + "parameters": [ + { + "name": "key", + "in": "path", + "description": "Pool key", + "required": true, + "schema": { + "type": "string" + } + } ], - "operationId": "get_settings", "responses": { "200": { - "description": "Referral settings", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReferralSettingsResponseDoc" - } - } - } - }, - "401": { - "description": "Authentication required", + "description": "Rolling 24h price/volume summary", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/PoolStats24hResponseDoc" } } } }, - "403": { - "description": "Administrator authorization required", + "404": { + "description": "Pool not found", "content": { "application/json": { "schema": { @@ -2335,75 +2240,67 @@ "bearer_auth": [] } ] - }, - "put": { + } + }, + "/pools/{key}/trades": { + "get": { "tags": [ - "referral" + "pools" ], - "operationId": "update_settings", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReferralUpdateSettingsRequest" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Updated referral settings", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReferralSettingsResponseDoc" - } - } + "operationId": "get_pool_trades", + "parameters": [ + { + "name": "key", + "in": "path", + "description": "Pool key", + "required": true, + "schema": { + "type": "string" } }, - "400": { - "description": "Malformed JSON request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } + { + "name": "limit", + "in": "query", + "description": "Page size (1-100)", + "required": false, + "schema": { + "type": "integer", + "format": "int64" } }, - "401": { - "description": "Authentication required", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } + { + "name": "offset", + "in": "query", + "description": "Page offset", + "required": false, + "schema": { + "type": "integer", + "format": "int64" } }, - "403": { - "description": "Administrator authorization required", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } + { + "name": "trade_type", + "in": "query", + "description": "Indexed pool trade type filter", + "required": false, + "schema": { + "$ref": "#/components/schemas/PoolTradeFilterDoc" } - }, - "413": { - "description": "Request body too large", + } + ], + "responses": { + "200": { + "description": "Paginated trade history", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/PoolTradesResponseDoc" } } } }, - "415": { - "description": "Content-Type must be application/json", + "400": { + "description": "Invalid query parameters", "content": { "application/json": { "schema": { @@ -2412,8 +2309,8 @@ } } }, - "422": { - "description": "Request body does not match schema", + "404": { + "description": "Pool not found", "content": { "application/json": { "schema": { @@ -2440,19 +2337,51 @@ ] } }, - "/referral/status": { + "/positions": { "get": { "tags": [ - "referral" + "positions" + ], + "operationId": "list_positions", + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "Page size (1-100)", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "offset", + "in": "query", + "description": "Page offset", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + } ], - "operationId": "referral_status", "responses": { "200": { - "description": "Wallet referral status", + "description": "Paginated LP positions", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ReferralStatusResponseDoc" + "$ref": "#/components/schemas/PositionListResponseDoc" + } + } + } + }, + "400": { + "description": "Invalid query parameters", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" } } } @@ -2485,54 +2414,36 @@ ] } }, - "/route": { + "/positions/{token_id}": { "get": { "tags": [ - "route" + "positions" ], - "operationId": "find_route", + "operationId": "get_position", "parameters": [ { - "name": "token_in", - "in": "query", - "description": "Input token ID", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "token_out", - "in": "query", - "description": "Output token ID", + "name": "token_id", + "in": "path", + "description": "On-chain position NFT token_id", "required": true, "schema": { "type": "string" } - }, - { - "name": "amount_in", - "in": "query", - "description": "Optional positive canonical decimal amount for output estimation", - "required": false, - "schema": { - "type": "string" - } } ], "responses": { "200": { - "description": "Best swap route (max 3 hops)", + "description": "Position details", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RouteResponseDoc" + "$ref": "#/components/schemas/PositionResponseDoc" } } } }, - "400": { - "description": "Invalid amount_in", + "401": { + "description": "Authentication required", "content": { "application/json": { "schema": { @@ -2542,7 +2453,7 @@ } }, "404": { - "description": "No route or executable quote for the given tokens", + "description": "Position not found", "content": { "application/json": { "schema": { @@ -2551,8 +2462,8 @@ } } }, - "503": { - "description": "Routing dependencies are temporarily unavailable or the quote candidate set exceeds the safe limit", + "500": { + "description": "Internal error", "content": { "application/json": { "schema": { @@ -2569,65 +2480,92 @@ ] } }, - "/schema/trading": { + "/protocol/state": { "get": { "tags": [ - "schema" + "protocol" + ], + "operationId": "get_protocol_state", + "parameters": [ + { + "name": "minimum_revision", + "in": "path", + "required": true, + "schema": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + } ], - "summary": "GET /schema/trading", - "description": "Returns the full list of on-chain trading, liquidity, and token operations\nwith their input signatures. Clients can use this to build transaction\npayloads without hardcoding the Leo function signatures.", - "operationId": "list_trading_schemas", "responses": { "200": { - "description": "List of all on-chain operation schemas", + "description": "Canonical versioned protocol state", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TradingSchemaListResponse" + "$ref": "#/components/schemas/ProtocolStateResponse" + } + } + } + }, + "304": { + "description": "Protocol state matches If-None-Match" + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "503": { + "description": "The requested protocol revision has not been indexed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProtocolRevisionPending" } } } } - }, - "security": [ - { - "bearer_auth": [] - } - ] + } } }, - "/schema/trading/{id}": { + "/referral/admin": { "get": { "tags": [ - "schema" - ], - "summary": "GET /schema/trading/{id}", - "description": "Returns the input schema for a single operation (e.g. `swap`, `mint`, `collect`).", - "operationId": "get_trading_schema", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "Operation ID (swap, mint, create_pool, burn, collect, decrease_liquidity, swap_multi_hop, claim_swap_output, claim_multi_hop_output, register_token, mint_public, mint_private, transfer_public_to_private, add_fee_tier, add_tick_spacing, set_pool_enabled)", - "required": true, - "schema": { - "type": "string" - } - } + "referral" ], + "operationId": "admin_check", "responses": { "200": { - "description": "Schema for the requested operation", + "description": "Wallet administrator status", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TradingSchemaResponse" + "$ref": "#/components/schemas/ReferralAdminResponseDoc" } } } }, - "404": { - "description": "Unknown operation ID", + "401": { + "description": "Authentication required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "403": { + "description": "Invite access required", "content": { "application/json": { "schema": { @@ -2644,17 +2582,17 @@ ] } }, - "/swaps": { + "/referral/codes": { "get": { "tags": [ - "swaps" + "referral" ], - "operationId": "list_swaps", + "operationId": "referral_list_codes", "parameters": [ { "name": "limit", "in": "query", - "description": "Page size (1-100)", + "description": "Page size (1-2000)", "required": false, "schema": { "type": "integer", @@ -2670,24 +2608,15 @@ "type": "integer", "format": "int64" } - }, - { - "name": "pool", - "in": "query", - "description": "Filter by any pool in the route", - "required": false, - "schema": { - "type": "string" - } } ], "responses": { "200": { - "description": "Paginated swap history", + "description": "Referral-code inventory", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwapListResponseDoc" + "$ref": "#/components/schemas/ReferralListResponseDoc" } } } @@ -2712,8 +2641,8 @@ } } }, - "404": { - "description": "Pool filter not found", + "403": { + "description": "Administrator authorization required", "content": { "application/json": { "schema": { @@ -2740,30 +2669,39 @@ ] } }, - "/swaps/{swap_id}": { - "get": { + "/referral/generate": { + "post": { "tags": [ - "swaps" - ], - "operationId": "get_swap", - "parameters": [ - { - "name": "swap_id", - "in": "path", - "description": "On-chain swap ID", - "required": true, - "schema": { - "type": "string" - } - } + "referral" ], - "responses": { + "operationId": "referral_generate", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReferralGenerateRequest" + } + } + }, + "required": true + }, + "responses": { "200": { - "description": "Swap details", + "description": "Generated referral codes", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwapResponseDoc" + "$ref": "#/components/schemas/ReferralGenerateResponseDoc" + } + } + } + }, + "400": { + "description": "Malformed JSON request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" } } } @@ -2778,8 +2716,8 @@ } } }, - "404": { - "description": "Swap not found", + "403": { + "description": "Administrator authorization required", "content": { "application/json": { "schema": { @@ -2788,8 +2726,8 @@ } } }, - "500": { - "description": "Internal error", + "413": { + "description": "Request body too large", "content": { "application/json": { "schema": { @@ -2797,28 +2735,23 @@ } } } - } - }, - "security": [ - { - "bearer_auth": [] - } - ] - } - }, - "/tick-spacings": { - "get": { - "tags": [ - "protocol" - ], - "operationId": "list_tick_spacings", - "responses": { - "200": { - "description": "Registered tick spacings", + }, + "415": { + "description": "Content-Type must be application/json", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TickSpacingListResponseDoc" + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "422": { + "description": "Request body does not match schema", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" } } } @@ -2841,19 +2774,39 @@ ] } }, - "/tokens": { + "/referral/my-codes": { "get": { "tags": [ - "tokens" + "referral" ], - "operationId": "list_tokens", + "operationId": "my_codes", "responses": { "200": { - "description": "All registered tokens", + "description": "Codes issued to the wallet", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TokenListResponseDoc" + "$ref": "#/components/schemas/ReferralMyCodesResponseDoc" + } + } + } + }, + "401": { + "description": "Authentication required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "403": { + "description": "Invite access required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" } } } @@ -2868,18 +2821,25 @@ } } } - } - }, + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/referral/redeem": { "post": { "tags": [ - "tokens" + "referral" ], - "operationId": "create_token", + "operationId": "referral_redeem", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateTokenRequestDoc" + "$ref": "#/components/schemas/ReferralRedeemRequest" } } }, @@ -2887,17 +2847,17 @@ }, "responses": { "200": { - "description": "Token stored", + "description": "Referral code redeemed", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TokenResponseDoc" + "$ref": "#/components/schemas/ReferralRedeemResponseDoc" } } } }, "400": { - "description": "Invalid token decimals or request", + "description": "Invalid, used, or capacity-limited code", "content": { "application/json": { "schema": { @@ -2907,7 +2867,7 @@ } }, "401": { - "description": "Administrator authorization required", + "description": "Authentication required", "content": { "application/json": { "schema": { @@ -2916,8 +2876,8 @@ } } }, - "403": { - "description": "Administrator authorization required", + "413": { + "description": "Request body too large", "content": { "application/json": { "schema": { @@ -2926,8 +2886,8 @@ } } }, - "413": { - "description": "Request body too large", + "415": { + "description": "Content-Type must be application/json", "content": { "application/json": { "schema": { @@ -2936,8 +2896,8 @@ } } }, - "415": { - "description": "Content-Type must be application/json", + "422": { + "description": "Request body does not match schema", "content": { "application/json": { "schema": { @@ -2946,8 +2906,8 @@ } } }, - "422": { - "description": "Request body does not match schema", + "429": { + "description": "Rate limit exceeded", "content": { "application/json": { "schema": { @@ -2974,41 +2934,19 @@ ] } }, - "/tokens/deploy": { - "post": { + "/referral/settings": { + "get": { "tags": [ - "tokens" + "referral" ], - "summary": "POST /tokens/deploy", - "description": "Deploys a fresh self-contained ARC-20 token (the treasury/deployer key is its\nbaked-in admin) and mints the initial supply to the creator (`recipient`),\nthen registers it (with `wrapper_program`) so it is swap- and airdrop-ready.\n\nDeploy + mint are two on-chain txs that take minutes, so this returns\nimmediately with `status: \"deploying\"` and finishes in the background. Poll\n`GET /tokens` for a row whose `wrapper_program` equals the returned\n`program_id` to know it completed.\n\nRequired env: `DEPLOYER_PRIVATE_KEY` (treasury/admin; `AIRDROP_PRIVATE_KEY`\nhonored as fallback), `RPC_URLS`. `leo` must be on the server PATH.", - "operationId": "deploy_token", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeployTokenRequest" - } - } - }, - "required": true - }, + "operationId": "get_settings", "responses": { "200": { - "description": "Deploy started", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeployTokenResponseDoc" - } - } - } - }, - "400": { - "description": "Bad request", + "description": "Referral settings", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" + "$ref": "#/components/schemas/ReferralSettingsResponseDoc" } } } @@ -3033,38 +2971,8 @@ } } }, - "413": { - "description": "Request body too large", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } - } - }, - "415": { - "description": "Content-Type must be application/json", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } - } - }, - "422": { - "description": "Request body does not match schema", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseDoc" - } - } - } - }, "500": { - "description": "Misconfigured server", + "description": "Internal error", "content": { "application/json": { "schema": { @@ -3079,21 +2987,17 @@ "bearer_auth": [] } ] - } - }, - "/tokens/mint": { - "post": { + }, + "put": { "tags": [ - "tokens" + "referral" ], - "summary": "POST /tokens/mint", - "description": "Admin-mints `amount` (base units) of an existing wrapper to `recipient`,\nsigned by the treasury/deployer key (the token's admin). Synchronous \u2014 a\nsingle mint tx. Reuses scripts/airdrop-helper.mjs (which calls mint_public).", - "operationId": "mint_token", + "operationId": "update_settings", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MintTokenRequest" + "$ref": "#/components/schemas/ReferralUpdateSettingsRequest" } } }, @@ -3101,17 +3005,17 @@ }, "responses": { "200": { - "description": "Mint broadcast", + "description": "Updated referral settings", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MintTokenResponseDoc" + "$ref": "#/components/schemas/ReferralSettingsResponseDoc" } } } }, "400": { - "description": "Bad request", + "description": "Malformed JSON request", "content": { "application/json": { "schema": { @@ -3171,7 +3075,7 @@ } }, "500": { - "description": "Misconfigured server", + "description": "Internal error", "content": { "application/json": { "schema": { @@ -3188,36 +3092,25 @@ ] } }, - "/tokens/{address}": { + "/referral/status": { "get": { "tags": [ - "tokens" - ], - "operationId": "get_token", - "parameters": [ - { - "name": "address", - "in": "path", - "description": "Token address (Aleo field ID)", - "required": true, - "schema": { - "type": "string" - } - } + "referral" ], + "operationId": "referral_status", "responses": { "200": { - "description": "Token details", + "description": "Wallet referral status", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TokenResponseDoc" + "$ref": "#/components/schemas/ReferralStatusResponseDoc" } } } }, - "404": { - "description": "Token not found", + "401": { + "description": "Authentication required", "content": { "application/json": { "schema": { @@ -3236,7 +3129,766 @@ } } } - } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/route": { + "get": { + "tags": [ + "route" + ], + "operationId": "find_route", + "parameters": [ + { + "name": "token_in", + "in": "query", + "description": "Input token ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "token_out", + "in": "query", + "description": "Output token ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "amount_in", + "in": "query", + "description": "Optional positive canonical decimal amount for output estimation", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Best swap route (max 3 hops)", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RouteResponseDoc" + } + } + } + }, + "400": { + "description": "Invalid amount_in", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "404": { + "description": "No route or executable quote for the given tokens", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "503": { + "description": "The live deployment is incompatible, routing dependencies are unavailable, or the quote candidate set exceeds the safe limit", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/schema/trading": { + "get": { + "tags": [ + "schema" + ], + "summary": "GET /schema/trading", + "description": "Returns the full list of on-chain trading, liquidity, and token operations\nwith their input signatures. Clients can use this to build transaction\npayloads without hardcoding the Leo function signatures.", + "operationId": "list_trading_schemas", + "responses": { + "200": { + "description": "List of all on-chain operation schemas", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TradingSchemaListResponse" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/schema/trading/{id}": { + "get": { + "tags": [ + "schema" + ], + "summary": "GET /schema/trading/{id}", + "description": "Returns the input schema for a single operation (e.g. `swap`, `mint`, `collect`).", + "operationId": "get_trading_schema", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Operation ID (swap, mint, create_pool, burn, collect, decrease_liquidity, swap_multi_hop, claim_swap_output, register_token, mint_public, mint_private, transfer_public_to_private, add_fee_tier, add_tick_spacing, bind_fee_to_tick_spacing, set_pool_enabled)", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Schema for the requested operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TradingSchemaResponse" + } + } + } + }, + "404": { + "description": "Unknown operation ID", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/swaps": { + "get": { + "tags": [ + "swaps" + ], + "operationId": "list_swaps", + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "Page size (1-100)", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "offset", + "in": "query", + "description": "Page offset", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "pool", + "in": "query", + "description": "Filter by any pool in the route", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Paginated swap history", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwapListResponseDoc" + } + } + } + }, + "400": { + "description": "Invalid query parameters", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "401": { + "description": "Authentication required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "404": { + "description": "Pool filter not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/swaps/{swap_id}": { + "get": { + "tags": [ + "swaps" + ], + "operationId": "get_swap", + "parameters": [ + { + "name": "swap_id", + "in": "path", + "description": "On-chain swap ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Swap details", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwapResponseDoc" + } + } + } + }, + "401": { + "description": "Authentication required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "404": { + "description": "Swap not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/tick-spacings": { + "get": { + "tags": [ + "protocol" + ], + "operationId": "list_tick_spacings", + "responses": { + "200": { + "description": "Registered tick spacings", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TickSpacingListResponseDoc" + } + } + } + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/tokens": { + "get": { + "tags": [ + "tokens" + ], + "operationId": "list_tokens", + "responses": { + "200": { + "description": "All registered tokens", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenListResponseDoc" + } + } + } + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + } + }, + "post": { + "tags": [ + "tokens" + ], + "operationId": "create_token", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTokenRequestDoc" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Token stored", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenResponseDoc" + } + } + } + }, + "400": { + "description": "Invalid token decimals or request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "401": { + "description": "Administrator authorization required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "403": { + "description": "Administrator authorization required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "413": { + "description": "Request body too large", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "415": { + "description": "Content-Type must be application/json", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "422": { + "description": "Request body does not match schema", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/tokens/deploy": { + "post": { + "tags": [ + "tokens" + ], + "summary": "POST /tokens/deploy", + "description": "Deploys a fresh self-contained ARC-20 token (the treasury/deployer key is its\nbaked-in admin) and mints the initial supply to the creator (`recipient`),\nthen registers it (with `amm_token_program`) so it is swap- and airdrop-ready.\n\nDeploy + mint are two on-chain txs that take minutes, so this returns\nimmediately with `status: \"deploying\"` and finishes in the background. Poll\n`GET /tokens` for a row whose `amm_token_program` equals the returned\n`program_id` to know it completed.\n\nRequired env: `DEPLOYER_PRIVATE_KEY` (treasury/admin; `AIRDROP_PRIVATE_KEY`\nhonored as fallback), `RPC_URLS`. `leo` must be on the server PATH.", + "operationId": "deploy_token", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployTokenRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Deploy started", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployTokenResponseDoc" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "401": { + "description": "Authentication required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "403": { + "description": "Administrator authorization required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "413": { + "description": "Request body too large", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "415": { + "description": "Content-Type must be application/json", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "422": { + "description": "Request body does not match schema", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "500": { + "description": "Misconfigured server", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/tokens/mint": { + "post": { + "tags": [ + "tokens" + ], + "summary": "POST /tokens/mint", + "description": "Admin-mints `amount` (base units) of an existing AMM token to `recipient`.", + "operationId": "mint_token", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MintTokenRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Mint broadcast", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MintTokenResponseDoc" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "401": { + "description": "Authentication required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "403": { + "description": "Administrator authorization required", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "413": { + "description": "Request body too large", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "415": { + "description": "Content-Type must be application/json", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "422": { + "description": "Request body does not match schema", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "500": { + "description": "Misconfigured server", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + }, + "security": [ + { + "bearer_auth": [] + } + ] + } + }, + "/tokens/{address}": { + "get": { + "tags": [ + "tokens" + ], + "operationId": "get_token", + "parameters": [ + { + "name": "address", + "in": "path", + "description": "Token address (Aleo field ID)", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Token details", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenResponseDoc" + } + } + } + }, + "404": { + "description": "Token not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + }, + "500": { + "description": "Internal error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDoc" + } + } + } + } + } } }, "/unclaimed": { @@ -3409,8 +4061,7 @@ "type": "object", "required": [ "code", - "status", - "token" + "status" ], "properties": { "code": { @@ -3418,42 +4069,90 @@ }, "status": { "type": "string" - }, - "token": { - "type": "string" } } }, - "AccessRedeemResponseDoc": { + "AccessRedeemResponseDoc": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/AccessRedeemResponse" + } + } + }, + "AccessStatusResponse": { + "type": "object", + "required": [ + "has_access" + ], + "properties": { + "has_access": { + "type": "boolean" + } + } + }, + "AccessStatusResponseDoc": { "type": "object", "required": [ "data" ], "properties": { "data": { - "$ref": "#/components/schemas/AccessRedeemResponse" + "$ref": "#/components/schemas/AccessStatusResponse" } } }, - "AccessStatusResponse": { + "ActiveSessionPayload": { "type": "object", "required": [ - "has_access" + "session_id", + "started_at", + "last_refreshed_at", + "expires_at", + "current" ], "properties": { - "has_access": { + "current": { "type": "boolean" + }, + "expires_at": { + "type": "integer", + "format": "int64" + }, + "last_refreshed_at": { + "type": "integer", + "format": "int64" + }, + "session_id": { + "type": "string", + "format": "uuid" + }, + "started_at": { + "type": "integer", + "format": "int64" + }, + "user_agent": { + "type": [ + "string", + "null" + ] } } }, - "AccessStatusResponseDoc": { + "ActiveSessionsResponseDoc": { "type": "object", "required": [ "data" ], "properties": { "data": { - "$ref": "#/components/schemas/AccessStatusResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ActiveSessionPayload" + } } } }, @@ -3508,11 +4207,14 @@ "type": "object", "required": [ "symbol", - "wrapper_program", + "amm_token_program", "amount", "status" ], "properties": { + "amm_token_program": { + "type": "string" + }, "amount": { "type": "string", "description": "Base-unit amount delivered." @@ -3535,9 +4237,6 @@ "string", "null" ] - }, - "wrapper_program": { - "type": "string" } } }, @@ -3729,9 +4428,14 @@ "AuthTokenPayload": { "type": "object", "required": [ - "token" + "token", + "expires_at" ], "properties": { + "expires_at": { + "type": "integer", + "format": "int64" + }, "token": { "type": "string" } @@ -3765,10 +4469,14 @@ "ChallengePayload": { "type": "object", "required": [ + "challenge_id", "nonce", "message" ], "properties": { + "challenge_id": { + "type": "string" + }, "message": { "type": "string" }, @@ -3812,6 +4520,13 @@ "type": "string", "description": "Aleo field ID (e.g. `1234567890field`)." }, + "amm_token_program": { + "type": [ + "string", + "null" + ], + "description": "Program for the token representation used by the AMM; the wrapper program for wrapped assets." + }, "decimals": { "type": "integer", "format": "int32", @@ -3823,13 +4538,6 @@ }, "symbol": { "type": "string" - }, - "wrapper_program": { - "type": [ - "string", - "null" - ], - "description": "Deployed ARC-20 wrapper program ID (e.g. `mtk_a1b2c3.aleo`). Optional." } } }, @@ -3888,14 +4596,14 @@ "properties": { "program_id": { "type": "string", - "description": "`_.aleo` \u2014 the deployed wrapper program id." + "description": "`_.aleo` \u2014 the deployed AMM token program id." }, "recipient": { "type": "string" }, "status": { "type": "string", - "description": "Always `\"deploying\"`. Deploy + initial mint run in the background\n(minutes); poll `GET /tokens` until a token with this `wrapper_program`\nappears to know it finished and was registered." + "description": "Always `\"deploying\"`. Deploy + initial mint run in the background\n(minutes); poll `GET /tokens` until a token with this `amm_token_program`\nappears to know it finished and was registered." } } }, @@ -3916,6 +4624,23 @@ } } }, + "FeeBinding": { + "type": "object", + "required": [ + "fee_tier", + "tick_spacing" + ], + "properties": { + "fee_tier": { + "type": "integer", + "format": "int32" + }, + "tick_spacing": { + "type": "integer", + "format": "int32" + } + } + }, "FeeTierDoc": { "type": "object", "required": [ @@ -3938,6 +4663,14 @@ "id": { "type": "string" }, + "tick_spacing": { + "type": [ + "integer", + "null" + ], + "format": "int32", + "description": "Current binding, or null when the registered fee has not been bound." + }, "transaction": { "type": "string" } @@ -3959,7 +4692,7 @@ }, "FunctionSchema": { "type": "object", - "description": "Full schema for a single trading / liquidity operation on the Aleo AMM.", + "description": "Input schema for one Shield Swap operation.", "required": [ "id", "program", @@ -4073,14 +4806,152 @@ } } }, + "LiveCompatibility": { + "type": "object", + "required": [ + "status", + "checked_at", + "artifacts_checked", + "failures" + ], + "properties": { + "artifacts_checked": { + "type": "integer", + "minimum": 0 + }, + "checked_at": { + "type": "string", + "format": "date-time" + }, + "failures": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LiveCompatibilityFailure" + } + }, + "status": { + "$ref": "#/components/schemas/LiveCompatibilityStatus" + } + } + }, + "LiveCompatibilityFailure": { + "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "$ref": "#/components/schemas/LiveCompatibilityFailureCode" + }, + "program_id": { + "type": [ + "string", + "null" + ] + } + } + }, + "LiveCompatibilityFailureCode": { + "type": "string", + "enum": [ + "cache_unavailable", + "edition_mismatch", + "edition_unavailable", + "rate_limited", + "rpc_unavailable", + "source_mismatch", + "source_unavailable", + "verification_timeout" + ] + }, + "LiveCompatibilityStatus": { + "type": "string", + "enum": [ + "compatible", + "incompatible", + "unavailable" + ] + }, + "LogoutAllResponse": { + "type": "object", + "required": [ + "ok", + "ended", + "address", + "session_version" + ], + "properties": { + "address": { + "type": "string" + }, + "ended": { + "type": "boolean" + }, + "ok": { + "type": "boolean" + }, + "session_version": { + "type": "integer", + "format": "int64" + } + } + }, + "LogoutAllResponseDoc": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/LogoutAllResponse" + } + } + }, + "LogoutResponse": { + "type": "object", + "required": [ + "ok", + "ended" + ], + "properties": { + "ended": { + "type": "boolean" + }, + "ok": { + "type": "boolean" + }, + "session_id": { + "type": [ + "string", + "null" + ], + "format": "uuid" + } + } + }, + "LogoutResponseDoc": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/LogoutResponse" + } + } + }, "MintTokenRequest": { "type": "object", "required": [ - "wrapper_program", + "amm_token_program", "recipient", "amount" ], "properties": { + "amm_token_program": { + "type": "string", + "description": "Program for the token representation used by the AMM." + }, "amount": { "type": "string", "description": "Amount in BASE units (already scaled by 10^decimals), as a string." @@ -4088,10 +4959,6 @@ "recipient": { "type": "string", "description": "Recipient Aleo address (`aleo1...`)." - }, - "wrapper_program": { - "type": "string", - "description": "The token's wrapper program id (e.g. `mtk_a1b2c3.aleo`)." } } }, @@ -4138,22 +5005,22 @@ "properties": { "c": { "type": "string", - "description": "Last normalized token1-per-token0 price; execution price after migration 0028, preserved legacy baseline before it." + "description": "Last raw atomic token1-per-token0 execution price." }, "granularity": { "$ref": "#/components/schemas/GranularityDoc" }, "h": { "type": "string", - "description": "Highest normalized token1-per-token0 price; execution price after migration 0028, preserved legacy baseline before it." + "description": "Highest raw atomic token1-per-token0 execution price." }, "l": { "type": "string", - "description": "Lowest normalized token1-per-token0 price; execution price after migration 0028, preserved legacy baseline before it." + "description": "Lowest raw atomic token1-per-token0 execution price." }, "o": { "type": "string", - "description": "First normalized token1-per-token0 price; execution price after migration 0028, preserved legacy baseline before it." + "description": "First raw atomic token1-per-token0 execution price." }, "pool": { "type": "string" @@ -4164,7 +5031,7 @@ }, "v": { "type": "string", - "description": "Raw token0 volume; exact consumed units after migration 0028, preserved legacy baseline before it." + "description": "Raw token0 units consumed." } } }, @@ -4297,36 +5164,12 @@ "amount_remaining": { "type": "string" }, - "amount_remaining_1": { - "type": [ - "string", - "null" - ] - }, - "amount_remaining_2": { - "type": [ - "string", - "null" - ] - }, "recipient": { "type": "string" }, "token_in": { "type": "string" }, - "token_in_1": { - "type": [ - "string", - "null" - ] - }, - "token_in_2": { - "type": [ - "string", - "null" - ] - }, "token_out": { "type": "string" } @@ -4392,6 +5235,22 @@ } } }, + "PoolFeeProtocol": { + "type": "object", + "required": [ + "pool_key", + "fee_protocol" + ], + "properties": { + "fee_protocol": { + "type": "integer", + "format": "int32" + }, + "pool_key": { + "type": "string" + } + } + }, "PoolListResponseDoc": { "type": "object", "required": [ @@ -4417,7 +5276,35 @@ }, { "type": "object", + "required": [ + "display_flipped" + ], "properties": { + "base_token": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/components/schemas/TokenDoc", + "description": "token0_info/token1_info reordered so the quote (denominator) token is\nalways `quote_token` (priority: USD stables > ETH > BTC > ALEO)." + } + ] + }, + "display_flipped": { + "type": "boolean", + "description": "True when the canonical display orientation is (token1, token0)." + }, + "quote_token": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/components/schemas/TokenDoc" + } + ] + }, "token0_info": { "oneOf": [ { @@ -4451,11 +5338,9 @@ "token1", "enabled", "creator", - "fee", + "fee_percent", "created_at", - "init_tx", - "scale0", - "scale1" + "init_tx" ], "properties": { "created_at": { @@ -4467,7 +5352,7 @@ "enabled": { "type": "boolean" }, - "fee": { + "fee_percent": { "type": "string" }, "id": { @@ -4479,12 +5364,6 @@ "key": { "type": "string" }, - "scale0": { - "type": "string" - }, - "scale1": { - "type": "string" - }, "token0": { "type": "string" }, @@ -4519,7 +5398,12 @@ "open_24h", "high_24h", "low_24h", - "volume_24h" + "volume_24h", + "display_flipped", + "display_price", + "display_open_24h", + "display_high_24h", + "display_low_24h" ], "properties": { "change_24h_pct": { @@ -4528,20 +5412,44 @@ "null" ] }, + "display_change_24h_pct": { + "type": [ + "string", + "null" + ] + }, + "display_flipped": { + "type": "boolean", + "description": "True when display fields are inverted relative to token0/token1 order." + }, + "display_high_24h": { + "type": "string", + "description": "Inverted windows swap extremes: display_high = 1 / low_24h." + }, + "display_low_24h": { + "type": "string" + }, + "display_open_24h": { + "type": "string" + }, + "display_price": { + "type": "string", + "description": "Current price in canonical display orientation (quote per base)." + }, "high_24h": { "type": "string", - "description": "Highest normalized price; execution price after migration 0028, preserved legacy baseline before it." + "description": "Highest raw atomic execution price." }, "liquidity": { "type": "string" }, "low_24h": { "type": "string", - "description": "Lowest normalized price; execution price after migration 0028, preserved legacy baseline before it." + "description": "Lowest raw atomic execution price." }, "open_24h": { "type": "string", - "description": "Earliest normalized price; execution price after migration 0028, preserved legacy baseline before it." + "description": "Earliest raw atomic execution price." }, "price": { "type": "string" @@ -4551,7 +5459,7 @@ }, "volume_24h": { "type": "string", - "description": "Raw token0 volume; exact consumed units after migration 0028, preserved legacy baseline before it." + "description": "Raw token0 units consumed." } } }, @@ -4579,8 +5487,8 @@ "fee_protocol", "protocol_fees0", "protocol_fees1", - "fee_growth_global0_x_64", - "fee_growth_global1_x_64", + "fee_growth_global0_x_128", + "fee_growth_global1_x_128", "max_liquidity_per_tick", "next_init_below", "next_init_above" @@ -4590,10 +5498,10 @@ "type": "integer", "format": "int32" }, - "fee_growth_global0_x_64": { + "fee_growth_global0_x_128": { "type": "string" }, - "fee_growth_global1_x_64": { + "fee_growth_global1_x_128": { "type": "string" }, "fee_protocol": { @@ -4721,7 +5629,34 @@ }, { "type": "object", + "required": [ + "display_flipped" + ], "properties": { + "base_token": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/components/schemas/TokenDoc" + } + ] + }, + "display_flipped": { + "type": "boolean", + "description": "True when the canonical display orientation is (token1, token0)." + }, + "quote_token": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/components/schemas/TokenDoc" + } + ] + }, "stats": { "oneOf": [ { @@ -4780,10 +5715,11 @@ "user", "pool", "created_at", - "transaction", + "created_transaction", + "last_transaction", "is_burned", - "fee_growth_inside0_last_64", - "fee_growth_inside1_last_64", + "fee_growth_inside0_last_x_128", + "fee_growth_inside1_last_x_128", "tokens_owed0", "tokens_owed1", "is_private", @@ -4799,10 +5735,19 @@ "created_at": { "type": "string" }, - "fee_growth_inside0_last_64": { + "created_transaction": { + "type": "string" + }, + "created_transaction_hash": { + "type": [ + "string", + "null" + ] + }, + "fee_growth_inside0_last_x_128": { "type": "string" }, - "fee_growth_inside1_last_64": { + "fee_growth_inside1_last_x_128": { "type": "string" }, "frozen_at": { @@ -4823,6 +5768,15 @@ "is_private": { "type": "boolean" }, + "last_transaction": { + "type": "string" + }, + "last_transaction_hash": { + "type": [ + "string", + "null" + ] + }, "liquidity": { "type": "string" }, @@ -4840,123 +5794,446 @@ "token_id": { "type": "string" }, - "tokens_owed0": { - "type": "string" + "tokens_owed0": { + "type": "string" + }, + "tokens_owed1": { + "type": "string" + }, + "user": { + "type": "string" + } + } + }, + "PositionListResponseDoc": { + "type": "object", + "required": [ + "data", + "pagination" + ], + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PositionDoc" + } + }, + "pagination": { + "$ref": "#/components/schemas/PaginationMeta" + } + } + }, + "PositionResponseDoc": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/PositionDoc" + } + } + }, + "PositionWithOwedDoc": { + "type": "object", + "required": [ + "token_id", + "pool", + "tick_lower", + "tick_upper", + "tokens_owed0", + "tokens_owed1", + "is_private", + "is_frozen" + ], + "properties": { + "frozen_at": { + "type": [ + "string", + "null" + ] + }, + "is_frozen": { + "type": "boolean" + }, + "is_private": { + "type": "boolean" + }, + "last_transaction_hash": { + "type": [ + "string", + "null" + ] + }, + "pool": { + "type": "string" + }, + "tick_lower": { + "type": "integer", + "format": "int32" + }, + "tick_upper": { + "type": "integer", + "format": "int32" + }, + "token0_info": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/components/schemas/TokenDoc" + } + ] + }, + "token1_info": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/components/schemas/TokenDoc" + } + ] + }, + "token_id": { + "type": "string" + }, + "tokens_owed0": { + "type": "string" + }, + "tokens_owed1": { + "type": "string" + } + } + }, + "ProtocolCapabilities": { + "type": "object", + "required": [ + "faucet", + "token_admin", + "debug_api", + "freezelist_proofs", + "protocol_config_websocket" + ], + "properties": { + "debug_api": { + "type": "boolean" + }, + "faucet": { + "type": "boolean" + }, + "freezelist_proofs": { + "type": "string" + }, + "protocol_config_websocket": { + "type": "boolean" + }, + "token_admin": { + "type": "boolean" + } + } + }, + "ProtocolControls": { + "type": "object", + "required": [ + "global_paused", + "pool_creation_is_open", + "allowed_tokens", + "paused_tokens", + "paused_pairs", + "disabled_pools" + ], + "properties": { + "allowed_tokens": { + "type": "array", + "items": { + "type": "string" + } + }, + "disabled_pools": { + "type": "array", + "items": { + "type": "string" + } + }, + "global_paused": { + "type": "boolean" + }, + "paused_pairs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProtocolPair" + } + }, + "paused_tokens": { + "type": "array", + "items": { + "type": "string" + } + }, + "pool_creation_is_open": { + "type": "boolean" + } + } + }, + "ProtocolDeployment": { + "type": "object", + "required": [ + "profile", + "network", + "verified_at", + "amm_start_block", + "contract_repository", + "contract_ref", + "protocol_version", + "abi_version", + "math_version", + "freezelist_proof_version", + "deployment_fingerprint", + "programs" + ], + "properties": { + "abi_version": { + "type": "integer", + "format": "int32", + "minimum": 0 + }, + "amm_start_block": { + "type": "integer", + "format": "int64", + "minimum": 0 + }, + "contract_ref": { + "type": "string" + }, + "contract_repository": { + "type": "string" + }, + "deployment_fingerprint": { + "type": "string" + }, + "freezelist_proof_version": { + "type": "string" + }, + "math_version": { + "type": "string" + }, + "network": { + "type": "string" + }, + "profile": { + "type": "string" + }, + "programs": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ProtocolProgram" + }, + "propertyNames": { + "type": "string" + } + }, + "protocol_version": { + "type": "integer", + "format": "int32", + "minimum": 0 + }, + "verified_at": { + "type": "string" + } + } + }, + "ProtocolFeeConfiguration": { + "type": "object", + "required": [ + "registered_fee_tiers", + "registered_tick_spacings", + "valid_bindings", + "pool_fee_protocols" + ], + "properties": { + "pool_fee_protocols": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PoolFeeProtocol" + } + }, + "registered_fee_tiers": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + }, + "registered_tick_spacings": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + }, + "valid_bindings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FeeBinding" + } + } + } + }, + "ProtocolFreshness": { + "type": "object", + "required": [ + "ready_for_entry" + ], + "properties": { + "confirmed_head": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "indexed_block": { + "type": [ + "integer", + "null" + ], + "format": "int64" }, - "tokens_owed1": { - "type": "string" + "lag_blocks": { + "type": [ + "integer", + "null" + ], + "format": "int64" }, - "transaction": { - "type": "string" + "ready_for_entry": { + "type": "boolean" }, - "transaction_hash": { + "updated_at": { "type": [ "string", "null" - ] - }, - "user": { - "type": "string" + ], + "format": "date-time" } } }, - "PositionListResponseDoc": { + "ProtocolPair": { "type": "object", "required": [ - "data", - "pagination" + "token0", + "token1" ], "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PositionDoc" - } + "token0": { + "type": "string" }, - "pagination": { - "$ref": "#/components/schemas/PaginationMeta" + "token1": { + "type": "string" } } }, - "PositionResponseDoc": { + "ProtocolProgram": { "type": "object", "required": [ - "data" + "program_id", + "role", + "source_sha256" ], "properties": { - "data": { - "$ref": "#/components/schemas/PositionDoc" + "edition": { + "type": [ + "integer", + "null" + ], + "format": "int32", + "minimum": 0 + }, + "program_id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "source_sha256": { + "type": "string" } } }, - "PositionWithOwedDoc": { + "ProtocolRevisionPending": { "type": "object", "required": [ - "token_id", - "pool", - "tick_lower", - "tick_upper", - "tokens_owed0", - "tokens_owed1", - "scale0", - "scale1", - "is_private" + "error", + "code", + "minimum_revision", + "current_revision" ], "properties": { - "is_private": { - "type": "boolean" - }, - "pool": { + "code": { "type": "string" }, - "scale0": { - "type": "string" + "current_revision": { + "type": "integer", + "format": "int64" }, - "scale1": { + "error": { "type": "string" }, - "tick_lower": { + "minimum_revision": { "type": "integer", - "format": "int32" + "format": "int64" + } + } + }, + "ProtocolStateResponse": { + "type": "object", + "required": [ + "revision", + "freshness", + "live_compatibility", + "deployment", + "controls", + "fee_configuration", + "capabilities" + ], + "properties": { + "capabilities": { + "$ref": "#/components/schemas/ProtocolCapabilities" }, - "tick_upper": { - "type": "integer", - "format": "int32" + "changed_at": { + "type": [ + "string", + "null" + ], + "format": "date-time" }, - "token0_info": { - "oneOf": [ - { - "type": "null" - }, - { - "$ref": "#/components/schemas/TokenDoc" - } - ] + "controls": { + "$ref": "#/components/schemas/ProtocolControls" }, - "token1_info": { - "oneOf": [ - { - "type": "null" - }, - { - "$ref": "#/components/schemas/TokenDoc" - } - ] + "deployment": { + "$ref": "#/components/schemas/ProtocolDeployment" }, - "token_id": { - "type": "string" + "fee_configuration": { + "$ref": "#/components/schemas/ProtocolFeeConfiguration" }, - "tokens_owed0": { - "type": "string" + "freshness": { + "$ref": "#/components/schemas/ProtocolFreshness" }, - "tokens_owed1": { - "type": "string" + "live_compatibility": { + "$ref": "#/components/schemas/LiveCompatibility" }, - "transaction_hash": { + "observed_block": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" + }, + "revision": { + "type": "integer", + "format": "int64" } } }, @@ -5161,8 +6438,7 @@ "type": "object", "required": [ "code", - "status", - "token" + "status" ], "properties": { "code": { @@ -5170,9 +6446,6 @@ }, "status": { "type": "string" - }, - "token": { - "type": "string" } } }, @@ -5269,6 +6542,76 @@ } } }, + "RevokeSessionPayload": { + "type": "object", + "required": [ + "ok", + "revoked", + "current" + ], + "properties": { + "current": { + "type": "boolean" + }, + "ok": { + "type": "boolean" + }, + "revoked": { + "type": "boolean" + } + } + }, + "RevokeSessionResponseDoc": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/RevokeSessionPayload" + } + } + }, + "RevokeSessionsRequest": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + }, + "RevokeSessionsResponse": { + "type": "object", + "required": [ + "session_version", + "refresh_tokens_revoked" + ], + "properties": { + "refresh_tokens_revoked": { + "type": "integer", + "format": "int64", + "minimum": 0 + }, + "session_version": { + "type": "integer", + "format": "int64" + } + } + }, + "RevokeSessionsResponseDoc": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/RevokeSessionsResponse" + } + } + }, "RouteHopDoc": { "type": "object", "required": [ @@ -5352,7 +6695,8 @@ "required": [ "hops", "token_in", - "token_out" + "token_out", + "protocol_revision" ], "properties": { "estimated_amount_out": { @@ -5367,6 +6711,17 @@ "$ref": "#/components/schemas/RouteHopDoc" } }, + "protocol_config_observed_block": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "protocol_revision": { + "type": "integer", + "format": "int64" + }, "token_in": { "type": "string" }, @@ -5413,6 +6768,50 @@ } } }, + "SessionPayload": { + "type": "object", + "description": "Session identity returned on verify/refresh/session. The access + refresh\ntokens are set as httpOnly cookies (not in the body); `csrf_token` is held in\nmemory by the SPA and echoed in the `X-CSRF-Token` header.", + "required": [ + "address", + "expires_at", + "csrf_token", + "session_version" + ], + "properties": { + "address": { + "type": "string" + }, + "csrf_token": { + "type": "string" + }, + "expires_at": { + "type": "integer", + "format": "int64" + }, + "session_id": { + "type": [ + "string", + "null" + ], + "format": "uuid" + }, + "session_version": { + "type": "integer", + "format": "int64" + } + } + }, + "SessionResponseDoc": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/SessionPayload" + } + } + }, "SwapDoc": { "type": "object", "required": [ @@ -5430,20 +6829,12 @@ "executed_at", "amount_remaining", "transaction", - "amount_remaining_1", - "amount_remaining_2", "is_private" ], "properties": { "amount_remaining": { "type": "string" }, - "amount_remaining_1": { - "type": "string" - }, - "amount_remaining_2": { - "type": "string" - }, "claim_tx": { "type": [ "string", @@ -5517,18 +6908,6 @@ "swap_id": { "type": "string" }, - "token_in_1": { - "type": [ - "string", - "null" - ] - }, - "token_in_2": { - "type": [ - "string", - "null" - ] - }, "trade": { "type": [ "string", @@ -5736,6 +7115,13 @@ "address": { "type": "string" }, + "amm_token_program": { + "type": [ + "string", + "null" + ], + "description": "Program for the token representation used by the AMM; the wrapper program for wrapped assets." + }, "decimals": { "type": "integer", "format": "int32" @@ -5755,7 +7141,13 @@ "symbol": { "type": "string" }, - "wrapper_program": { + "underlying_program": { + "type": [ + "string", + "null" + ] + }, + "underlying_token_id": { "type": [ "string", "null" @@ -5849,12 +7241,16 @@ "type": "object", "required": [ "address", - "signature" + "signature", + "challenge_id" ], "properties": { "address": { "type": "string" }, + "challenge_id": { + "type": "string" + }, "signature": { "type": "string" } @@ -5866,7 +7262,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "JWT", - "description": "Session JWT from `POST /auth/verify` (24h), or a long-lived API token (`ss_\u2026`) minted at `POST /api-tokens`. API tokens work on data and trading endpoints; token management and admin endpoints accept session JWTs only." + "description": "Session JWT (browsers receive it as an httpOnly cookie from `POST /auth/verify`; 15 min, silently renewed via `POST /auth/refresh`), or a long-lived API token (`ss_\u2026`) minted at `POST /api-tokens`. API tokens work on data and trading endpoints and can request WebSocket tickets; token management and admin endpoints accept session JWTs only." } } }, @@ -5877,7 +7273,7 @@ }, { "name": "auth", - "description": "Wallet signature challenge / JWT verification" + "description": "Wallet sign-in, sessions, logout, and WebSocket tickets" }, { "name": "access", @@ -5929,7 +7325,7 @@ }, { "name": "airdrop", - "description": "Faucet \u2014 sends ~$10 each of wALEO, wUSDCx, and wETH to a user address as private records, once per address per 15 min" + "description": "Faucet \u2014 sends ~$10 each of ALEO, USDCx, and ETH to a user address as private records, once per address per 15 min" }, { "name": "unclaimed", diff --git a/shield-swap-sdk/codegen/regen-openapi.sh b/shield-swap-sdk/codegen/regen-openapi.sh index 73e25e5c..69bed893 100755 --- a/shield-swap-sdk/codegen/regen-openapi.sh +++ b/shield-swap-sdk/codegen/regen-openapi.sh @@ -2,7 +2,9 @@ # Refetch the DEX API's OpenAPI spec and regenerate the response models. set -euo pipefail cd "$(dirname "$0")" -BASE="${1:-https://amm-api.dev.provable.com}" +# Staging serves the migrated shield_swap.aleo stack; the old dev host still +# serves the pre-migration deployment — never mix the two. +BASE="${1:-https://amm-api-staging.dev.provable.com}" PYTHON="${PYTHON:-python3}" curl -sf "${BASE}/openapi.json" | "$PYTHON" -m json.tool > amm_api.openapi.json "$PYTHON" -m datamodel_code_generator \ diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index 7b039ec9..7e4ded8e 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -229,7 +229,11 @@ Whether this authenticated account has redeemed an invite code. ### `api.redeem_code(self, code: 'str') -> 'models.AccessRedeemResponse'` -Redeem an invite code; adopts the fresh token the API returns. +Redeem an invite code. + +The staging API no longer returns a session token here (sessions +moved to the ``/auth/*`` endpoints) — re-authenticate after +redeeming. A token is still adopted if the API resurrects one. ### `api.request_airdrop(self, address: 'str') -> 'models.AirdropStartResult'` diff --git a/shield-swap-sdk/python/aleo_shield_swap/_api_models.py b/shield-swap-sdk/python/aleo_shield_swap/_api_models.py index 40c8b5ec..1bcbb471 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/_api_models.py +++ b/shield-swap-sdk/python/aleo_shield_swap/_api_models.py @@ -51,7 +51,6 @@ class AccessRedeemRequest: class AccessRedeemResponse: code: str status: str - token: str @dataclass @@ -69,6 +68,21 @@ class AccessStatusResponseDoc: data: AccessStatusResponse +@dataclass +class ActiveSessionPayload: + current: bool + expires_at: int + last_refreshed_at: int + session_id: str + started_at: int + user_agent: str | None = None + + +@dataclass +class ActiveSessionsResponseDoc: + data: list[ActiveSessionPayload] + + @dataclass class AirdropRequest: address: str @@ -76,10 +90,10 @@ class AirdropRequest: @dataclass class AirdropResult: + amm_token_program: str amount: str status: str symbol: str - wrapper_program: str error: str | None = None tx_id: str | None = None @@ -135,6 +149,7 @@ class ApiTokenRow: @dataclass class AuthTokenPayload: + expires_at: int token: str @@ -145,6 +160,7 @@ class AuthTokenResponseDoc: @dataclass class ChallengePayload: + challenge_id: str message: str nonce: str @@ -165,7 +181,7 @@ class CreateTokenRequestDoc: decimals: int name: str symbol: str - wrapper_program: str | None = None + amm_token_program: str | None = None @dataclass @@ -190,12 +206,19 @@ class ErrorResponseDoc: ref: str | None = None +@dataclass +class FeeBinding: + fee_tier: int + tick_spacing: int + + @dataclass class FeeTierDoc: created_at: str fee_tier: int id: str transaction: str + tick_spacing: int | None = None @dataclass @@ -225,11 +248,53 @@ class InitializedTicksResponseDoc: data: list[int] +class LiveCompatibilityFailureCode(Enum): + cache_unavailable = 'cache_unavailable' + edition_mismatch = 'edition_mismatch' + edition_unavailable = 'edition_unavailable' + rate_limited = 'rate_limited' + rpc_unavailable = 'rpc_unavailable' + source_mismatch = 'source_mismatch' + source_unavailable = 'source_unavailable' + verification_timeout = 'verification_timeout' + + +class LiveCompatibilityStatus(Enum): + compatible = 'compatible' + incompatible = 'incompatible' + unavailable = 'unavailable' + + +@dataclass +class LogoutAllResponse: + address: str + ended: bool + ok: bool + session_version: int + + +@dataclass +class LogoutAllResponseDoc: + data: LogoutAllResponse + + +@dataclass +class LogoutResponse: + ended: bool + ok: bool + session_id: str | None = None + + +@dataclass +class LogoutResponseDoc: + data: LogoutResponse + + @dataclass class MintTokenRequest: + amm_token_program: str amount: str recipient: str - wrapper_program: str @dataclass @@ -276,10 +341,12 @@ class PendingSwapOutputDoc: recipient: str token_in: str token_out: str - amount_remaining_1: str | None = None - amount_remaining_2: str | None = None - token_in_1: str | None = None - token_in_2: str | None = None + + +@dataclass +class PoolFeeProtocol: + fee_protocol: int + pool_key: str @dataclass @@ -287,18 +354,21 @@ class PoolStateDoc: created_at: str creator: str enabled: bool - fee: str + fee_percent: str id: str init_tx: str key: str - scale0: str - scale1: str token0: str token1: str @dataclass class PoolStats24hDoc: + display_flipped: bool + display_high_24h: str + display_low_24h: str + display_open_24h: str + display_price: str high_24h: str liquidity: str low_24h: str @@ -307,6 +377,7 @@ class PoolStats24hDoc: price_reversed: str volume_24h: str change_24h_pct: str | None = None + display_change_24h_pct: str | None = None @dataclass @@ -317,8 +388,8 @@ class PoolStats24hResponseDoc: @dataclass class PoolStatsDoc: active_tick: int - fee_growth_global0_x_64: str - fee_growth_global1_x_64: str + fee_growth_global0_x_128: str + fee_growth_global1_x_128: str fee_protocol: int id: str liquidity: str @@ -357,12 +428,14 @@ class PositionDoc: amount0: str amount1: str created_at: str - fee_growth_inside0_last_64: str - fee_growth_inside1_last_64: str + created_transaction: str + fee_growth_inside0_last_x_128: str + fee_growth_inside1_last_x_128: str id: str is_burned: bool is_frozen: bool is_private: bool + last_transaction: str liquidity: str pool: str tick_lower: int @@ -370,10 +443,10 @@ class PositionDoc: token_id: str tokens_owed0: str tokens_owed1: str - transaction: str user: str + created_transaction_hash: str | None = None frozen_at: str | None = None - transaction_hash: str | None = None + last_transaction_hash: str | None = None @dataclass @@ -387,6 +460,54 @@ class PositionResponseDoc: data: PositionDoc +@dataclass +class ProtocolCapabilities: + debug_api: bool + faucet: bool + freezelist_proofs: str + protocol_config_websocket: bool + token_admin: bool + + +@dataclass +class ProtocolFeeConfiguration: + pool_fee_protocols: list[PoolFeeProtocol] + registered_fee_tiers: list[int] + registered_tick_spacings: list[int] + valid_bindings: list[FeeBinding] + + +@dataclass +class ProtocolFreshness: + ready_for_entry: bool + confirmed_head: int | None = None + indexed_block: int | None = None + lag_blocks: int | None = None + updated_at: str | None = None + + +@dataclass +class ProtocolPair: + token0: str + token1: str + + +@dataclass +class ProtocolProgram: + program_id: str + role: str + source_sha256: str + edition: int | None = None + + +@dataclass +class ProtocolRevisionPending: + code: str + current_revision: int + error: str + minimum_revision: int + + @dataclass class ReferralAdminCheckResponse: is_admin: bool @@ -461,7 +582,6 @@ class ReferralRedeemRequest: class ReferralRedeemResponse: code: str status: str - token: str @dataclass @@ -498,6 +618,34 @@ class ReferralUpdateSettingsRequest: max_users: int | None = None +@dataclass +class RevokeSessionPayload: + current: bool + ok: bool + revoked: bool + + +@dataclass +class RevokeSessionResponseDoc: + data: RevokeSessionPayload + + +@dataclass +class RevokeSessionsRequest: + address: str + + +@dataclass +class RevokeSessionsResponse: + refresh_tokens_revoked: int + session_version: int + + +@dataclass +class RevokeSessionsResponseDoc: + data: RevokeSessionsResponse + + @dataclass class RouteHopDoc: fee: str @@ -516,9 +664,11 @@ class RouteHopDoc: @dataclass class RouteResultDoc: hops: list[RouteHopDoc] + protocol_revision: int token_in: str token_out: str estimated_amount_out: str | None = None + protocol_config_observed_block: int | None = None @dataclass @@ -530,6 +680,20 @@ class SchemaField: fields: list[SchemaField] | None = None +@dataclass +class SessionPayload: + address: str + csrf_token: str + expires_at: int + session_version: int + session_id: str | None = None + + +@dataclass +class SessionResponseDoc: + data: SessionPayload + + @dataclass class SwapHopDoc: pool: str @@ -585,8 +749,10 @@ class TokenDoc: id: str name: str symbol: str + amm_token_program: str | None = None image: str | None = None - wrapper_program: str | None = None + underlying_program: str | None = None + underlying_token_id: str | None = None @dataclass @@ -602,6 +768,7 @@ class TokenResponseDoc: @dataclass class VerifyRequestDoc: address: str + challenge_id: str signature: str @@ -663,6 +830,12 @@ class LiquidityDistributionResponseDoc: data: list[TickLiquidityDoc] +@dataclass +class LiveCompatibilityFailure: + code: LiveCompatibilityFailureCode + program_id: str | None = None + + @dataclass class MintTokenResponseDoc: data: MintTokenResult @@ -702,6 +875,9 @@ class PoolDebugResponseDoc: @dataclass class PoolResponseDoc(PoolStateDoc): + display_flipped: bool + base_token: TokenDoc | None = None + quote_token: TokenDoc | None = None token0_info: TokenDoc | None = None token1_info: TokenDoc | None = None @@ -730,6 +906,9 @@ class PoolTradesResponseDoc: @dataclass class PoolWithStatsDoc(PoolStateDoc): + display_flipped: bool + base_token: TokenDoc | None = None + quote_token: TokenDoc | None = None stats: PoolStatsDoc | None = None token0_info: TokenDoc | None = None token1_info: TokenDoc | None = None @@ -742,18 +921,44 @@ class PoolWithStatsResponseDoc: @dataclass class PositionWithOwedDoc: + is_frozen: bool is_private: bool pool: str - scale0: str - scale1: str tick_lower: int tick_upper: int token_id: str tokens_owed0: str tokens_owed1: str + frozen_at: str | None = None + last_transaction_hash: str | None = None token0_info: TokenDoc | None = None token1_info: TokenDoc | None = None - transaction_hash: str | None = None + + +@dataclass +class ProtocolControls: + allowed_tokens: list[str] + disabled_pools: list[str] + global_paused: bool + paused_pairs: list[ProtocolPair] + paused_tokens: list[str] + pool_creation_is_open: bool + + +@dataclass +class ProtocolDeployment: + abi_version: int + amm_start_block: int + contract_ref: str + contract_repository: str + deployment_fingerprint: str + freezelist_proof_version: str + math_version: str + network: str + profile: str + programs: dict[str, ProtocolProgram] + protocol_version: int + verified_at: str @dataclass @@ -764,8 +969,6 @@ class RouteResponseDoc: @dataclass class SwapDoc: amount_remaining: str - amount_remaining_1: str - amount_remaining_2: str executed_at: str hops: list[SwapHopDoc] id: str @@ -784,8 +987,6 @@ class SwapDoc: claimed_at: str | None = None input_token_info: TokenDoc | None = None output_token_info: TokenDoc | None = None - token_in_1: str | None = None - token_in_2: str | None = None trade: str | None = None @@ -826,7 +1027,28 @@ class UnclaimedResponseDoc: data: UnclaimedPayloadDoc +@dataclass +class LiveCompatibility: + artifacts_checked: int + checked_at: str + failures: list[LiveCompatibilityFailure] + status: LiveCompatibilityStatus + + @dataclass class PoolListResponseDoc: data: list[PoolResponseDoc] pagination: PaginationMeta + + +@dataclass +class ProtocolStateResponse: + capabilities: ProtocolCapabilities + controls: ProtocolControls + deployment: ProtocolDeployment + fee_configuration: ProtocolFeeConfiguration + freshness: ProtocolFreshness + live_compatibility: LiveCompatibility + revision: int + changed_at: str | None = None + observed_block: int | None = None diff --git a/shield-swap-sdk/python/aleo_shield_swap/api.py b/shield-swap-sdk/python/aleo_shield_swap/api.py index 33bdb598..ed4f6ba4 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/api.py +++ b/shield-swap-sdk/python/aleo_shield_swap/api.py @@ -10,6 +10,7 @@ """ from __future__ import annotations +import os from dataclasses import dataclass, fields from typing import Any, Optional, TypeVar @@ -44,7 +45,11 @@ def _check(resp: Any) -> None: raise AirdropRateLimitedError(text) raise DexApiError(code, text) -DEFAULT_API_URL = "https://amm-api.dev.provable.com" +# Staging serves the migrated shield_swap.aleo stack (the old +# amm-api.dev.provable.com host still serves the pre-migration deployment). +# Override with SHIELD_SWAP_API_URL when the host moves again. +DEFAULT_API_URL = os.environ.get("SHIELD_SWAP_API_URL", + "https://amm-api-staging.dev.provable.com") _TIMEOUT = 30.0 T = TypeVar("T") @@ -61,7 +66,8 @@ def _build(cls: type[T], d: Any) -> T: @dataclass(frozen=True) class PoolEntry: """One ``/pools`` entry: the documented pool state plus the undocumented - per-token info (which carries the load-bearing ``wrapper_program``). + per-token info (which carries the load-bearing ``amm_token_program`` / + ``underlying_program`` pair). Delegates attribute access to the pool state, so ``entry.key`` works.""" pool: models.PoolStateDoc @@ -146,11 +152,17 @@ def access_status(self) -> models.AccessStatusResponse: self._get("/access/status")["data"]) def redeem_code(self, code: str) -> models.AccessRedeemResponse: - """Redeem an invite code; adopts the fresh token the API returns.""" + """Redeem an invite code. + + The staging API no longer returns a session token here (sessions + moved to the ``/auth/*`` endpoints) — re-authenticate after + redeeming. A token is still adopted if the API resurrects one. + """ out = _build(models.AccessRedeemResponse, self._post("/access/redeem", {"code": code})["data"]) - if out.token: - self._token = out.token + token = getattr(out, "token", None) + if token: + self._token = token return out def request_airdrop(self, address: str) -> models.AirdropStartResult: @@ -289,11 +301,12 @@ async def access_status(self) -> models.AccessStatusResponse: (await self._get("/access/status"))["data"]) async def redeem_code(self, code: str) -> models.AccessRedeemResponse: - """Redeem an invite code; adopts the fresh token the API returns.""" + """Redeem an invite code — see :meth:`ApiClient.redeem_code`.""" out = _build(models.AccessRedeemResponse, (await self._post("/access/redeem", {"code": code}))["data"]) - if out.token: - self._token = out.token + token = getattr(out, "token", None) + if token: + self._token = token return out async def request_airdrop(self, address: str) -> models.AirdropStartResult: diff --git a/shield-swap-sdk/python/aleo_shield_swap/async_client.py b/shield-swap-sdk/python/aleo_shield_swap/async_client.py index 9f9541bb..e1f7a5ae 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/async_client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/async_client.py @@ -263,7 +263,11 @@ async def get_balances(self, address: Optional[str] = None, if addr is None: raise ValueError("No address: pass address= or set aleo.default_account") tokens = await self.api.get_tokens() - by_program = {t.wrapper_program: t for t in tokens if t.wrapper_program} + # Spendable private records live in the record-funding program: the + # UNDERLYING program for wrapped assets, the ARC-20 itself for plain. + by_program = {t.underlying_program or t.amm_token_program: t + for t in tokens + if t.underlying_program or t.amm_token_program} private = await self.get_private_balances(list(by_program), account=acct) out: dict[str, dict[str, Any]] = {} for bal in await self.api.get_public_balances(addr): diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index 63174af5..77d7a3ad 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -352,7 +352,11 @@ def get_balances(self, address: Optional[str] = None, raise ValueError("No address: pass address= or set aleo.default_account") tokens = self.api.get_tokens() - by_program = {t.wrapper_program: t for t in tokens if t.wrapper_program} + # Spendable private records live in the record-funding program: the + # UNDERLYING program for wrapped assets, the ARC-20 itself for plain. + by_program = {t.underlying_program or t.amm_token_program: t + for t in tokens + if t.underlying_program or t.amm_token_program} own_address = str(acct.address) if acct is not None else None private = (self.get_private_balances(list(by_program), account=acct) if addr == own_address else {p: 0 for p in by_program}) diff --git a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py index 697d7afb..871b1d21 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py +++ b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py @@ -37,10 +37,12 @@ def __init__(self, dex: Any, profile: Any, invite_code: Optional[str], self._wrappers: Optional[list[str]] = None def wrapper_programs(self) -> list[str]: - """Airdroppable token programs, from the live token registry.""" + """Record-funding token programs (underlying for wrapped assets), + from the live token registry — where airdropped records land.""" if self._wrappers is None: - self._wrappers = [t.wrapper_program for t in self.dex.api.get_tokens() - if t.wrapper_program] + self._wrappers = [t.underlying_program or t.amm_token_program + for t in self.dex.api.get_tokens() + if t.underlying_program or t.amm_token_program] return self._wrappers def funded(self) -> bool: diff --git a/shield-swap-sdk/tests/fixtures/pools_response.json b/shield-swap-sdk/tests/fixtures/pools_response.json index e9350cb3..076e1d6d 100644 --- a/shield-swap-sdk/tests/fixtures/pools_response.json +++ b/shield-swap-sdk/tests/fixtures/pools_response.json @@ -1,41 +1,289 @@ { - "_source": "GET https://amm-api.dev.provable.com/pools (live capture, 2026-07-13)", - "data": [ - { - "id": "b23af9f7-cd72-4d52-928e-637b9748354c", - "key": "1981234481256911848949989598432010959786505150793860245840256594800529816749field", - "token0": "40965999173564918995621006824189398836596field", - "token1": "185528603099650286599904399730556391637784315808306865395426676field", - "enabled": true, - "creator": "aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc", - "fee": "5.0000000000000000", - "created_at": "2026-07-10T11:28:09", - "init_tx": "1f025079-439e-48f3-85fa-80751ef82ef9", - "scale0": "1", - "scale1": "1", - "token0_info": { - "id": "2c73efd2-3c96-43d9-9ae0-f319e4fbe8d5", - "address": "40965999173564918995621006824189398836596field", - "name": "Wrapped_USDCx", - "symbol": "wUSDCx", - "decimals": 6, - "image": null, - "wrapper_program": "test_arc20_wusdcx.aleo" - }, - "token1_info": { - "id": "39420ec1-cea5-42e3-b93f-1065ed47fda6", - "address": "185528603099650286599904399730556391637784315808306865395426676field", - "name": "Wrapped_ALEO", - "symbol": "wALEO", - "decimals": 6, - "image": null, - "wrapper_program": "test_arc20_wrapped_credits.aleo" - } - } - ], - "pagination": { - "total": 1, - "limit": 20, - "offset": 0 - } -} \ No newline at end of file + "data": [ + { + "id": "9fb78708-6f12-43ec-af2c-43f11eaf4385", + "key": "5905392528088736716502352327676815883959790811081903315511484137973858480171field", + "token0": "2118592438692976300771526183183732field", + "token1": "724721105858008932013114020280511843613117371369744086165619field", + "enabled": true, + "creator": "aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc", + "fee_percent": "1", + "created_at": "2026-07-28T11:01:55", + "init_tx": "355ece25-b42e-46df-be2f-00a120a3289d", + "token0_info": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + }, + "token1_info": { + "id": "e6a82bab-b762-4e6a-a714-3b6bc6720bf0", + "address": "724721105858008932013114020280511843613117371369744086165619field", + "name": "Aleo", + "symbol": "ALEO", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_credits.aleo", + "underlying_program": "credits.aleo", + "underlying_token_id": "32497618326483555field" + }, + "display_flipped": true, + "base_token": { + "id": "e6a82bab-b762-4e6a-a714-3b6bc6720bf0", + "address": "724721105858008932013114020280511843613117371369744086165619field", + "name": "Aleo", + "symbol": "ALEO", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_credits.aleo", + "underlying_program": "credits.aleo", + "underlying_token_id": "32497618326483555field" + }, + "quote_token": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + } + }, + { + "id": "ba4d8768-40c0-4189-aa60-28ede5d8e837", + "key": "172132360768538428736178966225670187308781992225627888611524574051967533493field", + "token0": "2118592438692976300771526183183732field", + "token1": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "enabled": true, + "creator": "aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc", + "fee_percent": "1", + "created_at": "2026-07-28T10:45:05", + "init_tx": "4ee62cdc-bbbe-4f14-b0c1-41a222e75a5f", + "token0_info": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + }, + "token1_info": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + }, + "display_flipped": false, + "base_token": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + }, + "quote_token": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + } + }, + { + "id": "88162b59-1f96-4e8c-8946-44b6f9a18997", + "key": "1173589166721621645334743807748851198116844333784471634115272069852805846368field", + "token0": "2118592438692976300771526183183732field", + "token1": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "enabled": true, + "creator": "aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc", + "fee_percent": "5", + "created_at": "2026-07-28T02:02:10", + "init_tx": "7c5f96d9-5d07-4fff-944e-dcbd286a5876", + "token0_info": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + }, + "token1_info": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + }, + "display_flipped": false, + "base_token": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + }, + "quote_token": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + } + }, + { + "id": "5074f243-d878-46d8-bd47-1f0621b930c0", + "key": "6085766987492189793297428838557366304238221215806401539320680501321625719720field", + "token0": "2118592438692976300771526183183732field", + "token1": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "enabled": true, + "creator": "aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc", + "fee_percent": "30", + "created_at": "2026-07-24T17:24:32", + "init_tx": "50166664-09cd-45f3-afc3-68d3ab4c5bd5", + "token0_info": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + }, + "token1_info": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + }, + "display_flipped": false, + "base_token": { + "id": "371f0de6-bc04-46d7-a49a-9eed51e58511", + "address": "2118592438692976300771526183183732field", + "name": "ETH", + "symbol": "ETH", + "decimals": 18, + "image": null, + "amm_token_program": "test_arc20_eth.aleo", + "underlying_program": "test_arc20_eth.aleo", + "underlying_token_id": "2118592438692976300771526183183732field" + }, + "quote_token": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + } + }, + { + "id": "7258e700-e4e9-4208-89dd-bece7ab103a3", + "key": "4893250659656889246983527897014734417939413618372988821054001413773444600836field", + "token0": "724721105858008932013114020280511843613117371369744086165619field", + "token1": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "enabled": true, + "creator": "aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc", + "fee_percent": "30", + "created_at": "2026-07-24T11:12:13", + "init_tx": "9a3fc387-de50-406e-a084-978001f004d9", + "token0_info": { + "id": "e6a82bab-b762-4e6a-a714-3b6bc6720bf0", + "address": "724721105858008932013114020280511843613117371369744086165619field", + "name": "Aleo", + "symbol": "ALEO", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_credits.aleo", + "underlying_program": "credits.aleo", + "underlying_token_id": "32497618326483555field" + }, + "token1_info": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + }, + "display_flipped": false, + "base_token": { + "id": "e6a82bab-b762-4e6a-a714-3b6bc6720bf0", + "address": "724721105858008932013114020280511843613117371369744086165619field", + "name": "Aleo", + "symbol": "ALEO", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_credits.aleo", + "underlying_program": "credits.aleo", + "underlying_token_id": "32497618326483555field" + }, + "quote_token": { + "id": "7f4ebbd0-438f-41bf-957c-62d5245629f7", + "address": "212707628815602939926313406778312270053663804591730917421274098438979020915field", + "name": "USDCx", + "symbol": "USDCx", + "decimals": 6, + "image": null, + "amm_token_program": "shield_swap_arc20_wrapped_usdcx.aleo", + "underlying_program": "test_usdcx_stablecoin.aleo", + "underlying_token_id": "161367108178681754800154536922102733562196220142964field" + } + } + ], + "pagination": { + "total": 5, + "limit": 20, + "offset": 0 + } +} diff --git a/shield-swap-sdk/tests/test_api_client.py b/shield-swap-sdk/tests/test_api_client.py index 00f8bed6..efc609a8 100644 --- a/shield-swap-sdk/tests/test_api_client.py +++ b/shield-swap-sdk/tests/test_api_client.py @@ -39,12 +39,12 @@ def test_get_pools_parses_models_and_token_info(): assert s.calls[0][1] == "https://x/pools" entry = pools[0] assert entry.key.endswith("field") # delegation to PoolStateDoc - assert entry.token0_info.wrapper_program.endswith(".aleo") + assert entry.token0_info.amm_token_program.endswith(".aleo") def test_get_route_stringifies_amount(): payload = {"data": {"hops": [], "token_in": "1field", "token_out": "2field", - "estimated_amount_out": "42.5"}} + "protocol_revision": 1, "estimated_amount_out": "42.5"}} s = _Session([_Resp(200, payload)]) route = ApiClient(base_url="https://x", session=s).get_route( token_in="1field", token_out="2field", amount_in=10**18) @@ -121,20 +121,21 @@ def test_access_status(): assert s.calls[0][:2] == ("GET", "https://x/access/status") -def test_redeem_code_adopts_new_token(): - api, s = _lifecycle_client(_Resp(200, {"data": {"code": "C", "status": "redeemed", - "token": "fresh-jwt"}})) +def test_redeem_code_no_longer_returns_a_token(): + # Staging moved sessions to /auth/* — redeem returns code/status only + # and the client keeps its existing credential. + api, s = _lifecycle_client(_Resp(200, {"data": {"code": "C", "status": "redeemed"}})) out = api.redeem_code("C") assert out.status == "redeemed" assert s.calls[0][2] == {"code": "C"} - assert api._token == "fresh-jwt" + assert api._token == "t" def test_request_airdrop_and_poll(): api, s = _lifecycle_client( _Resp(200, {"data": {"job_id": "j1", "status": "running"}}), _Resp(200, {"data": {"status": "complete", "total": 3, "results": [ - {"symbol": "wALEO", "wrapper_program": "waleo.aleo", + {"symbol": "wALEO", "amm_token_program": "waleo.aleo", "amount": "1000000", "status": "accepted", "tx_id": "at1...", "error": None}]}}), ) @@ -187,19 +188,19 @@ async def test_async_lifecycle_endpoints(): from aleo_shield_swap.errors import AirdropRateLimitedError c = _AsyncClient([ _AsyncResp(200, {"data": {"has_access": False}}), - _AsyncResp(200, {"data": {"code": "C", "status": "redeemed", "token": "t2"}}), + _AsyncResp(200, {"data": {"code": "C", "status": "redeemed"}}), _AsyncResp(200, {"data": {"job_id": "j1", "status": "running"}}), _AsyncResp(200, {"data": {"status": "complete", "total": 1, "results": [ - {"symbol": "wETH", "wrapper_program": "weth.aleo", + {"symbol": "wETH", "amm_token_program": "weth.aleo", "amount": "5", "status": "accepted"}]}}), _AsyncResp(429, {"error": "already claimed"}), ]) api = AsyncApiClient(base_url="https://x", client=c, token="t") assert (await api.access_status()).has_access is False - assert (await api.redeem_code("C")).token == "t2" - assert api._token == "t2" + assert (await api.redeem_code("C")).status == "redeemed" + assert api._token == "t" # redeem no longer rotates the credential assert (await api.request_airdrop("aleo1a")).job_id == "j1" job = await api.get_airdrop_job("j1") - assert job.results[0].wrapper_program == "weth.aleo" + assert job.results[0].amm_token_program == "weth.aleo" with pytest.raises(AirdropRateLimitedError): await api.request_airdrop("aleo1a") diff --git a/shield-swap-sdk/tests/test_api_models.py b/shield-swap-sdk/tests/test_api_models.py index 1ac45ade..800ac129 100644 --- a/shield-swap-sdk/tests/test_api_models.py +++ b/shield-swap-sdk/tests/test_api_models.py @@ -33,7 +33,11 @@ def test_token_doc_parses_undocumented_token_info(): info = POOLS["data"][0]["token0_info"] tok = _filtered(m.TokenDoc, info) assert tok.decimals >= 0 - assert tok.wrapper_program is not None and tok.wrapper_program.endswith(".aleo") + assert tok.amm_token_program is not None and tok.amm_token_program.endswith(".aleo") + # The staging registry names the record-funding program per token: + # underlying for wrapped assets, the ARC-20 itself for plain tokens. + assert tok.underlying_program is not None and tok.underlying_program.endswith(".aleo") + assert tok.underlying_token_id is not None def test_route_models_exist(): diff --git a/shield-swap-sdk/tests/test_lifecycle.py b/shield-swap-sdk/tests/test_lifecycle.py index 59e1186e..8387246a 100644 --- a/shield-swap-sdk/tests/test_lifecycle.py +++ b/shield-swap-sdk/tests/test_lifecycle.py @@ -8,8 +8,9 @@ class _Tok: - def __init__(self, wrapper_program): - self.wrapper_program = wrapper_program + def __init__(self, program): + self.amm_token_program = program + self.underlying_program = program class _StubApi: From adc1700890a82560c671e1066bbf73d24c3b920c Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 11:22:41 -0500 Subject: [PATCH 10/23] docs(shield-swap): re-point docs, fixtures, and helpers at the new stack --- sdk/benchmarks/bench_proving.py | 4 ++-- shield-swap-sdk/AGENTS.md | 8 ++++++-- shield-swap-sdk/README.md | 12 +++++++++++- shield-swap-sdk/codegen/gen_context.py | 8 ++++++-- shield-swap-sdk/python/aleo_shield_swap/AGENTS.md | 8 ++++++-- shield-swap-sdk/scripts/rehearsal.py | 5 ++--- shield-swap-sdk/tests/test_claim.py | 2 +- shield-swap-sdk/tests/test_client_reads.py | 4 ++-- shield-swap-sdk/tests/test_journal.py | 2 +- shield-swap-sdk/tests/test_swap_many.py | 2 +- 10 files changed, 38 insertions(+), 17 deletions(-) diff --git a/sdk/benchmarks/bench_proving.py b/sdk/benchmarks/bench_proving.py index 5b17d758..bb3f6dd8 100644 --- a/sdk/benchmarks/bench_proving.py +++ b/sdk/benchmarks/bench_proving.py @@ -12,8 +12,8 @@ * ``credits.aleo/transfer_public`` * ``credits.aleo/transfer_private`` (spends a real credits record) -* ``shield_swap_v3.aleo/swap`` (spends a token record, blinded output) -* ``shield_swap_v3.aleo/mint`` (spends two token records) +* ``shield_swap.aleo/swap`` (spends a token record, blinded output) +* ``shield_swap.aleo/mint`` (spends two token records) The first prove of each function synthesizes its proving key (and may download SNARK parameters into ``~/.aleo/resources``) — that iteration is diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index 7e4ded8e..cde9d76e 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -177,8 +177,12 @@ them): the token registry; pass `imports=`/`token_*_program=` to override). - **Tokens are private records**: spendable balances do not appear in public reads; one covering record funds an amount — no aggregation. -- **Amounts obey the no-dust rule** both directions (`amount % scale == 0`); - quote in canonical decimals, transact in raw base units, display human. +- **Amounts are raw native units end to end** (the AMM does no decimal + scaling); quote in canonical decimals, transact in raw base units, + display human. +- **Wrapped assets route automatically** (swap/claim/LP verbs dispatch to + the routers per token shape) — fund them with UNDERLYING records; never + hand wrapper records around. - **A `SwapHandle` is the only key to a swap's output** — persist before anything else (the journal does this); claim after finalize with retry. - **Concurrency needs partitioned blinded-identity counters AND disjoint diff --git a/shield-swap-sdk/README.md b/shield-swap-sdk/README.md index 383ed6db..22b30c94 100644 --- a/shield-swap-sdk/README.md +++ b/shield-swap-sdk/README.md @@ -21,6 +21,16 @@ handle = dex.swap(pool_key=pools[0].key, out = dex.claim_swap_output(handle).delegate() # broadcasts; spends funds ``` +Targets the deployed `shield_swap.aleo` stack on testnet. Amounts are raw +native token units (the AMM does no decimal scaling); prices are Q128.128. +Wrapped assets (ALEO/USAD/USDCx) **route automatically** through the swap/LP +routers — fund them with *underlying* records (`credits.aleo` / stablecoin); +you never handle wrapper records. `mint` stores an immutable `withdrawal` +address on the position NFT (defaults to the recipient) and `collect` always +pays it — decide the payout wallet at mint time. The off-chain API default is +the staging host `https://amm-api-staging.dev.provable.com` (override with +`SHIELD_SWAP_API_URL`). + ## Install ```bash @@ -170,7 +180,7 @@ ALEO_DEVNODE_UNPROVEN=1 \ python -m pytest -m devnode # full AMM lifecycle on a local aleo-devnode ``` -The devnode tier deploys the vendored `shield_swap_v3.aleo` stack and drives +The devnode tier deploys the vendored `shield_swap.aleo` stack and drives pool creation, liquidity, swaps, and burn end-to-end, hermetically. It needs the `aleo-devnode` binary (`ALEO_DEVNODE_BIN` or on `PATH`) and skips otherwise. Deployments are proofless (dummy verifying keys — the devnode diff --git a/shield-swap-sdk/codegen/gen_context.py b/shield-swap-sdk/codegen/gen_context.py index bdf9d42e..deee2cba 100644 --- a/shield-swap-sdk/codegen/gen_context.py +++ b/shield-swap-sdk/codegen/gen_context.py @@ -151,8 +151,12 @@ the token registry; pass `imports=`/`token_*_program=` to override). - **Tokens are private records**: spendable balances do not appear in public reads; one covering record funds an amount — no aggregation. -- **Amounts obey the no-dust rule** both directions (`amount % scale == 0`); - quote in canonical decimals, transact in raw base units, display human. +- **Amounts are raw native units end to end** (the AMM does no decimal + scaling); quote in canonical decimals, transact in raw base units, + display human. +- **Wrapped assets route automatically** (swap/claim/LP verbs dispatch to + the routers per token shape) — fund them with UNDERLYING records; never + hand wrapper records around. - **A `SwapHandle` is the only key to a swap's output** — persist before anything else (the journal does this); claim after finalize with retry. - **Concurrency needs partitioned blinded-identity counters AND disjoint diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index 7e4ded8e..cde9d76e 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -177,8 +177,12 @@ them): the token registry; pass `imports=`/`token_*_program=` to override). - **Tokens are private records**: spendable balances do not appear in public reads; one covering record funds an amount — no aggregation. -- **Amounts obey the no-dust rule** both directions (`amount % scale == 0`); - quote in canonical decimals, transact in raw base units, display human. +- **Amounts are raw native units end to end** (the AMM does no decimal + scaling); quote in canonical decimals, transact in raw base units, + display human. +- **Wrapped assets route automatically** (swap/claim/LP verbs dispatch to + the routers per token shape) — fund them with UNDERLYING records; never + hand wrapper records around. - **A `SwapHandle` is the only key to a swap's output** — persist before anything else (the journal does this); claim after finalize with retry. - **Concurrency needs partitioned blinded-identity counters AND disjoint diff --git a/shield-swap-sdk/scripts/rehearsal.py b/shield-swap-sdk/scripts/rehearsal.py index e7b90466..4d1ab81c 100644 --- a/shield-swap-sdk/scripts/rehearsal.py +++ b/shield-swap-sdk/scripts/rehearsal.py @@ -59,11 +59,10 @@ def main() -> int: results.append(("collection", f"{len(collected.claimed)} claimed, " f"{len(collected.still_pending)} pending")) - state = dex.get_pool(pools[0].key) lo, hi = dex.get_slot(pools[0].key).tick_range(width=4) minted = dex.mint(pool_key=pools[0].key, tick_lower=lo, tick_upper=hi, - amount0_desired=100 * int(state.scale0), - amount1_desired=100 * int(state.scale1)).delegate() + amount0_desired=10**5, # raw native units — no scaling + amount1_desired=10**5).delegate() pos = dex._position_state(minted.position_token_id) from aleo_shield_swap._core import find_position_plaintext import time diff --git a/shield-swap-sdk/tests/test_claim.py b/shield-swap-sdk/tests/test_claim.py index 0e9a8db9..a1d42a97 100644 --- a/shield-swap-sdk/tests/test_claim.py +++ b/shield-swap-sdk/tests/test_claim.py @@ -22,7 +22,7 @@ def _handle(**over): base = dict(swap_id="77field", blinding_factor="11field", blinded_address="aleo1blinded", token_in_id="1field", token_out_id="2field", pool_key="5field", - amount_in=10**9, transaction_id="at1req", program="shield_swap_v3.aleo") + amount_in=10**9, transaction_id="at1req", program="shield_swap.aleo") base.update(over) return SwapHandle(**base) diff --git a/shield-swap-sdk/tests/test_client_reads.py b/shield-swap-sdk/tests/test_client_reads.py index ad77b2b1..123b341e 100644 --- a/shield-swap-sdk/tests/test_client_reads.py +++ b/shield-swap-sdk/tests/test_client_reads.py @@ -36,14 +36,14 @@ def test_get_swap_output_absent_raises(stub_aleo): def test_get_swap_output_accepts_handle(stub_aleo): handle = SwapHandle(swap_id="9field", blinding_factor=None, blinded_address=None, token_in_id="1field", token_out_id="2field", pool_key="5field", - amount_in=1, transaction_id="at1x", program="shield_swap_v3.aleo") + amount_in=1, transaction_id="at1x", program="shield_swap.aleo") with pytest.raises(SwapOutputNotFinalizedError): # resolved to the id ShieldSwap(stub_aleo).get_swap_output(handle) with pytest.raises(ValueError, match="no swap_id"): ShieldSwap(stub_aleo).get_swap_output( SwapHandle(swap_id=None, blinding_factor=None, blinded_address=None, token_in_id="1field", token_out_id="2field", pool_key="5field", - amount_in=1, transaction_id="at1x", program="shield_swap_v3.aleo")) + amount_in=1, transaction_id="at1x", program="shield_swap.aleo")) def test_uninitialized_pool_distinct_from_missing(stub_aleo): diff --git a/shield-swap-sdk/tests/test_journal.py b/shield-swap-sdk/tests/test_journal.py index 5f1b6c12..74ea5d50 100644 --- a/shield-swap-sdk/tests/test_journal.py +++ b/shield-swap-sdk/tests/test_journal.py @@ -8,7 +8,7 @@ def _handle(swap_id="s1", **kw): base = dict(swap_id=swap_id, blinding_factor="bf", blinded_address="ba", token_in_id="t0", token_out_id="t1", pool_key="pk", - amount_in=5, transaction_id="tx1", program="shield_swap_v3.aleo") + amount_in=5, transaction_id="tx1", program="shield_swap.aleo") base.update(kw) return SwapHandle(**base) diff --git a/shield-swap-sdk/tests/test_swap_many.py b/shield-swap-sdk/tests/test_swap_many.py index df4b701f..355d689b 100644 --- a/shield-swap-sdk/tests/test_swap_many.py +++ b/shield-swap-sdk/tests/test_swap_many.py @@ -59,7 +59,7 @@ def delegate(inner, account=None, **kw): token_in_id=token_in_id, token_out_id="t1", pool_key=pool_key, amount_in=amount_in, transaction_id=f"tx{identity.counter}", - program="shield_swap_v3.aleo") + program="shield_swap.aleo") return _Call() return fake_swap, calls From 6f3b03b7c76ec32a7ae853087dffc1ee283485cf Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 11:35:13 -0500 Subject: [PATCH 11/23] test(shield-swap): devnode + live cutover coverage for the new stack --- .../python/aleo_shield_swap/client.py | 27 +- .../tests/fixtures/programs/shield_swap.aleo | 24358 ++++++++++++++++ .../programs/shield_swap_freezelist.aleo | 173 + ...re.aleo => shield_swap_multisig_core.aleo} | 33 +- .../fixtures/programs/shield_swap_v3.aleo | 6439 ---- .../tests/integration/devnode_amm.py | 46 +- .../integration/test_agent_lifecycle_live.py | 15 +- .../integration/test_devnode_lifecycle.py | 59 +- .../tests/integration/test_drift.py | 22 +- .../tests/integration/test_reads_live.py | 30 +- .../tests/integration/test_swap_lifecycle.py | 70 +- 11 files changed, 24770 insertions(+), 6502 deletions(-) create mode 100644 shield-swap-sdk/tests/fixtures/programs/shield_swap.aleo create mode 100644 shield-swap-sdk/tests/fixtures/programs/shield_swap_freezelist.aleo rename shield-swap-sdk/tests/fixtures/programs/{test_shield_swap_multisig_core.aleo => shield_swap_multisig_core.aleo} (96%) delete mode 100644 shield-swap-sdk/tests/fixtures/programs/shield_swap_v3.aleo diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index 77d7a3ad..34f734a8 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -399,9 +399,10 @@ def _ensure(self, token_programs: list[str], def _lp_programs(self, route: Any, program0: str, program1: str, pool: Any, w0: bool, w1: bool) -> list[str]: """Programs a (possibly routed) LP call touches: both funding - programs, the LP router when routed, and each wrapped side's - wrapper program (the router's dynamic-dispatch callee).""" - pids = [program0, program1] + programs (None when an explicit record made resolution unnecessary), + the LP router when routed, and each wrapped side's wrapper program + (the router's dynamic-dispatch callee).""" + pids = [p for p in (program0, program1) if p] if route.program != self.program: pids.append(route.program) for token_id, wrapped in ((pool.token0, w0), (pool.token1, w1)): @@ -461,11 +462,13 @@ def swap( swap_nonce = nonce if nonce is not None else generate_swap_nonce() identity = identity or next_blinded_identity(self._aleo, acct, self.program) - # An explicit record still needs its program registered with the - # prover — resolve it unless the caller named one. - program = token_in_program or self._token_program(token_in_id) + # Resolve the record-funding program lazily: an explicit record + # needs no registry lookup (its program registration comes from + # token_in_program= or imports=). + program = token_in_program record = token_record if record is None: + program = program or self._token_program(token_in_id) record = select_token_record( self._aleo, program=program, min_amount=amount_in, token_id=token_in_id, account=acct, @@ -951,8 +954,10 @@ def mint( tick_lower_hint=lo_hint, tick_upper_hint=hi_hint, ).to_plaintext() - program0 = token0_program or self._token_program(pool.token0) - program1 = token1_program or self._token_program(pool.token1) + program0 = token0_program or ( + None if token0_record else self._token_program(pool.token0)) + program1 = token1_program or ( + None if token1_record else self._token_program(pool.token1)) record0 = token0_record or select_token_record( self._aleo, program=program0, min_amount=amount0_desired, token_id=pool.token0, account=acct) @@ -1025,8 +1030,10 @@ def increase_liquidity( hi_hint = (tick_upper_hint if tick_upper_hint is not None else pick_insert_hint(slot, int(decoded["tick_upper"]))) - program0 = token0_program or self._token_program(pool.token0) - program1 = token1_program or self._token_program(pool.token1) + program0 = token0_program or ( + None if token0_record else self._token_program(pool.token0)) + program1 = token1_program or ( + None if token1_record else self._token_program(pool.token1)) record0 = token0_record or select_token_record( self._aleo, program=program0, min_amount=amount0_desired, token_id=pool.token0, account=acct) diff --git a/shield-swap-sdk/tests/fixtures/programs/shield_swap.aleo b/shield-swap-sdk/tests/fixtures/programs/shield_swap.aleo new file mode 100644 index 00000000..a4724daa --- /dev/null +++ b/shield-swap-sdk/tests/fixtures/programs/shield_swap.aleo @@ -0,0 +1,24358 @@ +import shield_swap_freezelist.aleo; +import shield_swap_multisig_core.aleo; + +program shield_swap.aleo; + +record PositionNFT: + owner as address.private; + withdrawal as address.private; + token_id as field.private; + token0_id as field.private; + token1_id as field.private; + pool as field.private; + tick_lower as i32.private; + tick_upper as i32.private; + +struct U256__8JquwLopp8: + hi as u128; + lo as u128; + +struct SwapRequest: + pool as field; + zero_for_one as boolean; + amount_in as u128; + amount_out_min as u128; + sqrt_price_limit as U256__8JquwLopp8; + recipient as address; + nonce as u64; + deadline as u32; + +record SwapComplianceRecord: + owner as address.private; + swap_id as field.private; + token_in as field.private; + token_out as field.private; + request as SwapRequest.private; + caller as address.private; + signer as address.private; + blinded_address as address.private; + +struct SwapHop: + pool as field; + zero_for_one as boolean; + sqrt_price_limit as U256__8JquwLopp8; + +struct SwapMultiHopRequest: + token_in as field; + token_out as field; + amount_in as u128; + amount_out_min as u128; + recipient as address; + hop0 as SwapHop; + hop1 as SwapHop; + hop2 as SwapHop; + hop_count as u8; + nonce as u64; + deadline as u32; + caller as address; + +record MultiHopSwapComplianceRecord: + owner as address.private; + swap_id as field.private; + request as SwapMultiHopRequest.private; + caller as address.private; + signer as address.private; + blinded_address as address.private; + +struct MintPositionRequest: + pool as field; + tick_lower as i32; + tick_upper as i32; + amount0_desired as u128; + amount1_desired as u128; + amount0_min as u128; + amount1_min as u128; + tick_lower_hint as i32; + tick_upper_hint as i32; + +record MintComplianceRecord: + owner as address.private; + token_id as field.private; + token0_id as field.private; + token1_id as field.private; + nonce as field.private; + request as MintPositionRequest.private; + caller as address.private; + signer as address.private; + recipient as address.private; + withdrawal as address.private; + +struct ChecksumEdition: + checksum as [u8; 32u32]; + edition as u16; + +struct MerkleProof: + siblings as [field; 16u32]; + leaf_index as u32; + +struct PoolState: + token0 as field; + token1 as field; + fee as u16; + enabled as boolean; + +struct Slot: + tick as i32; + tick_spacing as u32; + sqrt_price as U256__8JquwLopp8; + fee_protocol as u8; + liquidity as u128; + fee_growth_global0_x_128 as U256__8JquwLopp8; + fee_growth_global1_x_128 as U256__8JquwLopp8; + max_liquidity_per_tick as u128; + protocol_fees0 as u128; + protocol_fees1 as u128; + next_init_below as i32; + next_init_above as i32; + +struct Tick: + pool as field; + liquidity_net as i128; + liquidity_gross as u128; + tick as i32; + fee_growth_outside0_x_128 as U256__8JquwLopp8; + fee_growth_outside1_x_128 as U256__8JquwLopp8; + prev as i32; + next as i32; + +struct Position: + token_id as field; + pool as field; + tick_lower as i32; + tick_upper as i32; + liquidity as u128; + fee_growth_inside0_last_x_128 as U256__8JquwLopp8; + fee_growth_inside1_last_x_128 as U256__8JquwLopp8; + tokens_owed0 as u128; + tokens_owed1 as u128; + +struct PoolKey: + token0 as field; + token1 as field; + fee as u16; + +struct PairKey: + token0 as field; + token1 as field; + +struct TickKey: + pool as field; + tick as i32; + +struct SwapKey: + pool as field; + zero_for_one as boolean; + amount_in as u128; + sqrt_price_limit as U256__8JquwLopp8; + recipient as address; + nonce as u64; + caller as address; + +struct TokenIDPreimage: + request as MintPositionRequest; + recipient as address; + nonce as field; + +struct SwapIterCfg: + z as boolean; + lim as U256__8JquwLopp8; + fee_pips as u32; + fee_protocol as u8; + slot_fg0 as U256__8JquwLopp8; + slot_fg1 as U256__8JquwLopp8; + +struct SwapIterState: + sp as U256__8JquwLopp8; + rem as u128; + out as u128; + fg as U256__8JquwLopp8; + liq as u128; + tk as i32; + crossed as boolean; + pf as u128; + nb as i32; + na as i32; + +struct SwapOutput: + recipient as address; + caller as address; + token_in as field; + token_out as field; + amount_out as u128; + amount_remaining as u128; + +mapping pools: + key as field.public; + value as PoolState.public; + +mapping slots: + key as field.public; + value as Slot.public; + +mapping ticks: + key as field.public; + value as Tick.public; + +mapping initialized_pools: + key as field.public; + value as boolean.public; + +mapping tick_spacings: + key as u32.public; + value as boolean.public; + +mapping fee_tiers: + key as u16.public; + value as boolean.public; + +mapping fee_to_tick_spacing: + key as u16.public; + value as u32.public; + +mapping positions: + key as field.public; + value as Position.public; + +mapping swap_outputs: + key as field.public; + value as SwapOutput.public; + +mapping admin: + key as boolean.public; + value as address.public; + +mapping pending_admin: + key as boolean.public; + value as address.public; + +mapping used_blinded_addresses: + key as address.public; + value as boolean.public; + +mapping pool_creation_is_open: + key as boolean.public; + value as boolean.public; + +mapping global_paused: + key as boolean.public; + value as boolean.public; + +mapping token_allowed: + key as field.public; + value as boolean.public; + +mapping token_paused: + key as field.public; + value as boolean.public; + +mapping pair_paused: + key as PairKey.public; + value as boolean.public; + +mapping frozen_position: + key as field.public; + value as u32.public; + +mapping from_wrapper_token_id: + key as field.public; + value as field.public; + +mapping to_wrapper_token_id: + key as field.public; + value as field.public; + +function transfer_admin: + input r0 as address.public; + async transfer_admin self.caller r0 into r1; + output r1 as shield_swap.aleo/transfer_admin.future; + +finalize transfer_admin: + input r0 as address.public; + input r1 as address.public; + get admin[true] into r2; + is.eq r0 r2 into r3; + assert.eq r3 true; + set r1 into pending_admin[true]; + +function accept_admin: + async accept_admin self.caller into r0; + output r0 as shield_swap.aleo/accept_admin.future; + +finalize accept_admin: + input r0 as address.public; + get pending_admin[true] into r1; + is.eq r0 r1 into r2; + assert.eq r2 true; + set r0 into admin[true]; + remove pending_admin[true]; + +function add_tick_spacing: + input r0 as u32.public; + async add_tick_spacing self.caller r0 into r1; + output r1 as shield_swap.aleo/add_tick_spacing.future; + +finalize add_tick_spacing: + input r0 as address.public; + input r1 as u32.public; + get admin[true] into r2; + is.eq r0 r2 into r3; + assert.eq r3 true; + gt r1 0u32 into r4; + assert.eq r4 true; + lte r1 400000u32 into r5; + assert.eq r5 true; + set true into tick_spacings[r1]; + +function add_fee_tier: + input r0 as u16.public; + async add_fee_tier self.caller r0 into r1; + output r1 as shield_swap.aleo/add_fee_tier.future; + +finalize add_fee_tier: + input r0 as address.public; + input r1 as u16.public; + get admin[true] into r2; + is.eq r0 r2 into r3; + assert.eq r3 true; + set true into fee_tiers[r1]; + +function bind_fee_to_tick_spacing: + input r0 as u16.public; + input r1 as u32.public; + async bind_fee_to_tick_spacing self.caller r0 r1 into r2; + output r2 as shield_swap.aleo/bind_fee_to_tick_spacing.future; + +finalize bind_fee_to_tick_spacing: + input r0 as address.public; + input r1 as u16.public; + input r2 as u32.public; + get admin[true] into r3; + is.eq r0 r3 into r4; + assert.eq r4 true; + get.or_use fee_tiers[r1] false into r5; + assert.eq r5 true; + get.or_use tick_spacings[r2] false into r6; + assert.eq r6 true; + set r2 into fee_to_tick_spacing[r1]; + +function set_pool_enabled: + input r0 as field.public; + input r1 as boolean.public; + async set_pool_enabled self.caller r0 r1 into r2; + output r2 as shield_swap.aleo/set_pool_enabled.future; + +finalize set_pool_enabled: + input r0 as address.public; + input r1 as field.public; + input r2 as boolean.public; + get admin[true] into r3; + is.eq r0 r3 into r4; + assert.eq r4 true; + get pools[r1] into r5; + cast r5.token0 r5.token1 r5.fee r2 into r6 as PoolState; + set r6 into pools[r1]; + +function set_pool_creation_is_open: + input r0 as boolean.public; + async set_pool_creation_is_open self.caller r0 into r1; + output r1 as shield_swap.aleo/set_pool_creation_is_open.future; + +finalize set_pool_creation_is_open: + input r0 as address.public; + input r1 as boolean.public; + get admin[true] into r2; + is.eq r0 r2 into r3; + assert.eq r3 true; + set r1 into pool_creation_is_open[true]; + +function set_global_paused: + input r0 as boolean.public; + async set_global_paused self.caller r0 into r1; + output r1 as shield_swap.aleo/set_global_paused.future; + +finalize set_global_paused: + input r0 as address.public; + input r1 as boolean.public; + get admin[true] into r2; + is.eq r0 r2 into r3; + assert.eq r3 true; + set r1 into global_paused[true]; + +function allow_token: + input r0 as field.public; + input r1 as field.public; + async allow_token self.caller r0 r1 into r2; + output r2 as shield_swap.aleo/allow_token.future; + +finalize allow_token: + input r0 as address.public; + input r1 as field.public; + input r2 as field.public; + get admin[true] into r3; + is.eq r0 r3 into r4; + assert.eq r4 true; + contains token_allowed[r1] into r5; + not r5 into r6; + assert.eq r6 true; + set true into token_allowed[r1]; + contains from_wrapper_token_id[r1] into r7; + not r7 into r8; + assert.eq r8 true; + contains to_wrapper_token_id[r1] into r9; + not r9 into r10; + assert.eq r10 true; + contains from_wrapper_token_id[r2] into r11; + not r11 into r12; + assert.eq r12 true; + contains to_wrapper_token_id[r2] into r13; + not r13 into r14; + assert.eq r14 true; + is.neq r1 r2 into r15; + branch.eq r15 false to end_then_0_0; + set r2 into from_wrapper_token_id[r1]; + set r1 into to_wrapper_token_id[r2]; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + +function set_token_paused: + input r0 as field.public; + input r1 as boolean.public; + async set_token_paused self.caller r0 r1 into r2; + output r2 as shield_swap.aleo/set_token_paused.future; + +finalize set_token_paused: + input r0 as address.public; + input r1 as field.public; + input r2 as boolean.public; + get admin[true] into r3; + is.eq r0 r3 into r4; + assert.eq r4 true; + set r2 into token_paused[r1]; + +function set_pair_paused: + input r0 as field.public; + input r1 as field.public; + input r2 as boolean.public; + lt r0 r1 into r3; + ternary r3 r0 r1 into r4; + ternary r3 r1 r0 into r5; + cast r4 r5 into r6 as PairKey; + async set_pair_paused self.caller r6 r2 into r7; + output r7 as shield_swap.aleo/set_pair_paused.future; + +finalize set_pair_paused: + input r0 as address.public; + input r1 as PairKey.public; + input r2 as boolean.public; + get admin[true] into r3; + is.eq r0 r3 into r4; + assert.eq r4 true; + set r2 into pair_paused[r1]; + +view view_sqrt_price_at_tick_x128: + input r0 as i32.public; + gte r0 -524287i32 into r1; + lte r0 524287i32 into r2; + and r1 r2 into r3; + assert.eq r3 true; + lt r0 0i32 into r4; + sub 0i32 r0 into r5; + ternary r4 r5 r0 into r6; + gte r6 0i32 into r7; + assert.eq r7 true; + cast r6 into r8 as u32; + and r8 3u32 into r9; + is.eq r9 0u32 into r10; + is.eq r9 1u32 into r11; + is.eq r9 2u32 into r12; + ternary r12 0u128 0u128 into r13; + ternary r12 340248342086729790484326174814286782778u128 340231330945450418515964920540021147199u128 into r14; + cast r13 r14 into r15 as U256__8JquwLopp8; + ternary r11 0u128 r15.hi into r16; + ternary r11 340265354078544963557816517032075149313u128 r15.lo into r17; + cast r16 r17 into r18 as U256__8JquwLopp8; + ternary r10 1u128 r18.hi into r19; + ternary r10 0u128 r18.lo into r20; + cast r19 r20 into r21 as U256__8JquwLopp8; + and r8 4u32 into r22; + is.neq r22 0u32 into r23; + and r21.lo 18446744073709551615u128 into r24; + shr r21.lo 64u8 into r25; + mul r24 17226890335427755468u128 into r26; + mul r24 18443055278223354162u128 into r27; + mul r25 17226890335427755468u128 into r28; + mul r25 18443055278223354162u128 into r29; + and r26 18446744073709551615u128 into r30; + shr r26 64u8 into r31; + and r27 18446744073709551615u128 into r32; + add r31 r32 into r33; + and r28 18446744073709551615u128 into r34; + add r33 r34 into r35; + and r35 18446744073709551615u128 into r36; + shr r35 64u8 into r37; + shr r27 64u8 into r38; + shr r28 64u8 into r39; + add r38 r39 into r40; + and r29 18446744073709551615u128 into r41; + add r40 r41 into r42; + add r42 r37 into r43; + and r43 18446744073709551615u128 into r44; + shr r43 64u8 into r45; + shr r29 64u8 into r46; + add r46 r45 into r47; + shl r47 64u8 into r48; + add r48 r44 into r49; + shl r36 64u8 into r50; + add r50 r30 into r51; + and r21.hi 18446744073709551615u128 into r52; + shr r21.hi 64u8 into r53; + mul r52 17226890335427755468u128 into r54; + mul r52 18443055278223354162u128 into r55; + mul r53 17226890335427755468u128 into r56; + mul r53 18443055278223354162u128 into r57; + and r54 18446744073709551615u128 into r58; + shr r54 64u8 into r59; + and r55 18446744073709551615u128 into r60; + add r59 r60 into r61; + and r56 18446744073709551615u128 into r62; + add r61 r62 into r63; + and r63 18446744073709551615u128 into r64; + shr r63 64u8 into r65; + shr r55 64u8 into r66; + shr r56 64u8 into r67; + add r66 r67 into r68; + and r57 18446744073709551615u128 into r69; + add r68 r69 into r70; + add r70 r65 into r71; + and r71 18446744073709551615u128 into r72; + shr r71 64u8 into r73; + shr r57 64u8 into r74; + add r74 r73 into r75; + shl r75 64u8 into r76; + add r76 r72 into r77; + shl r64 64u8 into r78; + add r78 r58 into r79; + add.w r49 r79 into r80; + lt r80 r49 into r81; + ternary r81 1u128 0u128 into r82; + add.w r77 r82 into r83; + cast r83 r80 into r84 as U256__8JquwLopp8; + ternary r23 r84.hi r21.hi into r85; + ternary r23 r84.lo r21.lo into r86; + cast r85 r86 into r87 as U256__8JquwLopp8; + and r8 8u32 into r88; + is.neq r88 0u32 into r89; + and r87.lo 18446744073709551615u128 into r90; + shr r87.lo 64u8 into r91; + mul r90 2032852871939366096u128 into r92; + mul r90 18439367220385604838u128 into r93; + mul r91 2032852871939366096u128 into r94; + mul r91 18439367220385604838u128 into r95; + and r92 18446744073709551615u128 into r96; + shr r92 64u8 into r97; + and r93 18446744073709551615u128 into r98; + add r97 r98 into r99; + and r94 18446744073709551615u128 into r100; + add r99 r100 into r101; + and r101 18446744073709551615u128 into r102; + shr r101 64u8 into r103; + shr r93 64u8 into r104; + shr r94 64u8 into r105; + add r104 r105 into r106; + and r95 18446744073709551615u128 into r107; + add r106 r107 into r108; + add r108 r103 into r109; + and r109 18446744073709551615u128 into r110; + shr r109 64u8 into r111; + shr r95 64u8 into r112; + add r112 r111 into r113; + shl r113 64u8 into r114; + add r114 r110 into r115; + shl r102 64u8 into r116; + add r116 r96 into r117; + and r87.hi 18446744073709551615u128 into r118; + shr r87.hi 64u8 into r119; + mul r118 2032852871939366096u128 into r120; + mul r118 18439367220385604838u128 into r121; + mul r119 2032852871939366096u128 into r122; + mul r119 18439367220385604838u128 into r123; + and r120 18446744073709551615u128 into r124; + shr r120 64u8 into r125; + and r121 18446744073709551615u128 into r126; + add r125 r126 into r127; + and r122 18446744073709551615u128 into r128; + add r127 r128 into r129; + and r129 18446744073709551615u128 into r130; + shr r129 64u8 into r131; + shr r121 64u8 into r132; + shr r122 64u8 into r133; + add r132 r133 into r134; + and r123 18446744073709551615u128 into r135; + add r134 r135 into r136; + add r136 r131 into r137; + and r137 18446744073709551615u128 into r138; + shr r137 64u8 into r139; + shr r123 64u8 into r140; + add r140 r139 into r141; + shl r141 64u8 into r142; + add r142 r138 into r143; + shl r130 64u8 into r144; + add r144 r124 into r145; + add.w r115 r145 into r146; + lt r146 r115 into r147; + ternary r147 1u128 0u128 into r148; + add.w r143 r148 into r149; + cast r149 r146 into r150 as U256__8JquwLopp8; + ternary r89 r150.hi r87.hi into r151; + ternary r89 r150.lo r87.lo into r152; + cast r151 r152 into r153 as U256__8JquwLopp8; + and r8 16u32 into r154; + is.neq r154 0u32 into r155; + and r153.lo 18446744073709551615u128 into r156; + shr r153.lo 64u8 into r157; + mul r156 14545316742740207172u128 into r158; + mul r156 18431993317065449817u128 into r159; + mul r157 14545316742740207172u128 into r160; + mul r157 18431993317065449817u128 into r161; + and r158 18446744073709551615u128 into r162; + shr r158 64u8 into r163; + and r159 18446744073709551615u128 into r164; + add r163 r164 into r165; + and r160 18446744073709551615u128 into r166; + add r165 r166 into r167; + and r167 18446744073709551615u128 into r168; + shr r167 64u8 into r169; + shr r159 64u8 into r170; + shr r160 64u8 into r171; + add r170 r171 into r172; + and r161 18446744073709551615u128 into r173; + add r172 r173 into r174; + add r174 r169 into r175; + and r175 18446744073709551615u128 into r176; + shr r175 64u8 into r177; + shr r161 64u8 into r178; + add r178 r177 into r179; + shl r179 64u8 into r180; + add r180 r176 into r181; + shl r168 64u8 into r182; + add r182 r162 into r183; + and r153.hi 18446744073709551615u128 into r184; + shr r153.hi 64u8 into r185; + mul r184 14545316742740207172u128 into r186; + mul r184 18431993317065449817u128 into r187; + mul r185 14545316742740207172u128 into r188; + mul r185 18431993317065449817u128 into r189; + and r186 18446744073709551615u128 into r190; + shr r186 64u8 into r191; + and r187 18446744073709551615u128 into r192; + add r191 r192 into r193; + and r188 18446744073709551615u128 into r194; + add r193 r194 into r195; + and r195 18446744073709551615u128 into r196; + shr r195 64u8 into r197; + shr r187 64u8 into r198; + shr r188 64u8 into r199; + add r198 r199 into r200; + and r189 18446744073709551615u128 into r201; + add r200 r201 into r202; + add r202 r197 into r203; + and r203 18446744073709551615u128 into r204; + shr r203 64u8 into r205; + shr r189 64u8 into r206; + add r206 r205 into r207; + shl r207 64u8 into r208; + add r208 r204 into r209; + shl r196 64u8 into r210; + add r210 r190 into r211; + add.w r181 r211 into r212; + lt r212 r181 into r213; + ternary r213 1u128 0u128 into r214; + add.w r209 r214 into r215; + cast r215 r212 into r216 as U256__8JquwLopp8; + ternary r155 r216.hi r153.hi into r217; + ternary r155 r216.lo r153.lo into r218; + cast r217 r218 into r219 as U256__8JquwLopp8; + and r8 32u32 into r220; + is.neq r220 0u32 into r221; + and r219.lo 18446744073709551615u128 into r222; + shr r219.lo 64u8 into r223; + mul r222 5129152022828963008u128 into r224; + mul r222 18417254355718160513u128 into r225; + mul r223 5129152022828963008u128 into r226; + mul r223 18417254355718160513u128 into r227; + and r224 18446744073709551615u128 into r228; + shr r224 64u8 into r229; + and r225 18446744073709551615u128 into r230; + add r229 r230 into r231; + and r226 18446744073709551615u128 into r232; + add r231 r232 into r233; + and r233 18446744073709551615u128 into r234; + shr r233 64u8 into r235; + shr r225 64u8 into r236; + shr r226 64u8 into r237; + add r236 r237 into r238; + and r227 18446744073709551615u128 into r239; + add r238 r239 into r240; + add r240 r235 into r241; + and r241 18446744073709551615u128 into r242; + shr r241 64u8 into r243; + shr r227 64u8 into r244; + add r244 r243 into r245; + shl r245 64u8 into r246; + add r246 r242 into r247; + shl r234 64u8 into r248; + add r248 r228 into r249; + and r219.hi 18446744073709551615u128 into r250; + shr r219.hi 64u8 into r251; + mul r250 5129152022828963008u128 into r252; + mul r250 18417254355718160513u128 into r253; + mul r251 5129152022828963008u128 into r254; + mul r251 18417254355718160513u128 into r255; + and r252 18446744073709551615u128 into r256; + shr r252 64u8 into r257; + and r253 18446744073709551615u128 into r258; + add r257 r258 into r259; + and r254 18446744073709551615u128 into r260; + add r259 r260 into r261; + and r261 18446744073709551615u128 into r262; + shr r261 64u8 into r263; + shr r253 64u8 into r264; + shr r254 64u8 into r265; + add r264 r265 into r266; + and r255 18446744073709551615u128 into r267; + add r266 r267 into r268; + add r268 r263 into r269; + and r269 18446744073709551615u128 into r270; + shr r269 64u8 into r271; + shr r255 64u8 into r272; + add r272 r271 into r273; + shl r273 64u8 into r274; + add r274 r270 into r275; + shl r262 64u8 into r276; + add r276 r256 into r277; + add.w r247 r277 into r278; + lt r278 r247 into r279; + ternary r279 1u128 0u128 into r280; + add.w r275 r280 into r281; + cast r281 r278 into r282 as U256__8JquwLopp8; + ternary r221 r282.hi r219.hi into r283; + ternary r221 r282.lo r219.lo into r284; + cast r283 r284 into r285 as U256__8JquwLopp8; + and r8 64u32 into r286; + is.neq r286 0u32 into r287; + and r285.lo 18446744073709551615u128 into r288; + shr r285.lo 64u8 into r289; + mul r288 4894419605888772193u128 into r290; + mul r288 18387811781193591352u128 into r291; + mul r289 4894419605888772193u128 into r292; + mul r289 18387811781193591352u128 into r293; + and r290 18446744073709551615u128 into r294; + shr r290 64u8 into r295; + and r291 18446744073709551615u128 into r296; + add r295 r296 into r297; + and r292 18446744073709551615u128 into r298; + add r297 r298 into r299; + and r299 18446744073709551615u128 into r300; + shr r299 64u8 into r301; + shr r291 64u8 into r302; + shr r292 64u8 into r303; + add r302 r303 into r304; + and r293 18446744073709551615u128 into r305; + add r304 r305 into r306; + add r306 r301 into r307; + and r307 18446744073709551615u128 into r308; + shr r307 64u8 into r309; + shr r293 64u8 into r310; + add r310 r309 into r311; + shl r311 64u8 into r312; + add r312 r308 into r313; + shl r300 64u8 into r314; + add r314 r294 into r315; + and r285.hi 18446744073709551615u128 into r316; + shr r285.hi 64u8 into r317; + mul r316 4894419605888772193u128 into r318; + mul r316 18387811781193591352u128 into r319; + mul r317 4894419605888772193u128 into r320; + mul r317 18387811781193591352u128 into r321; + and r318 18446744073709551615u128 into r322; + shr r318 64u8 into r323; + and r319 18446744073709551615u128 into r324; + add r323 r324 into r325; + and r320 18446744073709551615u128 into r326; + add r325 r326 into r327; + and r327 18446744073709551615u128 into r328; + shr r327 64u8 into r329; + shr r319 64u8 into r330; + shr r320 64u8 into r331; + add r330 r331 into r332; + and r321 18446744073709551615u128 into r333; + add r332 r333 into r334; + add r334 r329 into r335; + and r335 18446744073709551615u128 into r336; + shr r335 64u8 into r337; + shr r321 64u8 into r338; + add r338 r337 into r339; + shl r339 64u8 into r340; + add r340 r336 into r341; + shl r328 64u8 into r342; + add r342 r322 into r343; + add.w r313 r343 into r344; + lt r344 r313 into r345; + ternary r345 1u128 0u128 into r346; + add.w r341 r346 into r347; + cast r347 r344 into r348 as U256__8JquwLopp8; + ternary r287 r348.hi r285.hi into r349; + ternary r287 r348.lo r285.lo into r350; + cast r349 r350 into r351 as U256__8JquwLopp8; + and r8 128u32 into r352; + is.neq r352 0u32 into r353; + and r351.lo 18446744073709551615u128 into r354; + shr r351.lo 64u8 into r355; + mul r354 1280255884321894483u128 into r356; + mul r354 18329067761203520168u128 into r357; + mul r355 1280255884321894483u128 into r358; + mul r355 18329067761203520168u128 into r359; + and r356 18446744073709551615u128 into r360; + shr r356 64u8 into r361; + and r357 18446744073709551615u128 into r362; + add r361 r362 into r363; + and r358 18446744073709551615u128 into r364; + add r363 r364 into r365; + and r365 18446744073709551615u128 into r366; + shr r365 64u8 into r367; + shr r357 64u8 into r368; + shr r358 64u8 into r369; + add r368 r369 into r370; + and r359 18446744073709551615u128 into r371; + add r370 r371 into r372; + add r372 r367 into r373; + and r373 18446744073709551615u128 into r374; + shr r373 64u8 into r375; + shr r359 64u8 into r376; + add r376 r375 into r377; + shl r377 64u8 into r378; + add r378 r374 into r379; + shl r366 64u8 into r380; + add r380 r360 into r381; + and r351.hi 18446744073709551615u128 into r382; + shr r351.hi 64u8 into r383; + mul r382 1280255884321894483u128 into r384; + mul r382 18329067761203520168u128 into r385; + mul r383 1280255884321894483u128 into r386; + mul r383 18329067761203520168u128 into r387; + and r384 18446744073709551615u128 into r388; + shr r384 64u8 into r389; + and r385 18446744073709551615u128 into r390; + add r389 r390 into r391; + and r386 18446744073709551615u128 into r392; + add r391 r392 into r393; + and r393 18446744073709551615u128 into r394; + shr r393 64u8 into r395; + shr r385 64u8 into r396; + shr r386 64u8 into r397; + add r396 r397 into r398; + and r387 18446744073709551615u128 into r399; + add r398 r399 into r400; + add r400 r395 into r401; + and r401 18446744073709551615u128 into r402; + shr r401 64u8 into r403; + shr r387 64u8 into r404; + add r404 r403 into r405; + shl r405 64u8 into r406; + add r406 r402 into r407; + shl r394 64u8 into r408; + add r408 r388 into r409; + add.w r379 r409 into r410; + lt r410 r379 into r411; + ternary r411 1u128 0u128 into r412; + add.w r407 r412 into r413; + cast r413 r410 into r414 as U256__8JquwLopp8; + ternary r353 r414.hi r351.hi into r415; + ternary r353 r414.lo r351.lo into r416; + cast r415 r416 into r417 as U256__8JquwLopp8; + and r8 256u32 into r418; + is.neq r418 0u32 into r419; + and r417.lo 18446744073709551615u128 into r420; + shr r417.lo 64u8 into r421; + mul r420 15924666964335305636u128 into r422; + mul r420 18212142134806087854u128 into r423; + mul r421 15924666964335305636u128 into r424; + mul r421 18212142134806087854u128 into r425; + and r422 18446744073709551615u128 into r426; + shr r422 64u8 into r427; + and r423 18446744073709551615u128 into r428; + add r427 r428 into r429; + and r424 18446744073709551615u128 into r430; + add r429 r430 into r431; + and r431 18446744073709551615u128 into r432; + shr r431 64u8 into r433; + shr r423 64u8 into r434; + shr r424 64u8 into r435; + add r434 r435 into r436; + and r425 18446744073709551615u128 into r437; + add r436 r437 into r438; + add r438 r433 into r439; + and r439 18446744073709551615u128 into r440; + shr r439 64u8 into r441; + shr r425 64u8 into r442; + add r442 r441 into r443; + shl r443 64u8 into r444; + add r444 r440 into r445; + shl r432 64u8 into r446; + add r446 r426 into r447; + and r417.hi 18446744073709551615u128 into r448; + shr r417.hi 64u8 into r449; + mul r448 15924666964335305636u128 into r450; + mul r448 18212142134806087854u128 into r451; + mul r449 15924666964335305636u128 into r452; + mul r449 18212142134806087854u128 into r453; + and r450 18446744073709551615u128 into r454; + shr r450 64u8 into r455; + and r451 18446744073709551615u128 into r456; + add r455 r456 into r457; + and r452 18446744073709551615u128 into r458; + add r457 r458 into r459; + and r459 18446744073709551615u128 into r460; + shr r459 64u8 into r461; + shr r451 64u8 into r462; + shr r452 64u8 into r463; + add r462 r463 into r464; + and r453 18446744073709551615u128 into r465; + add r464 r465 into r466; + add r466 r461 into r467; + and r467 18446744073709551615u128 into r468; + shr r467 64u8 into r469; + shr r453 64u8 into r470; + add r470 r469 into r471; + shl r471 64u8 into r472; + add r472 r468 into r473; + shl r460 64u8 into r474; + add r474 r454 into r475; + add.w r445 r475 into r476; + lt r476 r445 into r477; + ternary r477 1u128 0u128 into r478; + add.w r473 r478 into r479; + cast r479 r476 into r480 as U256__8JquwLopp8; + ternary r419 r480.hi r417.hi into r481; + ternary r419 r480.lo r417.lo into r482; + cast r481 r482 into r483 as U256__8JquwLopp8; + and r8 512u32 into r484; + is.neq r484 0u32 into r485; + and r483.lo 18446744073709551615u128 into r486; + shr r483.lo 64u8 into r487; + mul r486 8010504389359918676u128 into r488; + mul r486 17980523815641551639u128 into r489; + mul r487 8010504389359918676u128 into r490; + mul r487 17980523815641551639u128 into r491; + and r488 18446744073709551615u128 into r492; + shr r488 64u8 into r493; + and r489 18446744073709551615u128 into r494; + add r493 r494 into r495; + and r490 18446744073709551615u128 into r496; + add r495 r496 into r497; + and r497 18446744073709551615u128 into r498; + shr r497 64u8 into r499; + shr r489 64u8 into r500; + shr r490 64u8 into r501; + add r500 r501 into r502; + and r491 18446744073709551615u128 into r503; + add r502 r503 into r504; + add r504 r499 into r505; + and r505 18446744073709551615u128 into r506; + shr r505 64u8 into r507; + shr r491 64u8 into r508; + add r508 r507 into r509; + shl r509 64u8 into r510; + add r510 r506 into r511; + shl r498 64u8 into r512; + add r512 r492 into r513; + and r483.hi 18446744073709551615u128 into r514; + shr r483.hi 64u8 into r515; + mul r514 8010504389359918676u128 into r516; + mul r514 17980523815641551639u128 into r517; + mul r515 8010504389359918676u128 into r518; + mul r515 17980523815641551639u128 into r519; + and r516 18446744073709551615u128 into r520; + shr r516 64u8 into r521; + and r517 18446744073709551615u128 into r522; + add r521 r522 into r523; + and r518 18446744073709551615u128 into r524; + add r523 r524 into r525; + and r525 18446744073709551615u128 into r526; + shr r525 64u8 into r527; + shr r517 64u8 into r528; + shr r518 64u8 into r529; + add r528 r529 into r530; + and r519 18446744073709551615u128 into r531; + add r530 r531 into r532; + add r532 r527 into r533; + and r533 18446744073709551615u128 into r534; + shr r533 64u8 into r535; + shr r519 64u8 into r536; + add r536 r535 into r537; + shl r537 64u8 into r538; + add r538 r534 into r539; + shl r526 64u8 into r540; + add r540 r520 into r541; + add.w r511 r541 into r542; + lt r542 r511 into r543; + ternary r543 1u128 0u128 into r544; + add.w r539 r544 into r545; + cast r545 r542 into r546 as U256__8JquwLopp8; + ternary r485 r546.hi r483.hi into r547; + ternary r485 r546.lo r483.lo into r548; + cast r547 r548 into r549 as U256__8JquwLopp8; + and r8 1024u32 into r550; + is.neq r550 0u32 into r551; + and r549.lo 18446744073709551615u128 into r552; + shr r549.lo 64u8 into r553; + mul r552 10668036004952895731u128 into r554; + mul r552 17526086738831147013u128 into r555; + mul r553 10668036004952895731u128 into r556; + mul r553 17526086738831147013u128 into r557; + and r554 18446744073709551615u128 into r558; + shr r554 64u8 into r559; + and r555 18446744073709551615u128 into r560; + add r559 r560 into r561; + and r556 18446744073709551615u128 into r562; + add r561 r562 into r563; + and r563 18446744073709551615u128 into r564; + shr r563 64u8 into r565; + shr r555 64u8 into r566; + shr r556 64u8 into r567; + add r566 r567 into r568; + and r557 18446744073709551615u128 into r569; + add r568 r569 into r570; + add r570 r565 into r571; + and r571 18446744073709551615u128 into r572; + shr r571 64u8 into r573; + shr r557 64u8 into r574; + add r574 r573 into r575; + shl r575 64u8 into r576; + add r576 r572 into r577; + shl r564 64u8 into r578; + add r578 r558 into r579; + and r549.hi 18446744073709551615u128 into r580; + shr r549.hi 64u8 into r581; + mul r580 10668036004952895731u128 into r582; + mul r580 17526086738831147013u128 into r583; + mul r581 10668036004952895731u128 into r584; + mul r581 17526086738831147013u128 into r585; + and r582 18446744073709551615u128 into r586; + shr r582 64u8 into r587; + and r583 18446744073709551615u128 into r588; + add r587 r588 into r589; + and r584 18446744073709551615u128 into r590; + add r589 r590 into r591; + and r591 18446744073709551615u128 into r592; + shr r591 64u8 into r593; + shr r583 64u8 into r594; + shr r584 64u8 into r595; + add r594 r595 into r596; + and r585 18446744073709551615u128 into r597; + add r596 r597 into r598; + add r598 r593 into r599; + and r599 18446744073709551615u128 into r600; + shr r599 64u8 into r601; + shr r585 64u8 into r602; + add r602 r601 into r603; + shl r603 64u8 into r604; + add r604 r600 into r605; + shl r592 64u8 into r606; + add r606 r586 into r607; + add.w r577 r607 into r608; + lt r608 r577 into r609; + ternary r609 1u128 0u128 into r610; + add.w r605 r610 into r611; + cast r611 r608 into r612 as U256__8JquwLopp8; + ternary r551 r612.hi r549.hi into r613; + ternary r551 r612.lo r549.lo into r614; + cast r613 r614 into r615 as U256__8JquwLopp8; + and r8 2048u32 into r616; + is.neq r616 0u32 into r617; + and r615.lo 18446744073709551615u128 into r618; + shr r615.lo 64u8 into r619; + mul r618 4878133418470705625u128 into r620; + mul r618 16651378430235024244u128 into r621; + mul r619 4878133418470705625u128 into r622; + mul r619 16651378430235024244u128 into r623; + and r620 18446744073709551615u128 into r624; + shr r620 64u8 into r625; + and r621 18446744073709551615u128 into r626; + add r625 r626 into r627; + and r622 18446744073709551615u128 into r628; + add r627 r628 into r629; + and r629 18446744073709551615u128 into r630; + shr r629 64u8 into r631; + shr r621 64u8 into r632; + shr r622 64u8 into r633; + add r632 r633 into r634; + and r623 18446744073709551615u128 into r635; + add r634 r635 into r636; + add r636 r631 into r637; + and r637 18446744073709551615u128 into r638; + shr r637 64u8 into r639; + shr r623 64u8 into r640; + add r640 r639 into r641; + shl r641 64u8 into r642; + add r642 r638 into r643; + shl r630 64u8 into r644; + add r644 r624 into r645; + and r615.hi 18446744073709551615u128 into r646; + shr r615.hi 64u8 into r647; + mul r646 4878133418470705625u128 into r648; + mul r646 16651378430235024244u128 into r649; + mul r647 4878133418470705625u128 into r650; + mul r647 16651378430235024244u128 into r651; + and r648 18446744073709551615u128 into r652; + shr r648 64u8 into r653; + and r649 18446744073709551615u128 into r654; + add r653 r654 into r655; + and r650 18446744073709551615u128 into r656; + add r655 r656 into r657; + and r657 18446744073709551615u128 into r658; + shr r657 64u8 into r659; + shr r649 64u8 into r660; + shr r650 64u8 into r661; + add r660 r661 into r662; + and r651 18446744073709551615u128 into r663; + add r662 r663 into r664; + add r664 r659 into r665; + and r665 18446744073709551615u128 into r666; + shr r665 64u8 into r667; + shr r651 64u8 into r668; + add r668 r667 into r669; + shl r669 64u8 into r670; + add r670 r666 into r671; + shl r658 64u8 into r672; + add r672 r652 into r673; + add.w r643 r673 into r674; + lt r674 r643 into r675; + ternary r675 1u128 0u128 into r676; + add.w r671 r676 into r677; + cast r677 r674 into r678 as U256__8JquwLopp8; + ternary r617 r678.hi r615.hi into r679; + ternary r617 r678.lo r615.lo into r680; + cast r679 r680 into r681 as U256__8JquwLopp8; + and r8 4096u32 into r682; + is.neq r682 0u32 into r683; + and r681.lo 18446744073709551615u128 into r684; + shr r681.lo 64u8 into r685; + mul r684 9537173718739605541u128 into r686; + mul r684 15030750278693429944u128 into r687; + mul r685 9537173718739605541u128 into r688; + mul r685 15030750278693429944u128 into r689; + and r686 18446744073709551615u128 into r690; + shr r686 64u8 into r691; + and r687 18446744073709551615u128 into r692; + add r691 r692 into r693; + and r688 18446744073709551615u128 into r694; + add r693 r694 into r695; + and r695 18446744073709551615u128 into r696; + shr r695 64u8 into r697; + shr r687 64u8 into r698; + shr r688 64u8 into r699; + add r698 r699 into r700; + and r689 18446744073709551615u128 into r701; + add r700 r701 into r702; + add r702 r697 into r703; + and r703 18446744073709551615u128 into r704; + shr r703 64u8 into r705; + shr r689 64u8 into r706; + add r706 r705 into r707; + shl r707 64u8 into r708; + add r708 r704 into r709; + shl r696 64u8 into r710; + add r710 r690 into r711; + and r681.hi 18446744073709551615u128 into r712; + shr r681.hi 64u8 into r713; + mul r712 9537173718739605541u128 into r714; + mul r712 15030750278693429944u128 into r715; + mul r713 9537173718739605541u128 into r716; + mul r713 15030750278693429944u128 into r717; + and r714 18446744073709551615u128 into r718; + shr r714 64u8 into r719; + and r715 18446744073709551615u128 into r720; + add r719 r720 into r721; + and r716 18446744073709551615u128 into r722; + add r721 r722 into r723; + and r723 18446744073709551615u128 into r724; + shr r723 64u8 into r725; + shr r715 64u8 into r726; + shr r716 64u8 into r727; + add r726 r727 into r728; + and r717 18446744073709551615u128 into r729; + add r728 r729 into r730; + add r730 r725 into r731; + and r731 18446744073709551615u128 into r732; + shr r731 64u8 into r733; + shr r717 64u8 into r734; + add r734 r733 into r735; + shl r735 64u8 into r736; + add r736 r732 into r737; + shl r724 64u8 into r738; + add r738 r718 into r739; + add.w r709 r739 into r740; + lt r740 r709 into r741; + ternary r741 1u128 0u128 into r742; + add.w r737 r742 into r743; + cast r743 r740 into r744 as U256__8JquwLopp8; + ternary r683 r744.hi r681.hi into r745; + ternary r683 r744.lo r681.lo into r746; + cast r745 r746 into r747 as U256__8JquwLopp8; + and r8 8192u32 into r748; + is.neq r748 0u32 into r749; + and r747.lo 18446744073709551615u128 into r750; + shr r747.lo 64u8 into r751; + mul r750 9972618978014552549u128 into r752; + mul r750 12247334978882834399u128 into r753; + mul r751 9972618978014552549u128 into r754; + mul r751 12247334978882834399u128 into r755; + and r752 18446744073709551615u128 into r756; + shr r752 64u8 into r757; + and r753 18446744073709551615u128 into r758; + add r757 r758 into r759; + and r754 18446744073709551615u128 into r760; + add r759 r760 into r761; + and r761 18446744073709551615u128 into r762; + shr r761 64u8 into r763; + shr r753 64u8 into r764; + shr r754 64u8 into r765; + add r764 r765 into r766; + and r755 18446744073709551615u128 into r767; + add r766 r767 into r768; + add r768 r763 into r769; + and r769 18446744073709551615u128 into r770; + shr r769 64u8 into r771; + shr r755 64u8 into r772; + add r772 r771 into r773; + shl r773 64u8 into r774; + add r774 r770 into r775; + shl r762 64u8 into r776; + add r776 r756 into r777; + and r747.hi 18446744073709551615u128 into r778; + shr r747.hi 64u8 into r779; + mul r778 9972618978014552549u128 into r780; + mul r778 12247334978882834399u128 into r781; + mul r779 9972618978014552549u128 into r782; + mul r779 12247334978882834399u128 into r783; + and r780 18446744073709551615u128 into r784; + shr r780 64u8 into r785; + and r781 18446744073709551615u128 into r786; + add r785 r786 into r787; + and r782 18446744073709551615u128 into r788; + add r787 r788 into r789; + and r789 18446744073709551615u128 into r790; + shr r789 64u8 into r791; + shr r781 64u8 into r792; + shr r782 64u8 into r793; + add r792 r793 into r794; + and r783 18446744073709551615u128 into r795; + add r794 r795 into r796; + add r796 r791 into r797; + and r797 18446744073709551615u128 into r798; + shr r797 64u8 into r799; + shr r783 64u8 into r800; + add r800 r799 into r801; + shl r801 64u8 into r802; + add r802 r798 into r803; + shl r790 64u8 into r804; + add r804 r784 into r805; + add.w r775 r805 into r806; + lt r806 r775 into r807; + ternary r807 1u128 0u128 into r808; + add.w r803 r808 into r809; + cast r809 r806 into r810 as U256__8JquwLopp8; + ternary r749 r810.hi r747.hi into r811; + ternary r749 r810.lo r747.lo into r812; + cast r811 r812 into r813 as U256__8JquwLopp8; + and r8 16384u32 into r814; + is.neq r814 0u32 into r815; + and r813.lo 18446744073709551615u128 into r816; + shr r813.lo 64u8 into r817; + mul r816 10428997489610666743u128 into r818; + mul r816 8131365268884726200u128 into r819; + mul r817 10428997489610666743u128 into r820; + mul r817 8131365268884726200u128 into r821; + and r818 18446744073709551615u128 into r822; + shr r818 64u8 into r823; + and r819 18446744073709551615u128 into r824; + add r823 r824 into r825; + and r820 18446744073709551615u128 into r826; + add r825 r826 into r827; + and r827 18446744073709551615u128 into r828; + shr r827 64u8 into r829; + shr r819 64u8 into r830; + shr r820 64u8 into r831; + add r830 r831 into r832; + and r821 18446744073709551615u128 into r833; + add r832 r833 into r834; + add r834 r829 into r835; + and r835 18446744073709551615u128 into r836; + shr r835 64u8 into r837; + shr r821 64u8 into r838; + add r838 r837 into r839; + shl r839 64u8 into r840; + add r840 r836 into r841; + shl r828 64u8 into r842; + add r842 r822 into r843; + and r813.hi 18446744073709551615u128 into r844; + shr r813.hi 64u8 into r845; + mul r844 10428997489610666743u128 into r846; + mul r844 8131365268884726200u128 into r847; + mul r845 10428997489610666743u128 into r848; + mul r845 8131365268884726200u128 into r849; + and r846 18446744073709551615u128 into r850; + shr r846 64u8 into r851; + and r847 18446744073709551615u128 into r852; + add r851 r852 into r853; + and r848 18446744073709551615u128 into r854; + add r853 r854 into r855; + and r855 18446744073709551615u128 into r856; + shr r855 64u8 into r857; + shr r847 64u8 into r858; + shr r848 64u8 into r859; + add r858 r859 into r860; + and r849 18446744073709551615u128 into r861; + add r860 r861 into r862; + add r862 r857 into r863; + and r863 18446744073709551615u128 into r864; + shr r863 64u8 into r865; + shr r849 64u8 into r866; + add r866 r865 into r867; + shl r867 64u8 into r868; + add r868 r864 into r869; + shl r856 64u8 into r870; + add r870 r850 into r871; + add.w r841 r871 into r872; + lt r872 r841 into r873; + ternary r873 1u128 0u128 into r874; + add.w r869 r874 into r875; + cast r875 r872 into r876 as U256__8JquwLopp8; + ternary r815 r876.hi r813.hi into r877; + ternary r815 r876.lo r813.lo into r878; + cast r877 r878 into r879 as U256__8JquwLopp8; + and r8 32768u32 into r880; + is.neq r880 0u32 into r881; + and r879.lo 18446744073709551615u128 into r882; + shr r879.lo 64u8 into r883; + mul r882 9305304367709015974u128 into r884; + mul r882 3584323654723342297u128 into r885; + mul r883 9305304367709015974u128 into r886; + mul r883 3584323654723342297u128 into r887; + and r884 18446744073709551615u128 into r888; + shr r884 64u8 into r889; + and r885 18446744073709551615u128 into r890; + add r889 r890 into r891; + and r886 18446744073709551615u128 into r892; + add r891 r892 into r893; + and r893 18446744073709551615u128 into r894; + shr r893 64u8 into r895; + shr r885 64u8 into r896; + shr r886 64u8 into r897; + add r896 r897 into r898; + and r887 18446744073709551615u128 into r899; + add r898 r899 into r900; + add r900 r895 into r901; + and r901 18446744073709551615u128 into r902; + shr r901 64u8 into r903; + shr r887 64u8 into r904; + add r904 r903 into r905; + shl r905 64u8 into r906; + add r906 r902 into r907; + shl r894 64u8 into r908; + add r908 r888 into r909; + and r879.hi 18446744073709551615u128 into r910; + shr r879.hi 64u8 into r911; + mul r910 9305304367709015974u128 into r912; + mul r910 3584323654723342297u128 into r913; + mul r911 9305304367709015974u128 into r914; + mul r911 3584323654723342297u128 into r915; + and r912 18446744073709551615u128 into r916; + shr r912 64u8 into r917; + and r913 18446744073709551615u128 into r918; + add r917 r918 into r919; + and r914 18446744073709551615u128 into r920; + add r919 r920 into r921; + and r921 18446744073709551615u128 into r922; + shr r921 64u8 into r923; + shr r913 64u8 into r924; + shr r914 64u8 into r925; + add r924 r925 into r926; + and r915 18446744073709551615u128 into r927; + add r926 r927 into r928; + add r928 r923 into r929; + and r929 18446744073709551615u128 into r930; + shr r929 64u8 into r931; + shr r915 64u8 into r932; + add r932 r931 into r933; + shl r933 64u8 into r934; + add r934 r930 into r935; + shl r922 64u8 into r936; + add r936 r916 into r937; + add.w r907 r937 into r938; + lt r938 r907 into r939; + ternary r939 1u128 0u128 into r940; + add.w r935 r940 into r941; + cast r941 r938 into r942 as U256__8JquwLopp8; + ternary r881 r942.hi r879.hi into r943; + ternary r881 r942.lo r879.lo into r944; + cast r943 r944 into r945 as U256__8JquwLopp8; + and r8 65536u32 into r946; + is.neq r946 0u32 into r947; + and r945.lo 18446744073709551615u128 into r948; + shr r945.lo 64u8 into r949; + mul r948 14301143598189091785u128 into r950; + mul r948 696457651847595233u128 into r951; + mul r949 14301143598189091785u128 into r952; + mul r949 696457651847595233u128 into r953; + and r950 18446744073709551615u128 into r954; + shr r950 64u8 into r955; + and r951 18446744073709551615u128 into r956; + add r955 r956 into r957; + and r952 18446744073709551615u128 into r958; + add r957 r958 into r959; + and r959 18446744073709551615u128 into r960; + shr r959 64u8 into r961; + shr r951 64u8 into r962; + shr r952 64u8 into r963; + add r962 r963 into r964; + and r953 18446744073709551615u128 into r965; + add r964 r965 into r966; + add r966 r961 into r967; + and r967 18446744073709551615u128 into r968; + shr r967 64u8 into r969; + shr r953 64u8 into r970; + add r970 r969 into r971; + shl r971 64u8 into r972; + add r972 r968 into r973; + shl r960 64u8 into r974; + add r974 r954 into r975; + and r945.hi 18446744073709551615u128 into r976; + shr r945.hi 64u8 into r977; + mul r976 14301143598189091785u128 into r978; + mul r976 696457651847595233u128 into r979; + mul r977 14301143598189091785u128 into r980; + mul r977 696457651847595233u128 into r981; + and r978 18446744073709551615u128 into r982; + shr r978 64u8 into r983; + and r979 18446744073709551615u128 into r984; + add r983 r984 into r985; + and r980 18446744073709551615u128 into r986; + add r985 r986 into r987; + and r987 18446744073709551615u128 into r988; + shr r987 64u8 into r989; + shr r979 64u8 into r990; + shr r980 64u8 into r991; + add r990 r991 into r992; + and r981 18446744073709551615u128 into r993; + add r992 r993 into r994; + add r994 r989 into r995; + and r995 18446744073709551615u128 into r996; + shr r995 64u8 into r997; + shr r981 64u8 into r998; + add r998 r997 into r999; + shl r999 64u8 into r1000; + add r1000 r996 into r1001; + shl r988 64u8 into r1002; + add r1002 r982 into r1003; + add.w r973 r1003 into r1004; + lt r1004 r973 into r1005; + ternary r1005 1u128 0u128 into r1006; + add.w r1001 r1006 into r1007; + cast r1007 r1004 into r1008 as U256__8JquwLopp8; + ternary r947 r1008.hi r945.hi into r1009; + ternary r947 r1008.lo r945.lo into r1010; + cast r1009 r1010 into r1011 as U256__8JquwLopp8; + and r8 131072u32 into r1012; + is.neq r1012 0u32 into r1013; + and r1011.lo 18446744073709551615u128 into r1014; + shr r1011.lo 64u8 into r1015; + mul r1014 7393154844743099908u128 into r1016; + mul r1014 26294789957452057u128 into r1017; + mul r1015 7393154844743099908u128 into r1018; + mul r1015 26294789957452057u128 into r1019; + and r1016 18446744073709551615u128 into r1020; + shr r1016 64u8 into r1021; + and r1017 18446744073709551615u128 into r1022; + add r1021 r1022 into r1023; + and r1018 18446744073709551615u128 into r1024; + add r1023 r1024 into r1025; + and r1025 18446744073709551615u128 into r1026; + shr r1025 64u8 into r1027; + shr r1017 64u8 into r1028; + shr r1018 64u8 into r1029; + add r1028 r1029 into r1030; + and r1019 18446744073709551615u128 into r1031; + add r1030 r1031 into r1032; + add r1032 r1027 into r1033; + and r1033 18446744073709551615u128 into r1034; + shr r1033 64u8 into r1035; + shr r1019 64u8 into r1036; + add r1036 r1035 into r1037; + shl r1037 64u8 into r1038; + add r1038 r1034 into r1039; + shl r1026 64u8 into r1040; + add r1040 r1020 into r1041; + and r1011.hi 18446744073709551615u128 into r1042; + shr r1011.hi 64u8 into r1043; + mul r1042 7393154844743099908u128 into r1044; + mul r1042 26294789957452057u128 into r1045; + mul r1043 7393154844743099908u128 into r1046; + mul r1043 26294789957452057u128 into r1047; + and r1044 18446744073709551615u128 into r1048; + shr r1044 64u8 into r1049; + and r1045 18446744073709551615u128 into r1050; + add r1049 r1050 into r1051; + and r1046 18446744073709551615u128 into r1052; + add r1051 r1052 into r1053; + and r1053 18446744073709551615u128 into r1054; + shr r1053 64u8 into r1055; + shr r1045 64u8 into r1056; + shr r1046 64u8 into r1057; + add r1056 r1057 into r1058; + and r1047 18446744073709551615u128 into r1059; + add r1058 r1059 into r1060; + add r1060 r1055 into r1061; + and r1061 18446744073709551615u128 into r1062; + shr r1061 64u8 into r1063; + shr r1047 64u8 into r1064; + add r1064 r1063 into r1065; + shl r1065 64u8 into r1066; + add r1066 r1062 into r1067; + shl r1054 64u8 into r1068; + add r1068 r1048 into r1069; + add.w r1039 r1069 into r1070; + lt r1070 r1039 into r1071; + ternary r1071 1u128 0u128 into r1072; + add.w r1067 r1072 into r1073; + cast r1073 r1070 into r1074 as U256__8JquwLopp8; + ternary r1013 r1074.hi r1011.hi into r1075; + ternary r1013 r1074.lo r1011.lo into r1076; + cast r1075 r1076 into r1077 as U256__8JquwLopp8; + and r8 262144u32 into r1078; + is.neq r1078 0u32 into r1079; + and r1077.lo 18446744073709551615u128 into r1080; + shr r1077.lo 64u8 into r1081; + mul r1080 2209338891292245656u128 into r1082; + mul r1080 37481735321082u128 into r1083; + mul r1081 2209338891292245656u128 into r1084; + mul r1081 37481735321082u128 into r1085; + and r1082 18446744073709551615u128 into r1086; + shr r1082 64u8 into r1087; + and r1083 18446744073709551615u128 into r1088; + add r1087 r1088 into r1089; + and r1084 18446744073709551615u128 into r1090; + add r1089 r1090 into r1091; + and r1091 18446744073709551615u128 into r1092; + shr r1091 64u8 into r1093; + shr r1083 64u8 into r1094; + shr r1084 64u8 into r1095; + add r1094 r1095 into r1096; + and r1085 18446744073709551615u128 into r1097; + add r1096 r1097 into r1098; + add r1098 r1093 into r1099; + and r1099 18446744073709551615u128 into r1100; + shr r1099 64u8 into r1101; + shr r1085 64u8 into r1102; + add r1102 r1101 into r1103; + shl r1103 64u8 into r1104; + add r1104 r1100 into r1105; + shl r1092 64u8 into r1106; + add r1106 r1086 into r1107; + and r1077.hi 18446744073709551615u128 into r1108; + shr r1077.hi 64u8 into r1109; + mul r1108 2209338891292245656u128 into r1110; + mul r1108 37481735321082u128 into r1111; + mul r1109 2209338891292245656u128 into r1112; + mul r1109 37481735321082u128 into r1113; + and r1110 18446744073709551615u128 into r1114; + shr r1110 64u8 into r1115; + and r1111 18446744073709551615u128 into r1116; + add r1115 r1116 into r1117; + and r1112 18446744073709551615u128 into r1118; + add r1117 r1118 into r1119; + and r1119 18446744073709551615u128 into r1120; + shr r1119 64u8 into r1121; + shr r1111 64u8 into r1122; + shr r1112 64u8 into r1123; + add r1122 r1123 into r1124; + and r1113 18446744073709551615u128 into r1125; + add r1124 r1125 into r1126; + add r1126 r1121 into r1127; + and r1127 18446744073709551615u128 into r1128; + shr r1127 64u8 into r1129; + shr r1113 64u8 into r1130; + add r1130 r1129 into r1131; + shl r1131 64u8 into r1132; + add r1132 r1128 into r1133; + shl r1120 64u8 into r1134; + add r1134 r1114 into r1135; + add.w r1105 r1135 into r1136; + lt r1136 r1105 into r1137; + ternary r1137 1u128 0u128 into r1138; + add.w r1133 r1138 into r1139; + cast r1139 r1136 into r1140 as U256__8JquwLopp8; + ternary r1079 r1140.hi r1077.hi into r1141; + ternary r1079 r1140.lo r1077.lo into r1142; + cast r1141 r1142 into r1143 as U256__8JquwLopp8; + gt r0 0i32 into r1144; + is.eq r1143.lo 0u128 into r1145; + ternary r1145 1u128 r1143.lo into r1146; + div 340282366920938463463374607431768211455u128 r1146 into r1147; + rem 340282366920938463463374607431768211455u128 r1146 into r1148; + lt r1148 r1146 into r1149; + assert.eq r1149 true; + gte r1148 170141183460469231731687303715884105728u128 into r1150; + add.w r1148 r1148 into r1151; + add r1151 1u128 into r1152; + gte r1152 r1146 into r1153; + or r1150 r1153 into r1154; + sub.w r1152 r1146 into r1155; + ternary r1154 r1155 r1152 into r1156; + ternary r1154 170141183460469231731687303715884105728u128 0u128 into r1157; + gte r1156 170141183460469231731687303715884105728u128 into r1158; + add.w r1156 r1156 into r1159; + add r1159 1u128 into r1160; + gte r1160 r1146 into r1161; + or r1158 r1161 into r1162; + sub.w r1160 r1146 into r1163; + ternary r1162 r1163 r1160 into r1164; + add r1157 85070591730234615865843651857942052864u128 into r1165; + ternary r1162 r1165 r1157 into r1166; + gte r1164 170141183460469231731687303715884105728u128 into r1167; + add.w r1164 r1164 into r1168; + add r1168 1u128 into r1169; + gte r1169 r1146 into r1170; + or r1167 r1170 into r1171; + sub.w r1169 r1146 into r1172; + ternary r1171 r1172 r1169 into r1173; + add r1166 42535295865117307932921825928971026432u128 into r1174; + ternary r1171 r1174 r1166 into r1175; + gte r1173 170141183460469231731687303715884105728u128 into r1176; + add.w r1173 r1173 into r1177; + add r1177 1u128 into r1178; + gte r1178 r1146 into r1179; + or r1176 r1179 into r1180; + sub.w r1178 r1146 into r1181; + ternary r1180 r1181 r1178 into r1182; + add r1175 21267647932558653966460912964485513216u128 into r1183; + ternary r1180 r1183 r1175 into r1184; + gte r1182 170141183460469231731687303715884105728u128 into r1185; + add.w r1182 r1182 into r1186; + add r1186 1u128 into r1187; + gte r1187 r1146 into r1188; + or r1185 r1188 into r1189; + sub.w r1187 r1146 into r1190; + ternary r1189 r1190 r1187 into r1191; + add r1184 10633823966279326983230456482242756608u128 into r1192; + ternary r1189 r1192 r1184 into r1193; + gte r1191 170141183460469231731687303715884105728u128 into r1194; + add.w r1191 r1191 into r1195; + add r1195 1u128 into r1196; + gte r1196 r1146 into r1197; + or r1194 r1197 into r1198; + sub.w r1196 r1146 into r1199; + ternary r1198 r1199 r1196 into r1200; + add r1193 5316911983139663491615228241121378304u128 into r1201; + ternary r1198 r1201 r1193 into r1202; + gte r1200 170141183460469231731687303715884105728u128 into r1203; + add.w r1200 r1200 into r1204; + add r1204 1u128 into r1205; + gte r1205 r1146 into r1206; + or r1203 r1206 into r1207; + sub.w r1205 r1146 into r1208; + ternary r1207 r1208 r1205 into r1209; + add r1202 2658455991569831745807614120560689152u128 into r1210; + ternary r1207 r1210 r1202 into r1211; + gte r1209 170141183460469231731687303715884105728u128 into r1212; + add.w r1209 r1209 into r1213; + add r1213 1u128 into r1214; + gte r1214 r1146 into r1215; + or r1212 r1215 into r1216; + sub.w r1214 r1146 into r1217; + ternary r1216 r1217 r1214 into r1218; + add r1211 1329227995784915872903807060280344576u128 into r1219; + ternary r1216 r1219 r1211 into r1220; + gte r1218 170141183460469231731687303715884105728u128 into r1221; + add.w r1218 r1218 into r1222; + add r1222 1u128 into r1223; + gte r1223 r1146 into r1224; + or r1221 r1224 into r1225; + sub.w r1223 r1146 into r1226; + ternary r1225 r1226 r1223 into r1227; + add r1220 664613997892457936451903530140172288u128 into r1228; + ternary r1225 r1228 r1220 into r1229; + gte r1227 170141183460469231731687303715884105728u128 into r1230; + add.w r1227 r1227 into r1231; + add r1231 1u128 into r1232; + gte r1232 r1146 into r1233; + or r1230 r1233 into r1234; + sub.w r1232 r1146 into r1235; + ternary r1234 r1235 r1232 into r1236; + add r1229 332306998946228968225951765070086144u128 into r1237; + ternary r1234 r1237 r1229 into r1238; + gte r1236 170141183460469231731687303715884105728u128 into r1239; + add.w r1236 r1236 into r1240; + add r1240 1u128 into r1241; + gte r1241 r1146 into r1242; + or r1239 r1242 into r1243; + sub.w r1241 r1146 into r1244; + ternary r1243 r1244 r1241 into r1245; + add r1238 166153499473114484112975882535043072u128 into r1246; + ternary r1243 r1246 r1238 into r1247; + gte r1245 170141183460469231731687303715884105728u128 into r1248; + add.w r1245 r1245 into r1249; + add r1249 1u128 into r1250; + gte r1250 r1146 into r1251; + or r1248 r1251 into r1252; + sub.w r1250 r1146 into r1253; + ternary r1252 r1253 r1250 into r1254; + add r1247 83076749736557242056487941267521536u128 into r1255; + ternary r1252 r1255 r1247 into r1256; + gte r1254 170141183460469231731687303715884105728u128 into r1257; + add.w r1254 r1254 into r1258; + add r1258 1u128 into r1259; + gte r1259 r1146 into r1260; + or r1257 r1260 into r1261; + sub.w r1259 r1146 into r1262; + ternary r1261 r1262 r1259 into r1263; + add r1256 41538374868278621028243970633760768u128 into r1264; + ternary r1261 r1264 r1256 into r1265; + gte r1263 170141183460469231731687303715884105728u128 into r1266; + add.w r1263 r1263 into r1267; + add r1267 1u128 into r1268; + gte r1268 r1146 into r1269; + or r1266 r1269 into r1270; + sub.w r1268 r1146 into r1271; + ternary r1270 r1271 r1268 into r1272; + add r1265 20769187434139310514121985316880384u128 into r1273; + ternary r1270 r1273 r1265 into r1274; + gte r1272 170141183460469231731687303715884105728u128 into r1275; + add.w r1272 r1272 into r1276; + add r1276 1u128 into r1277; + gte r1277 r1146 into r1278; + or r1275 r1278 into r1279; + sub.w r1277 r1146 into r1280; + ternary r1279 r1280 r1277 into r1281; + add r1274 10384593717069655257060992658440192u128 into r1282; + ternary r1279 r1282 r1274 into r1283; + gte r1281 170141183460469231731687303715884105728u128 into r1284; + add.w r1281 r1281 into r1285; + add r1285 1u128 into r1286; + gte r1286 r1146 into r1287; + or r1284 r1287 into r1288; + sub.w r1286 r1146 into r1289; + ternary r1288 r1289 r1286 into r1290; + add r1283 5192296858534827628530496329220096u128 into r1291; + ternary r1288 r1291 r1283 into r1292; + gte r1290 170141183460469231731687303715884105728u128 into r1293; + add.w r1290 r1290 into r1294; + add r1294 1u128 into r1295; + gte r1295 r1146 into r1296; + or r1293 r1296 into r1297; + sub.w r1295 r1146 into r1298; + ternary r1297 r1298 r1295 into r1299; + add r1292 2596148429267413814265248164610048u128 into r1300; + ternary r1297 r1300 r1292 into r1301; + gte r1299 170141183460469231731687303715884105728u128 into r1302; + add.w r1299 r1299 into r1303; + add r1303 1u128 into r1304; + gte r1304 r1146 into r1305; + or r1302 r1305 into r1306; + sub.w r1304 r1146 into r1307; + ternary r1306 r1307 r1304 into r1308; + add r1301 1298074214633706907132624082305024u128 into r1309; + ternary r1306 r1309 r1301 into r1310; + gte r1308 170141183460469231731687303715884105728u128 into r1311; + add.w r1308 r1308 into r1312; + add r1312 1u128 into r1313; + gte r1313 r1146 into r1314; + or r1311 r1314 into r1315; + sub.w r1313 r1146 into r1316; + ternary r1315 r1316 r1313 into r1317; + add r1310 649037107316853453566312041152512u128 into r1318; + ternary r1315 r1318 r1310 into r1319; + gte r1317 170141183460469231731687303715884105728u128 into r1320; + add.w r1317 r1317 into r1321; + add r1321 1u128 into r1322; + gte r1322 r1146 into r1323; + or r1320 r1323 into r1324; + sub.w r1322 r1146 into r1325; + ternary r1324 r1325 r1322 into r1326; + add r1319 324518553658426726783156020576256u128 into r1327; + ternary r1324 r1327 r1319 into r1328; + gte r1326 170141183460469231731687303715884105728u128 into r1329; + add.w r1326 r1326 into r1330; + add r1330 1u128 into r1331; + gte r1331 r1146 into r1332; + or r1329 r1332 into r1333; + sub.w r1331 r1146 into r1334; + ternary r1333 r1334 r1331 into r1335; + add r1328 162259276829213363391578010288128u128 into r1336; + ternary r1333 r1336 r1328 into r1337; + gte r1335 170141183460469231731687303715884105728u128 into r1338; + add.w r1335 r1335 into r1339; + add r1339 1u128 into r1340; + gte r1340 r1146 into r1341; + or r1338 r1341 into r1342; + sub.w r1340 r1146 into r1343; + ternary r1342 r1343 r1340 into r1344; + add r1337 81129638414606681695789005144064u128 into r1345; + ternary r1342 r1345 r1337 into r1346; + gte r1344 170141183460469231731687303715884105728u128 into r1347; + add.w r1344 r1344 into r1348; + add r1348 1u128 into r1349; + gte r1349 r1146 into r1350; + or r1347 r1350 into r1351; + sub.w r1349 r1146 into r1352; + ternary r1351 r1352 r1349 into r1353; + add r1346 40564819207303340847894502572032u128 into r1354; + ternary r1351 r1354 r1346 into r1355; + gte r1353 170141183460469231731687303715884105728u128 into r1356; + add.w r1353 r1353 into r1357; + add r1357 1u128 into r1358; + gte r1358 r1146 into r1359; + or r1356 r1359 into r1360; + sub.w r1358 r1146 into r1361; + ternary r1360 r1361 r1358 into r1362; + add r1355 20282409603651670423947251286016u128 into r1363; + ternary r1360 r1363 r1355 into r1364; + gte r1362 170141183460469231731687303715884105728u128 into r1365; + add.w r1362 r1362 into r1366; + add r1366 1u128 into r1367; + gte r1367 r1146 into r1368; + or r1365 r1368 into r1369; + sub.w r1367 r1146 into r1370; + ternary r1369 r1370 r1367 into r1371; + add r1364 10141204801825835211973625643008u128 into r1372; + ternary r1369 r1372 r1364 into r1373; + gte r1371 170141183460469231731687303715884105728u128 into r1374; + add.w r1371 r1371 into r1375; + add r1375 1u128 into r1376; + gte r1376 r1146 into r1377; + or r1374 r1377 into r1378; + sub.w r1376 r1146 into r1379; + ternary r1378 r1379 r1376 into r1380; + add r1373 5070602400912917605986812821504u128 into r1381; + ternary r1378 r1381 r1373 into r1382; + gte r1380 170141183460469231731687303715884105728u128 into r1383; + add.w r1380 r1380 into r1384; + add r1384 1u128 into r1385; + gte r1385 r1146 into r1386; + or r1383 r1386 into r1387; + sub.w r1385 r1146 into r1388; + ternary r1387 r1388 r1385 into r1389; + add r1382 2535301200456458802993406410752u128 into r1390; + ternary r1387 r1390 r1382 into r1391; + gte r1389 170141183460469231731687303715884105728u128 into r1392; + add.w r1389 r1389 into r1393; + add r1393 1u128 into r1394; + gte r1394 r1146 into r1395; + or r1392 r1395 into r1396; + sub.w r1394 r1146 into r1397; + ternary r1396 r1397 r1394 into r1398; + add r1391 1267650600228229401496703205376u128 into r1399; + ternary r1396 r1399 r1391 into r1400; + gte r1398 170141183460469231731687303715884105728u128 into r1401; + add.w r1398 r1398 into r1402; + add r1402 1u128 into r1403; + gte r1403 r1146 into r1404; + or r1401 r1404 into r1405; + sub.w r1403 r1146 into r1406; + ternary r1405 r1406 r1403 into r1407; + add r1400 633825300114114700748351602688u128 into r1408; + ternary r1405 r1408 r1400 into r1409; + gte r1407 170141183460469231731687303715884105728u128 into r1410; + add.w r1407 r1407 into r1411; + add r1411 1u128 into r1412; + gte r1412 r1146 into r1413; + or r1410 r1413 into r1414; + sub.w r1412 r1146 into r1415; + ternary r1414 r1415 r1412 into r1416; + add r1409 316912650057057350374175801344u128 into r1417; + ternary r1414 r1417 r1409 into r1418; + gte r1416 170141183460469231731687303715884105728u128 into r1419; + add.w r1416 r1416 into r1420; + add r1420 1u128 into r1421; + gte r1421 r1146 into r1422; + or r1419 r1422 into r1423; + sub.w r1421 r1146 into r1424; + ternary r1423 r1424 r1421 into r1425; + add r1418 158456325028528675187087900672u128 into r1426; + ternary r1423 r1426 r1418 into r1427; + gte r1425 170141183460469231731687303715884105728u128 into r1428; + add.w r1425 r1425 into r1429; + add r1429 1u128 into r1430; + gte r1430 r1146 into r1431; + or r1428 r1431 into r1432; + sub.w r1430 r1146 into r1433; + ternary r1432 r1433 r1430 into r1434; + add r1427 79228162514264337593543950336u128 into r1435; + ternary r1432 r1435 r1427 into r1436; + gte r1434 170141183460469231731687303715884105728u128 into r1437; + add.w r1434 r1434 into r1438; + add r1438 1u128 into r1439; + gte r1439 r1146 into r1440; + or r1437 r1440 into r1441; + sub.w r1439 r1146 into r1442; + ternary r1441 r1442 r1439 into r1443; + add r1436 39614081257132168796771975168u128 into r1444; + ternary r1441 r1444 r1436 into r1445; + gte r1443 170141183460469231731687303715884105728u128 into r1446; + add.w r1443 r1443 into r1447; + add r1447 1u128 into r1448; + gte r1448 r1146 into r1449; + or r1446 r1449 into r1450; + sub.w r1448 r1146 into r1451; + ternary r1450 r1451 r1448 into r1452; + add r1445 19807040628566084398385987584u128 into r1453; + ternary r1450 r1453 r1445 into r1454; + gte r1452 170141183460469231731687303715884105728u128 into r1455; + add.w r1452 r1452 into r1456; + add r1456 1u128 into r1457; + gte r1457 r1146 into r1458; + or r1455 r1458 into r1459; + sub.w r1457 r1146 into r1460; + ternary r1459 r1460 r1457 into r1461; + add r1454 9903520314283042199192993792u128 into r1462; + ternary r1459 r1462 r1454 into r1463; + gte r1461 170141183460469231731687303715884105728u128 into r1464; + add.w r1461 r1461 into r1465; + add r1465 1u128 into r1466; + gte r1466 r1146 into r1467; + or r1464 r1467 into r1468; + sub.w r1466 r1146 into r1469; + ternary r1468 r1469 r1466 into r1470; + add r1463 4951760157141521099596496896u128 into r1471; + ternary r1468 r1471 r1463 into r1472; + gte r1470 170141183460469231731687303715884105728u128 into r1473; + add.w r1470 r1470 into r1474; + add r1474 1u128 into r1475; + gte r1475 r1146 into r1476; + or r1473 r1476 into r1477; + sub.w r1475 r1146 into r1478; + ternary r1477 r1478 r1475 into r1479; + add r1472 2475880078570760549798248448u128 into r1480; + ternary r1477 r1480 r1472 into r1481; + gte r1479 170141183460469231731687303715884105728u128 into r1482; + add.w r1479 r1479 into r1483; + add r1483 1u128 into r1484; + gte r1484 r1146 into r1485; + or r1482 r1485 into r1486; + sub.w r1484 r1146 into r1487; + ternary r1486 r1487 r1484 into r1488; + add r1481 1237940039285380274899124224u128 into r1489; + ternary r1486 r1489 r1481 into r1490; + gte r1488 170141183460469231731687303715884105728u128 into r1491; + add.w r1488 r1488 into r1492; + add r1492 1u128 into r1493; + gte r1493 r1146 into r1494; + or r1491 r1494 into r1495; + sub.w r1493 r1146 into r1496; + ternary r1495 r1496 r1493 into r1497; + add r1490 618970019642690137449562112u128 into r1498; + ternary r1495 r1498 r1490 into r1499; + gte r1497 170141183460469231731687303715884105728u128 into r1500; + add.w r1497 r1497 into r1501; + add r1501 1u128 into r1502; + gte r1502 r1146 into r1503; + or r1500 r1503 into r1504; + sub.w r1502 r1146 into r1505; + ternary r1504 r1505 r1502 into r1506; + add r1499 309485009821345068724781056u128 into r1507; + ternary r1504 r1507 r1499 into r1508; + gte r1506 170141183460469231731687303715884105728u128 into r1509; + add.w r1506 r1506 into r1510; + add r1510 1u128 into r1511; + gte r1511 r1146 into r1512; + or r1509 r1512 into r1513; + sub.w r1511 r1146 into r1514; + ternary r1513 r1514 r1511 into r1515; + add r1508 154742504910672534362390528u128 into r1516; + ternary r1513 r1516 r1508 into r1517; + gte r1515 170141183460469231731687303715884105728u128 into r1518; + add.w r1515 r1515 into r1519; + add r1519 1u128 into r1520; + gte r1520 r1146 into r1521; + or r1518 r1521 into r1522; + sub.w r1520 r1146 into r1523; + ternary r1522 r1523 r1520 into r1524; + add r1517 77371252455336267181195264u128 into r1525; + ternary r1522 r1525 r1517 into r1526; + gte r1524 170141183460469231731687303715884105728u128 into r1527; + add.w r1524 r1524 into r1528; + add r1528 1u128 into r1529; + gte r1529 r1146 into r1530; + or r1527 r1530 into r1531; + sub.w r1529 r1146 into r1532; + ternary r1531 r1532 r1529 into r1533; + add r1526 38685626227668133590597632u128 into r1534; + ternary r1531 r1534 r1526 into r1535; + gte r1533 170141183460469231731687303715884105728u128 into r1536; + add.w r1533 r1533 into r1537; + add r1537 1u128 into r1538; + gte r1538 r1146 into r1539; + or r1536 r1539 into r1540; + sub.w r1538 r1146 into r1541; + ternary r1540 r1541 r1538 into r1542; + add r1535 19342813113834066795298816u128 into r1543; + ternary r1540 r1543 r1535 into r1544; + gte r1542 170141183460469231731687303715884105728u128 into r1545; + add.w r1542 r1542 into r1546; + add r1546 1u128 into r1547; + gte r1547 r1146 into r1548; + or r1545 r1548 into r1549; + sub.w r1547 r1146 into r1550; + ternary r1549 r1550 r1547 into r1551; + add r1544 9671406556917033397649408u128 into r1552; + ternary r1549 r1552 r1544 into r1553; + gte r1551 170141183460469231731687303715884105728u128 into r1554; + add.w r1551 r1551 into r1555; + add r1555 1u128 into r1556; + gte r1556 r1146 into r1557; + or r1554 r1557 into r1558; + sub.w r1556 r1146 into r1559; + ternary r1558 r1559 r1556 into r1560; + add r1553 4835703278458516698824704u128 into r1561; + ternary r1558 r1561 r1553 into r1562; + gte r1560 170141183460469231731687303715884105728u128 into r1563; + add.w r1560 r1560 into r1564; + add r1564 1u128 into r1565; + gte r1565 r1146 into r1566; + or r1563 r1566 into r1567; + sub.w r1565 r1146 into r1568; + ternary r1567 r1568 r1565 into r1569; + add r1562 2417851639229258349412352u128 into r1570; + ternary r1567 r1570 r1562 into r1571; + gte r1569 170141183460469231731687303715884105728u128 into r1572; + add.w r1569 r1569 into r1573; + add r1573 1u128 into r1574; + gte r1574 r1146 into r1575; + or r1572 r1575 into r1576; + sub.w r1574 r1146 into r1577; + ternary r1576 r1577 r1574 into r1578; + add r1571 1208925819614629174706176u128 into r1579; + ternary r1576 r1579 r1571 into r1580; + gte r1578 170141183460469231731687303715884105728u128 into r1581; + add.w r1578 r1578 into r1582; + add r1582 1u128 into r1583; + gte r1583 r1146 into r1584; + or r1581 r1584 into r1585; + sub.w r1583 r1146 into r1586; + ternary r1585 r1586 r1583 into r1587; + add r1580 604462909807314587353088u128 into r1588; + ternary r1585 r1588 r1580 into r1589; + gte r1587 170141183460469231731687303715884105728u128 into r1590; + add.w r1587 r1587 into r1591; + add r1591 1u128 into r1592; + gte r1592 r1146 into r1593; + or r1590 r1593 into r1594; + sub.w r1592 r1146 into r1595; + ternary r1594 r1595 r1592 into r1596; + add r1589 302231454903657293676544u128 into r1597; + ternary r1594 r1597 r1589 into r1598; + gte r1596 170141183460469231731687303715884105728u128 into r1599; + add.w r1596 r1596 into r1600; + add r1600 1u128 into r1601; + gte r1601 r1146 into r1602; + or r1599 r1602 into r1603; + sub.w r1601 r1146 into r1604; + ternary r1603 r1604 r1601 into r1605; + add r1598 151115727451828646838272u128 into r1606; + ternary r1603 r1606 r1598 into r1607; + gte r1605 170141183460469231731687303715884105728u128 into r1608; + add.w r1605 r1605 into r1609; + add r1609 1u128 into r1610; + gte r1610 r1146 into r1611; + or r1608 r1611 into r1612; + sub.w r1610 r1146 into r1613; + ternary r1612 r1613 r1610 into r1614; + add r1607 75557863725914323419136u128 into r1615; + ternary r1612 r1615 r1607 into r1616; + gte r1614 170141183460469231731687303715884105728u128 into r1617; + add.w r1614 r1614 into r1618; + add r1618 1u128 into r1619; + gte r1619 r1146 into r1620; + or r1617 r1620 into r1621; + sub.w r1619 r1146 into r1622; + ternary r1621 r1622 r1619 into r1623; + add r1616 37778931862957161709568u128 into r1624; + ternary r1621 r1624 r1616 into r1625; + gte r1623 170141183460469231731687303715884105728u128 into r1626; + add.w r1623 r1623 into r1627; + add r1627 1u128 into r1628; + gte r1628 r1146 into r1629; + or r1626 r1629 into r1630; + sub.w r1628 r1146 into r1631; + ternary r1630 r1631 r1628 into r1632; + add r1625 18889465931478580854784u128 into r1633; + ternary r1630 r1633 r1625 into r1634; + gte r1632 170141183460469231731687303715884105728u128 into r1635; + add.w r1632 r1632 into r1636; + add r1636 1u128 into r1637; + gte r1637 r1146 into r1638; + or r1635 r1638 into r1639; + sub.w r1637 r1146 into r1640; + ternary r1639 r1640 r1637 into r1641; + add r1634 9444732965739290427392u128 into r1642; + ternary r1639 r1642 r1634 into r1643; + gte r1641 170141183460469231731687303715884105728u128 into r1644; + add.w r1641 r1641 into r1645; + add r1645 1u128 into r1646; + gte r1646 r1146 into r1647; + or r1644 r1647 into r1648; + sub.w r1646 r1146 into r1649; + ternary r1648 r1649 r1646 into r1650; + add r1643 4722366482869645213696u128 into r1651; + ternary r1648 r1651 r1643 into r1652; + gte r1650 170141183460469231731687303715884105728u128 into r1653; + add.w r1650 r1650 into r1654; + add r1654 1u128 into r1655; + gte r1655 r1146 into r1656; + or r1653 r1656 into r1657; + sub.w r1655 r1146 into r1658; + ternary r1657 r1658 r1655 into r1659; + add r1652 2361183241434822606848u128 into r1660; + ternary r1657 r1660 r1652 into r1661; + gte r1659 170141183460469231731687303715884105728u128 into r1662; + add.w r1659 r1659 into r1663; + add r1663 1u128 into r1664; + gte r1664 r1146 into r1665; + or r1662 r1665 into r1666; + sub.w r1664 r1146 into r1667; + ternary r1666 r1667 r1664 into r1668; + add r1661 1180591620717411303424u128 into r1669; + ternary r1666 r1669 r1661 into r1670; + gte r1668 170141183460469231731687303715884105728u128 into r1671; + add.w r1668 r1668 into r1672; + add r1672 1u128 into r1673; + gte r1673 r1146 into r1674; + or r1671 r1674 into r1675; + sub.w r1673 r1146 into r1676; + ternary r1675 r1676 r1673 into r1677; + add r1670 590295810358705651712u128 into r1678; + ternary r1675 r1678 r1670 into r1679; + gte r1677 170141183460469231731687303715884105728u128 into r1680; + add.w r1677 r1677 into r1681; + add r1681 1u128 into r1682; + gte r1682 r1146 into r1683; + or r1680 r1683 into r1684; + sub.w r1682 r1146 into r1685; + ternary r1684 r1685 r1682 into r1686; + add r1679 295147905179352825856u128 into r1687; + ternary r1684 r1687 r1679 into r1688; + gte r1686 170141183460469231731687303715884105728u128 into r1689; + add.w r1686 r1686 into r1690; + add r1690 1u128 into r1691; + gte r1691 r1146 into r1692; + or r1689 r1692 into r1693; + sub.w r1691 r1146 into r1694; + ternary r1693 r1694 r1691 into r1695; + add r1688 147573952589676412928u128 into r1696; + ternary r1693 r1696 r1688 into r1697; + gte r1695 170141183460469231731687303715884105728u128 into r1698; + add.w r1695 r1695 into r1699; + add r1699 1u128 into r1700; + gte r1700 r1146 into r1701; + or r1698 r1701 into r1702; + sub.w r1700 r1146 into r1703; + ternary r1702 r1703 r1700 into r1704; + add r1697 73786976294838206464u128 into r1705; + ternary r1702 r1705 r1697 into r1706; + gte r1704 170141183460469231731687303715884105728u128 into r1707; + add.w r1704 r1704 into r1708; + add r1708 1u128 into r1709; + gte r1709 r1146 into r1710; + or r1707 r1710 into r1711; + sub.w r1709 r1146 into r1712; + ternary r1711 r1712 r1709 into r1713; + add r1706 36893488147419103232u128 into r1714; + ternary r1711 r1714 r1706 into r1715; + gte r1713 170141183460469231731687303715884105728u128 into r1716; + add.w r1713 r1713 into r1717; + add r1717 1u128 into r1718; + gte r1718 r1146 into r1719; + or r1716 r1719 into r1720; + sub.w r1718 r1146 into r1721; + ternary r1720 r1721 r1718 into r1722; + add r1715 18446744073709551616u128 into r1723; + ternary r1720 r1723 r1715 into r1724; + gte r1722 170141183460469231731687303715884105728u128 into r1725; + add.w r1722 r1722 into r1726; + add r1726 1u128 into r1727; + gte r1727 r1146 into r1728; + or r1725 r1728 into r1729; + sub.w r1727 r1146 into r1730; + ternary r1729 r1730 r1727 into r1731; + add r1724 9223372036854775808u128 into r1732; + ternary r1729 r1732 r1724 into r1733; + gte r1731 170141183460469231731687303715884105728u128 into r1734; + add.w r1731 r1731 into r1735; + add r1735 1u128 into r1736; + gte r1736 r1146 into r1737; + or r1734 r1737 into r1738; + sub.w r1736 r1146 into r1739; + ternary r1738 r1739 r1736 into r1740; + add r1733 4611686018427387904u128 into r1741; + ternary r1738 r1741 r1733 into r1742; + gte r1740 170141183460469231731687303715884105728u128 into r1743; + add.w r1740 r1740 into r1744; + add r1744 1u128 into r1745; + gte r1745 r1146 into r1746; + or r1743 r1746 into r1747; + sub.w r1745 r1146 into r1748; + ternary r1747 r1748 r1745 into r1749; + add r1742 2305843009213693952u128 into r1750; + ternary r1747 r1750 r1742 into r1751; + gte r1749 170141183460469231731687303715884105728u128 into r1752; + add.w r1749 r1749 into r1753; + add r1753 1u128 into r1754; + gte r1754 r1146 into r1755; + or r1752 r1755 into r1756; + sub.w r1754 r1146 into r1757; + ternary r1756 r1757 r1754 into r1758; + add r1751 1152921504606846976u128 into r1759; + ternary r1756 r1759 r1751 into r1760; + gte r1758 170141183460469231731687303715884105728u128 into r1761; + add.w r1758 r1758 into r1762; + add r1762 1u128 into r1763; + gte r1763 r1146 into r1764; + or r1761 r1764 into r1765; + sub.w r1763 r1146 into r1766; + ternary r1765 r1766 r1763 into r1767; + add r1760 576460752303423488u128 into r1768; + ternary r1765 r1768 r1760 into r1769; + gte r1767 170141183460469231731687303715884105728u128 into r1770; + add.w r1767 r1767 into r1771; + add r1771 1u128 into r1772; + gte r1772 r1146 into r1773; + or r1770 r1773 into r1774; + sub.w r1772 r1146 into r1775; + ternary r1774 r1775 r1772 into r1776; + add r1769 288230376151711744u128 into r1777; + ternary r1774 r1777 r1769 into r1778; + gte r1776 170141183460469231731687303715884105728u128 into r1779; + add.w r1776 r1776 into r1780; + add r1780 1u128 into r1781; + gte r1781 r1146 into r1782; + or r1779 r1782 into r1783; + sub.w r1781 r1146 into r1784; + ternary r1783 r1784 r1781 into r1785; + add r1778 144115188075855872u128 into r1786; + ternary r1783 r1786 r1778 into r1787; + gte r1785 170141183460469231731687303715884105728u128 into r1788; + add.w r1785 r1785 into r1789; + add r1789 1u128 into r1790; + gte r1790 r1146 into r1791; + or r1788 r1791 into r1792; + sub.w r1790 r1146 into r1793; + ternary r1792 r1793 r1790 into r1794; + add r1787 72057594037927936u128 into r1795; + ternary r1792 r1795 r1787 into r1796; + gte r1794 170141183460469231731687303715884105728u128 into r1797; + add.w r1794 r1794 into r1798; + add r1798 1u128 into r1799; + gte r1799 r1146 into r1800; + or r1797 r1800 into r1801; + sub.w r1799 r1146 into r1802; + ternary r1801 r1802 r1799 into r1803; + add r1796 36028797018963968u128 into r1804; + ternary r1801 r1804 r1796 into r1805; + gte r1803 170141183460469231731687303715884105728u128 into r1806; + add.w r1803 r1803 into r1807; + add r1807 1u128 into r1808; + gte r1808 r1146 into r1809; + or r1806 r1809 into r1810; + sub.w r1808 r1146 into r1811; + ternary r1810 r1811 r1808 into r1812; + add r1805 18014398509481984u128 into r1813; + ternary r1810 r1813 r1805 into r1814; + gte r1812 170141183460469231731687303715884105728u128 into r1815; + add.w r1812 r1812 into r1816; + add r1816 1u128 into r1817; + gte r1817 r1146 into r1818; + or r1815 r1818 into r1819; + sub.w r1817 r1146 into r1820; + ternary r1819 r1820 r1817 into r1821; + add r1814 9007199254740992u128 into r1822; + ternary r1819 r1822 r1814 into r1823; + gte r1821 170141183460469231731687303715884105728u128 into r1824; + add.w r1821 r1821 into r1825; + add r1825 1u128 into r1826; + gte r1826 r1146 into r1827; + or r1824 r1827 into r1828; + sub.w r1826 r1146 into r1829; + ternary r1828 r1829 r1826 into r1830; + add r1823 4503599627370496u128 into r1831; + ternary r1828 r1831 r1823 into r1832; + gte r1830 170141183460469231731687303715884105728u128 into r1833; + add.w r1830 r1830 into r1834; + add r1834 1u128 into r1835; + gte r1835 r1146 into r1836; + or r1833 r1836 into r1837; + sub.w r1835 r1146 into r1838; + ternary r1837 r1838 r1835 into r1839; + add r1832 2251799813685248u128 into r1840; + ternary r1837 r1840 r1832 into r1841; + gte r1839 170141183460469231731687303715884105728u128 into r1842; + add.w r1839 r1839 into r1843; + add r1843 1u128 into r1844; + gte r1844 r1146 into r1845; + or r1842 r1845 into r1846; + sub.w r1844 r1146 into r1847; + ternary r1846 r1847 r1844 into r1848; + add r1841 1125899906842624u128 into r1849; + ternary r1846 r1849 r1841 into r1850; + gte r1848 170141183460469231731687303715884105728u128 into r1851; + add.w r1848 r1848 into r1852; + add r1852 1u128 into r1853; + gte r1853 r1146 into r1854; + or r1851 r1854 into r1855; + sub.w r1853 r1146 into r1856; + ternary r1855 r1856 r1853 into r1857; + add r1850 562949953421312u128 into r1858; + ternary r1855 r1858 r1850 into r1859; + gte r1857 170141183460469231731687303715884105728u128 into r1860; + add.w r1857 r1857 into r1861; + add r1861 1u128 into r1862; + gte r1862 r1146 into r1863; + or r1860 r1863 into r1864; + sub.w r1862 r1146 into r1865; + ternary r1864 r1865 r1862 into r1866; + add r1859 281474976710656u128 into r1867; + ternary r1864 r1867 r1859 into r1868; + gte r1866 170141183460469231731687303715884105728u128 into r1869; + add.w r1866 r1866 into r1870; + add r1870 1u128 into r1871; + gte r1871 r1146 into r1872; + or r1869 r1872 into r1873; + sub.w r1871 r1146 into r1874; + ternary r1873 r1874 r1871 into r1875; + add r1868 140737488355328u128 into r1876; + ternary r1873 r1876 r1868 into r1877; + gte r1875 170141183460469231731687303715884105728u128 into r1878; + add.w r1875 r1875 into r1879; + add r1879 1u128 into r1880; + gte r1880 r1146 into r1881; + or r1878 r1881 into r1882; + sub.w r1880 r1146 into r1883; + ternary r1882 r1883 r1880 into r1884; + add r1877 70368744177664u128 into r1885; + ternary r1882 r1885 r1877 into r1886; + gte r1884 170141183460469231731687303715884105728u128 into r1887; + add.w r1884 r1884 into r1888; + add r1888 1u128 into r1889; + gte r1889 r1146 into r1890; + or r1887 r1890 into r1891; + sub.w r1889 r1146 into r1892; + ternary r1891 r1892 r1889 into r1893; + add r1886 35184372088832u128 into r1894; + ternary r1891 r1894 r1886 into r1895; + gte r1893 170141183460469231731687303715884105728u128 into r1896; + add.w r1893 r1893 into r1897; + add r1897 1u128 into r1898; + gte r1898 r1146 into r1899; + or r1896 r1899 into r1900; + sub.w r1898 r1146 into r1901; + ternary r1900 r1901 r1898 into r1902; + add r1895 17592186044416u128 into r1903; + ternary r1900 r1903 r1895 into r1904; + gte r1902 170141183460469231731687303715884105728u128 into r1905; + add.w r1902 r1902 into r1906; + add r1906 1u128 into r1907; + gte r1907 r1146 into r1908; + or r1905 r1908 into r1909; + sub.w r1907 r1146 into r1910; + ternary r1909 r1910 r1907 into r1911; + add r1904 8796093022208u128 into r1912; + ternary r1909 r1912 r1904 into r1913; + gte r1911 170141183460469231731687303715884105728u128 into r1914; + add.w r1911 r1911 into r1915; + add r1915 1u128 into r1916; + gte r1916 r1146 into r1917; + or r1914 r1917 into r1918; + sub.w r1916 r1146 into r1919; + ternary r1918 r1919 r1916 into r1920; + add r1913 4398046511104u128 into r1921; + ternary r1918 r1921 r1913 into r1922; + gte r1920 170141183460469231731687303715884105728u128 into r1923; + add.w r1920 r1920 into r1924; + add r1924 1u128 into r1925; + gte r1925 r1146 into r1926; + or r1923 r1926 into r1927; + sub.w r1925 r1146 into r1928; + ternary r1927 r1928 r1925 into r1929; + add r1922 2199023255552u128 into r1930; + ternary r1927 r1930 r1922 into r1931; + gte r1929 170141183460469231731687303715884105728u128 into r1932; + add.w r1929 r1929 into r1933; + add r1933 1u128 into r1934; + gte r1934 r1146 into r1935; + or r1932 r1935 into r1936; + sub.w r1934 r1146 into r1937; + ternary r1936 r1937 r1934 into r1938; + add r1931 1099511627776u128 into r1939; + ternary r1936 r1939 r1931 into r1940; + gte r1938 170141183460469231731687303715884105728u128 into r1941; + add.w r1938 r1938 into r1942; + add r1942 1u128 into r1943; + gte r1943 r1146 into r1944; + or r1941 r1944 into r1945; + sub.w r1943 r1146 into r1946; + ternary r1945 r1946 r1943 into r1947; + add r1940 549755813888u128 into r1948; + ternary r1945 r1948 r1940 into r1949; + gte r1947 170141183460469231731687303715884105728u128 into r1950; + add.w r1947 r1947 into r1951; + add r1951 1u128 into r1952; + gte r1952 r1146 into r1953; + or r1950 r1953 into r1954; + sub.w r1952 r1146 into r1955; + ternary r1954 r1955 r1952 into r1956; + add r1949 274877906944u128 into r1957; + ternary r1954 r1957 r1949 into r1958; + gte r1956 170141183460469231731687303715884105728u128 into r1959; + add.w r1956 r1956 into r1960; + add r1960 1u128 into r1961; + gte r1961 r1146 into r1962; + or r1959 r1962 into r1963; + sub.w r1961 r1146 into r1964; + ternary r1963 r1964 r1961 into r1965; + add r1958 137438953472u128 into r1966; + ternary r1963 r1966 r1958 into r1967; + gte r1965 170141183460469231731687303715884105728u128 into r1968; + add.w r1965 r1965 into r1969; + add r1969 1u128 into r1970; + gte r1970 r1146 into r1971; + or r1968 r1971 into r1972; + sub.w r1970 r1146 into r1973; + ternary r1972 r1973 r1970 into r1974; + add r1967 68719476736u128 into r1975; + ternary r1972 r1975 r1967 into r1976; + gte r1974 170141183460469231731687303715884105728u128 into r1977; + add.w r1974 r1974 into r1978; + add r1978 1u128 into r1979; + gte r1979 r1146 into r1980; + or r1977 r1980 into r1981; + sub.w r1979 r1146 into r1982; + ternary r1981 r1982 r1979 into r1983; + add r1976 34359738368u128 into r1984; + ternary r1981 r1984 r1976 into r1985; + gte r1983 170141183460469231731687303715884105728u128 into r1986; + add.w r1983 r1983 into r1987; + add r1987 1u128 into r1988; + gte r1988 r1146 into r1989; + or r1986 r1989 into r1990; + sub.w r1988 r1146 into r1991; + ternary r1990 r1991 r1988 into r1992; + add r1985 17179869184u128 into r1993; + ternary r1990 r1993 r1985 into r1994; + gte r1992 170141183460469231731687303715884105728u128 into r1995; + add.w r1992 r1992 into r1996; + add r1996 1u128 into r1997; + gte r1997 r1146 into r1998; + or r1995 r1998 into r1999; + sub.w r1997 r1146 into r2000; + ternary r1999 r2000 r1997 into r2001; + add r1994 8589934592u128 into r2002; + ternary r1999 r2002 r1994 into r2003; + gte r2001 170141183460469231731687303715884105728u128 into r2004; + add.w r2001 r2001 into r2005; + add r2005 1u128 into r2006; + gte r2006 r1146 into r2007; + or r2004 r2007 into r2008; + sub.w r2006 r1146 into r2009; + ternary r2008 r2009 r2006 into r2010; + add r2003 4294967296u128 into r2011; + ternary r2008 r2011 r2003 into r2012; + gte r2010 170141183460469231731687303715884105728u128 into r2013; + add.w r2010 r2010 into r2014; + add r2014 1u128 into r2015; + gte r2015 r1146 into r2016; + or r2013 r2016 into r2017; + sub.w r2015 r1146 into r2018; + ternary r2017 r2018 r2015 into r2019; + add r2012 2147483648u128 into r2020; + ternary r2017 r2020 r2012 into r2021; + gte r2019 170141183460469231731687303715884105728u128 into r2022; + add.w r2019 r2019 into r2023; + add r2023 1u128 into r2024; + gte r2024 r1146 into r2025; + or r2022 r2025 into r2026; + sub.w r2024 r1146 into r2027; + ternary r2026 r2027 r2024 into r2028; + add r2021 1073741824u128 into r2029; + ternary r2026 r2029 r2021 into r2030; + gte r2028 170141183460469231731687303715884105728u128 into r2031; + add.w r2028 r2028 into r2032; + add r2032 1u128 into r2033; + gte r2033 r1146 into r2034; + or r2031 r2034 into r2035; + sub.w r2033 r1146 into r2036; + ternary r2035 r2036 r2033 into r2037; + add r2030 536870912u128 into r2038; + ternary r2035 r2038 r2030 into r2039; + gte r2037 170141183460469231731687303715884105728u128 into r2040; + add.w r2037 r2037 into r2041; + add r2041 1u128 into r2042; + gte r2042 r1146 into r2043; + or r2040 r2043 into r2044; + sub.w r2042 r1146 into r2045; + ternary r2044 r2045 r2042 into r2046; + add r2039 268435456u128 into r2047; + ternary r2044 r2047 r2039 into r2048; + gte r2046 170141183460469231731687303715884105728u128 into r2049; + add.w r2046 r2046 into r2050; + add r2050 1u128 into r2051; + gte r2051 r1146 into r2052; + or r2049 r2052 into r2053; + sub.w r2051 r1146 into r2054; + ternary r2053 r2054 r2051 into r2055; + add r2048 134217728u128 into r2056; + ternary r2053 r2056 r2048 into r2057; + gte r2055 170141183460469231731687303715884105728u128 into r2058; + add.w r2055 r2055 into r2059; + add r2059 1u128 into r2060; + gte r2060 r1146 into r2061; + or r2058 r2061 into r2062; + sub.w r2060 r1146 into r2063; + ternary r2062 r2063 r2060 into r2064; + add r2057 67108864u128 into r2065; + ternary r2062 r2065 r2057 into r2066; + gte r2064 170141183460469231731687303715884105728u128 into r2067; + add.w r2064 r2064 into r2068; + add r2068 1u128 into r2069; + gte r2069 r1146 into r2070; + or r2067 r2070 into r2071; + sub.w r2069 r1146 into r2072; + ternary r2071 r2072 r2069 into r2073; + add r2066 33554432u128 into r2074; + ternary r2071 r2074 r2066 into r2075; + gte r2073 170141183460469231731687303715884105728u128 into r2076; + add.w r2073 r2073 into r2077; + add r2077 1u128 into r2078; + gte r2078 r1146 into r2079; + or r2076 r2079 into r2080; + sub.w r2078 r1146 into r2081; + ternary r2080 r2081 r2078 into r2082; + add r2075 16777216u128 into r2083; + ternary r2080 r2083 r2075 into r2084; + gte r2082 170141183460469231731687303715884105728u128 into r2085; + add.w r2082 r2082 into r2086; + add r2086 1u128 into r2087; + gte r2087 r1146 into r2088; + or r2085 r2088 into r2089; + sub.w r2087 r1146 into r2090; + ternary r2089 r2090 r2087 into r2091; + add r2084 8388608u128 into r2092; + ternary r2089 r2092 r2084 into r2093; + gte r2091 170141183460469231731687303715884105728u128 into r2094; + add.w r2091 r2091 into r2095; + add r2095 1u128 into r2096; + gte r2096 r1146 into r2097; + or r2094 r2097 into r2098; + sub.w r2096 r1146 into r2099; + ternary r2098 r2099 r2096 into r2100; + add r2093 4194304u128 into r2101; + ternary r2098 r2101 r2093 into r2102; + gte r2100 170141183460469231731687303715884105728u128 into r2103; + add.w r2100 r2100 into r2104; + add r2104 1u128 into r2105; + gte r2105 r1146 into r2106; + or r2103 r2106 into r2107; + sub.w r2105 r1146 into r2108; + ternary r2107 r2108 r2105 into r2109; + add r2102 2097152u128 into r2110; + ternary r2107 r2110 r2102 into r2111; + gte r2109 170141183460469231731687303715884105728u128 into r2112; + add.w r2109 r2109 into r2113; + add r2113 1u128 into r2114; + gte r2114 r1146 into r2115; + or r2112 r2115 into r2116; + sub.w r2114 r1146 into r2117; + ternary r2116 r2117 r2114 into r2118; + add r2111 1048576u128 into r2119; + ternary r2116 r2119 r2111 into r2120; + gte r2118 170141183460469231731687303715884105728u128 into r2121; + add.w r2118 r2118 into r2122; + add r2122 1u128 into r2123; + gte r2123 r1146 into r2124; + or r2121 r2124 into r2125; + sub.w r2123 r1146 into r2126; + ternary r2125 r2126 r2123 into r2127; + add r2120 524288u128 into r2128; + ternary r2125 r2128 r2120 into r2129; + gte r2127 170141183460469231731687303715884105728u128 into r2130; + add.w r2127 r2127 into r2131; + add r2131 1u128 into r2132; + gte r2132 r1146 into r2133; + or r2130 r2133 into r2134; + sub.w r2132 r1146 into r2135; + ternary r2134 r2135 r2132 into r2136; + add r2129 262144u128 into r2137; + ternary r2134 r2137 r2129 into r2138; + gte r2136 170141183460469231731687303715884105728u128 into r2139; + add.w r2136 r2136 into r2140; + add r2140 1u128 into r2141; + gte r2141 r1146 into r2142; + or r2139 r2142 into r2143; + sub.w r2141 r1146 into r2144; + ternary r2143 r2144 r2141 into r2145; + add r2138 131072u128 into r2146; + ternary r2143 r2146 r2138 into r2147; + gte r2145 170141183460469231731687303715884105728u128 into r2148; + add.w r2145 r2145 into r2149; + add r2149 1u128 into r2150; + gte r2150 r1146 into r2151; + or r2148 r2151 into r2152; + sub.w r2150 r1146 into r2153; + ternary r2152 r2153 r2150 into r2154; + add r2147 65536u128 into r2155; + ternary r2152 r2155 r2147 into r2156; + gte r2154 170141183460469231731687303715884105728u128 into r2157; + add.w r2154 r2154 into r2158; + add r2158 1u128 into r2159; + gte r2159 r1146 into r2160; + or r2157 r2160 into r2161; + sub.w r2159 r1146 into r2162; + ternary r2161 r2162 r2159 into r2163; + add r2156 32768u128 into r2164; + ternary r2161 r2164 r2156 into r2165; + gte r2163 170141183460469231731687303715884105728u128 into r2166; + add.w r2163 r2163 into r2167; + add r2167 1u128 into r2168; + gte r2168 r1146 into r2169; + or r2166 r2169 into r2170; + sub.w r2168 r1146 into r2171; + ternary r2170 r2171 r2168 into r2172; + add r2165 16384u128 into r2173; + ternary r2170 r2173 r2165 into r2174; + gte r2172 170141183460469231731687303715884105728u128 into r2175; + add.w r2172 r2172 into r2176; + add r2176 1u128 into r2177; + gte r2177 r1146 into r2178; + or r2175 r2178 into r2179; + sub.w r2177 r1146 into r2180; + ternary r2179 r2180 r2177 into r2181; + add r2174 8192u128 into r2182; + ternary r2179 r2182 r2174 into r2183; + gte r2181 170141183460469231731687303715884105728u128 into r2184; + add.w r2181 r2181 into r2185; + add r2185 1u128 into r2186; + gte r2186 r1146 into r2187; + or r2184 r2187 into r2188; + sub.w r2186 r1146 into r2189; + ternary r2188 r2189 r2186 into r2190; + add r2183 4096u128 into r2191; + ternary r2188 r2191 r2183 into r2192; + gte r2190 170141183460469231731687303715884105728u128 into r2193; + add.w r2190 r2190 into r2194; + add r2194 1u128 into r2195; + gte r2195 r1146 into r2196; + or r2193 r2196 into r2197; + sub.w r2195 r1146 into r2198; + ternary r2197 r2198 r2195 into r2199; + add r2192 2048u128 into r2200; + ternary r2197 r2200 r2192 into r2201; + gte r2199 170141183460469231731687303715884105728u128 into r2202; + add.w r2199 r2199 into r2203; + add r2203 1u128 into r2204; + gte r2204 r1146 into r2205; + or r2202 r2205 into r2206; + sub.w r2204 r1146 into r2207; + ternary r2206 r2207 r2204 into r2208; + add r2201 1024u128 into r2209; + ternary r2206 r2209 r2201 into r2210; + gte r2208 170141183460469231731687303715884105728u128 into r2211; + add.w r2208 r2208 into r2212; + add r2212 1u128 into r2213; + gte r2213 r1146 into r2214; + or r2211 r2214 into r2215; + sub.w r2213 r1146 into r2216; + ternary r2215 r2216 r2213 into r2217; + add r2210 512u128 into r2218; + ternary r2215 r2218 r2210 into r2219; + gte r2217 170141183460469231731687303715884105728u128 into r2220; + add.w r2217 r2217 into r2221; + add r2221 1u128 into r2222; + gte r2222 r1146 into r2223; + or r2220 r2223 into r2224; + sub.w r2222 r1146 into r2225; + ternary r2224 r2225 r2222 into r2226; + add r2219 256u128 into r2227; + ternary r2224 r2227 r2219 into r2228; + gte r2226 170141183460469231731687303715884105728u128 into r2229; + add.w r2226 r2226 into r2230; + add r2230 1u128 into r2231; + gte r2231 r1146 into r2232; + or r2229 r2232 into r2233; + sub.w r2231 r1146 into r2234; + ternary r2233 r2234 r2231 into r2235; + add r2228 128u128 into r2236; + ternary r2233 r2236 r2228 into r2237; + gte r2235 170141183460469231731687303715884105728u128 into r2238; + add.w r2235 r2235 into r2239; + add r2239 1u128 into r2240; + gte r2240 r1146 into r2241; + or r2238 r2241 into r2242; + sub.w r2240 r1146 into r2243; + ternary r2242 r2243 r2240 into r2244; + add r2237 64u128 into r2245; + ternary r2242 r2245 r2237 into r2246; + gte r2244 170141183460469231731687303715884105728u128 into r2247; + add.w r2244 r2244 into r2248; + add r2248 1u128 into r2249; + gte r2249 r1146 into r2250; + or r2247 r2250 into r2251; + sub.w r2249 r1146 into r2252; + ternary r2251 r2252 r2249 into r2253; + add r2246 32u128 into r2254; + ternary r2251 r2254 r2246 into r2255; + gte r2253 170141183460469231731687303715884105728u128 into r2256; + add.w r2253 r2253 into r2257; + add r2257 1u128 into r2258; + gte r2258 r1146 into r2259; + or r2256 r2259 into r2260; + sub.w r2258 r1146 into r2261; + ternary r2260 r2261 r2258 into r2262; + add r2255 16u128 into r2263; + ternary r2260 r2263 r2255 into r2264; + gte r2262 170141183460469231731687303715884105728u128 into r2265; + add.w r2262 r2262 into r2266; + add r2266 1u128 into r2267; + gte r2267 r1146 into r2268; + or r2265 r2268 into r2269; + sub.w r2267 r1146 into r2270; + ternary r2269 r2270 r2267 into r2271; + add r2264 8u128 into r2272; + ternary r2269 r2272 r2264 into r2273; + gte r2271 170141183460469231731687303715884105728u128 into r2274; + add.w r2271 r2271 into r2275; + add r2275 1u128 into r2276; + gte r2276 r1146 into r2277; + or r2274 r2277 into r2278; + sub.w r2276 r1146 into r2279; + ternary r2278 r2279 r2276 into r2280; + add r2273 4u128 into r2281; + ternary r2278 r2281 r2273 into r2282; + gte r2280 170141183460469231731687303715884105728u128 into r2283; + add.w r2280 r2280 into r2284; + add r2284 1u128 into r2285; + gte r2285 r1146 into r2286; + or r2283 r2286 into r2287; + sub.w r2285 r1146 into r2288; + ternary r2287 r2288 r2285 into r2289; + add r2282 2u128 into r2290; + ternary r2287 r2290 r2282 into r2291; + gte r2289 170141183460469231731687303715884105728u128 into r2292; + add.w r2289 r2289 into r2293; + add r2293 1u128 into r2294; + gte r2294 r1146 into r2295; + or r2292 r2295 into r2296; + add r2291 1u128 into r2297; + ternary r2296 r2297 r2291 into r2298; + cast r1147 r2298 into r2299 as U256__8JquwLopp8; + ternary r1144 r2299.hi r1143.hi into r2300; + ternary r1144 r2299.lo r1143.lo into r2301; + cast r2300 r2301 into r2302 as U256__8JquwLopp8; + output r2302 as U256__8JquwLopp8.public; + +view view_mul_div: + input r0 as U256__8JquwLopp8.public; + input r1 as U256__8JquwLopp8.public; + input r2 as U256__8JquwLopp8.public; + input r3 as boolean.public; + and r0.lo 18446744073709551615u128 into r4; + shr r0.lo 64u8 into r5; + and r1.lo 18446744073709551615u128 into r6; + shr r1.lo 64u8 into r7; + mul r4 r6 into r8; + mul r4 r7 into r9; + mul r5 r6 into r10; + mul r5 r7 into r11; + and r8 18446744073709551615u128 into r12; + shr r8 64u8 into r13; + and r9 18446744073709551615u128 into r14; + add r13 r14 into r15; + and r10 18446744073709551615u128 into r16; + add r15 r16 into r17; + and r17 18446744073709551615u128 into r18; + shr r17 64u8 into r19; + shr r9 64u8 into r20; + shr r10 64u8 into r21; + add r20 r21 into r22; + and r11 18446744073709551615u128 into r23; + add r22 r23 into r24; + add r24 r19 into r25; + and r25 18446744073709551615u128 into r26; + shr r25 64u8 into r27; + shr r11 64u8 into r28; + add r28 r27 into r29; + shl r29 64u8 into r30; + add r30 r26 into r31; + shl r18 64u8 into r32; + add r32 r12 into r33; + and r0.lo 18446744073709551615u128 into r34; + shr r0.lo 64u8 into r35; + and r1.hi 18446744073709551615u128 into r36; + shr r1.hi 64u8 into r37; + mul r34 r36 into r38; + mul r34 r37 into r39; + mul r35 r36 into r40; + mul r35 r37 into r41; + and r38 18446744073709551615u128 into r42; + shr r38 64u8 into r43; + and r39 18446744073709551615u128 into r44; + add r43 r44 into r45; + and r40 18446744073709551615u128 into r46; + add r45 r46 into r47; + and r47 18446744073709551615u128 into r48; + shr r47 64u8 into r49; + shr r39 64u8 into r50; + shr r40 64u8 into r51; + add r50 r51 into r52; + and r41 18446744073709551615u128 into r53; + add r52 r53 into r54; + add r54 r49 into r55; + and r55 18446744073709551615u128 into r56; + shr r55 64u8 into r57; + shr r41 64u8 into r58; + add r58 r57 into r59; + shl r59 64u8 into r60; + add r60 r56 into r61; + shl r48 64u8 into r62; + add r62 r42 into r63; + and r0.hi 18446744073709551615u128 into r64; + shr r0.hi 64u8 into r65; + and r1.lo 18446744073709551615u128 into r66; + shr r1.lo 64u8 into r67; + mul r64 r66 into r68; + mul r64 r67 into r69; + mul r65 r66 into r70; + mul r65 r67 into r71; + and r68 18446744073709551615u128 into r72; + shr r68 64u8 into r73; + and r69 18446744073709551615u128 into r74; + add r73 r74 into r75; + and r70 18446744073709551615u128 into r76; + add r75 r76 into r77; + and r77 18446744073709551615u128 into r78; + shr r77 64u8 into r79; + shr r69 64u8 into r80; + shr r70 64u8 into r81; + add r80 r81 into r82; + and r71 18446744073709551615u128 into r83; + add r82 r83 into r84; + add r84 r79 into r85; + and r85 18446744073709551615u128 into r86; + shr r85 64u8 into r87; + shr r71 64u8 into r88; + add r88 r87 into r89; + shl r89 64u8 into r90; + add r90 r86 into r91; + shl r78 64u8 into r92; + add r92 r72 into r93; + and r0.hi 18446744073709551615u128 into r94; + shr r0.hi 64u8 into r95; + and r1.hi 18446744073709551615u128 into r96; + shr r1.hi 64u8 into r97; + mul r94 r96 into r98; + mul r94 r97 into r99; + mul r95 r96 into r100; + mul r95 r97 into r101; + and r98 18446744073709551615u128 into r102; + shr r98 64u8 into r103; + and r99 18446744073709551615u128 into r104; + add r103 r104 into r105; + and r100 18446744073709551615u128 into r106; + add r105 r106 into r107; + and r107 18446744073709551615u128 into r108; + shr r107 64u8 into r109; + shr r99 64u8 into r110; + shr r100 64u8 into r111; + add r110 r111 into r112; + and r101 18446744073709551615u128 into r113; + add r112 r113 into r114; + add r114 r109 into r115; + and r115 18446744073709551615u128 into r116; + shr r115 64u8 into r117; + shr r101 64u8 into r118; + add r118 r117 into r119; + shl r119 64u8 into r120; + add r120 r116 into r121; + shl r108 64u8 into r122; + add r122 r102 into r123; + add.w r31 r63 into r124; + lt r124 r31 into r125; + ternary r125 1u128 0u128 into r126; + add.w r124 r93 into r127; + lt r127 r124 into r128; + ternary r128 1u128 0u128 into r129; + add r126 r129 into r130; + add.w r61 r91 into r131; + lt r131 r61 into r132; + ternary r132 1u128 0u128 into r133; + add.w r131 r123 into r134; + lt r134 r131 into r135; + ternary r135 1u128 0u128 into r136; + add.w r134 r130 into r137; + lt r137 r134 into r138; + ternary r138 1u128 0u128 into r139; + add r133 r136 into r140; + add r140 r139 into r141; + add.w r121 r141 into r142; + cast r142 r137 into r143 as U256__8JquwLopp8; + cast r127 r33 into r144 as U256__8JquwLopp8; + lt r143.hi r2.hi into r145; + gt r143.hi r2.hi into r146; + lt r143.lo r2.lo into r147; + ternary r146 false r147 into r148; + ternary r145 true r148 into r149; + assert.eq r149 true; + gt r2.hi 0u128 into r150; + ternary r150 r2.hi r2.lo into r151; + ternary r150 128u32 0u32 into r152; + gte r151 18446744073709551616u128 into r153; + shr r151 64u8 into r154; + ternary r153 r154 r151 into r155; + ternary r153 64u32 0u32 into r156; + gte r155 4294967296u128 into r157; + shr r155 32u8 into r158; + add r156 32u32 into r159; + ternary r157 r158 r155 into r160; + ternary r157 r159 r156 into r161; + gte r160 65536u128 into r162; + shr r160 16u8 into r163; + add r161 16u32 into r164; + ternary r162 r163 r160 into r165; + ternary r162 r164 r161 into r166; + gte r165 256u128 into r167; + shr r165 8u8 into r168; + add r166 8u32 into r169; + ternary r167 r168 r165 into r170; + ternary r167 r169 r166 into r171; + gte r170 16u128 into r172; + shr r170 4u8 into r173; + add r171 4u32 into r174; + ternary r172 r173 r170 into r175; + ternary r172 r174 r171 into r176; + gte r175 4u128 into r177; + shr r175 2u8 into r178; + add r176 2u32 into r179; + ternary r177 r178 r175 into r180; + ternary r177 r179 r176 into r181; + gte r180 2u128 into r182; + add r181 1u32 into r183; + ternary r182 r183 r181 into r184; + add r152 r184 into r185; + sub 255u32 r185 into r186; + cast r186 into r187 as u16; + and r187 127u16 into r188; + cast r188 into r189 as u8; + is.eq r189 0u8 into r190; + sub 128u8 r189 into r191; + shr.w r2.lo r191 into r192; + ternary r190 0u128 r192 into r193; + shl.w r2.hi r189 into r194; + or r194 r193 into r195; + shl.w r2.lo r189 into r196; + shl.w r2.lo r189 into r197; + gte r187 128u16 into r198; + ternary r198 r197 r195 into r199; + ternary r198 0u128 r196 into r200; + cast r199 r200 into r201 as U256__8JquwLopp8; + and r201.lo 18446744073709551615u128 into r202; + shr r201.lo 64u8 into r203; + and r201.hi 18446744073709551615u128 into r204; + shr r201.hi 64u8 into r205; + cast r188 into r206 as u8; + is.eq r206 0u8 into r207; + sub 128u8 r206 into r208; + shr.w r144.lo r208 into r209; + ternary r207 0u128 r209 into r210; + shl.w r144.hi r206 into r211; + or r211 r210 into r212; + shl.w r144.lo r206 into r213; + shl.w r144.lo r206 into r214; + ternary r198 r214 r212 into r215; + ternary r198 0u128 r213 into r216; + cast r215 r216 into r217 as U256__8JquwLopp8; + is.eq r187 0u16 into r218; + sub 256u16 r187 into r219; + and r219 127u16 into r220; + cast r220 into r221 as u8; + is.eq r221 0u8 into r222; + sub 128u8 r221 into r223; + shl.w r144.hi r223 into r224; + ternary r222 0u128 r224 into r225; + shr r144.lo r221 into r226; + or r226 r225 into r227; + shr r144.hi r221 into r228; + shr r144.hi r221 into r229; + gte r219 128u16 into r230; + ternary r230 0u128 r228 into r231; + ternary r230 r229 r227 into r232; + cast r231 r232 into r233 as U256__8JquwLopp8; + ternary r218 0u128 r233.hi into r234; + ternary r218 0u128 r233.lo into r235; + cast r234 r235 into r236 as U256__8JquwLopp8; + cast r188 into r237 as u8; + is.eq r237 0u8 into r238; + sub 128u8 r237 into r239; + shr.w r143.lo r239 into r240; + ternary r238 0u128 r240 into r241; + shl.w r143.hi r237 into r242; + or r242 r241 into r243; + shl.w r143.lo r237 into r244; + shl.w r143.lo r237 into r245; + ternary r198 r245 r243 into r246; + ternary r198 0u128 r244 into r247; + cast r246 r247 into r248 as U256__8JquwLopp8; + add.w r248.lo r236.lo into r249; + lt r249 r248.lo into r250; + ternary r250 1u128 0u128 into r251; + add.w r248.hi r236.hi into r252; + add.w r252 r251 into r253; + cast r253 r249 into r254 as U256__8JquwLopp8; + and r217.lo 18446744073709551615u128 into r255; + shr r217.lo 64u8 into r256; + and r217.hi 18446744073709551615u128 into r257; + shr r217.hi 64u8 into r258; + and r254.lo 18446744073709551615u128 into r259; + shr r254.lo 64u8 into r260; + and r254.hi 18446744073709551615u128 into r261; + shr r254.hi 64u8 into r262; + shl r262 64u8 into r263; + add r263 r261 into r264; + div r264 r205 into r265; + gt r265 18446744073709551615u128 into r266; + ternary r266 18446744073709551615u128 r265 into r267; + mul r267 r205 into r268; + sub r264 r268 into r269; + lte r269 18446744073709551615u128 into r270; + mul r267 r204 into r271; + and r269 18446744073709551615u128 into r272; + shl r272 64u8 into r273; + add r273 r260 into r274; + gt r271 r274 into r275; + and r270 r275 into r276; + sub.w r267 1u128 into r277; + ternary r276 r277 r267 into r278; + add r269 r205 into r279; + ternary r276 r279 r269 into r280; + lte r280 18446744073709551615u128 into r281; + and r276 r281 into r282; + mul r278 r204 into r283; + and r280 18446744073709551615u128 into r284; + shl r284 64u8 into r285; + add r285 r260 into r286; + gt r283 r286 into r287; + and r282 r287 into r288; + sub.w r278 1u128 into r289; + ternary r288 r289 r278 into r290; + mul r290 r202 into r291; + and r291 18446744073709551615u128 into r292; + lt r258 r292 into r293; + add r258 18446744073709551616u128 into r294; + sub r294 r292 into r295; + and r295 18446744073709551615u128 into r296; + shr r291 64u8 into r297; + ternary r293 1u128 0u128 into r298; + add r297 r298 into r299; + mul r290 r203 into r300; + add r300 r299 into r301; + and r301 18446744073709551615u128 into r302; + lt r259 r302 into r303; + add r259 18446744073709551616u128 into r304; + sub r304 r302 into r305; + and r305 18446744073709551615u128 into r306; + shr r301 64u8 into r307; + ternary r303 1u128 0u128 into r308; + add r307 r308 into r309; + mul r290 r204 into r310; + add r310 r309 into r311; + and r311 18446744073709551615u128 into r312; + lt r260 r312 into r313; + add r260 18446744073709551616u128 into r314; + sub r314 r312 into r315; + and r315 18446744073709551615u128 into r316; + shr r311 64u8 into r317; + ternary r313 1u128 0u128 into r318; + add r317 r318 into r319; + mul r290 r205 into r320; + add r320 r319 into r321; + and r321 18446744073709551615u128 into r322; + lt r261 r322 into r323; + add r261 18446744073709551616u128 into r324; + sub r324 r322 into r325; + and r325 18446744073709551615u128 into r326; + shr r321 64u8 into r327; + ternary r323 1u128 0u128 into r328; + add r327 r328 into r329; + lt r262 r329 into r330; + add r262 18446744073709551616u128 into r331; + sub r331 r329 into r332; + and r332 18446744073709551615u128 into r333; + sub.w r290 1u128 into r334; + ternary r330 r334 r290 into r335; + add r296 r202 into r336; + and r336 18446744073709551615u128 into r337; + ternary r330 r337 r296 into r338; + shr r336 64u8 into r339; + ternary r330 r339 0u128 into r340; + add r306 r203 into r341; + add r341 r340 into r342; + and r342 18446744073709551615u128 into r343; + ternary r330 r343 r306 into r344; + shr r342 64u8 into r345; + ternary r330 r345 0u128 into r346; + add r316 r204 into r347; + add r347 r346 into r348; + and r348 18446744073709551615u128 into r349; + ternary r330 r349 r316 into r350; + shr r348 64u8 into r351; + ternary r330 r351 0u128 into r352; + add r326 r205 into r353; + add r353 r352 into r354; + and r354 18446744073709551615u128 into r355; + ternary r330 r355 r326 into r356; + shr r354 64u8 into r357; + ternary r330 r357 0u128 into r358; + add r333 r358 into r359; + shl r356 64u8 into r360; + add r360 r350 into r361; + div r361 r205 into r362; + gt r362 18446744073709551615u128 into r363; + ternary r363 18446744073709551615u128 r362 into r364; + mul r364 r205 into r365; + sub r361 r365 into r366; + lte r366 18446744073709551615u128 into r367; + mul r364 r204 into r368; + and r366 18446744073709551615u128 into r369; + shl r369 64u8 into r370; + add r370 r344 into r371; + gt r368 r371 into r372; + and r367 r372 into r373; + sub.w r364 1u128 into r374; + ternary r373 r374 r364 into r375; + add r366 r205 into r376; + ternary r373 r376 r366 into r377; + lte r377 18446744073709551615u128 into r378; + and r373 r378 into r379; + mul r375 r204 into r380; + and r377 18446744073709551615u128 into r381; + shl r381 64u8 into r382; + add r382 r344 into r383; + gt r380 r383 into r384; + and r379 r384 into r385; + sub.w r375 1u128 into r386; + ternary r385 r386 r375 into r387; + mul r387 r202 into r388; + and r388 18446744073709551615u128 into r389; + lt r257 r389 into r390; + add r257 18446744073709551616u128 into r391; + sub r391 r389 into r392; + and r392 18446744073709551615u128 into r393; + shr r388 64u8 into r394; + ternary r390 1u128 0u128 into r395; + add r394 r395 into r396; + mul r387 r203 into r397; + add r397 r396 into r398; + and r398 18446744073709551615u128 into r399; + lt r338 r399 into r400; + add r338 18446744073709551616u128 into r401; + sub r401 r399 into r402; + and r402 18446744073709551615u128 into r403; + shr r398 64u8 into r404; + ternary r400 1u128 0u128 into r405; + add r404 r405 into r406; + mul r387 r204 into r407; + add r407 r406 into r408; + and r408 18446744073709551615u128 into r409; + lt r344 r409 into r410; + add r344 18446744073709551616u128 into r411; + sub r411 r409 into r412; + and r412 18446744073709551615u128 into r413; + shr r408 64u8 into r414; + ternary r410 1u128 0u128 into r415; + add r414 r415 into r416; + mul r387 r205 into r417; + add r417 r416 into r418; + and r418 18446744073709551615u128 into r419; + lt r350 r419 into r420; + add r350 18446744073709551616u128 into r421; + sub r421 r419 into r422; + and r422 18446744073709551615u128 into r423; + shr r418 64u8 into r424; + ternary r420 1u128 0u128 into r425; + add r424 r425 into r426; + lt r356 r426 into r427; + add r356 18446744073709551616u128 into r428; + sub r428 r426 into r429; + and r429 18446744073709551615u128 into r430; + sub.w r387 1u128 into r431; + ternary r427 r431 r387 into r432; + add r393 r202 into r433; + and r433 18446744073709551615u128 into r434; + ternary r427 r434 r393 into r435; + shr r433 64u8 into r436; + ternary r427 r436 0u128 into r437; + add r403 r203 into r438; + add r438 r437 into r439; + and r439 18446744073709551615u128 into r440; + ternary r427 r440 r403 into r441; + shr r439 64u8 into r442; + ternary r427 r442 0u128 into r443; + add r413 r204 into r444; + add r444 r443 into r445; + and r445 18446744073709551615u128 into r446; + ternary r427 r446 r413 into r447; + shr r445 64u8 into r448; + ternary r427 r448 0u128 into r449; + add r423 r205 into r450; + add r450 r449 into r451; + and r451 18446744073709551615u128 into r452; + ternary r427 r452 r423 into r453; + shr r451 64u8 into r454; + ternary r427 r454 0u128 into r455; + add r430 r455 into r456; + shl r453 64u8 into r457; + add r457 r447 into r458; + div r458 r205 into r459; + gt r459 18446744073709551615u128 into r460; + ternary r460 18446744073709551615u128 r459 into r461; + mul r461 r205 into r462; + sub r458 r462 into r463; + lte r463 18446744073709551615u128 into r464; + mul r461 r204 into r465; + and r463 18446744073709551615u128 into r466; + shl r466 64u8 into r467; + add r467 r441 into r468; + gt r465 r468 into r469; + and r464 r469 into r470; + sub.w r461 1u128 into r471; + ternary r470 r471 r461 into r472; + add r463 r205 into r473; + ternary r470 r473 r463 into r474; + lte r474 18446744073709551615u128 into r475; + and r470 r475 into r476; + mul r472 r204 into r477; + and r474 18446744073709551615u128 into r478; + shl r478 64u8 into r479; + add r479 r441 into r480; + gt r477 r480 into r481; + and r476 r481 into r482; + sub.w r472 1u128 into r483; + ternary r482 r483 r472 into r484; + mul r484 r202 into r485; + and r485 18446744073709551615u128 into r486; + lt r256 r486 into r487; + add r256 18446744073709551616u128 into r488; + sub r488 r486 into r489; + and r489 18446744073709551615u128 into r490; + shr r485 64u8 into r491; + ternary r487 1u128 0u128 into r492; + add r491 r492 into r493; + mul r484 r203 into r494; + add r494 r493 into r495; + and r495 18446744073709551615u128 into r496; + lt r435 r496 into r497; + add r435 18446744073709551616u128 into r498; + sub r498 r496 into r499; + and r499 18446744073709551615u128 into r500; + shr r495 64u8 into r501; + ternary r497 1u128 0u128 into r502; + add r501 r502 into r503; + mul r484 r204 into r504; + add r504 r503 into r505; + and r505 18446744073709551615u128 into r506; + lt r441 r506 into r507; + add r441 18446744073709551616u128 into r508; + sub r508 r506 into r509; + and r509 18446744073709551615u128 into r510; + shr r505 64u8 into r511; + ternary r507 1u128 0u128 into r512; + add r511 r512 into r513; + mul r484 r205 into r514; + add r514 r513 into r515; + and r515 18446744073709551615u128 into r516; + lt r447 r516 into r517; + add r447 18446744073709551616u128 into r518; + sub r518 r516 into r519; + and r519 18446744073709551615u128 into r520; + shr r515 64u8 into r521; + ternary r517 1u128 0u128 into r522; + add r521 r522 into r523; + lt r453 r523 into r524; + add r453 18446744073709551616u128 into r525; + sub r525 r523 into r526; + and r526 18446744073709551615u128 into r527; + sub.w r484 1u128 into r528; + ternary r524 r528 r484 into r529; + add r490 r202 into r530; + and r530 18446744073709551615u128 into r531; + ternary r524 r531 r490 into r532; + shr r530 64u8 into r533; + ternary r524 r533 0u128 into r534; + add r500 r203 into r535; + add r535 r534 into r536; + and r536 18446744073709551615u128 into r537; + ternary r524 r537 r500 into r538; + shr r536 64u8 into r539; + ternary r524 r539 0u128 into r540; + add r510 r204 into r541; + add r541 r540 into r542; + and r542 18446744073709551615u128 into r543; + ternary r524 r543 r510 into r544; + shr r542 64u8 into r545; + ternary r524 r545 0u128 into r546; + add r520 r205 into r547; + add r547 r546 into r548; + and r548 18446744073709551615u128 into r549; + ternary r524 r549 r520 into r550; + shr r548 64u8 into r551; + ternary r524 r551 0u128 into r552; + add r527 r552 into r553; + shl r550 64u8 into r554; + add r554 r544 into r555; + div r555 r205 into r556; + gt r556 18446744073709551615u128 into r557; + ternary r557 18446744073709551615u128 r556 into r558; + mul r558 r205 into r559; + sub r555 r559 into r560; + lte r560 18446744073709551615u128 into r561; + mul r558 r204 into r562; + and r560 18446744073709551615u128 into r563; + shl r563 64u8 into r564; + add r564 r538 into r565; + gt r562 r565 into r566; + and r561 r566 into r567; + sub.w r558 1u128 into r568; + ternary r567 r568 r558 into r569; + add r560 r205 into r570; + ternary r567 r570 r560 into r571; + lte r571 18446744073709551615u128 into r572; + and r567 r572 into r573; + mul r569 r204 into r574; + and r571 18446744073709551615u128 into r575; + shl r575 64u8 into r576; + add r576 r538 into r577; + gt r574 r577 into r578; + and r573 r578 into r579; + sub.w r569 1u128 into r580; + ternary r579 r580 r569 into r581; + mul r581 r202 into r582; + and r582 18446744073709551615u128 into r583; + lt r255 r583 into r584; + add r255 18446744073709551616u128 into r585; + sub r585 r583 into r586; + and r586 18446744073709551615u128 into r587; + shr r582 64u8 into r588; + ternary r584 1u128 0u128 into r589; + add r588 r589 into r590; + mul r581 r203 into r591; + add r591 r590 into r592; + and r592 18446744073709551615u128 into r593; + lt r532 r593 into r594; + add r532 18446744073709551616u128 into r595; + sub r595 r593 into r596; + and r596 18446744073709551615u128 into r597; + shr r592 64u8 into r598; + ternary r594 1u128 0u128 into r599; + add r598 r599 into r600; + mul r581 r204 into r601; + add r601 r600 into r602; + and r602 18446744073709551615u128 into r603; + lt r538 r603 into r604; + add r538 18446744073709551616u128 into r605; + sub r605 r603 into r606; + and r606 18446744073709551615u128 into r607; + shr r602 64u8 into r608; + ternary r604 1u128 0u128 into r609; + add r608 r609 into r610; + mul r581 r205 into r611; + add r611 r610 into r612; + and r612 18446744073709551615u128 into r613; + lt r544 r613 into r614; + add r544 18446744073709551616u128 into r615; + sub r615 r613 into r616; + and r616 18446744073709551615u128 into r617; + shr r612 64u8 into r618; + ternary r614 1u128 0u128 into r619; + add r618 r619 into r620; + lt r550 r620 into r621; + add r550 18446744073709551616u128 into r622; + sub r622 r620 into r623; + and r623 18446744073709551615u128 into r624; + sub.w r581 1u128 into r625; + ternary r621 r625 r581 into r626; + add r587 r202 into r627; + and r627 18446744073709551615u128 into r628; + ternary r621 r628 r587 into r629; + shr r627 64u8 into r630; + ternary r621 r630 0u128 into r631; + add r597 r203 into r632; + add r632 r631 into r633; + and r633 18446744073709551615u128 into r634; + ternary r621 r634 r597 into r635; + shr r633 64u8 into r636; + ternary r621 r636 0u128 into r637; + add r607 r204 into r638; + add r638 r637 into r639; + and r639 18446744073709551615u128 into r640; + ternary r621 r640 r607 into r641; + shr r639 64u8 into r642; + ternary r621 r642 0u128 into r643; + add r617 r205 into r644; + add r644 r643 into r645; + and r645 18446744073709551615u128 into r646; + ternary r621 r646 r617 into r647; + shr r645 64u8 into r648; + ternary r621 r648 0u128 into r649; + add r624 r649 into r650; + shl r335 64u8 into r651; + add r651 r432 into r652; + shl r529 64u8 into r653; + add r653 r626 into r654; + cast r652 r654 into r655 as U256__8JquwLopp8; + shl r647 64u8 into r656; + add r656 r641 into r657; + shl r635 64u8 into r658; + add r658 r629 into r659; + cast r188 into r660 as u8; + is.eq r660 0u8 into r661; + sub 128u8 r660 into r662; + shl.w r657 r662 into r663; + ternary r661 0u128 r663 into r664; + shr r659 r660 into r665; + or r665 r664 into r666; + shr r657 r660 into r667; + ternary r198 0u128 r667 into r668; + ternary r198 r667 r666 into r669; + cast r668 r669 into r670 as U256__8JquwLopp8; + is.eq r670.hi 0u128 into r671; + is.eq r670.lo 0u128 into r672; + and r671 r672 into r673; + not r673 into r674; + and r3 r674 into r675; + is.eq r655.hi 340282366920938463463374607431768211455u128 into r676; + is.eq r655.lo 340282366920938463463374607431768211455u128 into r677; + and r676 r677 into r678; + and r675 r678 into r679; + not r679 into r680; + assert.eq r680 true; + add.w r655.lo 1u128 into r681; + lt r681 r655.lo into r682; + ternary r682 1u128 0u128 into r683; + add.w r655.hi r683 into r684; + cast r684 r681 into r685 as U256__8JquwLopp8; + ternary r675 r685.hi r655.hi into r686; + ternary r675 r685.lo r655.lo into r687; + cast r686 r687 into r688 as U256__8JquwLopp8; + output r688 as U256__8JquwLopp8.public; + +function freeze_position: + input r0 as field.public; + async freeze_position self.caller r0 into r1; + output r1 as shield_swap.aleo/freeze_position.future; + +finalize freeze_position: + input r0 as address.public; + input r1 as field.public; + get admin[true] into r2; + is.eq r0 r2 into r3; + assert.eq r3 true; + contains positions[r1] into r4; + assert.eq r4 true; + contains frozen_position[r1] into r5; + not r5 into r6; + assert.eq r6 true; + get positions[r1] into r7; + gt r7.liquidity 0u128 into r8; + branch.eq r8 false to end_then_0_0; + get positions[r1] into r9; + get slots[r9.pool] into r10; + call view_sqrt_price_at_tick_x128 r9.tick_lower into r11; + call view_sqrt_price_at_tick_x128 r9.tick_upper into r12; + lt r11.hi r12.hi into r13; + gt r11.hi r12.hi into r14; + lt r11.lo r12.lo into r15; + ternary r14 false r15 into r16; + ternary r13 true r16 into r17; + ternary r17 r11.hi r12.hi into r18; + ternary r17 r11.lo r12.lo into r19; + cast r18 r19 into r20 as U256__8JquwLopp8; + lt r11.hi r12.hi into r21; + gt r11.hi r12.hi into r22; + lt r11.lo r12.lo into r23; + ternary r22 false r23 into r24; + ternary r21 true r24 into r25; + ternary r25 r12.hi r11.hi into r26; + ternary r25 r12.lo r11.lo into r27; + cast r26 r27 into r28 as U256__8JquwLopp8; + lt r20.hi r10.sqrt_price.hi into r29; + gt r20.hi r10.sqrt_price.hi into r30; + lt r20.lo r10.sqrt_price.lo into r31; + ternary r30 false r31 into r32; + ternary r29 true r32 into r33; + not r33 into r34; + not r34 into r35; + lt r10.sqrt_price.hi r28.hi into r36; + gt r10.sqrt_price.hi r28.hi into r37; + lt r10.sqrt_price.lo r28.lo into r38; + ternary r37 false r38 into r39; + ternary r36 true r39 into r40; + and r35 r40 into r41; + lt r10.sqrt_price.hi r28.hi into r42; + gt r10.sqrt_price.hi r28.hi into r43; + lt r10.sqrt_price.lo r28.lo into r44; + ternary r43 false r44 into r45; + ternary r42 true r45 into r46; + not r46 into r47; + and r35 r47 into r48; + ternary r34 r7.liquidity 0u128 into r49; + lt r20.hi r28.hi into r50; + gt r20.hi r28.hi into r51; + lt r20.lo r28.lo into r52; + ternary r51 false r52 into r53; + ternary r50 true r53 into r54; + ternary r54 r20.hi r28.hi into r55; + ternary r54 r20.lo r28.lo into r56; + cast r55 r56 into r57 as U256__8JquwLopp8; + lt r20.hi r28.hi into r58; + gt r20.hi r28.hi into r59; + lt r20.lo r28.lo into r60; + ternary r59 false r60 into r61; + ternary r58 true r61 into r62; + ternary r62 r28.hi r20.hi into r63; + ternary r62 r28.lo r20.lo into r64; + cast r63 r64 into r65 as U256__8JquwLopp8; + lt r65.lo r57.lo into r66; + ternary r66 1u128 0u128 into r67; + sub.w r65.lo r57.lo into r68; + sub.w r65.hi r57.hi into r69; + sub.w r69 r67 into r70; + cast r70 r68 into r71 as U256__8JquwLopp8; + cast r49 0u128 into r72 as U256__8JquwLopp8; + call view_mul_div r72 r71 r65 false into r73; + cast 0u128 1u128 into r74 as U256__8JquwLopp8; + call view_mul_div r73 r74 r57 false into r75; + is.eq r75.hi 0u128 into r76; + assert.eq r76 true; + ternary r41 r7.liquidity 0u128 into r77; + lt r10.sqrt_price.hi r28.hi into r78; + gt r10.sqrt_price.hi r28.hi into r79; + lt r10.sqrt_price.lo r28.lo into r80; + ternary r79 false r80 into r81; + ternary r78 true r81 into r82; + ternary r82 r10.sqrt_price.hi r28.hi into r83; + ternary r82 r10.sqrt_price.lo r28.lo into r84; + cast r83 r84 into r85 as U256__8JquwLopp8; + lt r10.sqrt_price.hi r28.hi into r86; + gt r10.sqrt_price.hi r28.hi into r87; + lt r10.sqrt_price.lo r28.lo into r88; + ternary r87 false r88 into r89; + ternary r86 true r89 into r90; + ternary r90 r28.hi r10.sqrt_price.hi into r91; + ternary r90 r28.lo r10.sqrt_price.lo into r92; + cast r91 r92 into r93 as U256__8JquwLopp8; + lt r93.lo r85.lo into r94; + ternary r94 1u128 0u128 into r95; + sub.w r93.lo r85.lo into r96; + sub.w r93.hi r85.hi into r97; + sub.w r97 r95 into r98; + cast r98 r96 into r99 as U256__8JquwLopp8; + cast r77 0u128 into r100 as U256__8JquwLopp8; + call view_mul_div r100 r99 r93 false into r101; + cast 0u128 1u128 into r102 as U256__8JquwLopp8; + call view_mul_div r101 r102 r85 false into r103; + is.eq r103.hi 0u128 into r104; + assert.eq r104 true; + lt r20.hi r10.sqrt_price.hi into r105; + gt r20.hi r10.sqrt_price.hi into r106; + lt r20.lo r10.sqrt_price.lo into r107; + ternary r106 false r107 into r108; + ternary r105 true r108 into r109; + ternary r109 r20.hi r10.sqrt_price.hi into r110; + ternary r109 r20.lo r10.sqrt_price.lo into r111; + cast r110 r111 into r112 as U256__8JquwLopp8; + lt r20.hi r10.sqrt_price.hi into r113; + gt r20.hi r10.sqrt_price.hi into r114; + lt r20.lo r10.sqrt_price.lo into r115; + ternary r114 false r115 into r116; + ternary r113 true r116 into r117; + ternary r117 r10.sqrt_price.hi r20.hi into r118; + ternary r117 r10.sqrt_price.lo r20.lo into r119; + cast r118 r119 into r120 as U256__8JquwLopp8; + lt r120.lo r112.lo into r121; + ternary r121 1u128 0u128 into r122; + sub.w r120.lo r112.lo into r123; + sub.w r120.hi r112.hi into r124; + sub.w r124 r122 into r125; + cast r125 r123 into r126 as U256__8JquwLopp8; + cast 0u128 r77 into r127 as U256__8JquwLopp8; + and r127.lo 18446744073709551615u128 into r128; + shr r127.lo 64u8 into r129; + and r126.lo 18446744073709551615u128 into r130; + shr r126.lo 64u8 into r131; + mul r128 r130 into r132; + mul r128 r131 into r133; + mul r129 r130 into r134; + mul r129 r131 into r135; + and r132 18446744073709551615u128 into r136; + shr r132 64u8 into r137; + and r133 18446744073709551615u128 into r138; + add r137 r138 into r139; + and r134 18446744073709551615u128 into r140; + add r139 r140 into r141; + and r141 18446744073709551615u128 into r142; + shr r141 64u8 into r143; + shr r133 64u8 into r144; + shr r134 64u8 into r145; + add r144 r145 into r146; + and r135 18446744073709551615u128 into r147; + add r146 r147 into r148; + add r148 r143 into r149; + and r149 18446744073709551615u128 into r150; + shr r149 64u8 into r151; + shr r135 64u8 into r152; + add r152 r151 into r153; + shl r153 64u8 into r154; + add r154 r150 into r155; + shl r142 64u8 into r156; + add r156 r136 into r157; + and r127.lo 18446744073709551615u128 into r158; + shr r127.lo 64u8 into r159; + and r126.hi 18446744073709551615u128 into r160; + shr r126.hi 64u8 into r161; + mul r158 r160 into r162; + mul r158 r161 into r163; + mul r159 r160 into r164; + mul r159 r161 into r165; + and r162 18446744073709551615u128 into r166; + shr r162 64u8 into r167; + and r163 18446744073709551615u128 into r168; + add r167 r168 into r169; + and r164 18446744073709551615u128 into r170; + add r169 r170 into r171; + and r171 18446744073709551615u128 into r172; + shr r171 64u8 into r173; + shr r163 64u8 into r174; + shr r164 64u8 into r175; + add r174 r175 into r176; + and r165 18446744073709551615u128 into r177; + add r176 r177 into r178; + add r178 r173 into r179; + and r179 18446744073709551615u128 into r180; + shr r179 64u8 into r181; + shr r165 64u8 into r182; + add r182 r181 into r183; + shl r183 64u8 into r184; + add r184 r180 into r185; + shl r172 64u8 into r186; + add r186 r166 into r187; + and r127.hi 18446744073709551615u128 into r188; + shr r127.hi 64u8 into r189; + and r126.lo 18446744073709551615u128 into r190; + shr r126.lo 64u8 into r191; + mul r188 r190 into r192; + mul r188 r191 into r193; + mul r189 r190 into r194; + mul r189 r191 into r195; + and r192 18446744073709551615u128 into r196; + shr r192 64u8 into r197; + and r193 18446744073709551615u128 into r198; + add r197 r198 into r199; + and r194 18446744073709551615u128 into r200; + add r199 r200 into r201; + and r201 18446744073709551615u128 into r202; + shr r201 64u8 into r203; + shr r193 64u8 into r204; + shr r194 64u8 into r205; + add r204 r205 into r206; + and r195 18446744073709551615u128 into r207; + add r206 r207 into r208; + add r208 r203 into r209; + and r209 18446744073709551615u128 into r210; + shr r209 64u8 into r211; + shr r195 64u8 into r212; + add r212 r211 into r213; + shl r213 64u8 into r214; + add r214 r210 into r215; + shl r202 64u8 into r216; + add r216 r196 into r217; + and r127.hi 18446744073709551615u128 into r218; + shr r127.hi 64u8 into r219; + and r126.hi 18446744073709551615u128 into r220; + shr r126.hi 64u8 into r221; + mul r218 r220 into r222; + mul r218 r221 into r223; + mul r219 r220 into r224; + mul r219 r221 into r225; + and r222 18446744073709551615u128 into r226; + shr r222 64u8 into r227; + and r223 18446744073709551615u128 into r228; + add r227 r228 into r229; + and r224 18446744073709551615u128 into r230; + add r229 r230 into r231; + and r231 18446744073709551615u128 into r232; + shr r231 64u8 into r233; + shr r223 64u8 into r234; + shr r224 64u8 into r235; + add r234 r235 into r236; + and r225 18446744073709551615u128 into r237; + add r236 r237 into r238; + add r238 r233 into r239; + and r239 18446744073709551615u128 into r240; + shr r239 64u8 into r241; + shr r225 64u8 into r242; + add r242 r241 into r243; + shl r243 64u8 into r244; + add r244 r240 into r245; + shl r232 64u8 into r246; + add r246 r226 into r247; + add.w r155 r187 into r248; + lt r248 r155 into r249; + ternary r249 1u128 0u128 into r250; + add.w r248 r217 into r251; + lt r251 r248 into r252; + ternary r252 1u128 0u128 into r253; + add r250 r253 into r254; + add.w r185 r215 into r255; + lt r255 r185 into r256; + ternary r256 1u128 0u128 into r257; + add.w r255 r247 into r258; + lt r258 r255 into r259; + ternary r259 1u128 0u128 into r260; + add.w r258 r254 into r261; + lt r261 r258 into r262; + ternary r262 1u128 0u128 into r263; + add r257 r260 into r264; + add r264 r263 into r265; + add.w r245 r265 into r266; + cast r266 r261 into r267 as U256__8JquwLopp8; + cast r251 r157 into r268 as U256__8JquwLopp8; + is.eq r267.hi 0u128 into r269; + is.eq r267.lo 0u128 into r270; + and r269 r270 into r271; + assert.eq r271 true; + ternary r48 r7.liquidity 0u128 into r272; + lt r20.hi r28.hi into r273; + gt r20.hi r28.hi into r274; + lt r20.lo r28.lo into r275; + ternary r274 false r275 into r276; + ternary r273 true r276 into r277; + ternary r277 r20.hi r28.hi into r278; + ternary r277 r20.lo r28.lo into r279; + cast r278 r279 into r280 as U256__8JquwLopp8; + lt r20.hi r28.hi into r281; + gt r20.hi r28.hi into r282; + lt r20.lo r28.lo into r283; + ternary r282 false r283 into r284; + ternary r281 true r284 into r285; + ternary r285 r28.hi r20.hi into r286; + ternary r285 r28.lo r20.lo into r287; + cast r286 r287 into r288 as U256__8JquwLopp8; + lt r288.lo r280.lo into r289; + ternary r289 1u128 0u128 into r290; + sub.w r288.lo r280.lo into r291; + sub.w r288.hi r280.hi into r292; + sub.w r292 r290 into r293; + cast r293 r291 into r294 as U256__8JquwLopp8; + cast 0u128 r272 into r295 as U256__8JquwLopp8; + and r295.lo 18446744073709551615u128 into r296; + shr r295.lo 64u8 into r297; + and r294.lo 18446744073709551615u128 into r298; + shr r294.lo 64u8 into r299; + mul r296 r298 into r300; + mul r296 r299 into r301; + mul r297 r298 into r302; + mul r297 r299 into r303; + and r300 18446744073709551615u128 into r304; + shr r300 64u8 into r305; + and r301 18446744073709551615u128 into r306; + add r305 r306 into r307; + and r302 18446744073709551615u128 into r308; + add r307 r308 into r309; + and r309 18446744073709551615u128 into r310; + shr r309 64u8 into r311; + shr r301 64u8 into r312; + shr r302 64u8 into r313; + add r312 r313 into r314; + and r303 18446744073709551615u128 into r315; + add r314 r315 into r316; + add r316 r311 into r317; + and r317 18446744073709551615u128 into r318; + shr r317 64u8 into r319; + shr r303 64u8 into r320; + add r320 r319 into r321; + shl r321 64u8 into r322; + add r322 r318 into r323; + shl r310 64u8 into r324; + add r324 r304 into r325; + and r295.lo 18446744073709551615u128 into r326; + shr r295.lo 64u8 into r327; + and r294.hi 18446744073709551615u128 into r328; + shr r294.hi 64u8 into r329; + mul r326 r328 into r330; + mul r326 r329 into r331; + mul r327 r328 into r332; + mul r327 r329 into r333; + and r330 18446744073709551615u128 into r334; + shr r330 64u8 into r335; + and r331 18446744073709551615u128 into r336; + add r335 r336 into r337; + and r332 18446744073709551615u128 into r338; + add r337 r338 into r339; + and r339 18446744073709551615u128 into r340; + shr r339 64u8 into r341; + shr r331 64u8 into r342; + shr r332 64u8 into r343; + add r342 r343 into r344; + and r333 18446744073709551615u128 into r345; + add r344 r345 into r346; + add r346 r341 into r347; + and r347 18446744073709551615u128 into r348; + shr r347 64u8 into r349; + shr r333 64u8 into r350; + add r350 r349 into r351; + shl r351 64u8 into r352; + add r352 r348 into r353; + shl r340 64u8 into r354; + add r354 r334 into r355; + and r295.hi 18446744073709551615u128 into r356; + shr r295.hi 64u8 into r357; + and r294.lo 18446744073709551615u128 into r358; + shr r294.lo 64u8 into r359; + mul r356 r358 into r360; + mul r356 r359 into r361; + mul r357 r358 into r362; + mul r357 r359 into r363; + and r360 18446744073709551615u128 into r364; + shr r360 64u8 into r365; + and r361 18446744073709551615u128 into r366; + add r365 r366 into r367; + and r362 18446744073709551615u128 into r368; + add r367 r368 into r369; + and r369 18446744073709551615u128 into r370; + shr r369 64u8 into r371; + shr r361 64u8 into r372; + shr r362 64u8 into r373; + add r372 r373 into r374; + and r363 18446744073709551615u128 into r375; + add r374 r375 into r376; + add r376 r371 into r377; + and r377 18446744073709551615u128 into r378; + shr r377 64u8 into r379; + shr r363 64u8 into r380; + add r380 r379 into r381; + shl r381 64u8 into r382; + add r382 r378 into r383; + shl r370 64u8 into r384; + add r384 r364 into r385; + and r295.hi 18446744073709551615u128 into r386; + shr r295.hi 64u8 into r387; + and r294.hi 18446744073709551615u128 into r388; + shr r294.hi 64u8 into r389; + mul r386 r388 into r390; + mul r386 r389 into r391; + mul r387 r388 into r392; + mul r387 r389 into r393; + and r390 18446744073709551615u128 into r394; + shr r390 64u8 into r395; + and r391 18446744073709551615u128 into r396; + add r395 r396 into r397; + and r392 18446744073709551615u128 into r398; + add r397 r398 into r399; + and r399 18446744073709551615u128 into r400; + shr r399 64u8 into r401; + shr r391 64u8 into r402; + shr r392 64u8 into r403; + add r402 r403 into r404; + and r393 18446744073709551615u128 into r405; + add r404 r405 into r406; + add r406 r401 into r407; + and r407 18446744073709551615u128 into r408; + shr r407 64u8 into r409; + shr r393 64u8 into r410; + add r410 r409 into r411; + shl r411 64u8 into r412; + add r412 r408 into r413; + shl r400 64u8 into r414; + add r414 r394 into r415; + add.w r323 r355 into r416; + lt r416 r323 into r417; + ternary r417 1u128 0u128 into r418; + add.w r416 r385 into r419; + lt r419 r416 into r420; + ternary r420 1u128 0u128 into r421; + add r418 r421 into r422; + add.w r353 r383 into r423; + lt r423 r353 into r424; + ternary r424 1u128 0u128 into r425; + add.w r423 r415 into r426; + lt r426 r423 into r427; + ternary r427 1u128 0u128 into r428; + add.w r426 r422 into r429; + lt r429 r426 into r430; + ternary r430 1u128 0u128 into r431; + add r425 r428 into r432; + add r432 r431 into r433; + add.w r413 r433 into r434; + cast r434 r429 into r435 as U256__8JquwLopp8; + cast r419 r325 into r436 as U256__8JquwLopp8; + is.eq r435.hi 0u128 into r437; + is.eq r435.lo 0u128 into r438; + and r437 r438 into r439; + assert.eq r439 true; + ternary r41 r103.lo 0u128 into r440; + ternary r34 r75.lo r440 into r441; + ternary r48 r436.hi 0u128 into r442; + ternary r41 r268.hi r442 into r443; + cast r9.pool r9.tick_lower into r444 as TickKey; + hash.bhp256 r444 into r445 as field; + cast r9.pool r9.tick_upper into r446 as TickKey; + hash.bhp256 r446 into r447 as field; + get ticks[r445] into r448; + get ticks[r447] into r449; + gt r448.liquidity_gross 0u128 into r450; + gt r449.liquidity_gross 0u128 into r451; + sub r448.liquidity_gross r7.liquidity into r452; + sub r449.liquidity_gross r7.liquidity into r453; + is.eq r452 0u128 into r454; + and r450 r454 into r455; + is.eq r453 0u128 into r456; + and r451 r456 into r457; + cast r7.liquidity into r458 as i128; + sub r448.liquidity_net r458 into r459; + cast r448.pool r459 r452 r448.tick r448.fee_growth_outside0_x_128 r448.fee_growth_outside1_x_128 r448.prev r448.next into r460 as Tick; + set r460 into ticks[r445]; + branch.eq r455 false to end_then_1_2; + cast r9.pool r448.prev into r461 as TickKey; + hash.bhp256 r461 into r462 as field; + get ticks[r462] into r463; + cast r463.pool r463.liquidity_net r463.liquidity_gross r463.tick r463.fee_growth_outside0_x_128 r463.fee_growth_outside1_x_128 r463.prev r448.next into r464 as Tick; + set r464 into ticks[r462]; + cast r9.pool r448.next into r465 as TickKey; + hash.bhp256 r465 into r466 as field; + get ticks[r466] into r467; + cast r467.pool r467.liquidity_net r467.liquidity_gross r467.tick r467.fee_growth_outside0_x_128 r467.fee_growth_outside1_x_128 r448.prev r467.next into r468 as Tick; + set r468 into ticks[r466]; + branch.eq true true to end_otherwise_1_3; + position end_then_1_2; + position end_otherwise_1_3; + get ticks[r447] into r469; + cast r7.liquidity into r470 as i128; + add r469.liquidity_net r470 into r471; + cast r469.pool r471 r453 r469.tick r469.fee_growth_outside0_x_128 r469.fee_growth_outside1_x_128 r469.prev r469.next into r472 as Tick; + set r472 into ticks[r447]; + branch.eq r457 false to end_then_1_4; + cast r9.pool r469.prev into r473 as TickKey; + hash.bhp256 r473 into r474 as field; + get ticks[r474] into r475; + cast r475.pool r475.liquidity_net r475.liquidity_gross r475.tick r475.fee_growth_outside0_x_128 r475.fee_growth_outside1_x_128 r475.prev r469.next into r476 as Tick; + set r476 into ticks[r474]; + cast r9.pool r469.next into r477 as TickKey; + hash.bhp256 r477 into r478 as field; + get ticks[r478] into r479; + cast r479.pool r479.liquidity_net r479.liquidity_gross r479.tick r479.fee_growth_outside0_x_128 r479.fee_growth_outside1_x_128 r469.prev r479.next into r480 as Tick; + set r480 into ticks[r478]; + branch.eq true true to end_otherwise_1_5; + position end_then_1_4; + position end_otherwise_1_5; + get ticks[r445] into r481; + get ticks[r447] into r482; + gte r10.tick r481.tick into r483; + lt r10.fee_growth_global0_x_128.lo r481.fee_growth_outside0_x_128.lo into r484; + ternary r484 1u128 0u128 into r485; + sub.w r10.fee_growth_global0_x_128.lo r481.fee_growth_outside0_x_128.lo into r486; + sub.w r10.fee_growth_global0_x_128.hi r481.fee_growth_outside0_x_128.hi into r487; + sub.w r487 r485 into r488; + cast r488 r486 into r489 as U256__8JquwLopp8; + lt r10.fee_growth_global1_x_128.lo r481.fee_growth_outside1_x_128.lo into r490; + ternary r490 1u128 0u128 into r491; + sub.w r10.fee_growth_global1_x_128.lo r481.fee_growth_outside1_x_128.lo into r492; + sub.w r10.fee_growth_global1_x_128.hi r481.fee_growth_outside1_x_128.hi into r493; + sub.w r493 r491 into r494; + cast r494 r492 into r495 as U256__8JquwLopp8; + ternary r483 r481.fee_growth_outside0_x_128.hi r489.hi into r496; + ternary r483 r481.fee_growth_outside0_x_128.lo r489.lo into r497; + cast r496 r497 into r498 as U256__8JquwLopp8; + ternary r483 r481.fee_growth_outside1_x_128.hi r495.hi into r499; + ternary r483 r481.fee_growth_outside1_x_128.lo r495.lo into r500; + cast r499 r500 into r501 as U256__8JquwLopp8; + lt r10.tick r482.tick into r502; + lt r10.fee_growth_global0_x_128.lo r482.fee_growth_outside0_x_128.lo into r503; + ternary r503 1u128 0u128 into r504; + sub.w r10.fee_growth_global0_x_128.lo r482.fee_growth_outside0_x_128.lo into r505; + sub.w r10.fee_growth_global0_x_128.hi r482.fee_growth_outside0_x_128.hi into r506; + sub.w r506 r504 into r507; + cast r507 r505 into r508 as U256__8JquwLopp8; + lt r10.fee_growth_global1_x_128.lo r482.fee_growth_outside1_x_128.lo into r509; + ternary r509 1u128 0u128 into r510; + sub.w r10.fee_growth_global1_x_128.lo r482.fee_growth_outside1_x_128.lo into r511; + sub.w r10.fee_growth_global1_x_128.hi r482.fee_growth_outside1_x_128.hi into r512; + sub.w r512 r510 into r513; + cast r513 r511 into r514 as U256__8JquwLopp8; + ternary r502 r482.fee_growth_outside0_x_128.hi r508.hi into r515; + ternary r502 r482.fee_growth_outside0_x_128.lo r508.lo into r516; + cast r515 r516 into r517 as U256__8JquwLopp8; + ternary r502 r482.fee_growth_outside1_x_128.hi r514.hi into r518; + ternary r502 r482.fee_growth_outside1_x_128.lo r514.lo into r519; + cast r518 r519 into r520 as U256__8JquwLopp8; + lt r10.fee_growth_global0_x_128.lo r498.lo into r521; + ternary r521 1u128 0u128 into r522; + sub.w r10.fee_growth_global0_x_128.lo r498.lo into r523; + sub.w r10.fee_growth_global0_x_128.hi r498.hi into r524; + sub.w r524 r522 into r525; + cast r525 r523 into r526 as U256__8JquwLopp8; + lt r526.lo r517.lo into r527; + ternary r527 1u128 0u128 into r528; + sub.w r526.lo r517.lo into r529; + sub.w r526.hi r517.hi into r530; + sub.w r530 r528 into r531; + cast r531 r529 into r532 as U256__8JquwLopp8; + lt r10.fee_growth_global1_x_128.lo r501.lo into r533; + ternary r533 1u128 0u128 into r534; + sub.w r10.fee_growth_global1_x_128.lo r501.lo into r535; + sub.w r10.fee_growth_global1_x_128.hi r501.hi into r536; + sub.w r536 r534 into r537; + cast r537 r535 into r538 as U256__8JquwLopp8; + lt r538.lo r520.lo into r539; + ternary r539 1u128 0u128 into r540; + sub.w r538.lo r520.lo into r541; + sub.w r538.hi r520.hi into r542; + sub.w r542 r540 into r543; + cast r543 r541 into r544 as U256__8JquwLopp8; + lt r532.lo r9.fee_growth_inside0_last_x_128.lo into r545; + ternary r545 1u128 0u128 into r546; + sub.w r532.lo r9.fee_growth_inside0_last_x_128.lo into r547; + sub.w r532.hi r9.fee_growth_inside0_last_x_128.hi into r548; + sub.w r548 r546 into r549; + cast r549 r547 into r550 as U256__8JquwLopp8; + and r550.hi 18446744073709551615u128 into r551; + shr r550.hi 64u8 into r552; + and r9.liquidity 18446744073709551615u128 into r553; + shr r9.liquidity 64u8 into r554; + mul r551 r553 into r555; + mul r551 r554 into r556; + mul r552 r553 into r557; + mul r552 r554 into r558; + and r555 18446744073709551615u128 into r559; + shr r555 64u8 into r560; + and r556 18446744073709551615u128 into r561; + add r560 r561 into r562; + and r557 18446744073709551615u128 into r563; + add r562 r563 into r564; + and r564 18446744073709551615u128 into r565; + shr r564 64u8 into r566; + shr r556 64u8 into r567; + shr r557 64u8 into r568; + add r567 r568 into r569; + and r558 18446744073709551615u128 into r570; + add r569 r570 into r571; + add r571 r566 into r572; + and r572 18446744073709551615u128 into r573; + shr r572 64u8 into r574; + shr r558 64u8 into r575; + add r575 r574 into r576; + shl r576 64u8 into r577; + add r577 r573 into r578; + shl r565 64u8 into r579; + add r579 r559 into r580; + and r550.lo 18446744073709551615u128 into r581; + shr r550.lo 64u8 into r582; + mul r581 r553 into r583; + mul r581 r554 into r584; + mul r582 r553 into r585; + mul r582 r554 into r586; + and r583 18446744073709551615u128 into r587; + shr r583 64u8 into r588; + and r584 18446744073709551615u128 into r589; + add r588 r589 into r590; + and r585 18446744073709551615u128 into r591; + add r590 r591 into r592; + and r592 18446744073709551615u128 into r593; + shr r592 64u8 into r594; + shr r584 64u8 into r595; + shr r585 64u8 into r596; + add r595 r596 into r597; + and r586 18446744073709551615u128 into r598; + add r597 r598 into r599; + add r599 r594 into r600; + and r600 18446744073709551615u128 into r601; + shr r600 64u8 into r602; + shr r586 64u8 into r603; + add r603 r602 into r604; + shl r604 64u8 into r605; + add r605 r601 into r606; + shl r593 64u8 into r607; + add r607 r587 into r608; + sub 340282366920938463463374607431768211455u128 r580 into r609; + lte r606 r609 into r610; + is.eq r578 0u128 into r611; + and r611 r610 into r612; + assert.eq r612 true; + add r580 r606 into r613; + add r9.tokens_owed0 r613 into r614; + add r614 r441 into r615; + lt r544.lo r9.fee_growth_inside1_last_x_128.lo into r616; + ternary r616 1u128 0u128 into r617; + sub.w r544.lo r9.fee_growth_inside1_last_x_128.lo into r618; + sub.w r544.hi r9.fee_growth_inside1_last_x_128.hi into r619; + sub.w r619 r617 into r620; + cast r620 r618 into r621 as U256__8JquwLopp8; + and r621.hi 18446744073709551615u128 into r622; + shr r621.hi 64u8 into r623; + and r9.liquidity 18446744073709551615u128 into r624; + shr r9.liquidity 64u8 into r625; + mul r622 r624 into r626; + mul r622 r625 into r627; + mul r623 r624 into r628; + mul r623 r625 into r629; + and r626 18446744073709551615u128 into r630; + shr r626 64u8 into r631; + and r627 18446744073709551615u128 into r632; + add r631 r632 into r633; + and r628 18446744073709551615u128 into r634; + add r633 r634 into r635; + and r635 18446744073709551615u128 into r636; + shr r635 64u8 into r637; + shr r627 64u8 into r638; + shr r628 64u8 into r639; + add r638 r639 into r640; + and r629 18446744073709551615u128 into r641; + add r640 r641 into r642; + add r642 r637 into r643; + and r643 18446744073709551615u128 into r644; + shr r643 64u8 into r645; + shr r629 64u8 into r646; + add r646 r645 into r647; + shl r647 64u8 into r648; + add r648 r644 into r649; + shl r636 64u8 into r650; + add r650 r630 into r651; + and r621.lo 18446744073709551615u128 into r652; + shr r621.lo 64u8 into r653; + mul r652 r624 into r654; + mul r652 r625 into r655; + mul r653 r624 into r656; + mul r653 r625 into r657; + and r654 18446744073709551615u128 into r658; + shr r654 64u8 into r659; + and r655 18446744073709551615u128 into r660; + add r659 r660 into r661; + and r656 18446744073709551615u128 into r662; + add r661 r662 into r663; + and r663 18446744073709551615u128 into r664; + shr r663 64u8 into r665; + shr r655 64u8 into r666; + shr r656 64u8 into r667; + add r666 r667 into r668; + and r657 18446744073709551615u128 into r669; + add r668 r669 into r670; + add r670 r665 into r671; + and r671 18446744073709551615u128 into r672; + shr r671 64u8 into r673; + shr r657 64u8 into r674; + add r674 r673 into r675; + shl r675 64u8 into r676; + add r676 r672 into r677; + shl r664 64u8 into r678; + add r678 r658 into r679; + sub 340282366920938463463374607431768211455u128 r651 into r680; + lte r677 r680 into r681; + is.eq r649 0u128 into r682; + and r682 r681 into r683; + assert.eq r683 true; + add r651 r677 into r684; + add r9.tokens_owed1 r684 into r685; + add r685 r443 into r686; + sub r9.liquidity r7.liquidity into r687; + cast r1 r9.pool r9.tick_lower r9.tick_upper r687 r532 r544 r615 r686 into r688 as Position; + set r688 into positions[r1]; + is.eq r10.next_init_below r9.tick_lower into r689; + and r455 r689 into r690; + ternary r690 r448.prev r10.next_init_below into r691; + is.eq r10.next_init_above r9.tick_lower into r692; + and r455 r692 into r693; + ternary r693 r448.next r10.next_init_above into r694; + is.eq r691 r9.tick_upper into r695; + and r457 r695 into r696; + ternary r696 r469.prev r691 into r697; + is.eq r694 r9.tick_upper into r698; + and r457 r698 into r699; + ternary r699 r469.next r694 into r700; + gte r10.tick r9.tick_lower into r701; + lt r10.tick r9.tick_upper into r702; + and r701 r702 into r703; + ternary r703 r7.liquidity 0u128 into r704; + sub r10.liquidity r704 into r705; + cast r10.tick r10.tick_spacing r10.sqrt_price r10.fee_protocol r705 r10.fee_growth_global0_x_128 r10.fee_growth_global1_x_128 r10.max_liquidity_per_tick r10.protocol_fees0 r10.protocol_fees1 r697 r700 into r706 as Slot; + set r706 into slots[r9.pool]; + branch.eq r455 false to end_then_1_6; + remove ticks[r445]; + branch.eq true true to end_otherwise_1_7; + position end_then_1_6; + position end_otherwise_1_7; + branch.eq r457 false to end_then_1_8; + remove ticks[r447]; + branch.eq true true to end_otherwise_1_9; + position end_then_1_8; + position end_otherwise_1_9; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + set block.height into frozen_position[r1]; + +function unfreeze_position: + input r0 as field.public; + async unfreeze_position self.caller r0 into r1; + output r1 as shield_swap.aleo/unfreeze_position.future; + +finalize unfreeze_position: + input r0 as address.public; + input r1 as field.public; + get admin[true] into r2; + is.eq r0 r2 into r3; + assert.eq r3 true; + contains frozen_position[r1] into r4; + assert.eq r4 true; + remove frozen_position[r1]; + +function set_fee_protocol: + input r0 as field.public; + input r1 as u8.public; + async set_fee_protocol self.caller r0 r1 into r2; + output r2 as shield_swap.aleo/set_fee_protocol.future; + +finalize set_fee_protocol: + input r0 as address.public; + input r1 as field.public; + input r2 as u8.public; + get admin[true] into r3; + is.eq r0 r3 into r4; + assert.eq r4 true; + is.eq r2 0u8 into r5; + gte r2 4u8 into r6; + lte r2 10u8 into r7; + and r6 r7 into r8; + or r5 r8 into r9; + assert.eq r9 true; + get slots[r1] into r10; + cast r10.tick r10.tick_spacing r10.sqrt_price r2 r10.liquidity r10.fee_growth_global0_x_128 r10.fee_growth_global1_x_128 r10.max_liquidity_per_tick r10.protocol_fees0 r10.protocol_fees1 r10.next_init_below r10.next_init_above into r11 as Slot; + set r11 into slots[r1]; + +function collect_protocol: + input r0 as field.public; + input r1 as u128.public; + input r2 as u128.public; + input r3 as field.public; + input r4 as field.public; + input r5 as address.public; + assert.neq r5 shield_swap.aleo; + call.dynamic r3 'aleo' 'transfer_public' with r5 r1 (as address.public u128.public) into r6 (as dynamic.future); + call.dynamic r4 'aleo' 'transfer_public' with r5 r2 (as address.public u128.public) into r7 (as dynamic.future); + async collect_protocol r6 r7 self.signer r0 r1 r2 r3 r4 self.caller into r8; + output r8 as shield_swap.aleo/collect_protocol.future; + +finalize collect_protocol: + input r0 as dynamic.future; + input r1 as dynamic.future; + input r2 as address.public; + input r3 as field.public; + input r4 as u128.public; + input r5 as u128.public; + input r6 as field.public; + input r7 as field.public; + input r8 as address.public; + get admin[true] into r9; + is.eq r8 r9 into r10; + is.eq r2 r9 into r11; + or r10 r11 into r12; + assert.eq r12 true; + is.eq r8 aleo18sekmsl46y6skh3kvkekmw4kqqm7d6rz79akpsg58r7wpp5klyyq0qtzqf into r13; + contains from_wrapper_token_id[r6] into r14; + contains from_wrapper_token_id[r7] into r15; + or r14 r15 into r16; + branch.eq r16 false to end_then_0_0; + assert.eq r13 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + get pools[r3] into r17; + is.eq r17.token0 r6 into r18; + is.eq r17.token1 r7 into r19; + and r18 r19 into r20; + assert.eq r20 true; + get slots[r3] into r21; + lte r4 r21.protocol_fees0 into r22; + assert.eq r22 true; + lte r5 r21.protocol_fees1 into r23; + assert.eq r23 true; + await r0; + await r1; + sub r21.protocol_fees0 r4 into r24; + sub r21.protocol_fees1 r5 into r25; + cast r21.tick r21.tick_spacing r21.sqrt_price r21.fee_protocol r21.liquidity r21.fee_growth_global0_x_128 r21.fee_growth_global1_x_128 r21.max_liquidity_per_tick r24 r25 r21.next_init_below r21.next_init_above into r26 as Slot; + set r26 into slots[r3]; + +function create_pool: + input r0 as field.public; + input r1 as field.public; + input r2 as u16.public; + input r3 as U256__8JquwLopp8.public; + input r4 as u32.public; + input r5 as i32.public; + lt r0 r1 into r6; + ternary r6 r0 r1 into r7; + ternary r6 r1 r0 into r8; + cast r7 r8 r2 into r9 as PoolKey; + hash.bhp256 r9 into r10 as field; + async create_pool self.caller r0 r1 r2 r3 r4 r5 into r11; + output r10 as field.public; + output self.signer as address.public; + output r11 as shield_swap.aleo/create_pool.future; + +finalize create_pool: + input r0 as address.public; + input r1 as field.public; + input r2 as field.public; + input r3 as u16.public; + input r4 as U256__8JquwLopp8.public; + input r5 as u32.public; + input r6 as i32.public; + get.or_use pool_creation_is_open[true] false into r7; + get admin[true] into r8; + is.eq r0 r8 into r9; + or r7 r9 into r10; + assert.eq r10 true; + get.or_use token_allowed[r1] false into r11; + assert.eq r11 true; + get.or_use token_allowed[r2] false into r12; + assert.eq r12 true; + get.or_use global_paused[true] false into r13; + not r13 into r14; + assert.eq r14 true; + lt r1 r2 into r15; + ternary r15 r1 r2 into r16; + ternary r15 r2 r1 into r17; + cast r16 r17 r3 into r18 as PoolKey; + hash.bhp256 r18 into r19 as field; + cast r16 r17 r3 true into r20 as PoolState; + get.or_use token_paused[r16] false into r21; + not r21 into r22; + assert.eq r22 true; + get.or_use token_paused[r17] false into r23; + not r23 into r24; + assert.eq r24 true; + cast r16 r17 into r25 as PairKey; + get.or_use pair_paused[r25] false into r26; + not r26 into r27; + assert.eq r27 true; + assert.neq r1 r2; + get.or_use initialized_pools[r19] false into r28; + not r28 into r29; + assert.eq r29 true; + get.or_use tick_spacings[r5] false into r30; + assert.eq r30 true; + get.or_use fee_tiers[r3] false into r31; + assert.eq r31 true; + get fee_to_tick_spacing[r3] into r32; + is.eq r32 r5 into r33; + assert.eq r33 true; + cast r5 into r34 as i32; + rem r6 r34 into r35; + is.eq r35 0i32 into r36; + assert.eq r36 true; + gte r6 -400000i32 into r37; + lt r6 400000i32 into r38; + and r37 r38 into r39; + assert.eq r39 true; + call view_sqrt_price_at_tick_x128 r6 into r40; + add r6 1i32 into r41; + call view_sqrt_price_at_tick_x128 r41 into r42; + lt r4.hi r40.hi into r43; + gt r4.hi r40.hi into r44; + lt r4.lo r40.lo into r45; + ternary r44 false r45 into r46; + ternary r43 true r46 into r47; + not r47 into r48; + lt r4.hi r42.hi into r49; + gt r4.hi r42.hi into r50; + lt r4.lo r42.lo into r51; + ternary r50 false r51 into r52; + ternary r49 true r52 into r53; + and r48 r53 into r54; + assert.eq r54 true; + cast r5 into r55 as u128; + div 800000u128 r55 into r56; + div 340282366920938463463374607431768211455u128 r56 into r57; + lt r57 702075911466779181339691826086u128 into r58; + ternary r58 r57 702075911466779181339691826086u128 into r59; + set true into initialized_pools[r19]; + set r20 into pools[r19]; + cast r19 -400001i32 into r60 as TickKey; + hash.bhp256 r60 into r61 as field; + cast r19 400001i32 into r62 as TickKey; + hash.bhp256 r62 into r63 as field; + cast 0u128 0u128 into r64 as U256__8JquwLopp8; + cast 0u128 0u128 into r65 as U256__8JquwLopp8; + cast r19 0i128 0u128 -400001i32 r64 r65 -400001i32 400001i32 into r66 as Tick; + set r66 into ticks[r61]; + cast 0u128 0u128 into r67 as U256__8JquwLopp8; + cast 0u128 0u128 into r68 as U256__8JquwLopp8; + cast r19 0i128 0u128 400001i32 r67 r68 -400001i32 400001i32 into r69 as Tick; + set r69 into ticks[r63]; + cast 0u128 0u128 into r70 as U256__8JquwLopp8; + cast 0u128 0u128 into r71 as U256__8JquwLopp8; + cast r6 r5 r4 0u8 0u128 r70 r71 r59 0u128 0u128 -400001i32 400001i32 into r72 as Slot; + set r72 into slots[r19]; + +closure assert_valid_position_address: + input r0 as address; + assert.neq r0 shield_swap.aleo; + assert.neq r0 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc; + +function mint: + input r0 as field.private; + input r1 as dynamic.record; + input r2 as dynamic.record; + input r3 as address.private; + input r4 as address.private; + input r5 as MintPositionRequest.public; + input r6 as field.public; + input r7 as field.public; + input r8 as [MerkleProof; 2u32].private; + input r9 as [MerkleProof; 2u32].private; + input r10 as [MerkleProof; 2u32].private; + is.eq self.caller aleo18sekmsl46y6skh3kvkekmw4kqqm7d6rz79akpsg58r7wpp5klyyq0qtzqf into r11; + call assert_valid_position_address r3; + call assert_valid_position_address r4; + rem r8[0u32].leaf_index 2u32 into r12; + is.eq r12 0u32 into r13; + cast 1field r8[0u32].siblings[0u32] r8[0u32].siblings[1u32] into r14 as [field; 3u32]; + cast 1field r8[0u32].siblings[1u32] r8[0u32].siblings[0u32] into r15 as [field; 3u32]; + ternary r13 r14[0u32] r15[0u32] into r16; + ternary r13 r14[1u32] r15[1u32] into r17; + ternary r13 r14[2u32] r15[2u32] into r18; + cast r16 r17 r18 into r19 as [field; 3u32]; + hash.psd4 r19 into r20 as field; + is.eq r8[0u32].siblings[2u32] 0field into r21; + div r8[0u32].leaf_index 2u32 into r22; + rem r22 2u32 into r23; + is.eq r23 0u32 into r24; + cast 0field r20 r8[0u32].siblings[2u32] into r25 as [field; 3u32]; + cast 0field r8[0u32].siblings[2u32] r20 into r26 as [field; 3u32]; + ternary r24 r25[0u32] r26[0u32] into r27; + ternary r24 r25[1u32] r26[1u32] into r28; + ternary r24 r25[2u32] r26[2u32] into r29; + cast r27 r28 r29 into r30 as [field; 3u32]; + hash.psd4 r30 into r31 as field; + is.eq r8[0u32].siblings[3u32] 0field into r32; + div r8[0u32].leaf_index 4u32 into r33; + rem r33 2u32 into r34; + is.eq r34 0u32 into r35; + cast 0field r31 r8[0u32].siblings[3u32] into r36 as [field; 3u32]; + cast 0field r8[0u32].siblings[3u32] r31 into r37 as [field; 3u32]; + ternary r35 r36[0u32] r37[0u32] into r38; + ternary r35 r36[1u32] r37[1u32] into r39; + ternary r35 r36[2u32] r37[2u32] into r40; + cast r38 r39 r40 into r41 as [field; 3u32]; + hash.psd4 r41 into r42 as field; + is.eq r8[0u32].siblings[4u32] 0field into r43; + div r8[0u32].leaf_index 8u32 into r44; + rem r44 2u32 into r45; + is.eq r45 0u32 into r46; + cast 0field r42 r8[0u32].siblings[4u32] into r47 as [field; 3u32]; + cast 0field r8[0u32].siblings[4u32] r42 into r48 as [field; 3u32]; + ternary r46 r47[0u32] r48[0u32] into r49; + ternary r46 r47[1u32] r48[1u32] into r50; + ternary r46 r47[2u32] r48[2u32] into r51; + cast r49 r50 r51 into r52 as [field; 3u32]; + hash.psd4 r52 into r53 as field; + is.eq r8[0u32].siblings[5u32] 0field into r54; + div r8[0u32].leaf_index 16u32 into r55; + rem r55 2u32 into r56; + is.eq r56 0u32 into r57; + cast 0field r53 r8[0u32].siblings[5u32] into r58 as [field; 3u32]; + cast 0field r8[0u32].siblings[5u32] r53 into r59 as [field; 3u32]; + ternary r57 r58[0u32] r59[0u32] into r60; + ternary r57 r58[1u32] r59[1u32] into r61; + ternary r57 r58[2u32] r59[2u32] into r62; + cast r60 r61 r62 into r63 as [field; 3u32]; + hash.psd4 r63 into r64 as field; + is.eq r8[0u32].siblings[6u32] 0field into r65; + div r8[0u32].leaf_index 32u32 into r66; + rem r66 2u32 into r67; + is.eq r67 0u32 into r68; + cast 0field r64 r8[0u32].siblings[6u32] into r69 as [field; 3u32]; + cast 0field r8[0u32].siblings[6u32] r64 into r70 as [field; 3u32]; + ternary r68 r69[0u32] r70[0u32] into r71; + ternary r68 r69[1u32] r70[1u32] into r72; + ternary r68 r69[2u32] r70[2u32] into r73; + cast r71 r72 r73 into r74 as [field; 3u32]; + hash.psd4 r74 into r75 as field; + is.eq r8[0u32].siblings[7u32] 0field into r76; + div r8[0u32].leaf_index 64u32 into r77; + rem r77 2u32 into r78; + is.eq r78 0u32 into r79; + cast 0field r75 r8[0u32].siblings[7u32] into r80 as [field; 3u32]; + cast 0field r8[0u32].siblings[7u32] r75 into r81 as [field; 3u32]; + ternary r79 r80[0u32] r81[0u32] into r82; + ternary r79 r80[1u32] r81[1u32] into r83; + ternary r79 r80[2u32] r81[2u32] into r84; + cast r82 r83 r84 into r85 as [field; 3u32]; + hash.psd4 r85 into r86 as field; + is.eq r8[0u32].siblings[8u32] 0field into r87; + div r8[0u32].leaf_index 128u32 into r88; + rem r88 2u32 into r89; + is.eq r89 0u32 into r90; + cast 0field r86 r8[0u32].siblings[8u32] into r91 as [field; 3u32]; + cast 0field r8[0u32].siblings[8u32] r86 into r92 as [field; 3u32]; + ternary r90 r91[0u32] r92[0u32] into r93; + ternary r90 r91[1u32] r92[1u32] into r94; + ternary r90 r91[2u32] r92[2u32] into r95; + cast r93 r94 r95 into r96 as [field; 3u32]; + hash.psd4 r96 into r97 as field; + is.eq r8[0u32].siblings[9u32] 0field into r98; + div r8[0u32].leaf_index 256u32 into r99; + rem r99 2u32 into r100; + is.eq r100 0u32 into r101; + cast 0field r97 r8[0u32].siblings[9u32] into r102 as [field; 3u32]; + cast 0field r8[0u32].siblings[9u32] r97 into r103 as [field; 3u32]; + ternary r101 r102[0u32] r103[0u32] into r104; + ternary r101 r102[1u32] r103[1u32] into r105; + ternary r101 r102[2u32] r103[2u32] into r106; + cast r104 r105 r106 into r107 as [field; 3u32]; + hash.psd4 r107 into r108 as field; + is.eq r8[0u32].siblings[10u32] 0field into r109; + div r8[0u32].leaf_index 512u32 into r110; + rem r110 2u32 into r111; + is.eq r111 0u32 into r112; + cast 0field r108 r8[0u32].siblings[10u32] into r113 as [field; 3u32]; + cast 0field r8[0u32].siblings[10u32] r108 into r114 as [field; 3u32]; + ternary r112 r113[0u32] r114[0u32] into r115; + ternary r112 r113[1u32] r114[1u32] into r116; + ternary r112 r113[2u32] r114[2u32] into r117; + cast r115 r116 r117 into r118 as [field; 3u32]; + hash.psd4 r118 into r119 as field; + is.eq r8[0u32].siblings[11u32] 0field into r120; + div r8[0u32].leaf_index 1024u32 into r121; + rem r121 2u32 into r122; + is.eq r122 0u32 into r123; + cast 0field r119 r8[0u32].siblings[11u32] into r124 as [field; 3u32]; + cast 0field r8[0u32].siblings[11u32] r119 into r125 as [field; 3u32]; + ternary r123 r124[0u32] r125[0u32] into r126; + ternary r123 r124[1u32] r125[1u32] into r127; + ternary r123 r124[2u32] r125[2u32] into r128; + cast r126 r127 r128 into r129 as [field; 3u32]; + hash.psd4 r129 into r130 as field; + is.eq r8[0u32].siblings[12u32] 0field into r131; + div r8[0u32].leaf_index 2048u32 into r132; + rem r132 2u32 into r133; + is.eq r133 0u32 into r134; + cast 0field r130 r8[0u32].siblings[12u32] into r135 as [field; 3u32]; + cast 0field r8[0u32].siblings[12u32] r130 into r136 as [field; 3u32]; + ternary r134 r135[0u32] r136[0u32] into r137; + ternary r134 r135[1u32] r136[1u32] into r138; + ternary r134 r135[2u32] r136[2u32] into r139; + cast r137 r138 r139 into r140 as [field; 3u32]; + hash.psd4 r140 into r141 as field; + is.eq r8[0u32].siblings[13u32] 0field into r142; + div r8[0u32].leaf_index 4096u32 into r143; + rem r143 2u32 into r144; + is.eq r144 0u32 into r145; + cast 0field r141 r8[0u32].siblings[13u32] into r146 as [field; 3u32]; + cast 0field r8[0u32].siblings[13u32] r141 into r147 as [field; 3u32]; + ternary r145 r146[0u32] r147[0u32] into r148; + ternary r145 r146[1u32] r147[1u32] into r149; + ternary r145 r146[2u32] r147[2u32] into r150; + cast r148 r149 r150 into r151 as [field; 3u32]; + hash.psd4 r151 into r152 as field; + is.eq r8[0u32].siblings[14u32] 0field into r153; + div r8[0u32].leaf_index 8192u32 into r154; + rem r154 2u32 into r155; + is.eq r155 0u32 into r156; + cast 0field r152 r8[0u32].siblings[14u32] into r157 as [field; 3u32]; + cast 0field r8[0u32].siblings[14u32] r152 into r158 as [field; 3u32]; + ternary r156 r157[0u32] r158[0u32] into r159; + ternary r156 r157[1u32] r158[1u32] into r160; + ternary r156 r157[2u32] r158[2u32] into r161; + cast r159 r160 r161 into r162 as [field; 3u32]; + hash.psd4 r162 into r163 as field; + is.eq r8[0u32].siblings[15u32] 0field into r164; + div r8[0u32].leaf_index 16384u32 into r165; + rem r165 2u32 into r166; + is.eq r166 0u32 into r167; + cast 0field r163 r8[0u32].siblings[15u32] into r168 as [field; 3u32]; + cast 0field r8[0u32].siblings[15u32] r163 into r169 as [field; 3u32]; + ternary r167 r168[0u32] r169[0u32] into r170; + ternary r167 r168[1u32] r169[1u32] into r171; + ternary r167 r168[2u32] r169[2u32] into r172; + cast r170 r171 r172 into r173 as [field; 3u32]; + hash.psd4 r173 into r174 as field; + ternary r164 r163 r174 into r175; + ternary r164 14u32 15u32 into r176; + ternary r153 r152 r175 into r177; + ternary r153 13u32 r176 into r178; + ternary r142 r141 r177 into r179; + ternary r142 12u32 r178 into r180; + ternary r131 r130 r179 into r181; + ternary r131 11u32 r180 into r182; + ternary r120 r119 r181 into r183; + ternary r120 10u32 r182 into r184; + ternary r109 r108 r183 into r185; + ternary r109 9u32 r184 into r186; + ternary r98 r97 r185 into r187; + ternary r98 8u32 r186 into r188; + ternary r87 r86 r187 into r189; + ternary r87 7u32 r188 into r190; + ternary r76 r75 r189 into r191; + ternary r76 6u32 r190 into r192; + ternary r65 r64 r191 into r193; + ternary r65 5u32 r192 into r194; + ternary r54 r53 r193 into r195; + ternary r54 4u32 r194 into r196; + ternary r43 r42 r195 into r197; + ternary r43 3u32 r196 into r198; + ternary r32 r31 r197 into r199; + ternary r32 2u32 r198 into r200; + ternary r21 r20 r199 into r201; + ternary r21 1u32 r200 into r202; + rem r8[1u32].leaf_index 2u32 into r203; + is.eq r203 0u32 into r204; + cast 1field r8[1u32].siblings[0u32] r8[1u32].siblings[1u32] into r205 as [field; 3u32]; + cast 1field r8[1u32].siblings[1u32] r8[1u32].siblings[0u32] into r206 as [field; 3u32]; + ternary r204 r205[0u32] r206[0u32] into r207; + ternary r204 r205[1u32] r206[1u32] into r208; + ternary r204 r205[2u32] r206[2u32] into r209; + cast r207 r208 r209 into r210 as [field; 3u32]; + hash.psd4 r210 into r211 as field; + is.eq r8[1u32].siblings[2u32] 0field into r212; + div r8[1u32].leaf_index 2u32 into r213; + rem r213 2u32 into r214; + is.eq r214 0u32 into r215; + cast 0field r211 r8[1u32].siblings[2u32] into r216 as [field; 3u32]; + cast 0field r8[1u32].siblings[2u32] r211 into r217 as [field; 3u32]; + ternary r215 r216[0u32] r217[0u32] into r218; + ternary r215 r216[1u32] r217[1u32] into r219; + ternary r215 r216[2u32] r217[2u32] into r220; + cast r218 r219 r220 into r221 as [field; 3u32]; + hash.psd4 r221 into r222 as field; + is.eq r8[1u32].siblings[3u32] 0field into r223; + div r8[1u32].leaf_index 4u32 into r224; + rem r224 2u32 into r225; + is.eq r225 0u32 into r226; + cast 0field r222 r8[1u32].siblings[3u32] into r227 as [field; 3u32]; + cast 0field r8[1u32].siblings[3u32] r222 into r228 as [field; 3u32]; + ternary r226 r227[0u32] r228[0u32] into r229; + ternary r226 r227[1u32] r228[1u32] into r230; + ternary r226 r227[2u32] r228[2u32] into r231; + cast r229 r230 r231 into r232 as [field; 3u32]; + hash.psd4 r232 into r233 as field; + is.eq r8[1u32].siblings[4u32] 0field into r234; + div r8[1u32].leaf_index 8u32 into r235; + rem r235 2u32 into r236; + is.eq r236 0u32 into r237; + cast 0field r233 r8[1u32].siblings[4u32] into r238 as [field; 3u32]; + cast 0field r8[1u32].siblings[4u32] r233 into r239 as [field; 3u32]; + ternary r237 r238[0u32] r239[0u32] into r240; + ternary r237 r238[1u32] r239[1u32] into r241; + ternary r237 r238[2u32] r239[2u32] into r242; + cast r240 r241 r242 into r243 as [field; 3u32]; + hash.psd4 r243 into r244 as field; + is.eq r8[1u32].siblings[5u32] 0field into r245; + div r8[1u32].leaf_index 16u32 into r246; + rem r246 2u32 into r247; + is.eq r247 0u32 into r248; + cast 0field r244 r8[1u32].siblings[5u32] into r249 as [field; 3u32]; + cast 0field r8[1u32].siblings[5u32] r244 into r250 as [field; 3u32]; + ternary r248 r249[0u32] r250[0u32] into r251; + ternary r248 r249[1u32] r250[1u32] into r252; + ternary r248 r249[2u32] r250[2u32] into r253; + cast r251 r252 r253 into r254 as [field; 3u32]; + hash.psd4 r254 into r255 as field; + is.eq r8[1u32].siblings[6u32] 0field into r256; + div r8[1u32].leaf_index 32u32 into r257; + rem r257 2u32 into r258; + is.eq r258 0u32 into r259; + cast 0field r255 r8[1u32].siblings[6u32] into r260 as [field; 3u32]; + cast 0field r8[1u32].siblings[6u32] r255 into r261 as [field; 3u32]; + ternary r259 r260[0u32] r261[0u32] into r262; + ternary r259 r260[1u32] r261[1u32] into r263; + ternary r259 r260[2u32] r261[2u32] into r264; + cast r262 r263 r264 into r265 as [field; 3u32]; + hash.psd4 r265 into r266 as field; + is.eq r8[1u32].siblings[7u32] 0field into r267; + div r8[1u32].leaf_index 64u32 into r268; + rem r268 2u32 into r269; + is.eq r269 0u32 into r270; + cast 0field r266 r8[1u32].siblings[7u32] into r271 as [field; 3u32]; + cast 0field r8[1u32].siblings[7u32] r266 into r272 as [field; 3u32]; + ternary r270 r271[0u32] r272[0u32] into r273; + ternary r270 r271[1u32] r272[1u32] into r274; + ternary r270 r271[2u32] r272[2u32] into r275; + cast r273 r274 r275 into r276 as [field; 3u32]; + hash.psd4 r276 into r277 as field; + is.eq r8[1u32].siblings[8u32] 0field into r278; + div r8[1u32].leaf_index 128u32 into r279; + rem r279 2u32 into r280; + is.eq r280 0u32 into r281; + cast 0field r277 r8[1u32].siblings[8u32] into r282 as [field; 3u32]; + cast 0field r8[1u32].siblings[8u32] r277 into r283 as [field; 3u32]; + ternary r281 r282[0u32] r283[0u32] into r284; + ternary r281 r282[1u32] r283[1u32] into r285; + ternary r281 r282[2u32] r283[2u32] into r286; + cast r284 r285 r286 into r287 as [field; 3u32]; + hash.psd4 r287 into r288 as field; + is.eq r8[1u32].siblings[9u32] 0field into r289; + div r8[1u32].leaf_index 256u32 into r290; + rem r290 2u32 into r291; + is.eq r291 0u32 into r292; + cast 0field r288 r8[1u32].siblings[9u32] into r293 as [field; 3u32]; + cast 0field r8[1u32].siblings[9u32] r288 into r294 as [field; 3u32]; + ternary r292 r293[0u32] r294[0u32] into r295; + ternary r292 r293[1u32] r294[1u32] into r296; + ternary r292 r293[2u32] r294[2u32] into r297; + cast r295 r296 r297 into r298 as [field; 3u32]; + hash.psd4 r298 into r299 as field; + is.eq r8[1u32].siblings[10u32] 0field into r300; + div r8[1u32].leaf_index 512u32 into r301; + rem r301 2u32 into r302; + is.eq r302 0u32 into r303; + cast 0field r299 r8[1u32].siblings[10u32] into r304 as [field; 3u32]; + cast 0field r8[1u32].siblings[10u32] r299 into r305 as [field; 3u32]; + ternary r303 r304[0u32] r305[0u32] into r306; + ternary r303 r304[1u32] r305[1u32] into r307; + ternary r303 r304[2u32] r305[2u32] into r308; + cast r306 r307 r308 into r309 as [field; 3u32]; + hash.psd4 r309 into r310 as field; + is.eq r8[1u32].siblings[11u32] 0field into r311; + div r8[1u32].leaf_index 1024u32 into r312; + rem r312 2u32 into r313; + is.eq r313 0u32 into r314; + cast 0field r310 r8[1u32].siblings[11u32] into r315 as [field; 3u32]; + cast 0field r8[1u32].siblings[11u32] r310 into r316 as [field; 3u32]; + ternary r314 r315[0u32] r316[0u32] into r317; + ternary r314 r315[1u32] r316[1u32] into r318; + ternary r314 r315[2u32] r316[2u32] into r319; + cast r317 r318 r319 into r320 as [field; 3u32]; + hash.psd4 r320 into r321 as field; + is.eq r8[1u32].siblings[12u32] 0field into r322; + div r8[1u32].leaf_index 2048u32 into r323; + rem r323 2u32 into r324; + is.eq r324 0u32 into r325; + cast 0field r321 r8[1u32].siblings[12u32] into r326 as [field; 3u32]; + cast 0field r8[1u32].siblings[12u32] r321 into r327 as [field; 3u32]; + ternary r325 r326[0u32] r327[0u32] into r328; + ternary r325 r326[1u32] r327[1u32] into r329; + ternary r325 r326[2u32] r327[2u32] into r330; + cast r328 r329 r330 into r331 as [field; 3u32]; + hash.psd4 r331 into r332 as field; + is.eq r8[1u32].siblings[13u32] 0field into r333; + div r8[1u32].leaf_index 4096u32 into r334; + rem r334 2u32 into r335; + is.eq r335 0u32 into r336; + cast 0field r332 r8[1u32].siblings[13u32] into r337 as [field; 3u32]; + cast 0field r8[1u32].siblings[13u32] r332 into r338 as [field; 3u32]; + ternary r336 r337[0u32] r338[0u32] into r339; + ternary r336 r337[1u32] r338[1u32] into r340; + ternary r336 r337[2u32] r338[2u32] into r341; + cast r339 r340 r341 into r342 as [field; 3u32]; + hash.psd4 r342 into r343 as field; + is.eq r8[1u32].siblings[14u32] 0field into r344; + div r8[1u32].leaf_index 8192u32 into r345; + rem r345 2u32 into r346; + is.eq r346 0u32 into r347; + cast 0field r343 r8[1u32].siblings[14u32] into r348 as [field; 3u32]; + cast 0field r8[1u32].siblings[14u32] r343 into r349 as [field; 3u32]; + ternary r347 r348[0u32] r349[0u32] into r350; + ternary r347 r348[1u32] r349[1u32] into r351; + ternary r347 r348[2u32] r349[2u32] into r352; + cast r350 r351 r352 into r353 as [field; 3u32]; + hash.psd4 r353 into r354 as field; + is.eq r8[1u32].siblings[15u32] 0field into r355; + div r8[1u32].leaf_index 16384u32 into r356; + rem r356 2u32 into r357; + is.eq r357 0u32 into r358; + cast 0field r354 r8[1u32].siblings[15u32] into r359 as [field; 3u32]; + cast 0field r8[1u32].siblings[15u32] r354 into r360 as [field; 3u32]; + ternary r358 r359[0u32] r360[0u32] into r361; + ternary r358 r359[1u32] r360[1u32] into r362; + ternary r358 r359[2u32] r360[2u32] into r363; + cast r361 r362 r363 into r364 as [field; 3u32]; + hash.psd4 r364 into r365 as field; + ternary r355 r354 r365 into r366; + ternary r355 14u32 15u32 into r367; + ternary r344 r343 r366 into r368; + ternary r344 13u32 r367 into r369; + ternary r333 r332 r368 into r370; + ternary r333 12u32 r369 into r371; + ternary r322 r321 r370 into r372; + ternary r322 11u32 r371 into r373; + ternary r311 r310 r372 into r374; + ternary r311 10u32 r373 into r375; + ternary r300 r299 r374 into r376; + ternary r300 9u32 r375 into r377; + ternary r289 r288 r376 into r378; + ternary r289 8u32 r377 into r379; + ternary r278 r277 r378 into r380; + ternary r278 7u32 r379 into r381; + ternary r267 r266 r380 into r382; + ternary r267 6u32 r381 into r383; + ternary r256 r255 r382 into r384; + ternary r256 5u32 r383 into r385; + ternary r245 r244 r384 into r386; + ternary r245 4u32 r385 into r387; + ternary r234 r233 r386 into r388; + ternary r234 3u32 r387 into r389; + ternary r223 r222 r388 into r390; + ternary r223 2u32 r389 into r391; + ternary r212 r211 r390 into r392; + ternary r212 1u32 r391 into r393; + assert.eq r201 r392; + assert.eq r202 r393; + cast self.signer into r394 as field; + is.eq r8[0u32].leaf_index r8[1u32].leaf_index into r395; + is.eq r8[0u32].leaf_index 0u32 into r396; + lt r394 r8[0u32].siblings[0u32] into r397; + and r395 r396 into r398; + not r398 into r399; + or r397 r399 into r400; + assert.eq r400 true; + not r396 into r401; + pow 2u32 r202 into r402; + sub r402 1u32 into r403; + and r395 r401 into r404; + not r404 into r405; + is.eq r8[0u32].leaf_index r403 into r406; + or r406 r405 into r407; + assert.eq r407 true; + gt r394 r8[0u32].siblings[0u32] into r408; + or r408 r405 into r409; + assert.eq r409 true; + not r395 into r410; + gt r394 r8[0u32].siblings[0u32] into r411; + not r410 into r412; + or r411 r412 into r413; + assert.eq r413 true; + lt r394 r8[1u32].siblings[0u32] into r414; + or r414 r412 into r415; + assert.eq r415 true; + lte r8[1u32].leaf_index r403 into r416; + or r416 r412 into r417; + assert.eq r417 true; + add r8[0u32].leaf_index 1u32 into r418; + is.eq r418 r8[1u32].leaf_index into r419; + or r419 r412 into r420; + assert.eq r420 true; + rem r9[0u32].leaf_index 2u32 into r421; + is.eq r421 0u32 into r422; + cast 1field r9[0u32].siblings[0u32] r9[0u32].siblings[1u32] into r423 as [field; 3u32]; + cast 1field r9[0u32].siblings[1u32] r9[0u32].siblings[0u32] into r424 as [field; 3u32]; + ternary r422 r423[0u32] r424[0u32] into r425; + ternary r422 r423[1u32] r424[1u32] into r426; + ternary r422 r423[2u32] r424[2u32] into r427; + cast r425 r426 r427 into r428 as [field; 3u32]; + hash.psd4 r428 into r429 as field; + is.eq r9[0u32].siblings[2u32] 0field into r430; + div r9[0u32].leaf_index 2u32 into r431; + rem r431 2u32 into r432; + is.eq r432 0u32 into r433; + cast 0field r429 r9[0u32].siblings[2u32] into r434 as [field; 3u32]; + cast 0field r9[0u32].siblings[2u32] r429 into r435 as [field; 3u32]; + ternary r433 r434[0u32] r435[0u32] into r436; + ternary r433 r434[1u32] r435[1u32] into r437; + ternary r433 r434[2u32] r435[2u32] into r438; + cast r436 r437 r438 into r439 as [field; 3u32]; + hash.psd4 r439 into r440 as field; + is.eq r9[0u32].siblings[3u32] 0field into r441; + div r9[0u32].leaf_index 4u32 into r442; + rem r442 2u32 into r443; + is.eq r443 0u32 into r444; + cast 0field r440 r9[0u32].siblings[3u32] into r445 as [field; 3u32]; + cast 0field r9[0u32].siblings[3u32] r440 into r446 as [field; 3u32]; + ternary r444 r445[0u32] r446[0u32] into r447; + ternary r444 r445[1u32] r446[1u32] into r448; + ternary r444 r445[2u32] r446[2u32] into r449; + cast r447 r448 r449 into r450 as [field; 3u32]; + hash.psd4 r450 into r451 as field; + is.eq r9[0u32].siblings[4u32] 0field into r452; + div r9[0u32].leaf_index 8u32 into r453; + rem r453 2u32 into r454; + is.eq r454 0u32 into r455; + cast 0field r451 r9[0u32].siblings[4u32] into r456 as [field; 3u32]; + cast 0field r9[0u32].siblings[4u32] r451 into r457 as [field; 3u32]; + ternary r455 r456[0u32] r457[0u32] into r458; + ternary r455 r456[1u32] r457[1u32] into r459; + ternary r455 r456[2u32] r457[2u32] into r460; + cast r458 r459 r460 into r461 as [field; 3u32]; + hash.psd4 r461 into r462 as field; + is.eq r9[0u32].siblings[5u32] 0field into r463; + div r9[0u32].leaf_index 16u32 into r464; + rem r464 2u32 into r465; + is.eq r465 0u32 into r466; + cast 0field r462 r9[0u32].siblings[5u32] into r467 as [field; 3u32]; + cast 0field r9[0u32].siblings[5u32] r462 into r468 as [field; 3u32]; + ternary r466 r467[0u32] r468[0u32] into r469; + ternary r466 r467[1u32] r468[1u32] into r470; + ternary r466 r467[2u32] r468[2u32] into r471; + cast r469 r470 r471 into r472 as [field; 3u32]; + hash.psd4 r472 into r473 as field; + is.eq r9[0u32].siblings[6u32] 0field into r474; + div r9[0u32].leaf_index 32u32 into r475; + rem r475 2u32 into r476; + is.eq r476 0u32 into r477; + cast 0field r473 r9[0u32].siblings[6u32] into r478 as [field; 3u32]; + cast 0field r9[0u32].siblings[6u32] r473 into r479 as [field; 3u32]; + ternary r477 r478[0u32] r479[0u32] into r480; + ternary r477 r478[1u32] r479[1u32] into r481; + ternary r477 r478[2u32] r479[2u32] into r482; + cast r480 r481 r482 into r483 as [field; 3u32]; + hash.psd4 r483 into r484 as field; + is.eq r9[0u32].siblings[7u32] 0field into r485; + div r9[0u32].leaf_index 64u32 into r486; + rem r486 2u32 into r487; + is.eq r487 0u32 into r488; + cast 0field r484 r9[0u32].siblings[7u32] into r489 as [field; 3u32]; + cast 0field r9[0u32].siblings[7u32] r484 into r490 as [field; 3u32]; + ternary r488 r489[0u32] r490[0u32] into r491; + ternary r488 r489[1u32] r490[1u32] into r492; + ternary r488 r489[2u32] r490[2u32] into r493; + cast r491 r492 r493 into r494 as [field; 3u32]; + hash.psd4 r494 into r495 as field; + is.eq r9[0u32].siblings[8u32] 0field into r496; + div r9[0u32].leaf_index 128u32 into r497; + rem r497 2u32 into r498; + is.eq r498 0u32 into r499; + cast 0field r495 r9[0u32].siblings[8u32] into r500 as [field; 3u32]; + cast 0field r9[0u32].siblings[8u32] r495 into r501 as [field; 3u32]; + ternary r499 r500[0u32] r501[0u32] into r502; + ternary r499 r500[1u32] r501[1u32] into r503; + ternary r499 r500[2u32] r501[2u32] into r504; + cast r502 r503 r504 into r505 as [field; 3u32]; + hash.psd4 r505 into r506 as field; + is.eq r9[0u32].siblings[9u32] 0field into r507; + div r9[0u32].leaf_index 256u32 into r508; + rem r508 2u32 into r509; + is.eq r509 0u32 into r510; + cast 0field r506 r9[0u32].siblings[9u32] into r511 as [field; 3u32]; + cast 0field r9[0u32].siblings[9u32] r506 into r512 as [field; 3u32]; + ternary r510 r511[0u32] r512[0u32] into r513; + ternary r510 r511[1u32] r512[1u32] into r514; + ternary r510 r511[2u32] r512[2u32] into r515; + cast r513 r514 r515 into r516 as [field; 3u32]; + hash.psd4 r516 into r517 as field; + is.eq r9[0u32].siblings[10u32] 0field into r518; + div r9[0u32].leaf_index 512u32 into r519; + rem r519 2u32 into r520; + is.eq r520 0u32 into r521; + cast 0field r517 r9[0u32].siblings[10u32] into r522 as [field; 3u32]; + cast 0field r9[0u32].siblings[10u32] r517 into r523 as [field; 3u32]; + ternary r521 r522[0u32] r523[0u32] into r524; + ternary r521 r522[1u32] r523[1u32] into r525; + ternary r521 r522[2u32] r523[2u32] into r526; + cast r524 r525 r526 into r527 as [field; 3u32]; + hash.psd4 r527 into r528 as field; + is.eq r9[0u32].siblings[11u32] 0field into r529; + div r9[0u32].leaf_index 1024u32 into r530; + rem r530 2u32 into r531; + is.eq r531 0u32 into r532; + cast 0field r528 r9[0u32].siblings[11u32] into r533 as [field; 3u32]; + cast 0field r9[0u32].siblings[11u32] r528 into r534 as [field; 3u32]; + ternary r532 r533[0u32] r534[0u32] into r535; + ternary r532 r533[1u32] r534[1u32] into r536; + ternary r532 r533[2u32] r534[2u32] into r537; + cast r535 r536 r537 into r538 as [field; 3u32]; + hash.psd4 r538 into r539 as field; + is.eq r9[0u32].siblings[12u32] 0field into r540; + div r9[0u32].leaf_index 2048u32 into r541; + rem r541 2u32 into r542; + is.eq r542 0u32 into r543; + cast 0field r539 r9[0u32].siblings[12u32] into r544 as [field; 3u32]; + cast 0field r9[0u32].siblings[12u32] r539 into r545 as [field; 3u32]; + ternary r543 r544[0u32] r545[0u32] into r546; + ternary r543 r544[1u32] r545[1u32] into r547; + ternary r543 r544[2u32] r545[2u32] into r548; + cast r546 r547 r548 into r549 as [field; 3u32]; + hash.psd4 r549 into r550 as field; + is.eq r9[0u32].siblings[13u32] 0field into r551; + div r9[0u32].leaf_index 4096u32 into r552; + rem r552 2u32 into r553; + is.eq r553 0u32 into r554; + cast 0field r550 r9[0u32].siblings[13u32] into r555 as [field; 3u32]; + cast 0field r9[0u32].siblings[13u32] r550 into r556 as [field; 3u32]; + ternary r554 r555[0u32] r556[0u32] into r557; + ternary r554 r555[1u32] r556[1u32] into r558; + ternary r554 r555[2u32] r556[2u32] into r559; + cast r557 r558 r559 into r560 as [field; 3u32]; + hash.psd4 r560 into r561 as field; + is.eq r9[0u32].siblings[14u32] 0field into r562; + div r9[0u32].leaf_index 8192u32 into r563; + rem r563 2u32 into r564; + is.eq r564 0u32 into r565; + cast 0field r561 r9[0u32].siblings[14u32] into r566 as [field; 3u32]; + cast 0field r9[0u32].siblings[14u32] r561 into r567 as [field; 3u32]; + ternary r565 r566[0u32] r567[0u32] into r568; + ternary r565 r566[1u32] r567[1u32] into r569; + ternary r565 r566[2u32] r567[2u32] into r570; + cast r568 r569 r570 into r571 as [field; 3u32]; + hash.psd4 r571 into r572 as field; + is.eq r9[0u32].siblings[15u32] 0field into r573; + div r9[0u32].leaf_index 16384u32 into r574; + rem r574 2u32 into r575; + is.eq r575 0u32 into r576; + cast 0field r572 r9[0u32].siblings[15u32] into r577 as [field; 3u32]; + cast 0field r9[0u32].siblings[15u32] r572 into r578 as [field; 3u32]; + ternary r576 r577[0u32] r578[0u32] into r579; + ternary r576 r577[1u32] r578[1u32] into r580; + ternary r576 r577[2u32] r578[2u32] into r581; + cast r579 r580 r581 into r582 as [field; 3u32]; + hash.psd4 r582 into r583 as field; + ternary r573 r572 r583 into r584; + ternary r573 14u32 15u32 into r585; + ternary r562 r561 r584 into r586; + ternary r562 13u32 r585 into r587; + ternary r551 r550 r586 into r588; + ternary r551 12u32 r587 into r589; + ternary r540 r539 r588 into r590; + ternary r540 11u32 r589 into r591; + ternary r529 r528 r590 into r592; + ternary r529 10u32 r591 into r593; + ternary r518 r517 r592 into r594; + ternary r518 9u32 r593 into r595; + ternary r507 r506 r594 into r596; + ternary r507 8u32 r595 into r597; + ternary r496 r495 r596 into r598; + ternary r496 7u32 r597 into r599; + ternary r485 r484 r598 into r600; + ternary r485 6u32 r599 into r601; + ternary r474 r473 r600 into r602; + ternary r474 5u32 r601 into r603; + ternary r463 r462 r602 into r604; + ternary r463 4u32 r603 into r605; + ternary r452 r451 r604 into r606; + ternary r452 3u32 r605 into r607; + ternary r441 r440 r606 into r608; + ternary r441 2u32 r607 into r609; + ternary r430 r429 r608 into r610; + ternary r430 1u32 r609 into r611; + rem r9[1u32].leaf_index 2u32 into r612; + is.eq r612 0u32 into r613; + cast 1field r9[1u32].siblings[0u32] r9[1u32].siblings[1u32] into r614 as [field; 3u32]; + cast 1field r9[1u32].siblings[1u32] r9[1u32].siblings[0u32] into r615 as [field; 3u32]; + ternary r613 r614[0u32] r615[0u32] into r616; + ternary r613 r614[1u32] r615[1u32] into r617; + ternary r613 r614[2u32] r615[2u32] into r618; + cast r616 r617 r618 into r619 as [field; 3u32]; + hash.psd4 r619 into r620 as field; + is.eq r9[1u32].siblings[2u32] 0field into r621; + div r9[1u32].leaf_index 2u32 into r622; + rem r622 2u32 into r623; + is.eq r623 0u32 into r624; + cast 0field r620 r9[1u32].siblings[2u32] into r625 as [field; 3u32]; + cast 0field r9[1u32].siblings[2u32] r620 into r626 as [field; 3u32]; + ternary r624 r625[0u32] r626[0u32] into r627; + ternary r624 r625[1u32] r626[1u32] into r628; + ternary r624 r625[2u32] r626[2u32] into r629; + cast r627 r628 r629 into r630 as [field; 3u32]; + hash.psd4 r630 into r631 as field; + is.eq r9[1u32].siblings[3u32] 0field into r632; + div r9[1u32].leaf_index 4u32 into r633; + rem r633 2u32 into r634; + is.eq r634 0u32 into r635; + cast 0field r631 r9[1u32].siblings[3u32] into r636 as [field; 3u32]; + cast 0field r9[1u32].siblings[3u32] r631 into r637 as [field; 3u32]; + ternary r635 r636[0u32] r637[0u32] into r638; + ternary r635 r636[1u32] r637[1u32] into r639; + ternary r635 r636[2u32] r637[2u32] into r640; + cast r638 r639 r640 into r641 as [field; 3u32]; + hash.psd4 r641 into r642 as field; + is.eq r9[1u32].siblings[4u32] 0field into r643; + div r9[1u32].leaf_index 8u32 into r644; + rem r644 2u32 into r645; + is.eq r645 0u32 into r646; + cast 0field r642 r9[1u32].siblings[4u32] into r647 as [field; 3u32]; + cast 0field r9[1u32].siblings[4u32] r642 into r648 as [field; 3u32]; + ternary r646 r647[0u32] r648[0u32] into r649; + ternary r646 r647[1u32] r648[1u32] into r650; + ternary r646 r647[2u32] r648[2u32] into r651; + cast r649 r650 r651 into r652 as [field; 3u32]; + hash.psd4 r652 into r653 as field; + is.eq r9[1u32].siblings[5u32] 0field into r654; + div r9[1u32].leaf_index 16u32 into r655; + rem r655 2u32 into r656; + is.eq r656 0u32 into r657; + cast 0field r653 r9[1u32].siblings[5u32] into r658 as [field; 3u32]; + cast 0field r9[1u32].siblings[5u32] r653 into r659 as [field; 3u32]; + ternary r657 r658[0u32] r659[0u32] into r660; + ternary r657 r658[1u32] r659[1u32] into r661; + ternary r657 r658[2u32] r659[2u32] into r662; + cast r660 r661 r662 into r663 as [field; 3u32]; + hash.psd4 r663 into r664 as field; + is.eq r9[1u32].siblings[6u32] 0field into r665; + div r9[1u32].leaf_index 32u32 into r666; + rem r666 2u32 into r667; + is.eq r667 0u32 into r668; + cast 0field r664 r9[1u32].siblings[6u32] into r669 as [field; 3u32]; + cast 0field r9[1u32].siblings[6u32] r664 into r670 as [field; 3u32]; + ternary r668 r669[0u32] r670[0u32] into r671; + ternary r668 r669[1u32] r670[1u32] into r672; + ternary r668 r669[2u32] r670[2u32] into r673; + cast r671 r672 r673 into r674 as [field; 3u32]; + hash.psd4 r674 into r675 as field; + is.eq r9[1u32].siblings[7u32] 0field into r676; + div r9[1u32].leaf_index 64u32 into r677; + rem r677 2u32 into r678; + is.eq r678 0u32 into r679; + cast 0field r675 r9[1u32].siblings[7u32] into r680 as [field; 3u32]; + cast 0field r9[1u32].siblings[7u32] r675 into r681 as [field; 3u32]; + ternary r679 r680[0u32] r681[0u32] into r682; + ternary r679 r680[1u32] r681[1u32] into r683; + ternary r679 r680[2u32] r681[2u32] into r684; + cast r682 r683 r684 into r685 as [field; 3u32]; + hash.psd4 r685 into r686 as field; + is.eq r9[1u32].siblings[8u32] 0field into r687; + div r9[1u32].leaf_index 128u32 into r688; + rem r688 2u32 into r689; + is.eq r689 0u32 into r690; + cast 0field r686 r9[1u32].siblings[8u32] into r691 as [field; 3u32]; + cast 0field r9[1u32].siblings[8u32] r686 into r692 as [field; 3u32]; + ternary r690 r691[0u32] r692[0u32] into r693; + ternary r690 r691[1u32] r692[1u32] into r694; + ternary r690 r691[2u32] r692[2u32] into r695; + cast r693 r694 r695 into r696 as [field; 3u32]; + hash.psd4 r696 into r697 as field; + is.eq r9[1u32].siblings[9u32] 0field into r698; + div r9[1u32].leaf_index 256u32 into r699; + rem r699 2u32 into r700; + is.eq r700 0u32 into r701; + cast 0field r697 r9[1u32].siblings[9u32] into r702 as [field; 3u32]; + cast 0field r9[1u32].siblings[9u32] r697 into r703 as [field; 3u32]; + ternary r701 r702[0u32] r703[0u32] into r704; + ternary r701 r702[1u32] r703[1u32] into r705; + ternary r701 r702[2u32] r703[2u32] into r706; + cast r704 r705 r706 into r707 as [field; 3u32]; + hash.psd4 r707 into r708 as field; + is.eq r9[1u32].siblings[10u32] 0field into r709; + div r9[1u32].leaf_index 512u32 into r710; + rem r710 2u32 into r711; + is.eq r711 0u32 into r712; + cast 0field r708 r9[1u32].siblings[10u32] into r713 as [field; 3u32]; + cast 0field r9[1u32].siblings[10u32] r708 into r714 as [field; 3u32]; + ternary r712 r713[0u32] r714[0u32] into r715; + ternary r712 r713[1u32] r714[1u32] into r716; + ternary r712 r713[2u32] r714[2u32] into r717; + cast r715 r716 r717 into r718 as [field; 3u32]; + hash.psd4 r718 into r719 as field; + is.eq r9[1u32].siblings[11u32] 0field into r720; + div r9[1u32].leaf_index 1024u32 into r721; + rem r721 2u32 into r722; + is.eq r722 0u32 into r723; + cast 0field r719 r9[1u32].siblings[11u32] into r724 as [field; 3u32]; + cast 0field r9[1u32].siblings[11u32] r719 into r725 as [field; 3u32]; + ternary r723 r724[0u32] r725[0u32] into r726; + ternary r723 r724[1u32] r725[1u32] into r727; + ternary r723 r724[2u32] r725[2u32] into r728; + cast r726 r727 r728 into r729 as [field; 3u32]; + hash.psd4 r729 into r730 as field; + is.eq r9[1u32].siblings[12u32] 0field into r731; + div r9[1u32].leaf_index 2048u32 into r732; + rem r732 2u32 into r733; + is.eq r733 0u32 into r734; + cast 0field r730 r9[1u32].siblings[12u32] into r735 as [field; 3u32]; + cast 0field r9[1u32].siblings[12u32] r730 into r736 as [field; 3u32]; + ternary r734 r735[0u32] r736[0u32] into r737; + ternary r734 r735[1u32] r736[1u32] into r738; + ternary r734 r735[2u32] r736[2u32] into r739; + cast r737 r738 r739 into r740 as [field; 3u32]; + hash.psd4 r740 into r741 as field; + is.eq r9[1u32].siblings[13u32] 0field into r742; + div r9[1u32].leaf_index 4096u32 into r743; + rem r743 2u32 into r744; + is.eq r744 0u32 into r745; + cast 0field r741 r9[1u32].siblings[13u32] into r746 as [field; 3u32]; + cast 0field r9[1u32].siblings[13u32] r741 into r747 as [field; 3u32]; + ternary r745 r746[0u32] r747[0u32] into r748; + ternary r745 r746[1u32] r747[1u32] into r749; + ternary r745 r746[2u32] r747[2u32] into r750; + cast r748 r749 r750 into r751 as [field; 3u32]; + hash.psd4 r751 into r752 as field; + is.eq r9[1u32].siblings[14u32] 0field into r753; + div r9[1u32].leaf_index 8192u32 into r754; + rem r754 2u32 into r755; + is.eq r755 0u32 into r756; + cast 0field r752 r9[1u32].siblings[14u32] into r757 as [field; 3u32]; + cast 0field r9[1u32].siblings[14u32] r752 into r758 as [field; 3u32]; + ternary r756 r757[0u32] r758[0u32] into r759; + ternary r756 r757[1u32] r758[1u32] into r760; + ternary r756 r757[2u32] r758[2u32] into r761; + cast r759 r760 r761 into r762 as [field; 3u32]; + hash.psd4 r762 into r763 as field; + is.eq r9[1u32].siblings[15u32] 0field into r764; + div r9[1u32].leaf_index 16384u32 into r765; + rem r765 2u32 into r766; + is.eq r766 0u32 into r767; + cast 0field r763 r9[1u32].siblings[15u32] into r768 as [field; 3u32]; + cast 0field r9[1u32].siblings[15u32] r763 into r769 as [field; 3u32]; + ternary r767 r768[0u32] r769[0u32] into r770; + ternary r767 r768[1u32] r769[1u32] into r771; + ternary r767 r768[2u32] r769[2u32] into r772; + cast r770 r771 r772 into r773 as [field; 3u32]; + hash.psd4 r773 into r774 as field; + ternary r764 r763 r774 into r775; + ternary r764 14u32 15u32 into r776; + ternary r753 r752 r775 into r777; + ternary r753 13u32 r776 into r778; + ternary r742 r741 r777 into r779; + ternary r742 12u32 r778 into r780; + ternary r731 r730 r779 into r781; + ternary r731 11u32 r780 into r782; + ternary r720 r719 r781 into r783; + ternary r720 10u32 r782 into r784; + ternary r709 r708 r783 into r785; + ternary r709 9u32 r784 into r786; + ternary r698 r697 r785 into r787; + ternary r698 8u32 r786 into r788; + ternary r687 r686 r787 into r789; + ternary r687 7u32 r788 into r790; + ternary r676 r675 r789 into r791; + ternary r676 6u32 r790 into r792; + ternary r665 r664 r791 into r793; + ternary r665 5u32 r792 into r794; + ternary r654 r653 r793 into r795; + ternary r654 4u32 r794 into r796; + ternary r643 r642 r795 into r797; + ternary r643 3u32 r796 into r798; + ternary r632 r631 r797 into r799; + ternary r632 2u32 r798 into r800; + ternary r621 r620 r799 into r801; + ternary r621 1u32 r800 into r802; + assert.eq r610 r801; + assert.eq r611 r802; + cast r3 into r803 as field; + is.eq r9[0u32].leaf_index r9[1u32].leaf_index into r804; + is.eq r9[0u32].leaf_index 0u32 into r805; + lt r803 r9[0u32].siblings[0u32] into r806; + and r804 r805 into r807; + not r807 into r808; + or r806 r808 into r809; + assert.eq r809 true; + not r805 into r810; + pow 2u32 r611 into r811; + sub r811 1u32 into r812; + and r804 r810 into r813; + not r813 into r814; + is.eq r9[0u32].leaf_index r812 into r815; + or r815 r814 into r816; + assert.eq r816 true; + gt r803 r9[0u32].siblings[0u32] into r817; + or r817 r814 into r818; + assert.eq r818 true; + not r804 into r819; + gt r803 r9[0u32].siblings[0u32] into r820; + not r819 into r821; + or r820 r821 into r822; + assert.eq r822 true; + lt r803 r9[1u32].siblings[0u32] into r823; + or r823 r821 into r824; + assert.eq r824 true; + lte r9[1u32].leaf_index r812 into r825; + or r825 r821 into r826; + assert.eq r826 true; + add r9[0u32].leaf_index 1u32 into r827; + is.eq r827 r9[1u32].leaf_index into r828; + or r828 r821 into r829; + assert.eq r829 true; + rem r10[0u32].leaf_index 2u32 into r830; + is.eq r830 0u32 into r831; + cast 1field r10[0u32].siblings[0u32] r10[0u32].siblings[1u32] into r832 as [field; 3u32]; + cast 1field r10[0u32].siblings[1u32] r10[0u32].siblings[0u32] into r833 as [field; 3u32]; + ternary r831 r832[0u32] r833[0u32] into r834; + ternary r831 r832[1u32] r833[1u32] into r835; + ternary r831 r832[2u32] r833[2u32] into r836; + cast r834 r835 r836 into r837 as [field; 3u32]; + hash.psd4 r837 into r838 as field; + is.eq r10[0u32].siblings[2u32] 0field into r839; + div r10[0u32].leaf_index 2u32 into r840; + rem r840 2u32 into r841; + is.eq r841 0u32 into r842; + cast 0field r838 r10[0u32].siblings[2u32] into r843 as [field; 3u32]; + cast 0field r10[0u32].siblings[2u32] r838 into r844 as [field; 3u32]; + ternary r842 r843[0u32] r844[0u32] into r845; + ternary r842 r843[1u32] r844[1u32] into r846; + ternary r842 r843[2u32] r844[2u32] into r847; + cast r845 r846 r847 into r848 as [field; 3u32]; + hash.psd4 r848 into r849 as field; + is.eq r10[0u32].siblings[3u32] 0field into r850; + div r10[0u32].leaf_index 4u32 into r851; + rem r851 2u32 into r852; + is.eq r852 0u32 into r853; + cast 0field r849 r10[0u32].siblings[3u32] into r854 as [field; 3u32]; + cast 0field r10[0u32].siblings[3u32] r849 into r855 as [field; 3u32]; + ternary r853 r854[0u32] r855[0u32] into r856; + ternary r853 r854[1u32] r855[1u32] into r857; + ternary r853 r854[2u32] r855[2u32] into r858; + cast r856 r857 r858 into r859 as [field; 3u32]; + hash.psd4 r859 into r860 as field; + is.eq r10[0u32].siblings[4u32] 0field into r861; + div r10[0u32].leaf_index 8u32 into r862; + rem r862 2u32 into r863; + is.eq r863 0u32 into r864; + cast 0field r860 r10[0u32].siblings[4u32] into r865 as [field; 3u32]; + cast 0field r10[0u32].siblings[4u32] r860 into r866 as [field; 3u32]; + ternary r864 r865[0u32] r866[0u32] into r867; + ternary r864 r865[1u32] r866[1u32] into r868; + ternary r864 r865[2u32] r866[2u32] into r869; + cast r867 r868 r869 into r870 as [field; 3u32]; + hash.psd4 r870 into r871 as field; + is.eq r10[0u32].siblings[5u32] 0field into r872; + div r10[0u32].leaf_index 16u32 into r873; + rem r873 2u32 into r874; + is.eq r874 0u32 into r875; + cast 0field r871 r10[0u32].siblings[5u32] into r876 as [field; 3u32]; + cast 0field r10[0u32].siblings[5u32] r871 into r877 as [field; 3u32]; + ternary r875 r876[0u32] r877[0u32] into r878; + ternary r875 r876[1u32] r877[1u32] into r879; + ternary r875 r876[2u32] r877[2u32] into r880; + cast r878 r879 r880 into r881 as [field; 3u32]; + hash.psd4 r881 into r882 as field; + is.eq r10[0u32].siblings[6u32] 0field into r883; + div r10[0u32].leaf_index 32u32 into r884; + rem r884 2u32 into r885; + is.eq r885 0u32 into r886; + cast 0field r882 r10[0u32].siblings[6u32] into r887 as [field; 3u32]; + cast 0field r10[0u32].siblings[6u32] r882 into r888 as [field; 3u32]; + ternary r886 r887[0u32] r888[0u32] into r889; + ternary r886 r887[1u32] r888[1u32] into r890; + ternary r886 r887[2u32] r888[2u32] into r891; + cast r889 r890 r891 into r892 as [field; 3u32]; + hash.psd4 r892 into r893 as field; + is.eq r10[0u32].siblings[7u32] 0field into r894; + div r10[0u32].leaf_index 64u32 into r895; + rem r895 2u32 into r896; + is.eq r896 0u32 into r897; + cast 0field r893 r10[0u32].siblings[7u32] into r898 as [field; 3u32]; + cast 0field r10[0u32].siblings[7u32] r893 into r899 as [field; 3u32]; + ternary r897 r898[0u32] r899[0u32] into r900; + ternary r897 r898[1u32] r899[1u32] into r901; + ternary r897 r898[2u32] r899[2u32] into r902; + cast r900 r901 r902 into r903 as [field; 3u32]; + hash.psd4 r903 into r904 as field; + is.eq r10[0u32].siblings[8u32] 0field into r905; + div r10[0u32].leaf_index 128u32 into r906; + rem r906 2u32 into r907; + is.eq r907 0u32 into r908; + cast 0field r904 r10[0u32].siblings[8u32] into r909 as [field; 3u32]; + cast 0field r10[0u32].siblings[8u32] r904 into r910 as [field; 3u32]; + ternary r908 r909[0u32] r910[0u32] into r911; + ternary r908 r909[1u32] r910[1u32] into r912; + ternary r908 r909[2u32] r910[2u32] into r913; + cast r911 r912 r913 into r914 as [field; 3u32]; + hash.psd4 r914 into r915 as field; + is.eq r10[0u32].siblings[9u32] 0field into r916; + div r10[0u32].leaf_index 256u32 into r917; + rem r917 2u32 into r918; + is.eq r918 0u32 into r919; + cast 0field r915 r10[0u32].siblings[9u32] into r920 as [field; 3u32]; + cast 0field r10[0u32].siblings[9u32] r915 into r921 as [field; 3u32]; + ternary r919 r920[0u32] r921[0u32] into r922; + ternary r919 r920[1u32] r921[1u32] into r923; + ternary r919 r920[2u32] r921[2u32] into r924; + cast r922 r923 r924 into r925 as [field; 3u32]; + hash.psd4 r925 into r926 as field; + is.eq r10[0u32].siblings[10u32] 0field into r927; + div r10[0u32].leaf_index 512u32 into r928; + rem r928 2u32 into r929; + is.eq r929 0u32 into r930; + cast 0field r926 r10[0u32].siblings[10u32] into r931 as [field; 3u32]; + cast 0field r10[0u32].siblings[10u32] r926 into r932 as [field; 3u32]; + ternary r930 r931[0u32] r932[0u32] into r933; + ternary r930 r931[1u32] r932[1u32] into r934; + ternary r930 r931[2u32] r932[2u32] into r935; + cast r933 r934 r935 into r936 as [field; 3u32]; + hash.psd4 r936 into r937 as field; + is.eq r10[0u32].siblings[11u32] 0field into r938; + div r10[0u32].leaf_index 1024u32 into r939; + rem r939 2u32 into r940; + is.eq r940 0u32 into r941; + cast 0field r937 r10[0u32].siblings[11u32] into r942 as [field; 3u32]; + cast 0field r10[0u32].siblings[11u32] r937 into r943 as [field; 3u32]; + ternary r941 r942[0u32] r943[0u32] into r944; + ternary r941 r942[1u32] r943[1u32] into r945; + ternary r941 r942[2u32] r943[2u32] into r946; + cast r944 r945 r946 into r947 as [field; 3u32]; + hash.psd4 r947 into r948 as field; + is.eq r10[0u32].siblings[12u32] 0field into r949; + div r10[0u32].leaf_index 2048u32 into r950; + rem r950 2u32 into r951; + is.eq r951 0u32 into r952; + cast 0field r948 r10[0u32].siblings[12u32] into r953 as [field; 3u32]; + cast 0field r10[0u32].siblings[12u32] r948 into r954 as [field; 3u32]; + ternary r952 r953[0u32] r954[0u32] into r955; + ternary r952 r953[1u32] r954[1u32] into r956; + ternary r952 r953[2u32] r954[2u32] into r957; + cast r955 r956 r957 into r958 as [field; 3u32]; + hash.psd4 r958 into r959 as field; + is.eq r10[0u32].siblings[13u32] 0field into r960; + div r10[0u32].leaf_index 4096u32 into r961; + rem r961 2u32 into r962; + is.eq r962 0u32 into r963; + cast 0field r959 r10[0u32].siblings[13u32] into r964 as [field; 3u32]; + cast 0field r10[0u32].siblings[13u32] r959 into r965 as [field; 3u32]; + ternary r963 r964[0u32] r965[0u32] into r966; + ternary r963 r964[1u32] r965[1u32] into r967; + ternary r963 r964[2u32] r965[2u32] into r968; + cast r966 r967 r968 into r969 as [field; 3u32]; + hash.psd4 r969 into r970 as field; + is.eq r10[0u32].siblings[14u32] 0field into r971; + div r10[0u32].leaf_index 8192u32 into r972; + rem r972 2u32 into r973; + is.eq r973 0u32 into r974; + cast 0field r970 r10[0u32].siblings[14u32] into r975 as [field; 3u32]; + cast 0field r10[0u32].siblings[14u32] r970 into r976 as [field; 3u32]; + ternary r974 r975[0u32] r976[0u32] into r977; + ternary r974 r975[1u32] r976[1u32] into r978; + ternary r974 r975[2u32] r976[2u32] into r979; + cast r977 r978 r979 into r980 as [field; 3u32]; + hash.psd4 r980 into r981 as field; + is.eq r10[0u32].siblings[15u32] 0field into r982; + div r10[0u32].leaf_index 16384u32 into r983; + rem r983 2u32 into r984; + is.eq r984 0u32 into r985; + cast 0field r981 r10[0u32].siblings[15u32] into r986 as [field; 3u32]; + cast 0field r10[0u32].siblings[15u32] r981 into r987 as [field; 3u32]; + ternary r985 r986[0u32] r987[0u32] into r988; + ternary r985 r986[1u32] r987[1u32] into r989; + ternary r985 r986[2u32] r987[2u32] into r990; + cast r988 r989 r990 into r991 as [field; 3u32]; + hash.psd4 r991 into r992 as field; + ternary r982 r981 r992 into r993; + ternary r982 14u32 15u32 into r994; + ternary r971 r970 r993 into r995; + ternary r971 13u32 r994 into r996; + ternary r960 r959 r995 into r997; + ternary r960 12u32 r996 into r998; + ternary r949 r948 r997 into r999; + ternary r949 11u32 r998 into r1000; + ternary r938 r937 r999 into r1001; + ternary r938 10u32 r1000 into r1002; + ternary r927 r926 r1001 into r1003; + ternary r927 9u32 r1002 into r1004; + ternary r916 r915 r1003 into r1005; + ternary r916 8u32 r1004 into r1006; + ternary r905 r904 r1005 into r1007; + ternary r905 7u32 r1006 into r1008; + ternary r894 r893 r1007 into r1009; + ternary r894 6u32 r1008 into r1010; + ternary r883 r882 r1009 into r1011; + ternary r883 5u32 r1010 into r1012; + ternary r872 r871 r1011 into r1013; + ternary r872 4u32 r1012 into r1014; + ternary r861 r860 r1013 into r1015; + ternary r861 3u32 r1014 into r1016; + ternary r850 r849 r1015 into r1017; + ternary r850 2u32 r1016 into r1018; + ternary r839 r838 r1017 into r1019; + ternary r839 1u32 r1018 into r1020; + rem r10[1u32].leaf_index 2u32 into r1021; + is.eq r1021 0u32 into r1022; + cast 1field r10[1u32].siblings[0u32] r10[1u32].siblings[1u32] into r1023 as [field; 3u32]; + cast 1field r10[1u32].siblings[1u32] r10[1u32].siblings[0u32] into r1024 as [field; 3u32]; + ternary r1022 r1023[0u32] r1024[0u32] into r1025; + ternary r1022 r1023[1u32] r1024[1u32] into r1026; + ternary r1022 r1023[2u32] r1024[2u32] into r1027; + cast r1025 r1026 r1027 into r1028 as [field; 3u32]; + hash.psd4 r1028 into r1029 as field; + is.eq r10[1u32].siblings[2u32] 0field into r1030; + div r10[1u32].leaf_index 2u32 into r1031; + rem r1031 2u32 into r1032; + is.eq r1032 0u32 into r1033; + cast 0field r1029 r10[1u32].siblings[2u32] into r1034 as [field; 3u32]; + cast 0field r10[1u32].siblings[2u32] r1029 into r1035 as [field; 3u32]; + ternary r1033 r1034[0u32] r1035[0u32] into r1036; + ternary r1033 r1034[1u32] r1035[1u32] into r1037; + ternary r1033 r1034[2u32] r1035[2u32] into r1038; + cast r1036 r1037 r1038 into r1039 as [field; 3u32]; + hash.psd4 r1039 into r1040 as field; + is.eq r10[1u32].siblings[3u32] 0field into r1041; + div r10[1u32].leaf_index 4u32 into r1042; + rem r1042 2u32 into r1043; + is.eq r1043 0u32 into r1044; + cast 0field r1040 r10[1u32].siblings[3u32] into r1045 as [field; 3u32]; + cast 0field r10[1u32].siblings[3u32] r1040 into r1046 as [field; 3u32]; + ternary r1044 r1045[0u32] r1046[0u32] into r1047; + ternary r1044 r1045[1u32] r1046[1u32] into r1048; + ternary r1044 r1045[2u32] r1046[2u32] into r1049; + cast r1047 r1048 r1049 into r1050 as [field; 3u32]; + hash.psd4 r1050 into r1051 as field; + is.eq r10[1u32].siblings[4u32] 0field into r1052; + div r10[1u32].leaf_index 8u32 into r1053; + rem r1053 2u32 into r1054; + is.eq r1054 0u32 into r1055; + cast 0field r1051 r10[1u32].siblings[4u32] into r1056 as [field; 3u32]; + cast 0field r10[1u32].siblings[4u32] r1051 into r1057 as [field; 3u32]; + ternary r1055 r1056[0u32] r1057[0u32] into r1058; + ternary r1055 r1056[1u32] r1057[1u32] into r1059; + ternary r1055 r1056[2u32] r1057[2u32] into r1060; + cast r1058 r1059 r1060 into r1061 as [field; 3u32]; + hash.psd4 r1061 into r1062 as field; + is.eq r10[1u32].siblings[5u32] 0field into r1063; + div r10[1u32].leaf_index 16u32 into r1064; + rem r1064 2u32 into r1065; + is.eq r1065 0u32 into r1066; + cast 0field r1062 r10[1u32].siblings[5u32] into r1067 as [field; 3u32]; + cast 0field r10[1u32].siblings[5u32] r1062 into r1068 as [field; 3u32]; + ternary r1066 r1067[0u32] r1068[0u32] into r1069; + ternary r1066 r1067[1u32] r1068[1u32] into r1070; + ternary r1066 r1067[2u32] r1068[2u32] into r1071; + cast r1069 r1070 r1071 into r1072 as [field; 3u32]; + hash.psd4 r1072 into r1073 as field; + is.eq r10[1u32].siblings[6u32] 0field into r1074; + div r10[1u32].leaf_index 32u32 into r1075; + rem r1075 2u32 into r1076; + is.eq r1076 0u32 into r1077; + cast 0field r1073 r10[1u32].siblings[6u32] into r1078 as [field; 3u32]; + cast 0field r10[1u32].siblings[6u32] r1073 into r1079 as [field; 3u32]; + ternary r1077 r1078[0u32] r1079[0u32] into r1080; + ternary r1077 r1078[1u32] r1079[1u32] into r1081; + ternary r1077 r1078[2u32] r1079[2u32] into r1082; + cast r1080 r1081 r1082 into r1083 as [field; 3u32]; + hash.psd4 r1083 into r1084 as field; + is.eq r10[1u32].siblings[7u32] 0field into r1085; + div r10[1u32].leaf_index 64u32 into r1086; + rem r1086 2u32 into r1087; + is.eq r1087 0u32 into r1088; + cast 0field r1084 r10[1u32].siblings[7u32] into r1089 as [field; 3u32]; + cast 0field r10[1u32].siblings[7u32] r1084 into r1090 as [field; 3u32]; + ternary r1088 r1089[0u32] r1090[0u32] into r1091; + ternary r1088 r1089[1u32] r1090[1u32] into r1092; + ternary r1088 r1089[2u32] r1090[2u32] into r1093; + cast r1091 r1092 r1093 into r1094 as [field; 3u32]; + hash.psd4 r1094 into r1095 as field; + is.eq r10[1u32].siblings[8u32] 0field into r1096; + div r10[1u32].leaf_index 128u32 into r1097; + rem r1097 2u32 into r1098; + is.eq r1098 0u32 into r1099; + cast 0field r1095 r10[1u32].siblings[8u32] into r1100 as [field; 3u32]; + cast 0field r10[1u32].siblings[8u32] r1095 into r1101 as [field; 3u32]; + ternary r1099 r1100[0u32] r1101[0u32] into r1102; + ternary r1099 r1100[1u32] r1101[1u32] into r1103; + ternary r1099 r1100[2u32] r1101[2u32] into r1104; + cast r1102 r1103 r1104 into r1105 as [field; 3u32]; + hash.psd4 r1105 into r1106 as field; + is.eq r10[1u32].siblings[9u32] 0field into r1107; + div r10[1u32].leaf_index 256u32 into r1108; + rem r1108 2u32 into r1109; + is.eq r1109 0u32 into r1110; + cast 0field r1106 r10[1u32].siblings[9u32] into r1111 as [field; 3u32]; + cast 0field r10[1u32].siblings[9u32] r1106 into r1112 as [field; 3u32]; + ternary r1110 r1111[0u32] r1112[0u32] into r1113; + ternary r1110 r1111[1u32] r1112[1u32] into r1114; + ternary r1110 r1111[2u32] r1112[2u32] into r1115; + cast r1113 r1114 r1115 into r1116 as [field; 3u32]; + hash.psd4 r1116 into r1117 as field; + is.eq r10[1u32].siblings[10u32] 0field into r1118; + div r10[1u32].leaf_index 512u32 into r1119; + rem r1119 2u32 into r1120; + is.eq r1120 0u32 into r1121; + cast 0field r1117 r10[1u32].siblings[10u32] into r1122 as [field; 3u32]; + cast 0field r10[1u32].siblings[10u32] r1117 into r1123 as [field; 3u32]; + ternary r1121 r1122[0u32] r1123[0u32] into r1124; + ternary r1121 r1122[1u32] r1123[1u32] into r1125; + ternary r1121 r1122[2u32] r1123[2u32] into r1126; + cast r1124 r1125 r1126 into r1127 as [field; 3u32]; + hash.psd4 r1127 into r1128 as field; + is.eq r10[1u32].siblings[11u32] 0field into r1129; + div r10[1u32].leaf_index 1024u32 into r1130; + rem r1130 2u32 into r1131; + is.eq r1131 0u32 into r1132; + cast 0field r1128 r10[1u32].siblings[11u32] into r1133 as [field; 3u32]; + cast 0field r10[1u32].siblings[11u32] r1128 into r1134 as [field; 3u32]; + ternary r1132 r1133[0u32] r1134[0u32] into r1135; + ternary r1132 r1133[1u32] r1134[1u32] into r1136; + ternary r1132 r1133[2u32] r1134[2u32] into r1137; + cast r1135 r1136 r1137 into r1138 as [field; 3u32]; + hash.psd4 r1138 into r1139 as field; + is.eq r10[1u32].siblings[12u32] 0field into r1140; + div r10[1u32].leaf_index 2048u32 into r1141; + rem r1141 2u32 into r1142; + is.eq r1142 0u32 into r1143; + cast 0field r1139 r10[1u32].siblings[12u32] into r1144 as [field; 3u32]; + cast 0field r10[1u32].siblings[12u32] r1139 into r1145 as [field; 3u32]; + ternary r1143 r1144[0u32] r1145[0u32] into r1146; + ternary r1143 r1144[1u32] r1145[1u32] into r1147; + ternary r1143 r1144[2u32] r1145[2u32] into r1148; + cast r1146 r1147 r1148 into r1149 as [field; 3u32]; + hash.psd4 r1149 into r1150 as field; + is.eq r10[1u32].siblings[13u32] 0field into r1151; + div r10[1u32].leaf_index 4096u32 into r1152; + rem r1152 2u32 into r1153; + is.eq r1153 0u32 into r1154; + cast 0field r1150 r10[1u32].siblings[13u32] into r1155 as [field; 3u32]; + cast 0field r10[1u32].siblings[13u32] r1150 into r1156 as [field; 3u32]; + ternary r1154 r1155[0u32] r1156[0u32] into r1157; + ternary r1154 r1155[1u32] r1156[1u32] into r1158; + ternary r1154 r1155[2u32] r1156[2u32] into r1159; + cast r1157 r1158 r1159 into r1160 as [field; 3u32]; + hash.psd4 r1160 into r1161 as field; + is.eq r10[1u32].siblings[14u32] 0field into r1162; + div r10[1u32].leaf_index 8192u32 into r1163; + rem r1163 2u32 into r1164; + is.eq r1164 0u32 into r1165; + cast 0field r1161 r10[1u32].siblings[14u32] into r1166 as [field; 3u32]; + cast 0field r10[1u32].siblings[14u32] r1161 into r1167 as [field; 3u32]; + ternary r1165 r1166[0u32] r1167[0u32] into r1168; + ternary r1165 r1166[1u32] r1167[1u32] into r1169; + ternary r1165 r1166[2u32] r1167[2u32] into r1170; + cast r1168 r1169 r1170 into r1171 as [field; 3u32]; + hash.psd4 r1171 into r1172 as field; + is.eq r10[1u32].siblings[15u32] 0field into r1173; + div r10[1u32].leaf_index 16384u32 into r1174; + rem r1174 2u32 into r1175; + is.eq r1175 0u32 into r1176; + cast 0field r1172 r10[1u32].siblings[15u32] into r1177 as [field; 3u32]; + cast 0field r10[1u32].siblings[15u32] r1172 into r1178 as [field; 3u32]; + ternary r1176 r1177[0u32] r1178[0u32] into r1179; + ternary r1176 r1177[1u32] r1178[1u32] into r1180; + ternary r1176 r1177[2u32] r1178[2u32] into r1181; + cast r1179 r1180 r1181 into r1182 as [field; 3u32]; + hash.psd4 r1182 into r1183 as field; + ternary r1173 r1172 r1183 into r1184; + ternary r1173 14u32 15u32 into r1185; + ternary r1162 r1161 r1184 into r1186; + ternary r1162 13u32 r1185 into r1187; + ternary r1151 r1150 r1186 into r1188; + ternary r1151 12u32 r1187 into r1189; + ternary r1140 r1139 r1188 into r1190; + ternary r1140 11u32 r1189 into r1191; + ternary r1129 r1128 r1190 into r1192; + ternary r1129 10u32 r1191 into r1193; + ternary r1118 r1117 r1192 into r1194; + ternary r1118 9u32 r1193 into r1195; + ternary r1107 r1106 r1194 into r1196; + ternary r1107 8u32 r1195 into r1197; + ternary r1096 r1095 r1196 into r1198; + ternary r1096 7u32 r1197 into r1199; + ternary r1085 r1084 r1198 into r1200; + ternary r1085 6u32 r1199 into r1201; + ternary r1074 r1073 r1200 into r1202; + ternary r1074 5u32 r1201 into r1203; + ternary r1063 r1062 r1202 into r1204; + ternary r1063 4u32 r1203 into r1205; + ternary r1052 r1051 r1204 into r1206; + ternary r1052 3u32 r1205 into r1207; + ternary r1041 r1040 r1206 into r1208; + ternary r1041 2u32 r1207 into r1209; + ternary r1030 r1029 r1208 into r1210; + ternary r1030 1u32 r1209 into r1211; + assert.eq r1019 r1210; + assert.eq r1020 r1211; + cast r4 into r1212 as field; + is.eq r10[0u32].leaf_index r10[1u32].leaf_index into r1213; + is.eq r10[0u32].leaf_index 0u32 into r1214; + lt r1212 r10[0u32].siblings[0u32] into r1215; + and r1213 r1214 into r1216; + not r1216 into r1217; + or r1215 r1217 into r1218; + assert.eq r1218 true; + not r1214 into r1219; + pow 2u32 r1020 into r1220; + sub r1220 1u32 into r1221; + and r1213 r1219 into r1222; + not r1222 into r1223; + is.eq r10[0u32].leaf_index r1221 into r1224; + or r1224 r1223 into r1225; + assert.eq r1225 true; + gt r1212 r10[0u32].siblings[0u32] into r1226; + or r1226 r1223 into r1227; + assert.eq r1227 true; + not r1213 into r1228; + gt r1212 r10[0u32].siblings[0u32] into r1229; + not r1228 into r1230; + or r1229 r1230 into r1231; + assert.eq r1231 true; + lt r1212 r10[1u32].siblings[0u32] into r1232; + or r1232 r1230 into r1233; + assert.eq r1233 true; + lte r10[1u32].leaf_index r1221 into r1234; + or r1234 r1230 into r1235; + assert.eq r1235 true; + add r10[0u32].leaf_index 1u32 into r1236; + is.eq r1236 r10[1u32].leaf_index into r1237; + or r1237 r1230 into r1238; + assert.eq r1238 true; + assert.eq r201 r610; + assert.eq r201 r1019; + cast r5 r3 r0 into r1239 as TokenIDPreimage; + hash.bhp256 r1239 into r1240 as field; + cast aleo1t08epjqqv8h7jpuy2m2cxm80zy2pcy5c4f3m82hnac4sjmdrjyysvx3s2h r1240 r6 r7 r0 r5 self.caller self.signer r3 r4 into r1241 as MintComplianceRecord.record; + cast r3 r4 r1240 r6 r7 r5.pool r5.tick_lower r5.tick_upper into r1242 as PositionNFT.record; + call.dynamic r6 'aleo' 'transfer_private_to_public' with r1 shield_swap.aleo r5.amount0_desired (as dynamic.record address.public u128.public) into r1243 r1244 (as dynamic.record dynamic.future); + call.dynamic r7 'aleo' 'transfer_private_to_public' with r2 shield_swap.aleo r5.amount1_desired (as dynamic.record address.public u128.public) into r1245 r1246 (as dynamic.record dynamic.future); + async mint r1244 r1246 r5 r1240 r6 r7 r201 r11 into r1247; + output r1240 as field.public; + output r1242 as PositionNFT.record; + output r1243 as dynamic.record; + output r1245 as dynamic.record; + output r1241 as MintComplianceRecord.record; + output r1247 as shield_swap.aleo/mint.future; + +finalize mint: + input r0 as dynamic.future; + input r1 as dynamic.future; + input r2 as MintPositionRequest.public; + input r3 as field.public; + input r4 as field.public; + input r5 as field.public; + input r6 as field.public; + input r7 as boolean.public; + get shield_swap_freezelist.aleo/freeze_list_root[1u8] into r8; + is.neq r8 r6 into r9; + branch.eq r9 false to end_then_0_0; + get shield_swap_freezelist.aleo/freeze_list_root[2u8] into r10; + get shield_swap_freezelist.aleo/root_updated_height[true] into r11; + get shield_swap_freezelist.aleo/previous_root_window[true] into r12; + is.eq r6 r8 into r13; + is.eq r6 r10 into r14; + sub block.height r11 into r15; + lt r15 r12 into r16; + and r14 r16 into r17; + or r13 r17 into r18; + assert.eq r18 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + contains from_wrapper_token_id[r4] into r19; + contains from_wrapper_token_id[r5] into r20; + or r19 r20 into r21; + branch.eq r21 false to end_then_0_2; + assert.eq r7 true; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + await r0; + await r1; + get.or_use global_paused[true] false into r22; + not r22 into r23; + assert.eq r23 true; + get pools[r2.pool] into r24; + assert.eq r24.enabled true; + get.or_use token_paused[r24.token0] false into r25; + not r25 into r26; + assert.eq r26 true; + get.or_use token_paused[r24.token1] false into r27; + not r27 into r28; + assert.eq r28 true; + cast r24.token0 r24.token1 into r29 as PairKey; + get.or_use pair_paused[r29] false into r30; + not r30 into r31; + assert.eq r31 true; + is.eq r24.token0 r4 into r32; + assert.eq r32 true; + is.eq r24.token1 r5 into r33; + assert.eq r33 true; + get slots[r2.pool] into r34; + cast r34.tick_spacing into r35 as i32; + rem r2.tick_lower r35 into r36; + is.eq r36 0i32 into r37; + assert.eq r37 true; + cast r34.tick_spacing into r38 as i32; + rem r2.tick_upper r38 into r39; + is.eq r39 0i32 into r40; + assert.eq r40 true; + lt r2.tick_lower r2.tick_upper into r41; + assert.eq r41 true; + gte r2.tick_lower -400000i32 into r42; + assert.eq r42 true; + lte r2.tick_upper 400000i32 into r43; + assert.eq r43 true; + call view_sqrt_price_at_tick_x128 r2.tick_lower into r44; + call view_sqrt_price_at_tick_x128 r2.tick_upper into r45; + lt r44.hi r45.hi into r46; + gt r44.hi r45.hi into r47; + lt r44.lo r45.lo into r48; + ternary r47 false r48 into r49; + ternary r46 true r49 into r50; + ternary r50 r44.hi r45.hi into r51; + ternary r50 r44.lo r45.lo into r52; + cast r51 r52 into r53 as U256__8JquwLopp8; + lt r44.hi r45.hi into r54; + gt r44.hi r45.hi into r55; + lt r44.lo r45.lo into r56; + ternary r55 false r56 into r57; + ternary r54 true r57 into r58; + ternary r58 r45.hi r44.hi into r59; + ternary r58 r45.lo r44.lo into r60; + cast r59 r60 into r61 as U256__8JquwLopp8; + lt r53.hi r34.sqrt_price.hi into r62; + gt r53.hi r34.sqrt_price.hi into r63; + lt r53.lo r34.sqrt_price.lo into r64; + ternary r63 false r64 into r65; + ternary r62 true r65 into r66; + not r66 into r67; + not r67 into r68; + lt r34.sqrt_price.hi r61.hi into r69; + gt r34.sqrt_price.hi r61.hi into r70; + lt r34.sqrt_price.lo r61.lo into r71; + ternary r70 false r71 into r72; + ternary r69 true r72 into r73; + and r68 r73 into r74; + lt r34.sqrt_price.hi r61.hi into r75; + gt r34.sqrt_price.hi r61.hi into r76; + lt r34.sqrt_price.lo r61.lo into r77; + ternary r76 false r77 into r78; + ternary r75 true r78 into r79; + not r79 into r80; + and r68 r80 into r81; + ternary r67 r2.amount0_desired 0u128 into r82; + lt r53.hi r61.hi into r83; + gt r53.hi r61.hi into r84; + lt r53.lo r61.lo into r85; + ternary r84 false r85 into r86; + ternary r83 true r86 into r87; + ternary r87 r53.hi r61.hi into r88; + ternary r87 r53.lo r61.lo into r89; + cast r88 r89 into r90 as U256__8JquwLopp8; + lt r53.hi r61.hi into r91; + gt r53.hi r61.hi into r92; + lt r53.lo r61.lo into r93; + ternary r92 false r93 into r94; + ternary r91 true r94 into r95; + ternary r95 r61.hi r53.hi into r96; + ternary r95 r61.lo r53.lo into r97; + cast r96 r97 into r98 as U256__8JquwLopp8; + lt r98.lo r90.lo into r99; + ternary r99 1u128 0u128 into r100; + sub.w r98.lo r90.lo into r101; + sub.w r98.hi r90.hi into r102; + sub.w r102 r100 into r103; + cast r103 r101 into r104 as U256__8JquwLopp8; + is.eq r104.hi 0u128 into r105; + is.eq r104.lo 0u128 into r106; + and r105 r106 into r107; + ternary r107 0u128 r104.hi into r108; + ternary r107 1u128 r104.lo into r109; + cast r108 r109 into r110 as U256__8JquwLopp8; + is.eq r104.hi 0u128 into r111; + is.eq r104.lo 0u128 into r112; + and r111 r112 into r113; + ternary r113 0u128 r82 into r114; + cast 1u128 0u128 into r115 as U256__8JquwLopp8; + call view_mul_div r90 r98 r115 false into r116; + cast 0u128 r114 into r117 as U256__8JquwLopp8; + call view_mul_div r117 r116 r110 false into r118; + is.eq r118.hi 0u128 into r119; + assert.eq r119 true; + ternary r74 r2.amount0_desired 0u128 into r120; + lt r34.sqrt_price.hi r61.hi into r121; + gt r34.sqrt_price.hi r61.hi into r122; + lt r34.sqrt_price.lo r61.lo into r123; + ternary r122 false r123 into r124; + ternary r121 true r124 into r125; + ternary r125 r34.sqrt_price.hi r61.hi into r126; + ternary r125 r34.sqrt_price.lo r61.lo into r127; + cast r126 r127 into r128 as U256__8JquwLopp8; + lt r34.sqrt_price.hi r61.hi into r129; + gt r34.sqrt_price.hi r61.hi into r130; + lt r34.sqrt_price.lo r61.lo into r131; + ternary r130 false r131 into r132; + ternary r129 true r132 into r133; + ternary r133 r61.hi r34.sqrt_price.hi into r134; + ternary r133 r61.lo r34.sqrt_price.lo into r135; + cast r134 r135 into r136 as U256__8JquwLopp8; + lt r136.lo r128.lo into r137; + ternary r137 1u128 0u128 into r138; + sub.w r136.lo r128.lo into r139; + sub.w r136.hi r128.hi into r140; + sub.w r140 r138 into r141; + cast r141 r139 into r142 as U256__8JquwLopp8; + is.eq r142.hi 0u128 into r143; + is.eq r142.lo 0u128 into r144; + and r143 r144 into r145; + ternary r145 0u128 r142.hi into r146; + ternary r145 1u128 r142.lo into r147; + cast r146 r147 into r148 as U256__8JquwLopp8; + is.eq r142.hi 0u128 into r149; + is.eq r142.lo 0u128 into r150; + and r149 r150 into r151; + ternary r151 0u128 r120 into r152; + cast 1u128 0u128 into r153 as U256__8JquwLopp8; + call view_mul_div r128 r136 r153 false into r154; + cast 0u128 r152 into r155 as U256__8JquwLopp8; + call view_mul_div r155 r154 r148 false into r156; + is.eq r156.hi 0u128 into r157; + assert.eq r157 true; + ternary r74 r2.amount1_desired 0u128 into r158; + lt r53.hi r34.sqrt_price.hi into r159; + gt r53.hi r34.sqrt_price.hi into r160; + lt r53.lo r34.sqrt_price.lo into r161; + ternary r160 false r161 into r162; + ternary r159 true r162 into r163; + ternary r163 r53.hi r34.sqrt_price.hi into r164; + ternary r163 r53.lo r34.sqrt_price.lo into r165; + cast r164 r165 into r166 as U256__8JquwLopp8; + lt r53.hi r34.sqrt_price.hi into r167; + gt r53.hi r34.sqrt_price.hi into r168; + lt r53.lo r34.sqrt_price.lo into r169; + ternary r168 false r169 into r170; + ternary r167 true r170 into r171; + ternary r171 r34.sqrt_price.hi r53.hi into r172; + ternary r171 r34.sqrt_price.lo r53.lo into r173; + cast r172 r173 into r174 as U256__8JquwLopp8; + lt r174.lo r166.lo into r175; + ternary r175 1u128 0u128 into r176; + sub.w r174.lo r166.lo into r177; + sub.w r174.hi r166.hi into r178; + sub.w r178 r176 into r179; + cast r179 r177 into r180 as U256__8JquwLopp8; + is.eq r180.hi 0u128 into r181; + is.eq r180.lo 0u128 into r182; + and r181 r182 into r183; + ternary r183 0u128 r180.hi into r184; + ternary r183 1u128 r180.lo into r185; + cast r184 r185 into r186 as U256__8JquwLopp8; + is.eq r180.hi 0u128 into r187; + is.eq r180.lo 0u128 into r188; + and r187 r188 into r189; + ternary r189 0u128 r158 into r190; + cast r190 0u128 into r191 as U256__8JquwLopp8; + cast 0u128 1u128 into r192 as U256__8JquwLopp8; + call view_mul_div r191 r192 r186 false into r193; + is.eq r193.hi 0u128 into r194; + assert.eq r194 true; + ternary r81 r2.amount1_desired 0u128 into r195; + lt r53.hi r61.hi into r196; + gt r53.hi r61.hi into r197; + lt r53.lo r61.lo into r198; + ternary r197 false r198 into r199; + ternary r196 true r199 into r200; + ternary r200 r53.hi r61.hi into r201; + ternary r200 r53.lo r61.lo into r202; + cast r201 r202 into r203 as U256__8JquwLopp8; + lt r53.hi r61.hi into r204; + gt r53.hi r61.hi into r205; + lt r53.lo r61.lo into r206; + ternary r205 false r206 into r207; + ternary r204 true r207 into r208; + ternary r208 r61.hi r53.hi into r209; + ternary r208 r61.lo r53.lo into r210; + cast r209 r210 into r211 as U256__8JquwLopp8; + lt r211.lo r203.lo into r212; + ternary r212 1u128 0u128 into r213; + sub.w r211.lo r203.lo into r214; + sub.w r211.hi r203.hi into r215; + sub.w r215 r213 into r216; + cast r216 r214 into r217 as U256__8JquwLopp8; + is.eq r217.hi 0u128 into r218; + is.eq r217.lo 0u128 into r219; + and r218 r219 into r220; + ternary r220 0u128 r217.hi into r221; + ternary r220 1u128 r217.lo into r222; + cast r221 r222 into r223 as U256__8JquwLopp8; + is.eq r217.hi 0u128 into r224; + is.eq r217.lo 0u128 into r225; + and r224 r225 into r226; + ternary r226 0u128 r195 into r227; + cast r227 0u128 into r228 as U256__8JquwLopp8; + cast 0u128 1u128 into r229 as U256__8JquwLopp8; + call view_mul_div r228 r229 r223 false into r230; + is.eq r230.hi 0u128 into r231; + assert.eq r231 true; + lt r156.lo r193.lo into r232; + ternary r232 r156.lo r193.lo into r233; + ternary r74 r233 r230.lo into r234; + ternary r67 r118.lo r234 into r235; + gt r235 0u128 into r236; + assert.eq r236 true; + lt r44.hi r45.hi into r237; + gt r44.hi r45.hi into r238; + lt r44.lo r45.lo into r239; + ternary r238 false r239 into r240; + ternary r237 true r240 into r241; + ternary r241 r44.hi r45.hi into r242; + ternary r241 r44.lo r45.lo into r243; + cast r242 r243 into r244 as U256__8JquwLopp8; + lt r44.hi r45.hi into r245; + gt r44.hi r45.hi into r246; + lt r44.lo r45.lo into r247; + ternary r246 false r247 into r248; + ternary r245 true r248 into r249; + ternary r249 r45.hi r44.hi into r250; + ternary r249 r45.lo r44.lo into r251; + cast r250 r251 into r252 as U256__8JquwLopp8; + lt r244.hi r34.sqrt_price.hi into r253; + gt r244.hi r34.sqrt_price.hi into r254; + lt r244.lo r34.sqrt_price.lo into r255; + ternary r254 false r255 into r256; + ternary r253 true r256 into r257; + not r257 into r258; + not r258 into r259; + lt r34.sqrt_price.hi r252.hi into r260; + gt r34.sqrt_price.hi r252.hi into r261; + lt r34.sqrt_price.lo r252.lo into r262; + ternary r261 false r262 into r263; + ternary r260 true r263 into r264; + and r259 r264 into r265; + lt r34.sqrt_price.hi r252.hi into r266; + gt r34.sqrt_price.hi r252.hi into r267; + lt r34.sqrt_price.lo r252.lo into r268; + ternary r267 false r268 into r269; + ternary r266 true r269 into r270; + not r270 into r271; + and r259 r271 into r272; + ternary r258 r235 0u128 into r273; + lt r244.hi r252.hi into r274; + gt r244.hi r252.hi into r275; + lt r244.lo r252.lo into r276; + ternary r275 false r276 into r277; + ternary r274 true r277 into r278; + ternary r278 r244.hi r252.hi into r279; + ternary r278 r244.lo r252.lo into r280; + cast r279 r280 into r281 as U256__8JquwLopp8; + lt r244.hi r252.hi into r282; + gt r244.hi r252.hi into r283; + lt r244.lo r252.lo into r284; + ternary r283 false r284 into r285; + ternary r282 true r285 into r286; + ternary r286 r252.hi r244.hi into r287; + ternary r286 r252.lo r244.lo into r288; + cast r287 r288 into r289 as U256__8JquwLopp8; + lt r289.lo r281.lo into r290; + ternary r290 1u128 0u128 into r291; + sub.w r289.lo r281.lo into r292; + sub.w r289.hi r281.hi into r293; + sub.w r293 r291 into r294; + cast r294 r292 into r295 as U256__8JquwLopp8; + cast r273 0u128 into r296 as U256__8JquwLopp8; + call view_mul_div r296 r295 r289 true into r297; + cast 0u128 1u128 into r298 as U256__8JquwLopp8; + call view_mul_div r297 r298 r281 true into r299; + is.eq r299.hi 0u128 into r300; + assert.eq r300 true; + ternary r265 r235 0u128 into r301; + lt r34.sqrt_price.hi r252.hi into r302; + gt r34.sqrt_price.hi r252.hi into r303; + lt r34.sqrt_price.lo r252.lo into r304; + ternary r303 false r304 into r305; + ternary r302 true r305 into r306; + ternary r306 r34.sqrt_price.hi r252.hi into r307; + ternary r306 r34.sqrt_price.lo r252.lo into r308; + cast r307 r308 into r309 as U256__8JquwLopp8; + lt r34.sqrt_price.hi r252.hi into r310; + gt r34.sqrt_price.hi r252.hi into r311; + lt r34.sqrt_price.lo r252.lo into r312; + ternary r311 false r312 into r313; + ternary r310 true r313 into r314; + ternary r314 r252.hi r34.sqrt_price.hi into r315; + ternary r314 r252.lo r34.sqrt_price.lo into r316; + cast r315 r316 into r317 as U256__8JquwLopp8; + lt r317.lo r309.lo into r318; + ternary r318 1u128 0u128 into r319; + sub.w r317.lo r309.lo into r320; + sub.w r317.hi r309.hi into r321; + sub.w r321 r319 into r322; + cast r322 r320 into r323 as U256__8JquwLopp8; + cast r301 0u128 into r324 as U256__8JquwLopp8; + call view_mul_div r324 r323 r317 true into r325; + cast 0u128 1u128 into r326 as U256__8JquwLopp8; + call view_mul_div r325 r326 r309 true into r327; + is.eq r327.hi 0u128 into r328; + assert.eq r328 true; + lt r244.hi r34.sqrt_price.hi into r329; + gt r244.hi r34.sqrt_price.hi into r330; + lt r244.lo r34.sqrt_price.lo into r331; + ternary r330 false r331 into r332; + ternary r329 true r332 into r333; + ternary r333 r244.hi r34.sqrt_price.hi into r334; + ternary r333 r244.lo r34.sqrt_price.lo into r335; + cast r334 r335 into r336 as U256__8JquwLopp8; + lt r244.hi r34.sqrt_price.hi into r337; + gt r244.hi r34.sqrt_price.hi into r338; + lt r244.lo r34.sqrt_price.lo into r339; + ternary r338 false r339 into r340; + ternary r337 true r340 into r341; + ternary r341 r34.sqrt_price.hi r244.hi into r342; + ternary r341 r34.sqrt_price.lo r244.lo into r343; + cast r342 r343 into r344 as U256__8JquwLopp8; + lt r344.lo r336.lo into r345; + ternary r345 1u128 0u128 into r346; + sub.w r344.lo r336.lo into r347; + sub.w r344.hi r336.hi into r348; + sub.w r348 r346 into r349; + cast r349 r347 into r350 as U256__8JquwLopp8; + cast 0u128 r301 into r351 as U256__8JquwLopp8; + and r351.lo 18446744073709551615u128 into r352; + shr r351.lo 64u8 into r353; + and r350.lo 18446744073709551615u128 into r354; + shr r350.lo 64u8 into r355; + mul r352 r354 into r356; + mul r352 r355 into r357; + mul r353 r354 into r358; + mul r353 r355 into r359; + and r356 18446744073709551615u128 into r360; + shr r356 64u8 into r361; + and r357 18446744073709551615u128 into r362; + add r361 r362 into r363; + and r358 18446744073709551615u128 into r364; + add r363 r364 into r365; + and r365 18446744073709551615u128 into r366; + shr r365 64u8 into r367; + shr r357 64u8 into r368; + shr r358 64u8 into r369; + add r368 r369 into r370; + and r359 18446744073709551615u128 into r371; + add r370 r371 into r372; + add r372 r367 into r373; + and r373 18446744073709551615u128 into r374; + shr r373 64u8 into r375; + shr r359 64u8 into r376; + add r376 r375 into r377; + shl r377 64u8 into r378; + add r378 r374 into r379; + shl r366 64u8 into r380; + add r380 r360 into r381; + and r351.lo 18446744073709551615u128 into r382; + shr r351.lo 64u8 into r383; + and r350.hi 18446744073709551615u128 into r384; + shr r350.hi 64u8 into r385; + mul r382 r384 into r386; + mul r382 r385 into r387; + mul r383 r384 into r388; + mul r383 r385 into r389; + and r386 18446744073709551615u128 into r390; + shr r386 64u8 into r391; + and r387 18446744073709551615u128 into r392; + add r391 r392 into r393; + and r388 18446744073709551615u128 into r394; + add r393 r394 into r395; + and r395 18446744073709551615u128 into r396; + shr r395 64u8 into r397; + shr r387 64u8 into r398; + shr r388 64u8 into r399; + add r398 r399 into r400; + and r389 18446744073709551615u128 into r401; + add r400 r401 into r402; + add r402 r397 into r403; + and r403 18446744073709551615u128 into r404; + shr r403 64u8 into r405; + shr r389 64u8 into r406; + add r406 r405 into r407; + shl r407 64u8 into r408; + add r408 r404 into r409; + shl r396 64u8 into r410; + add r410 r390 into r411; + and r351.hi 18446744073709551615u128 into r412; + shr r351.hi 64u8 into r413; + and r350.lo 18446744073709551615u128 into r414; + shr r350.lo 64u8 into r415; + mul r412 r414 into r416; + mul r412 r415 into r417; + mul r413 r414 into r418; + mul r413 r415 into r419; + and r416 18446744073709551615u128 into r420; + shr r416 64u8 into r421; + and r417 18446744073709551615u128 into r422; + add r421 r422 into r423; + and r418 18446744073709551615u128 into r424; + add r423 r424 into r425; + and r425 18446744073709551615u128 into r426; + shr r425 64u8 into r427; + shr r417 64u8 into r428; + shr r418 64u8 into r429; + add r428 r429 into r430; + and r419 18446744073709551615u128 into r431; + add r430 r431 into r432; + add r432 r427 into r433; + and r433 18446744073709551615u128 into r434; + shr r433 64u8 into r435; + shr r419 64u8 into r436; + add r436 r435 into r437; + shl r437 64u8 into r438; + add r438 r434 into r439; + shl r426 64u8 into r440; + add r440 r420 into r441; + and r351.hi 18446744073709551615u128 into r442; + shr r351.hi 64u8 into r443; + and r350.hi 18446744073709551615u128 into r444; + shr r350.hi 64u8 into r445; + mul r442 r444 into r446; + mul r442 r445 into r447; + mul r443 r444 into r448; + mul r443 r445 into r449; + and r446 18446744073709551615u128 into r450; + shr r446 64u8 into r451; + and r447 18446744073709551615u128 into r452; + add r451 r452 into r453; + and r448 18446744073709551615u128 into r454; + add r453 r454 into r455; + and r455 18446744073709551615u128 into r456; + shr r455 64u8 into r457; + shr r447 64u8 into r458; + shr r448 64u8 into r459; + add r458 r459 into r460; + and r449 18446744073709551615u128 into r461; + add r460 r461 into r462; + add r462 r457 into r463; + and r463 18446744073709551615u128 into r464; + shr r463 64u8 into r465; + shr r449 64u8 into r466; + add r466 r465 into r467; + shl r467 64u8 into r468; + add r468 r464 into r469; + shl r456 64u8 into r470; + add r470 r450 into r471; + add.w r379 r411 into r472; + lt r472 r379 into r473; + ternary r473 1u128 0u128 into r474; + add.w r472 r441 into r475; + lt r475 r472 into r476; + ternary r476 1u128 0u128 into r477; + add r474 r477 into r478; + add.w r409 r439 into r479; + lt r479 r409 into r480; + ternary r480 1u128 0u128 into r481; + add.w r479 r471 into r482; + lt r482 r479 into r483; + ternary r483 1u128 0u128 into r484; + add.w r482 r478 into r485; + lt r485 r482 into r486; + ternary r486 1u128 0u128 into r487; + add r481 r484 into r488; + add r488 r487 into r489; + add.w r469 r489 into r490; + cast r490 r485 into r491 as U256__8JquwLopp8; + cast r475 r381 into r492 as U256__8JquwLopp8; + is.eq r491.hi 0u128 into r493; + is.eq r491.lo 0u128 into r494; + and r493 r494 into r495; + assert.eq r495 true; + gt r492.lo 0u128 into r496; + ternary r496 1u128 0u128 into r497; + add r492.hi r497 into r498; + ternary r272 r235 0u128 into r499; + lt r244.hi r252.hi into r500; + gt r244.hi r252.hi into r501; + lt r244.lo r252.lo into r502; + ternary r501 false r502 into r503; + ternary r500 true r503 into r504; + ternary r504 r244.hi r252.hi into r505; + ternary r504 r244.lo r252.lo into r506; + cast r505 r506 into r507 as U256__8JquwLopp8; + lt r244.hi r252.hi into r508; + gt r244.hi r252.hi into r509; + lt r244.lo r252.lo into r510; + ternary r509 false r510 into r511; + ternary r508 true r511 into r512; + ternary r512 r252.hi r244.hi into r513; + ternary r512 r252.lo r244.lo into r514; + cast r513 r514 into r515 as U256__8JquwLopp8; + lt r515.lo r507.lo into r516; + ternary r516 1u128 0u128 into r517; + sub.w r515.lo r507.lo into r518; + sub.w r515.hi r507.hi into r519; + sub.w r519 r517 into r520; + cast r520 r518 into r521 as U256__8JquwLopp8; + cast 0u128 r499 into r522 as U256__8JquwLopp8; + and r522.lo 18446744073709551615u128 into r523; + shr r522.lo 64u8 into r524; + and r521.lo 18446744073709551615u128 into r525; + shr r521.lo 64u8 into r526; + mul r523 r525 into r527; + mul r523 r526 into r528; + mul r524 r525 into r529; + mul r524 r526 into r530; + and r527 18446744073709551615u128 into r531; + shr r527 64u8 into r532; + and r528 18446744073709551615u128 into r533; + add r532 r533 into r534; + and r529 18446744073709551615u128 into r535; + add r534 r535 into r536; + and r536 18446744073709551615u128 into r537; + shr r536 64u8 into r538; + shr r528 64u8 into r539; + shr r529 64u8 into r540; + add r539 r540 into r541; + and r530 18446744073709551615u128 into r542; + add r541 r542 into r543; + add r543 r538 into r544; + and r544 18446744073709551615u128 into r545; + shr r544 64u8 into r546; + shr r530 64u8 into r547; + add r547 r546 into r548; + shl r548 64u8 into r549; + add r549 r545 into r550; + shl r537 64u8 into r551; + add r551 r531 into r552; + and r522.lo 18446744073709551615u128 into r553; + shr r522.lo 64u8 into r554; + and r521.hi 18446744073709551615u128 into r555; + shr r521.hi 64u8 into r556; + mul r553 r555 into r557; + mul r553 r556 into r558; + mul r554 r555 into r559; + mul r554 r556 into r560; + and r557 18446744073709551615u128 into r561; + shr r557 64u8 into r562; + and r558 18446744073709551615u128 into r563; + add r562 r563 into r564; + and r559 18446744073709551615u128 into r565; + add r564 r565 into r566; + and r566 18446744073709551615u128 into r567; + shr r566 64u8 into r568; + shr r558 64u8 into r569; + shr r559 64u8 into r570; + add r569 r570 into r571; + and r560 18446744073709551615u128 into r572; + add r571 r572 into r573; + add r573 r568 into r574; + and r574 18446744073709551615u128 into r575; + shr r574 64u8 into r576; + shr r560 64u8 into r577; + add r577 r576 into r578; + shl r578 64u8 into r579; + add r579 r575 into r580; + shl r567 64u8 into r581; + add r581 r561 into r582; + and r522.hi 18446744073709551615u128 into r583; + shr r522.hi 64u8 into r584; + and r521.lo 18446744073709551615u128 into r585; + shr r521.lo 64u8 into r586; + mul r583 r585 into r587; + mul r583 r586 into r588; + mul r584 r585 into r589; + mul r584 r586 into r590; + and r587 18446744073709551615u128 into r591; + shr r587 64u8 into r592; + and r588 18446744073709551615u128 into r593; + add r592 r593 into r594; + and r589 18446744073709551615u128 into r595; + add r594 r595 into r596; + and r596 18446744073709551615u128 into r597; + shr r596 64u8 into r598; + shr r588 64u8 into r599; + shr r589 64u8 into r600; + add r599 r600 into r601; + and r590 18446744073709551615u128 into r602; + add r601 r602 into r603; + add r603 r598 into r604; + and r604 18446744073709551615u128 into r605; + shr r604 64u8 into r606; + shr r590 64u8 into r607; + add r607 r606 into r608; + shl r608 64u8 into r609; + add r609 r605 into r610; + shl r597 64u8 into r611; + add r611 r591 into r612; + and r522.hi 18446744073709551615u128 into r613; + shr r522.hi 64u8 into r614; + and r521.hi 18446744073709551615u128 into r615; + shr r521.hi 64u8 into r616; + mul r613 r615 into r617; + mul r613 r616 into r618; + mul r614 r615 into r619; + mul r614 r616 into r620; + and r617 18446744073709551615u128 into r621; + shr r617 64u8 into r622; + and r618 18446744073709551615u128 into r623; + add r622 r623 into r624; + and r619 18446744073709551615u128 into r625; + add r624 r625 into r626; + and r626 18446744073709551615u128 into r627; + shr r626 64u8 into r628; + shr r618 64u8 into r629; + shr r619 64u8 into r630; + add r629 r630 into r631; + and r620 18446744073709551615u128 into r632; + add r631 r632 into r633; + add r633 r628 into r634; + and r634 18446744073709551615u128 into r635; + shr r634 64u8 into r636; + shr r620 64u8 into r637; + add r637 r636 into r638; + shl r638 64u8 into r639; + add r639 r635 into r640; + shl r627 64u8 into r641; + add r641 r621 into r642; + add.w r550 r582 into r643; + lt r643 r550 into r644; + ternary r644 1u128 0u128 into r645; + add.w r643 r612 into r646; + lt r646 r643 into r647; + ternary r647 1u128 0u128 into r648; + add r645 r648 into r649; + add.w r580 r610 into r650; + lt r650 r580 into r651; + ternary r651 1u128 0u128 into r652; + add.w r650 r642 into r653; + lt r653 r650 into r654; + ternary r654 1u128 0u128 into r655; + add.w r653 r649 into r656; + lt r656 r653 into r657; + ternary r657 1u128 0u128 into r658; + add r652 r655 into r659; + add r659 r658 into r660; + add.w r640 r660 into r661; + cast r661 r656 into r662 as U256__8JquwLopp8; + cast r646 r552 into r663 as U256__8JquwLopp8; + is.eq r662.hi 0u128 into r664; + is.eq r662.lo 0u128 into r665; + and r664 r665 into r666; + assert.eq r666 true; + gt r663.lo 0u128 into r667; + ternary r667 1u128 0u128 into r668; + add r663.hi r668 into r669; + ternary r265 r327.lo 0u128 into r670; + ternary r258 r299.lo r670 into r671; + ternary r272 r669 0u128 into r672; + ternary r265 r498 r672 into r673; + lte r671 r2.amount0_desired into r674; + lte r673 r2.amount1_desired into r675; + and r674 r675 into r676; + assert.eq r676 true; + gte r671 r2.amount0_min into r677; + gte r673 r2.amount1_min into r678; + and r677 r678 into r679; + assert.eq r679 true; + lt r34.sqrt_price.hi r45.hi into r680; + gt r34.sqrt_price.hi r45.hi into r681; + lt r34.sqrt_price.lo r45.lo into r682; + ternary r681 false r682 into r683; + ternary r680 true r683 into r684; + branch.eq r684 false to end_then_0_4; + gt r671 0u128 into r685; + assert.eq r685 true; + branch.eq true true to end_otherwise_0_5; + position end_then_0_4; + position end_otherwise_0_5; + lt r44.hi r34.sqrt_price.hi into r686; + gt r44.hi r34.sqrt_price.hi into r687; + lt r44.lo r34.sqrt_price.lo into r688; + ternary r687 false r688 into r689; + ternary r686 true r689 into r690; + branch.eq r690 false to end_then_0_6; + gt r673 0u128 into r691; + assert.eq r691 true; + branch.eq true true to end_otherwise_0_7; + position end_then_0_6; + position end_otherwise_0_7; + cast r2.pool r2.tick_lower into r692 as TickKey; + hash.bhp256 r692 into r693 as field; + cast r2.pool r2.tick_upper into r694 as TickKey; + hash.bhp256 r694 into r695 as field; + cast 0u128 0u128 into r696 as U256__8JquwLopp8; + cast 0u128 0u128 into r697 as U256__8JquwLopp8; + cast r2.pool 0i128 0u128 r2.tick_lower r696 r697 0i32 0i32 into r698 as Tick; + cast 0u128 0u128 into r699 as U256__8JquwLopp8; + cast 0u128 0u128 into r700 as U256__8JquwLopp8; + cast r2.pool 0i128 0u128 r2.tick_upper r699 r700 0i32 0i32 into r701 as Tick; + get.or_use ticks[r693] r698 into r702; + get.or_use ticks[r695] r701 into r703; + gt r702.liquidity_gross 0u128 into r704; + gt r703.liquidity_gross 0u128 into r705; + not r704 into r706; + lte r2.tick_lower r34.tick into r707; + and r706 r707 into r708; + ternary r708 r34.fee_growth_global0_x_128.hi r702.fee_growth_outside0_x_128.hi into r709; + ternary r708 r34.fee_growth_global0_x_128.lo r702.fee_growth_outside0_x_128.lo into r710; + cast r709 r710 into r711 as U256__8JquwLopp8; + lte r2.tick_lower r34.tick into r712; + and r706 r712 into r713; + ternary r713 r34.fee_growth_global1_x_128.hi r702.fee_growth_outside1_x_128.hi into r714; + ternary r713 r34.fee_growth_global1_x_128.lo r702.fee_growth_outside1_x_128.lo into r715; + cast r714 r715 into r716 as U256__8JquwLopp8; + not r705 into r717; + lte r2.tick_upper r34.tick into r718; + and r717 r718 into r719; + ternary r719 r34.fee_growth_global0_x_128.hi r703.fee_growth_outside0_x_128.hi into r720; + ternary r719 r34.fee_growth_global0_x_128.lo r703.fee_growth_outside0_x_128.lo into r721; + cast r720 r721 into r722 as U256__8JquwLopp8; + lte r2.tick_upper r34.tick into r723; + and r717 r723 into r724; + ternary r724 r34.fee_growth_global1_x_128.hi r703.fee_growth_outside1_x_128.hi into r725; + ternary r724 r34.fee_growth_global1_x_128.lo r703.fee_growth_outside1_x_128.lo into r726; + cast r725 r726 into r727 as U256__8JquwLopp8; + add r702.liquidity_gross r235 into r728; + add r703.liquidity_gross r235 into r729; + lte r728 r34.max_liquidity_per_tick into r730; + assert.eq r730 true; + lte r729 r34.max_liquidity_per_tick into r731; + assert.eq r731 true; + ternary r704 -400001i32 r2.tick_lower_hint into r732; + cast r2.pool r732 into r733 as TickKey; + hash.bhp256 r733 into r734 as field; + get ticks[r734] into r735; + branch.eq r706 false to end_then_0_8; + is.eq r735.pool r2.pool into r736; + assert.eq r736 true; + is.eq r735.tick r2.tick_lower_hint into r737; + assert.eq r737 true; + is.eq r2.tick_lower_hint -400001i32 into r738; + gt r735.liquidity_gross 0u128 into r739; + or r738 r739 into r740; + assert.eq r740 true; + lt r735.tick r2.tick_lower into r741; + assert.eq r741 true; + gt r735.next r2.tick_lower into r742; + assert.eq r742 true; + branch.eq true true to end_otherwise_0_9; + position end_then_0_8; + position end_otherwise_0_9; + ternary r704 r702.prev r2.tick_lower_hint into r743; + ternary r704 r702.next r735.next into r744; + cast r235 into r745 as i128; + add r702.liquidity_net r745 into r746; + cast r2.pool r746 r728 r2.tick_lower r711 r716 r743 r744 into r747 as Tick; + set r747 into ticks[r693]; + branch.eq r706 false to end_then_0_10; + cast r735.pool r735.liquidity_net r735.liquidity_gross r735.tick r735.fee_growth_outside0_x_128 r735.fee_growth_outside1_x_128 r735.prev r2.tick_lower into r748 as Tick; + set r748 into ticks[r734]; + cast r2.pool r744 into r749 as TickKey; + hash.bhp256 r749 into r750 as field; + get ticks[r750] into r751; + cast r751.pool r751.liquidity_net r751.liquidity_gross r751.tick r751.fee_growth_outside0_x_128 r751.fee_growth_outside1_x_128 r2.tick_lower r751.next into r752 as Tick; + set r752 into ticks[r750]; + branch.eq true true to end_otherwise_0_11; + position end_then_0_10; + position end_otherwise_0_11; + get.or_use ticks[r695] r701 into r753; + ternary r705 -400001i32 r2.tick_upper_hint into r754; + cast r2.pool r754 into r755 as TickKey; + hash.bhp256 r755 into r756 as field; + get ticks[r756] into r757; + branch.eq r717 false to end_then_0_12; + is.eq r757.pool r2.pool into r758; + assert.eq r758 true; + is.eq r757.tick r2.tick_upper_hint into r759; + assert.eq r759 true; + is.eq r2.tick_upper_hint -400001i32 into r760; + gt r757.liquidity_gross 0u128 into r761; + or r760 r761 into r762; + assert.eq r762 true; + lt r757.tick r2.tick_upper into r763; + assert.eq r763 true; + gt r757.next r2.tick_upper into r764; + assert.eq r764 true; + branch.eq true true to end_otherwise_0_13; + position end_then_0_12; + position end_otherwise_0_13; + ternary r705 r753.prev r2.tick_upper_hint into r765; + ternary r705 r753.next r757.next into r766; + cast r235 into r767 as i128; + sub r753.liquidity_net r767 into r768; + cast r2.pool r768 r729 r2.tick_upper r722 r727 r765 r766 into r769 as Tick; + set r769 into ticks[r695]; + branch.eq r717 false to end_then_0_14; + get ticks[r756] into r770; + cast r770.pool r770.liquidity_net r770.liquidity_gross r770.tick r770.fee_growth_outside0_x_128 r770.fee_growth_outside1_x_128 r770.prev r2.tick_upper into r771 as Tick; + set r771 into ticks[r756]; + cast r2.pool r766 into r772 as TickKey; + hash.bhp256 r772 into r773 as field; + get ticks[r773] into r774; + cast r774.pool r774.liquidity_net r774.liquidity_gross r774.tick r774.fee_growth_outside0_x_128 r774.fee_growth_outside1_x_128 r2.tick_upper r774.next into r775 as Tick; + set r775 into ticks[r773]; + branch.eq true true to end_otherwise_0_15; + position end_then_0_14; + position end_otherwise_0_15; + get ticks[r693] into r776; + get ticks[r695] into r777; + gte r34.tick r776.tick into r778; + lt r34.fee_growth_global0_x_128.lo r776.fee_growth_outside0_x_128.lo into r779; + ternary r779 1u128 0u128 into r780; + sub.w r34.fee_growth_global0_x_128.lo r776.fee_growth_outside0_x_128.lo into r781; + sub.w r34.fee_growth_global0_x_128.hi r776.fee_growth_outside0_x_128.hi into r782; + sub.w r782 r780 into r783; + cast r783 r781 into r784 as U256__8JquwLopp8; + lt r34.fee_growth_global1_x_128.lo r776.fee_growth_outside1_x_128.lo into r785; + ternary r785 1u128 0u128 into r786; + sub.w r34.fee_growth_global1_x_128.lo r776.fee_growth_outside1_x_128.lo into r787; + sub.w r34.fee_growth_global1_x_128.hi r776.fee_growth_outside1_x_128.hi into r788; + sub.w r788 r786 into r789; + cast r789 r787 into r790 as U256__8JquwLopp8; + ternary r778 r776.fee_growth_outside0_x_128.hi r784.hi into r791; + ternary r778 r776.fee_growth_outside0_x_128.lo r784.lo into r792; + cast r791 r792 into r793 as U256__8JquwLopp8; + ternary r778 r776.fee_growth_outside1_x_128.hi r790.hi into r794; + ternary r778 r776.fee_growth_outside1_x_128.lo r790.lo into r795; + cast r794 r795 into r796 as U256__8JquwLopp8; + lt r34.tick r777.tick into r797; + lt r34.fee_growth_global0_x_128.lo r777.fee_growth_outside0_x_128.lo into r798; + ternary r798 1u128 0u128 into r799; + sub.w r34.fee_growth_global0_x_128.lo r777.fee_growth_outside0_x_128.lo into r800; + sub.w r34.fee_growth_global0_x_128.hi r777.fee_growth_outside0_x_128.hi into r801; + sub.w r801 r799 into r802; + cast r802 r800 into r803 as U256__8JquwLopp8; + lt r34.fee_growth_global1_x_128.lo r777.fee_growth_outside1_x_128.lo into r804; + ternary r804 1u128 0u128 into r805; + sub.w r34.fee_growth_global1_x_128.lo r777.fee_growth_outside1_x_128.lo into r806; + sub.w r34.fee_growth_global1_x_128.hi r777.fee_growth_outside1_x_128.hi into r807; + sub.w r807 r805 into r808; + cast r808 r806 into r809 as U256__8JquwLopp8; + ternary r797 r777.fee_growth_outside0_x_128.hi r803.hi into r810; + ternary r797 r777.fee_growth_outside0_x_128.lo r803.lo into r811; + cast r810 r811 into r812 as U256__8JquwLopp8; + ternary r797 r777.fee_growth_outside1_x_128.hi r809.hi into r813; + ternary r797 r777.fee_growth_outside1_x_128.lo r809.lo into r814; + cast r813 r814 into r815 as U256__8JquwLopp8; + lt r34.fee_growth_global0_x_128.lo r793.lo into r816; + ternary r816 1u128 0u128 into r817; + sub.w r34.fee_growth_global0_x_128.lo r793.lo into r818; + sub.w r34.fee_growth_global0_x_128.hi r793.hi into r819; + sub.w r819 r817 into r820; + cast r820 r818 into r821 as U256__8JquwLopp8; + lt r821.lo r812.lo into r822; + ternary r822 1u128 0u128 into r823; + sub.w r821.lo r812.lo into r824; + sub.w r821.hi r812.hi into r825; + sub.w r825 r823 into r826; + cast r826 r824 into r827 as U256__8JquwLopp8; + lt r34.fee_growth_global1_x_128.lo r796.lo into r828; + ternary r828 1u128 0u128 into r829; + sub.w r34.fee_growth_global1_x_128.lo r796.lo into r830; + sub.w r34.fee_growth_global1_x_128.hi r796.hi into r831; + sub.w r831 r829 into r832; + cast r832 r830 into r833 as U256__8JquwLopp8; + lt r833.lo r815.lo into r834; + ternary r834 1u128 0u128 into r835; + sub.w r833.lo r815.lo into r836; + sub.w r833.hi r815.hi into r837; + sub.w r837 r835 into r838; + cast r838 r836 into r839 as U256__8JquwLopp8; + contains positions[r3] into r840; + not r840 into r841; + assert.eq r841 true; + sub r2.amount0_desired r671 into r842; + sub r2.amount1_desired r673 into r843; + cast r3 r2.pool r2.tick_lower r2.tick_upper r235 r827 r839 r842 r843 into r844 as Position; + set r844 into positions[r3]; + lte r2.tick_lower r34.tick into r845; + and r706 r845 into r846; + gt r2.tick_lower r34.next_init_below into r847; + and r846 r847 into r848; + ternary r848 r2.tick_lower r34.next_init_below into r849; + gt r2.tick_lower r34.tick into r850; + and r706 r850 into r851; + lt r2.tick_lower r34.next_init_above into r852; + and r851 r852 into r853; + ternary r853 r2.tick_lower r34.next_init_above into r854; + lte r2.tick_upper r34.tick into r855; + and r717 r855 into r856; + gt r2.tick_upper r849 into r857; + and r856 r857 into r858; + ternary r858 r2.tick_upper r849 into r859; + gt r2.tick_upper r34.tick into r860; + and r717 r860 into r861; + lt r2.tick_upper r854 into r862; + and r861 r862 into r863; + ternary r863 r2.tick_upper r854 into r864; + gte r34.tick r2.tick_lower into r865; + lt r34.tick r2.tick_upper into r866; + and r865 r866 into r867; + add r34.liquidity r235 into r868; + ternary r867 r868 r34.liquidity into r869; + cast r34.tick r34.tick_spacing r34.sqrt_price r34.fee_protocol r869 r34.fee_growth_global0_x_128 r34.fee_growth_global1_x_128 r34.max_liquidity_per_tick r34.protocol_fees0 r34.protocol_fees1 r859 r864 into r870 as Slot; + set r870 into slots[r2.pool]; + +function decrease_liquidity: + input r0 as PositionNFT.record; + input r1 as u128.public; + input r2 as u128.public; + input r3 as u128.public; + cast r0.owner r0.withdrawal r0.token_id r0.token0_id r0.token1_id r0.pool r0.tick_lower r0.tick_upper into r4 as PositionNFT.record; + async decrease_liquidity r0.token_id r0.pool r0.tick_lower r0.tick_upper r1 r2 r3 into r5; + output r0.token_id as field.public; + output r4 as PositionNFT.record; + output r5 as shield_swap.aleo/decrease_liquidity.future; + +finalize decrease_liquidity: + input r0 as field.public; + input r1 as field.public; + input r2 as i32.public; + input r3 as i32.public; + input r4 as u128.public; + input r5 as u128.public; + input r6 as u128.public; + get positions[r0] into r7; + contains frozen_position[r0] into r8; + not r8 into r9; + assert.eq r9 true; + is.eq r7.pool r1 into r10; + is.eq r7.tick_lower r2 into r11; + and r10 r11 into r12; + is.eq r7.tick_upper r3 into r13; + and r12 r13 into r14; + assert.eq r14 true; + lte r4 r7.liquidity into r15; + assert.eq r15 true; + get positions[r0] into r16; + get slots[r16.pool] into r17; + call view_sqrt_price_at_tick_x128 r16.tick_lower into r18; + call view_sqrt_price_at_tick_x128 r16.tick_upper into r19; + lt r18.hi r19.hi into r20; + gt r18.hi r19.hi into r21; + lt r18.lo r19.lo into r22; + ternary r21 false r22 into r23; + ternary r20 true r23 into r24; + ternary r24 r18.hi r19.hi into r25; + ternary r24 r18.lo r19.lo into r26; + cast r25 r26 into r27 as U256__8JquwLopp8; + lt r18.hi r19.hi into r28; + gt r18.hi r19.hi into r29; + lt r18.lo r19.lo into r30; + ternary r29 false r30 into r31; + ternary r28 true r31 into r32; + ternary r32 r19.hi r18.hi into r33; + ternary r32 r19.lo r18.lo into r34; + cast r33 r34 into r35 as U256__8JquwLopp8; + lt r27.hi r17.sqrt_price.hi into r36; + gt r27.hi r17.sqrt_price.hi into r37; + lt r27.lo r17.sqrt_price.lo into r38; + ternary r37 false r38 into r39; + ternary r36 true r39 into r40; + not r40 into r41; + not r41 into r42; + lt r17.sqrt_price.hi r35.hi into r43; + gt r17.sqrt_price.hi r35.hi into r44; + lt r17.sqrt_price.lo r35.lo into r45; + ternary r44 false r45 into r46; + ternary r43 true r46 into r47; + and r42 r47 into r48; + lt r17.sqrt_price.hi r35.hi into r49; + gt r17.sqrt_price.hi r35.hi into r50; + lt r17.sqrt_price.lo r35.lo into r51; + ternary r50 false r51 into r52; + ternary r49 true r52 into r53; + not r53 into r54; + and r42 r54 into r55; + ternary r41 r4 0u128 into r56; + lt r27.hi r35.hi into r57; + gt r27.hi r35.hi into r58; + lt r27.lo r35.lo into r59; + ternary r58 false r59 into r60; + ternary r57 true r60 into r61; + ternary r61 r27.hi r35.hi into r62; + ternary r61 r27.lo r35.lo into r63; + cast r62 r63 into r64 as U256__8JquwLopp8; + lt r27.hi r35.hi into r65; + gt r27.hi r35.hi into r66; + lt r27.lo r35.lo into r67; + ternary r66 false r67 into r68; + ternary r65 true r68 into r69; + ternary r69 r35.hi r27.hi into r70; + ternary r69 r35.lo r27.lo into r71; + cast r70 r71 into r72 as U256__8JquwLopp8; + lt r72.lo r64.lo into r73; + ternary r73 1u128 0u128 into r74; + sub.w r72.lo r64.lo into r75; + sub.w r72.hi r64.hi into r76; + sub.w r76 r74 into r77; + cast r77 r75 into r78 as U256__8JquwLopp8; + cast r56 0u128 into r79 as U256__8JquwLopp8; + call view_mul_div r79 r78 r72 false into r80; + cast 0u128 1u128 into r81 as U256__8JquwLopp8; + call view_mul_div r80 r81 r64 false into r82; + is.eq r82.hi 0u128 into r83; + assert.eq r83 true; + ternary r48 r4 0u128 into r84; + lt r17.sqrt_price.hi r35.hi into r85; + gt r17.sqrt_price.hi r35.hi into r86; + lt r17.sqrt_price.lo r35.lo into r87; + ternary r86 false r87 into r88; + ternary r85 true r88 into r89; + ternary r89 r17.sqrt_price.hi r35.hi into r90; + ternary r89 r17.sqrt_price.lo r35.lo into r91; + cast r90 r91 into r92 as U256__8JquwLopp8; + lt r17.sqrt_price.hi r35.hi into r93; + gt r17.sqrt_price.hi r35.hi into r94; + lt r17.sqrt_price.lo r35.lo into r95; + ternary r94 false r95 into r96; + ternary r93 true r96 into r97; + ternary r97 r35.hi r17.sqrt_price.hi into r98; + ternary r97 r35.lo r17.sqrt_price.lo into r99; + cast r98 r99 into r100 as U256__8JquwLopp8; + lt r100.lo r92.lo into r101; + ternary r101 1u128 0u128 into r102; + sub.w r100.lo r92.lo into r103; + sub.w r100.hi r92.hi into r104; + sub.w r104 r102 into r105; + cast r105 r103 into r106 as U256__8JquwLopp8; + cast r84 0u128 into r107 as U256__8JquwLopp8; + call view_mul_div r107 r106 r100 false into r108; + cast 0u128 1u128 into r109 as U256__8JquwLopp8; + call view_mul_div r108 r109 r92 false into r110; + is.eq r110.hi 0u128 into r111; + assert.eq r111 true; + lt r27.hi r17.sqrt_price.hi into r112; + gt r27.hi r17.sqrt_price.hi into r113; + lt r27.lo r17.sqrt_price.lo into r114; + ternary r113 false r114 into r115; + ternary r112 true r115 into r116; + ternary r116 r27.hi r17.sqrt_price.hi into r117; + ternary r116 r27.lo r17.sqrt_price.lo into r118; + cast r117 r118 into r119 as U256__8JquwLopp8; + lt r27.hi r17.sqrt_price.hi into r120; + gt r27.hi r17.sqrt_price.hi into r121; + lt r27.lo r17.sqrt_price.lo into r122; + ternary r121 false r122 into r123; + ternary r120 true r123 into r124; + ternary r124 r17.sqrt_price.hi r27.hi into r125; + ternary r124 r17.sqrt_price.lo r27.lo into r126; + cast r125 r126 into r127 as U256__8JquwLopp8; + lt r127.lo r119.lo into r128; + ternary r128 1u128 0u128 into r129; + sub.w r127.lo r119.lo into r130; + sub.w r127.hi r119.hi into r131; + sub.w r131 r129 into r132; + cast r132 r130 into r133 as U256__8JquwLopp8; + cast 0u128 r84 into r134 as U256__8JquwLopp8; + and r134.lo 18446744073709551615u128 into r135; + shr r134.lo 64u8 into r136; + and r133.lo 18446744073709551615u128 into r137; + shr r133.lo 64u8 into r138; + mul r135 r137 into r139; + mul r135 r138 into r140; + mul r136 r137 into r141; + mul r136 r138 into r142; + and r139 18446744073709551615u128 into r143; + shr r139 64u8 into r144; + and r140 18446744073709551615u128 into r145; + add r144 r145 into r146; + and r141 18446744073709551615u128 into r147; + add r146 r147 into r148; + and r148 18446744073709551615u128 into r149; + shr r148 64u8 into r150; + shr r140 64u8 into r151; + shr r141 64u8 into r152; + add r151 r152 into r153; + and r142 18446744073709551615u128 into r154; + add r153 r154 into r155; + add r155 r150 into r156; + and r156 18446744073709551615u128 into r157; + shr r156 64u8 into r158; + shr r142 64u8 into r159; + add r159 r158 into r160; + shl r160 64u8 into r161; + add r161 r157 into r162; + shl r149 64u8 into r163; + add r163 r143 into r164; + and r134.lo 18446744073709551615u128 into r165; + shr r134.lo 64u8 into r166; + and r133.hi 18446744073709551615u128 into r167; + shr r133.hi 64u8 into r168; + mul r165 r167 into r169; + mul r165 r168 into r170; + mul r166 r167 into r171; + mul r166 r168 into r172; + and r169 18446744073709551615u128 into r173; + shr r169 64u8 into r174; + and r170 18446744073709551615u128 into r175; + add r174 r175 into r176; + and r171 18446744073709551615u128 into r177; + add r176 r177 into r178; + and r178 18446744073709551615u128 into r179; + shr r178 64u8 into r180; + shr r170 64u8 into r181; + shr r171 64u8 into r182; + add r181 r182 into r183; + and r172 18446744073709551615u128 into r184; + add r183 r184 into r185; + add r185 r180 into r186; + and r186 18446744073709551615u128 into r187; + shr r186 64u8 into r188; + shr r172 64u8 into r189; + add r189 r188 into r190; + shl r190 64u8 into r191; + add r191 r187 into r192; + shl r179 64u8 into r193; + add r193 r173 into r194; + and r134.hi 18446744073709551615u128 into r195; + shr r134.hi 64u8 into r196; + and r133.lo 18446744073709551615u128 into r197; + shr r133.lo 64u8 into r198; + mul r195 r197 into r199; + mul r195 r198 into r200; + mul r196 r197 into r201; + mul r196 r198 into r202; + and r199 18446744073709551615u128 into r203; + shr r199 64u8 into r204; + and r200 18446744073709551615u128 into r205; + add r204 r205 into r206; + and r201 18446744073709551615u128 into r207; + add r206 r207 into r208; + and r208 18446744073709551615u128 into r209; + shr r208 64u8 into r210; + shr r200 64u8 into r211; + shr r201 64u8 into r212; + add r211 r212 into r213; + and r202 18446744073709551615u128 into r214; + add r213 r214 into r215; + add r215 r210 into r216; + and r216 18446744073709551615u128 into r217; + shr r216 64u8 into r218; + shr r202 64u8 into r219; + add r219 r218 into r220; + shl r220 64u8 into r221; + add r221 r217 into r222; + shl r209 64u8 into r223; + add r223 r203 into r224; + and r134.hi 18446744073709551615u128 into r225; + shr r134.hi 64u8 into r226; + and r133.hi 18446744073709551615u128 into r227; + shr r133.hi 64u8 into r228; + mul r225 r227 into r229; + mul r225 r228 into r230; + mul r226 r227 into r231; + mul r226 r228 into r232; + and r229 18446744073709551615u128 into r233; + shr r229 64u8 into r234; + and r230 18446744073709551615u128 into r235; + add r234 r235 into r236; + and r231 18446744073709551615u128 into r237; + add r236 r237 into r238; + and r238 18446744073709551615u128 into r239; + shr r238 64u8 into r240; + shr r230 64u8 into r241; + shr r231 64u8 into r242; + add r241 r242 into r243; + and r232 18446744073709551615u128 into r244; + add r243 r244 into r245; + add r245 r240 into r246; + and r246 18446744073709551615u128 into r247; + shr r246 64u8 into r248; + shr r232 64u8 into r249; + add r249 r248 into r250; + shl r250 64u8 into r251; + add r251 r247 into r252; + shl r239 64u8 into r253; + add r253 r233 into r254; + add.w r162 r194 into r255; + lt r255 r162 into r256; + ternary r256 1u128 0u128 into r257; + add.w r255 r224 into r258; + lt r258 r255 into r259; + ternary r259 1u128 0u128 into r260; + add r257 r260 into r261; + add.w r192 r222 into r262; + lt r262 r192 into r263; + ternary r263 1u128 0u128 into r264; + add.w r262 r254 into r265; + lt r265 r262 into r266; + ternary r266 1u128 0u128 into r267; + add.w r265 r261 into r268; + lt r268 r265 into r269; + ternary r269 1u128 0u128 into r270; + add r264 r267 into r271; + add r271 r270 into r272; + add.w r252 r272 into r273; + cast r273 r268 into r274 as U256__8JquwLopp8; + cast r258 r164 into r275 as U256__8JquwLopp8; + is.eq r274.hi 0u128 into r276; + is.eq r274.lo 0u128 into r277; + and r276 r277 into r278; + assert.eq r278 true; + ternary r55 r4 0u128 into r279; + lt r27.hi r35.hi into r280; + gt r27.hi r35.hi into r281; + lt r27.lo r35.lo into r282; + ternary r281 false r282 into r283; + ternary r280 true r283 into r284; + ternary r284 r27.hi r35.hi into r285; + ternary r284 r27.lo r35.lo into r286; + cast r285 r286 into r287 as U256__8JquwLopp8; + lt r27.hi r35.hi into r288; + gt r27.hi r35.hi into r289; + lt r27.lo r35.lo into r290; + ternary r289 false r290 into r291; + ternary r288 true r291 into r292; + ternary r292 r35.hi r27.hi into r293; + ternary r292 r35.lo r27.lo into r294; + cast r293 r294 into r295 as U256__8JquwLopp8; + lt r295.lo r287.lo into r296; + ternary r296 1u128 0u128 into r297; + sub.w r295.lo r287.lo into r298; + sub.w r295.hi r287.hi into r299; + sub.w r299 r297 into r300; + cast r300 r298 into r301 as U256__8JquwLopp8; + cast 0u128 r279 into r302 as U256__8JquwLopp8; + and r302.lo 18446744073709551615u128 into r303; + shr r302.lo 64u8 into r304; + and r301.lo 18446744073709551615u128 into r305; + shr r301.lo 64u8 into r306; + mul r303 r305 into r307; + mul r303 r306 into r308; + mul r304 r305 into r309; + mul r304 r306 into r310; + and r307 18446744073709551615u128 into r311; + shr r307 64u8 into r312; + and r308 18446744073709551615u128 into r313; + add r312 r313 into r314; + and r309 18446744073709551615u128 into r315; + add r314 r315 into r316; + and r316 18446744073709551615u128 into r317; + shr r316 64u8 into r318; + shr r308 64u8 into r319; + shr r309 64u8 into r320; + add r319 r320 into r321; + and r310 18446744073709551615u128 into r322; + add r321 r322 into r323; + add r323 r318 into r324; + and r324 18446744073709551615u128 into r325; + shr r324 64u8 into r326; + shr r310 64u8 into r327; + add r327 r326 into r328; + shl r328 64u8 into r329; + add r329 r325 into r330; + shl r317 64u8 into r331; + add r331 r311 into r332; + and r302.lo 18446744073709551615u128 into r333; + shr r302.lo 64u8 into r334; + and r301.hi 18446744073709551615u128 into r335; + shr r301.hi 64u8 into r336; + mul r333 r335 into r337; + mul r333 r336 into r338; + mul r334 r335 into r339; + mul r334 r336 into r340; + and r337 18446744073709551615u128 into r341; + shr r337 64u8 into r342; + and r338 18446744073709551615u128 into r343; + add r342 r343 into r344; + and r339 18446744073709551615u128 into r345; + add r344 r345 into r346; + and r346 18446744073709551615u128 into r347; + shr r346 64u8 into r348; + shr r338 64u8 into r349; + shr r339 64u8 into r350; + add r349 r350 into r351; + and r340 18446744073709551615u128 into r352; + add r351 r352 into r353; + add r353 r348 into r354; + and r354 18446744073709551615u128 into r355; + shr r354 64u8 into r356; + shr r340 64u8 into r357; + add r357 r356 into r358; + shl r358 64u8 into r359; + add r359 r355 into r360; + shl r347 64u8 into r361; + add r361 r341 into r362; + and r302.hi 18446744073709551615u128 into r363; + shr r302.hi 64u8 into r364; + and r301.lo 18446744073709551615u128 into r365; + shr r301.lo 64u8 into r366; + mul r363 r365 into r367; + mul r363 r366 into r368; + mul r364 r365 into r369; + mul r364 r366 into r370; + and r367 18446744073709551615u128 into r371; + shr r367 64u8 into r372; + and r368 18446744073709551615u128 into r373; + add r372 r373 into r374; + and r369 18446744073709551615u128 into r375; + add r374 r375 into r376; + and r376 18446744073709551615u128 into r377; + shr r376 64u8 into r378; + shr r368 64u8 into r379; + shr r369 64u8 into r380; + add r379 r380 into r381; + and r370 18446744073709551615u128 into r382; + add r381 r382 into r383; + add r383 r378 into r384; + and r384 18446744073709551615u128 into r385; + shr r384 64u8 into r386; + shr r370 64u8 into r387; + add r387 r386 into r388; + shl r388 64u8 into r389; + add r389 r385 into r390; + shl r377 64u8 into r391; + add r391 r371 into r392; + and r302.hi 18446744073709551615u128 into r393; + shr r302.hi 64u8 into r394; + and r301.hi 18446744073709551615u128 into r395; + shr r301.hi 64u8 into r396; + mul r393 r395 into r397; + mul r393 r396 into r398; + mul r394 r395 into r399; + mul r394 r396 into r400; + and r397 18446744073709551615u128 into r401; + shr r397 64u8 into r402; + and r398 18446744073709551615u128 into r403; + add r402 r403 into r404; + and r399 18446744073709551615u128 into r405; + add r404 r405 into r406; + and r406 18446744073709551615u128 into r407; + shr r406 64u8 into r408; + shr r398 64u8 into r409; + shr r399 64u8 into r410; + add r409 r410 into r411; + and r400 18446744073709551615u128 into r412; + add r411 r412 into r413; + add r413 r408 into r414; + and r414 18446744073709551615u128 into r415; + shr r414 64u8 into r416; + shr r400 64u8 into r417; + add r417 r416 into r418; + shl r418 64u8 into r419; + add r419 r415 into r420; + shl r407 64u8 into r421; + add r421 r401 into r422; + add.w r330 r362 into r423; + lt r423 r330 into r424; + ternary r424 1u128 0u128 into r425; + add.w r423 r392 into r426; + lt r426 r423 into r427; + ternary r427 1u128 0u128 into r428; + add r425 r428 into r429; + add.w r360 r390 into r430; + lt r430 r360 into r431; + ternary r431 1u128 0u128 into r432; + add.w r430 r422 into r433; + lt r433 r430 into r434; + ternary r434 1u128 0u128 into r435; + add.w r433 r429 into r436; + lt r436 r433 into r437; + ternary r437 1u128 0u128 into r438; + add r432 r435 into r439; + add r439 r438 into r440; + add.w r420 r440 into r441; + cast r441 r436 into r442 as U256__8JquwLopp8; + cast r426 r332 into r443 as U256__8JquwLopp8; + is.eq r442.hi 0u128 into r444; + is.eq r442.lo 0u128 into r445; + and r444 r445 into r446; + assert.eq r446 true; + ternary r48 r110.lo 0u128 into r447; + ternary r41 r82.lo r447 into r448; + ternary r55 r443.hi 0u128 into r449; + ternary r48 r275.hi r449 into r450; + cast r16.pool r16.tick_lower into r451 as TickKey; + hash.bhp256 r451 into r452 as field; + cast r16.pool r16.tick_upper into r453 as TickKey; + hash.bhp256 r453 into r454 as field; + get ticks[r452] into r455; + get ticks[r454] into r456; + gt r455.liquidity_gross 0u128 into r457; + gt r456.liquidity_gross 0u128 into r458; + sub r455.liquidity_gross r4 into r459; + sub r456.liquidity_gross r4 into r460; + is.eq r459 0u128 into r461; + and r457 r461 into r462; + is.eq r460 0u128 into r463; + and r458 r463 into r464; + cast r4 into r465 as i128; + sub r455.liquidity_net r465 into r466; + cast r455.pool r466 r459 r455.tick r455.fee_growth_outside0_x_128 r455.fee_growth_outside1_x_128 r455.prev r455.next into r467 as Tick; + set r467 into ticks[r452]; + branch.eq r462 false to end_then_0_0; + cast r16.pool r455.prev into r468 as TickKey; + hash.bhp256 r468 into r469 as field; + get ticks[r469] into r470; + cast r470.pool r470.liquidity_net r470.liquidity_gross r470.tick r470.fee_growth_outside0_x_128 r470.fee_growth_outside1_x_128 r470.prev r455.next into r471 as Tick; + set r471 into ticks[r469]; + cast r16.pool r455.next into r472 as TickKey; + hash.bhp256 r472 into r473 as field; + get ticks[r473] into r474; + cast r474.pool r474.liquidity_net r474.liquidity_gross r474.tick r474.fee_growth_outside0_x_128 r474.fee_growth_outside1_x_128 r455.prev r474.next into r475 as Tick; + set r475 into ticks[r473]; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + get ticks[r454] into r476; + cast r4 into r477 as i128; + add r476.liquidity_net r477 into r478; + cast r476.pool r478 r460 r476.tick r476.fee_growth_outside0_x_128 r476.fee_growth_outside1_x_128 r476.prev r476.next into r479 as Tick; + set r479 into ticks[r454]; + branch.eq r464 false to end_then_0_2; + cast r16.pool r476.prev into r480 as TickKey; + hash.bhp256 r480 into r481 as field; + get ticks[r481] into r482; + cast r482.pool r482.liquidity_net r482.liquidity_gross r482.tick r482.fee_growth_outside0_x_128 r482.fee_growth_outside1_x_128 r482.prev r476.next into r483 as Tick; + set r483 into ticks[r481]; + cast r16.pool r476.next into r484 as TickKey; + hash.bhp256 r484 into r485 as field; + get ticks[r485] into r486; + cast r486.pool r486.liquidity_net r486.liquidity_gross r486.tick r486.fee_growth_outside0_x_128 r486.fee_growth_outside1_x_128 r476.prev r486.next into r487 as Tick; + set r487 into ticks[r485]; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + get ticks[r452] into r488; + get ticks[r454] into r489; + gte r17.tick r488.tick into r490; + lt r17.fee_growth_global0_x_128.lo r488.fee_growth_outside0_x_128.lo into r491; + ternary r491 1u128 0u128 into r492; + sub.w r17.fee_growth_global0_x_128.lo r488.fee_growth_outside0_x_128.lo into r493; + sub.w r17.fee_growth_global0_x_128.hi r488.fee_growth_outside0_x_128.hi into r494; + sub.w r494 r492 into r495; + cast r495 r493 into r496 as U256__8JquwLopp8; + lt r17.fee_growth_global1_x_128.lo r488.fee_growth_outside1_x_128.lo into r497; + ternary r497 1u128 0u128 into r498; + sub.w r17.fee_growth_global1_x_128.lo r488.fee_growth_outside1_x_128.lo into r499; + sub.w r17.fee_growth_global1_x_128.hi r488.fee_growth_outside1_x_128.hi into r500; + sub.w r500 r498 into r501; + cast r501 r499 into r502 as U256__8JquwLopp8; + ternary r490 r488.fee_growth_outside0_x_128.hi r496.hi into r503; + ternary r490 r488.fee_growth_outside0_x_128.lo r496.lo into r504; + cast r503 r504 into r505 as U256__8JquwLopp8; + ternary r490 r488.fee_growth_outside1_x_128.hi r502.hi into r506; + ternary r490 r488.fee_growth_outside1_x_128.lo r502.lo into r507; + cast r506 r507 into r508 as U256__8JquwLopp8; + lt r17.tick r489.tick into r509; + lt r17.fee_growth_global0_x_128.lo r489.fee_growth_outside0_x_128.lo into r510; + ternary r510 1u128 0u128 into r511; + sub.w r17.fee_growth_global0_x_128.lo r489.fee_growth_outside0_x_128.lo into r512; + sub.w r17.fee_growth_global0_x_128.hi r489.fee_growth_outside0_x_128.hi into r513; + sub.w r513 r511 into r514; + cast r514 r512 into r515 as U256__8JquwLopp8; + lt r17.fee_growth_global1_x_128.lo r489.fee_growth_outside1_x_128.lo into r516; + ternary r516 1u128 0u128 into r517; + sub.w r17.fee_growth_global1_x_128.lo r489.fee_growth_outside1_x_128.lo into r518; + sub.w r17.fee_growth_global1_x_128.hi r489.fee_growth_outside1_x_128.hi into r519; + sub.w r519 r517 into r520; + cast r520 r518 into r521 as U256__8JquwLopp8; + ternary r509 r489.fee_growth_outside0_x_128.hi r515.hi into r522; + ternary r509 r489.fee_growth_outside0_x_128.lo r515.lo into r523; + cast r522 r523 into r524 as U256__8JquwLopp8; + ternary r509 r489.fee_growth_outside1_x_128.hi r521.hi into r525; + ternary r509 r489.fee_growth_outside1_x_128.lo r521.lo into r526; + cast r525 r526 into r527 as U256__8JquwLopp8; + lt r17.fee_growth_global0_x_128.lo r505.lo into r528; + ternary r528 1u128 0u128 into r529; + sub.w r17.fee_growth_global0_x_128.lo r505.lo into r530; + sub.w r17.fee_growth_global0_x_128.hi r505.hi into r531; + sub.w r531 r529 into r532; + cast r532 r530 into r533 as U256__8JquwLopp8; + lt r533.lo r524.lo into r534; + ternary r534 1u128 0u128 into r535; + sub.w r533.lo r524.lo into r536; + sub.w r533.hi r524.hi into r537; + sub.w r537 r535 into r538; + cast r538 r536 into r539 as U256__8JquwLopp8; + lt r17.fee_growth_global1_x_128.lo r508.lo into r540; + ternary r540 1u128 0u128 into r541; + sub.w r17.fee_growth_global1_x_128.lo r508.lo into r542; + sub.w r17.fee_growth_global1_x_128.hi r508.hi into r543; + sub.w r543 r541 into r544; + cast r544 r542 into r545 as U256__8JquwLopp8; + lt r545.lo r527.lo into r546; + ternary r546 1u128 0u128 into r547; + sub.w r545.lo r527.lo into r548; + sub.w r545.hi r527.hi into r549; + sub.w r549 r547 into r550; + cast r550 r548 into r551 as U256__8JquwLopp8; + lt r539.lo r16.fee_growth_inside0_last_x_128.lo into r552; + ternary r552 1u128 0u128 into r553; + sub.w r539.lo r16.fee_growth_inside0_last_x_128.lo into r554; + sub.w r539.hi r16.fee_growth_inside0_last_x_128.hi into r555; + sub.w r555 r553 into r556; + cast r556 r554 into r557 as U256__8JquwLopp8; + and r557.hi 18446744073709551615u128 into r558; + shr r557.hi 64u8 into r559; + and r16.liquidity 18446744073709551615u128 into r560; + shr r16.liquidity 64u8 into r561; + mul r558 r560 into r562; + mul r558 r561 into r563; + mul r559 r560 into r564; + mul r559 r561 into r565; + and r562 18446744073709551615u128 into r566; + shr r562 64u8 into r567; + and r563 18446744073709551615u128 into r568; + add r567 r568 into r569; + and r564 18446744073709551615u128 into r570; + add r569 r570 into r571; + and r571 18446744073709551615u128 into r572; + shr r571 64u8 into r573; + shr r563 64u8 into r574; + shr r564 64u8 into r575; + add r574 r575 into r576; + and r565 18446744073709551615u128 into r577; + add r576 r577 into r578; + add r578 r573 into r579; + and r579 18446744073709551615u128 into r580; + shr r579 64u8 into r581; + shr r565 64u8 into r582; + add r582 r581 into r583; + shl r583 64u8 into r584; + add r584 r580 into r585; + shl r572 64u8 into r586; + add r586 r566 into r587; + and r557.lo 18446744073709551615u128 into r588; + shr r557.lo 64u8 into r589; + mul r588 r560 into r590; + mul r588 r561 into r591; + mul r589 r560 into r592; + mul r589 r561 into r593; + and r590 18446744073709551615u128 into r594; + shr r590 64u8 into r595; + and r591 18446744073709551615u128 into r596; + add r595 r596 into r597; + and r592 18446744073709551615u128 into r598; + add r597 r598 into r599; + and r599 18446744073709551615u128 into r600; + shr r599 64u8 into r601; + shr r591 64u8 into r602; + shr r592 64u8 into r603; + add r602 r603 into r604; + and r593 18446744073709551615u128 into r605; + add r604 r605 into r606; + add r606 r601 into r607; + and r607 18446744073709551615u128 into r608; + shr r607 64u8 into r609; + shr r593 64u8 into r610; + add r610 r609 into r611; + shl r611 64u8 into r612; + add r612 r608 into r613; + shl r600 64u8 into r614; + add r614 r594 into r615; + sub 340282366920938463463374607431768211455u128 r587 into r616; + lte r613 r616 into r617; + is.eq r585 0u128 into r618; + and r618 r617 into r619; + assert.eq r619 true; + add r587 r613 into r620; + add r16.tokens_owed0 r620 into r621; + add r621 r448 into r622; + lt r551.lo r16.fee_growth_inside1_last_x_128.lo into r623; + ternary r623 1u128 0u128 into r624; + sub.w r551.lo r16.fee_growth_inside1_last_x_128.lo into r625; + sub.w r551.hi r16.fee_growth_inside1_last_x_128.hi into r626; + sub.w r626 r624 into r627; + cast r627 r625 into r628 as U256__8JquwLopp8; + and r628.hi 18446744073709551615u128 into r629; + shr r628.hi 64u8 into r630; + and r16.liquidity 18446744073709551615u128 into r631; + shr r16.liquidity 64u8 into r632; + mul r629 r631 into r633; + mul r629 r632 into r634; + mul r630 r631 into r635; + mul r630 r632 into r636; + and r633 18446744073709551615u128 into r637; + shr r633 64u8 into r638; + and r634 18446744073709551615u128 into r639; + add r638 r639 into r640; + and r635 18446744073709551615u128 into r641; + add r640 r641 into r642; + and r642 18446744073709551615u128 into r643; + shr r642 64u8 into r644; + shr r634 64u8 into r645; + shr r635 64u8 into r646; + add r645 r646 into r647; + and r636 18446744073709551615u128 into r648; + add r647 r648 into r649; + add r649 r644 into r650; + and r650 18446744073709551615u128 into r651; + shr r650 64u8 into r652; + shr r636 64u8 into r653; + add r653 r652 into r654; + shl r654 64u8 into r655; + add r655 r651 into r656; + shl r643 64u8 into r657; + add r657 r637 into r658; + and r628.lo 18446744073709551615u128 into r659; + shr r628.lo 64u8 into r660; + mul r659 r631 into r661; + mul r659 r632 into r662; + mul r660 r631 into r663; + mul r660 r632 into r664; + and r661 18446744073709551615u128 into r665; + shr r661 64u8 into r666; + and r662 18446744073709551615u128 into r667; + add r666 r667 into r668; + and r663 18446744073709551615u128 into r669; + add r668 r669 into r670; + and r670 18446744073709551615u128 into r671; + shr r670 64u8 into r672; + shr r662 64u8 into r673; + shr r663 64u8 into r674; + add r673 r674 into r675; + and r664 18446744073709551615u128 into r676; + add r675 r676 into r677; + add r677 r672 into r678; + and r678 18446744073709551615u128 into r679; + shr r678 64u8 into r680; + shr r664 64u8 into r681; + add r681 r680 into r682; + shl r682 64u8 into r683; + add r683 r679 into r684; + shl r671 64u8 into r685; + add r685 r665 into r686; + sub 340282366920938463463374607431768211455u128 r658 into r687; + lte r684 r687 into r688; + is.eq r656 0u128 into r689; + and r689 r688 into r690; + assert.eq r690 true; + add r658 r684 into r691; + add r16.tokens_owed1 r691 into r692; + add r692 r450 into r693; + sub r16.liquidity r4 into r694; + cast r0 r16.pool r16.tick_lower r16.tick_upper r694 r539 r551 r622 r693 into r695 as Position; + set r695 into positions[r0]; + is.eq r17.next_init_below r16.tick_lower into r696; + and r462 r696 into r697; + ternary r697 r455.prev r17.next_init_below into r698; + is.eq r17.next_init_above r16.tick_lower into r699; + and r462 r699 into r700; + ternary r700 r455.next r17.next_init_above into r701; + is.eq r698 r16.tick_upper into r702; + and r464 r702 into r703; + ternary r703 r476.prev r698 into r704; + is.eq r701 r16.tick_upper into r705; + and r464 r705 into r706; + ternary r706 r476.next r701 into r707; + gte r17.tick r16.tick_lower into r708; + lt r17.tick r16.tick_upper into r709; + and r708 r709 into r710; + ternary r710 r4 0u128 into r711; + sub r17.liquidity r711 into r712; + cast r17.tick r17.tick_spacing r17.sqrt_price r17.fee_protocol r712 r17.fee_growth_global0_x_128 r17.fee_growth_global1_x_128 r17.max_liquidity_per_tick r17.protocol_fees0 r17.protocol_fees1 r704 r707 into r713 as Slot; + set r713 into slots[r16.pool]; + branch.eq r462 false to end_then_0_4; + remove ticks[r452]; + branch.eq true true to end_otherwise_0_5; + position end_then_0_4; + position end_otherwise_0_5; + branch.eq r464 false to end_then_0_6; + remove ticks[r454]; + branch.eq true true to end_otherwise_0_7; + position end_then_0_6; + position end_otherwise_0_7; + gte r448 r5 into r714; + gte r450 r6 into r715; + and r714 r715 into r716; + assert.eq r716 true; + +function increase_liquidity: + input r0 as PositionNFT.record; + input r1 as dynamic.record; + input r2 as dynamic.record; + input r3 as u128.public; + input r4 as u128.public; + input r5 as u128.public; + input r6 as u128.public; + input r7 as field.public; + input r8 as field.public; + input r9 as i32.public; + input r10 as i32.public; + is.eq self.caller aleo18sekmsl46y6skh3kvkekmw4kqqm7d6rz79akpsg58r7wpp5klyyq0qtzqf into r11; + cast r0.owner r0.withdrawal r0.token_id r0.token0_id r0.token1_id r0.pool r0.tick_lower r0.tick_upper into r12 as PositionNFT.record; + call.dynamic r7 'aleo' 'transfer_private_to_public' with r1 shield_swap.aleo r3 (as dynamic.record address.public u128.public) into r13 r14 (as dynamic.record dynamic.future); + call.dynamic r8 'aleo' 'transfer_private_to_public' with r2 shield_swap.aleo r4 (as dynamic.record address.public u128.public) into r15 r16 (as dynamic.record dynamic.future); + async increase_liquidity r14 r16 r0.token_id r0.pool r0.tick_lower r0.tick_upper r3 r4 r5 r6 r7 r8 r9 r10 r11 into r17; + output r0.token_id as field.public; + output r12 as PositionNFT.record; + output r13 as dynamic.record; + output r15 as dynamic.record; + output r17 as shield_swap.aleo/increase_liquidity.future; + +finalize increase_liquidity: + input r0 as dynamic.future; + input r1 as dynamic.future; + input r2 as field.public; + input r3 as field.public; + input r4 as i32.public; + input r5 as i32.public; + input r6 as u128.public; + input r7 as u128.public; + input r8 as u128.public; + input r9 as u128.public; + input r10 as field.public; + input r11 as field.public; + input r12 as i32.public; + input r13 as i32.public; + input r14 as boolean.public; + contains from_wrapper_token_id[r10] into r15; + contains from_wrapper_token_id[r11] into r16; + or r15 r16 into r17; + branch.eq r17 false to end_then_0_0; + assert.eq r14 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + await r0; + await r1; + get.or_use global_paused[true] false into r18; + not r18 into r19; + assert.eq r19 true; + get pools[r3] into r20; + assert.eq r20.enabled true; + get.or_use token_paused[r20.token0] false into r21; + not r21 into r22; + assert.eq r22 true; + get.or_use token_paused[r20.token1] false into r23; + not r23 into r24; + assert.eq r24 true; + cast r20.token0 r20.token1 into r25 as PairKey; + get.or_use pair_paused[r25] false into r26; + not r26 into r27; + assert.eq r27 true; + is.eq r20.token0 r10 into r28; + assert.eq r28 true; + is.eq r20.token1 r11 into r29; + assert.eq r29 true; + get slots[r3] into r30; + get positions[r2] into r31; + contains frozen_position[r2] into r32; + not r32 into r33; + assert.eq r33 true; + is.eq r31.pool r3 into r34; + is.eq r31.tick_lower r4 into r35; + and r34 r35 into r36; + is.eq r31.tick_upper r5 into r37; + and r36 r37 into r38; + assert.eq r38 true; + call view_sqrt_price_at_tick_x128 r4 into r39; + call view_sqrt_price_at_tick_x128 r5 into r40; + lt r39.hi r40.hi into r41; + gt r39.hi r40.hi into r42; + lt r39.lo r40.lo into r43; + ternary r42 false r43 into r44; + ternary r41 true r44 into r45; + ternary r45 r39.hi r40.hi into r46; + ternary r45 r39.lo r40.lo into r47; + cast r46 r47 into r48 as U256__8JquwLopp8; + lt r39.hi r40.hi into r49; + gt r39.hi r40.hi into r50; + lt r39.lo r40.lo into r51; + ternary r50 false r51 into r52; + ternary r49 true r52 into r53; + ternary r53 r40.hi r39.hi into r54; + ternary r53 r40.lo r39.lo into r55; + cast r54 r55 into r56 as U256__8JquwLopp8; + lt r48.hi r30.sqrt_price.hi into r57; + gt r48.hi r30.sqrt_price.hi into r58; + lt r48.lo r30.sqrt_price.lo into r59; + ternary r58 false r59 into r60; + ternary r57 true r60 into r61; + not r61 into r62; + not r62 into r63; + lt r30.sqrt_price.hi r56.hi into r64; + gt r30.sqrt_price.hi r56.hi into r65; + lt r30.sqrt_price.lo r56.lo into r66; + ternary r65 false r66 into r67; + ternary r64 true r67 into r68; + and r63 r68 into r69; + lt r30.sqrt_price.hi r56.hi into r70; + gt r30.sqrt_price.hi r56.hi into r71; + lt r30.sqrt_price.lo r56.lo into r72; + ternary r71 false r72 into r73; + ternary r70 true r73 into r74; + not r74 into r75; + and r63 r75 into r76; + ternary r62 r6 0u128 into r77; + lt r48.hi r56.hi into r78; + gt r48.hi r56.hi into r79; + lt r48.lo r56.lo into r80; + ternary r79 false r80 into r81; + ternary r78 true r81 into r82; + ternary r82 r48.hi r56.hi into r83; + ternary r82 r48.lo r56.lo into r84; + cast r83 r84 into r85 as U256__8JquwLopp8; + lt r48.hi r56.hi into r86; + gt r48.hi r56.hi into r87; + lt r48.lo r56.lo into r88; + ternary r87 false r88 into r89; + ternary r86 true r89 into r90; + ternary r90 r56.hi r48.hi into r91; + ternary r90 r56.lo r48.lo into r92; + cast r91 r92 into r93 as U256__8JquwLopp8; + lt r93.lo r85.lo into r94; + ternary r94 1u128 0u128 into r95; + sub.w r93.lo r85.lo into r96; + sub.w r93.hi r85.hi into r97; + sub.w r97 r95 into r98; + cast r98 r96 into r99 as U256__8JquwLopp8; + is.eq r99.hi 0u128 into r100; + is.eq r99.lo 0u128 into r101; + and r100 r101 into r102; + ternary r102 0u128 r99.hi into r103; + ternary r102 1u128 r99.lo into r104; + cast r103 r104 into r105 as U256__8JquwLopp8; + is.eq r99.hi 0u128 into r106; + is.eq r99.lo 0u128 into r107; + and r106 r107 into r108; + ternary r108 0u128 r77 into r109; + cast 1u128 0u128 into r110 as U256__8JquwLopp8; + call view_mul_div r85 r93 r110 false into r111; + cast 0u128 r109 into r112 as U256__8JquwLopp8; + call view_mul_div r112 r111 r105 false into r113; + is.eq r113.hi 0u128 into r114; + assert.eq r114 true; + ternary r69 r6 0u128 into r115; + lt r30.sqrt_price.hi r56.hi into r116; + gt r30.sqrt_price.hi r56.hi into r117; + lt r30.sqrt_price.lo r56.lo into r118; + ternary r117 false r118 into r119; + ternary r116 true r119 into r120; + ternary r120 r30.sqrt_price.hi r56.hi into r121; + ternary r120 r30.sqrt_price.lo r56.lo into r122; + cast r121 r122 into r123 as U256__8JquwLopp8; + lt r30.sqrt_price.hi r56.hi into r124; + gt r30.sqrt_price.hi r56.hi into r125; + lt r30.sqrt_price.lo r56.lo into r126; + ternary r125 false r126 into r127; + ternary r124 true r127 into r128; + ternary r128 r56.hi r30.sqrt_price.hi into r129; + ternary r128 r56.lo r30.sqrt_price.lo into r130; + cast r129 r130 into r131 as U256__8JquwLopp8; + lt r131.lo r123.lo into r132; + ternary r132 1u128 0u128 into r133; + sub.w r131.lo r123.lo into r134; + sub.w r131.hi r123.hi into r135; + sub.w r135 r133 into r136; + cast r136 r134 into r137 as U256__8JquwLopp8; + is.eq r137.hi 0u128 into r138; + is.eq r137.lo 0u128 into r139; + and r138 r139 into r140; + ternary r140 0u128 r137.hi into r141; + ternary r140 1u128 r137.lo into r142; + cast r141 r142 into r143 as U256__8JquwLopp8; + is.eq r137.hi 0u128 into r144; + is.eq r137.lo 0u128 into r145; + and r144 r145 into r146; + ternary r146 0u128 r115 into r147; + cast 1u128 0u128 into r148 as U256__8JquwLopp8; + call view_mul_div r123 r131 r148 false into r149; + cast 0u128 r147 into r150 as U256__8JquwLopp8; + call view_mul_div r150 r149 r143 false into r151; + is.eq r151.hi 0u128 into r152; + assert.eq r152 true; + ternary r69 r7 0u128 into r153; + lt r48.hi r30.sqrt_price.hi into r154; + gt r48.hi r30.sqrt_price.hi into r155; + lt r48.lo r30.sqrt_price.lo into r156; + ternary r155 false r156 into r157; + ternary r154 true r157 into r158; + ternary r158 r48.hi r30.sqrt_price.hi into r159; + ternary r158 r48.lo r30.sqrt_price.lo into r160; + cast r159 r160 into r161 as U256__8JquwLopp8; + lt r48.hi r30.sqrt_price.hi into r162; + gt r48.hi r30.sqrt_price.hi into r163; + lt r48.lo r30.sqrt_price.lo into r164; + ternary r163 false r164 into r165; + ternary r162 true r165 into r166; + ternary r166 r30.sqrt_price.hi r48.hi into r167; + ternary r166 r30.sqrt_price.lo r48.lo into r168; + cast r167 r168 into r169 as U256__8JquwLopp8; + lt r169.lo r161.lo into r170; + ternary r170 1u128 0u128 into r171; + sub.w r169.lo r161.lo into r172; + sub.w r169.hi r161.hi into r173; + sub.w r173 r171 into r174; + cast r174 r172 into r175 as U256__8JquwLopp8; + is.eq r175.hi 0u128 into r176; + is.eq r175.lo 0u128 into r177; + and r176 r177 into r178; + ternary r178 0u128 r175.hi into r179; + ternary r178 1u128 r175.lo into r180; + cast r179 r180 into r181 as U256__8JquwLopp8; + is.eq r175.hi 0u128 into r182; + is.eq r175.lo 0u128 into r183; + and r182 r183 into r184; + ternary r184 0u128 r153 into r185; + cast r185 0u128 into r186 as U256__8JquwLopp8; + cast 0u128 1u128 into r187 as U256__8JquwLopp8; + call view_mul_div r186 r187 r181 false into r188; + is.eq r188.hi 0u128 into r189; + assert.eq r189 true; + ternary r76 r7 0u128 into r190; + lt r48.hi r56.hi into r191; + gt r48.hi r56.hi into r192; + lt r48.lo r56.lo into r193; + ternary r192 false r193 into r194; + ternary r191 true r194 into r195; + ternary r195 r48.hi r56.hi into r196; + ternary r195 r48.lo r56.lo into r197; + cast r196 r197 into r198 as U256__8JquwLopp8; + lt r48.hi r56.hi into r199; + gt r48.hi r56.hi into r200; + lt r48.lo r56.lo into r201; + ternary r200 false r201 into r202; + ternary r199 true r202 into r203; + ternary r203 r56.hi r48.hi into r204; + ternary r203 r56.lo r48.lo into r205; + cast r204 r205 into r206 as U256__8JquwLopp8; + lt r206.lo r198.lo into r207; + ternary r207 1u128 0u128 into r208; + sub.w r206.lo r198.lo into r209; + sub.w r206.hi r198.hi into r210; + sub.w r210 r208 into r211; + cast r211 r209 into r212 as U256__8JquwLopp8; + is.eq r212.hi 0u128 into r213; + is.eq r212.lo 0u128 into r214; + and r213 r214 into r215; + ternary r215 0u128 r212.hi into r216; + ternary r215 1u128 r212.lo into r217; + cast r216 r217 into r218 as U256__8JquwLopp8; + is.eq r212.hi 0u128 into r219; + is.eq r212.lo 0u128 into r220; + and r219 r220 into r221; + ternary r221 0u128 r190 into r222; + cast r222 0u128 into r223 as U256__8JquwLopp8; + cast 0u128 1u128 into r224 as U256__8JquwLopp8; + call view_mul_div r223 r224 r218 false into r225; + is.eq r225.hi 0u128 into r226; + assert.eq r226 true; + lt r151.lo r188.lo into r227; + ternary r227 r151.lo r188.lo into r228; + ternary r69 r228 r225.lo into r229; + ternary r62 r113.lo r229 into r230; + gt r230 0u128 into r231; + assert.eq r231 true; + lt r39.hi r40.hi into r232; + gt r39.hi r40.hi into r233; + lt r39.lo r40.lo into r234; + ternary r233 false r234 into r235; + ternary r232 true r235 into r236; + ternary r236 r39.hi r40.hi into r237; + ternary r236 r39.lo r40.lo into r238; + cast r237 r238 into r239 as U256__8JquwLopp8; + lt r39.hi r40.hi into r240; + gt r39.hi r40.hi into r241; + lt r39.lo r40.lo into r242; + ternary r241 false r242 into r243; + ternary r240 true r243 into r244; + ternary r244 r40.hi r39.hi into r245; + ternary r244 r40.lo r39.lo into r246; + cast r245 r246 into r247 as U256__8JquwLopp8; + lt r239.hi r30.sqrt_price.hi into r248; + gt r239.hi r30.sqrt_price.hi into r249; + lt r239.lo r30.sqrt_price.lo into r250; + ternary r249 false r250 into r251; + ternary r248 true r251 into r252; + not r252 into r253; + not r253 into r254; + lt r30.sqrt_price.hi r247.hi into r255; + gt r30.sqrt_price.hi r247.hi into r256; + lt r30.sqrt_price.lo r247.lo into r257; + ternary r256 false r257 into r258; + ternary r255 true r258 into r259; + and r254 r259 into r260; + lt r30.sqrt_price.hi r247.hi into r261; + gt r30.sqrt_price.hi r247.hi into r262; + lt r30.sqrt_price.lo r247.lo into r263; + ternary r262 false r263 into r264; + ternary r261 true r264 into r265; + not r265 into r266; + and r254 r266 into r267; + ternary r253 r230 0u128 into r268; + lt r239.hi r247.hi into r269; + gt r239.hi r247.hi into r270; + lt r239.lo r247.lo into r271; + ternary r270 false r271 into r272; + ternary r269 true r272 into r273; + ternary r273 r239.hi r247.hi into r274; + ternary r273 r239.lo r247.lo into r275; + cast r274 r275 into r276 as U256__8JquwLopp8; + lt r239.hi r247.hi into r277; + gt r239.hi r247.hi into r278; + lt r239.lo r247.lo into r279; + ternary r278 false r279 into r280; + ternary r277 true r280 into r281; + ternary r281 r247.hi r239.hi into r282; + ternary r281 r247.lo r239.lo into r283; + cast r282 r283 into r284 as U256__8JquwLopp8; + lt r284.lo r276.lo into r285; + ternary r285 1u128 0u128 into r286; + sub.w r284.lo r276.lo into r287; + sub.w r284.hi r276.hi into r288; + sub.w r288 r286 into r289; + cast r289 r287 into r290 as U256__8JquwLopp8; + cast r268 0u128 into r291 as U256__8JquwLopp8; + call view_mul_div r291 r290 r284 true into r292; + cast 0u128 1u128 into r293 as U256__8JquwLopp8; + call view_mul_div r292 r293 r276 true into r294; + is.eq r294.hi 0u128 into r295; + assert.eq r295 true; + ternary r260 r230 0u128 into r296; + lt r30.sqrt_price.hi r247.hi into r297; + gt r30.sqrt_price.hi r247.hi into r298; + lt r30.sqrt_price.lo r247.lo into r299; + ternary r298 false r299 into r300; + ternary r297 true r300 into r301; + ternary r301 r30.sqrt_price.hi r247.hi into r302; + ternary r301 r30.sqrt_price.lo r247.lo into r303; + cast r302 r303 into r304 as U256__8JquwLopp8; + lt r30.sqrt_price.hi r247.hi into r305; + gt r30.sqrt_price.hi r247.hi into r306; + lt r30.sqrt_price.lo r247.lo into r307; + ternary r306 false r307 into r308; + ternary r305 true r308 into r309; + ternary r309 r247.hi r30.sqrt_price.hi into r310; + ternary r309 r247.lo r30.sqrt_price.lo into r311; + cast r310 r311 into r312 as U256__8JquwLopp8; + lt r312.lo r304.lo into r313; + ternary r313 1u128 0u128 into r314; + sub.w r312.lo r304.lo into r315; + sub.w r312.hi r304.hi into r316; + sub.w r316 r314 into r317; + cast r317 r315 into r318 as U256__8JquwLopp8; + cast r296 0u128 into r319 as U256__8JquwLopp8; + call view_mul_div r319 r318 r312 true into r320; + cast 0u128 1u128 into r321 as U256__8JquwLopp8; + call view_mul_div r320 r321 r304 true into r322; + is.eq r322.hi 0u128 into r323; + assert.eq r323 true; + lt r239.hi r30.sqrt_price.hi into r324; + gt r239.hi r30.sqrt_price.hi into r325; + lt r239.lo r30.sqrt_price.lo into r326; + ternary r325 false r326 into r327; + ternary r324 true r327 into r328; + ternary r328 r239.hi r30.sqrt_price.hi into r329; + ternary r328 r239.lo r30.sqrt_price.lo into r330; + cast r329 r330 into r331 as U256__8JquwLopp8; + lt r239.hi r30.sqrt_price.hi into r332; + gt r239.hi r30.sqrt_price.hi into r333; + lt r239.lo r30.sqrt_price.lo into r334; + ternary r333 false r334 into r335; + ternary r332 true r335 into r336; + ternary r336 r30.sqrt_price.hi r239.hi into r337; + ternary r336 r30.sqrt_price.lo r239.lo into r338; + cast r337 r338 into r339 as U256__8JquwLopp8; + lt r339.lo r331.lo into r340; + ternary r340 1u128 0u128 into r341; + sub.w r339.lo r331.lo into r342; + sub.w r339.hi r331.hi into r343; + sub.w r343 r341 into r344; + cast r344 r342 into r345 as U256__8JquwLopp8; + cast 0u128 r296 into r346 as U256__8JquwLopp8; + and r346.lo 18446744073709551615u128 into r347; + shr r346.lo 64u8 into r348; + and r345.lo 18446744073709551615u128 into r349; + shr r345.lo 64u8 into r350; + mul r347 r349 into r351; + mul r347 r350 into r352; + mul r348 r349 into r353; + mul r348 r350 into r354; + and r351 18446744073709551615u128 into r355; + shr r351 64u8 into r356; + and r352 18446744073709551615u128 into r357; + add r356 r357 into r358; + and r353 18446744073709551615u128 into r359; + add r358 r359 into r360; + and r360 18446744073709551615u128 into r361; + shr r360 64u8 into r362; + shr r352 64u8 into r363; + shr r353 64u8 into r364; + add r363 r364 into r365; + and r354 18446744073709551615u128 into r366; + add r365 r366 into r367; + add r367 r362 into r368; + and r368 18446744073709551615u128 into r369; + shr r368 64u8 into r370; + shr r354 64u8 into r371; + add r371 r370 into r372; + shl r372 64u8 into r373; + add r373 r369 into r374; + shl r361 64u8 into r375; + add r375 r355 into r376; + and r346.lo 18446744073709551615u128 into r377; + shr r346.lo 64u8 into r378; + and r345.hi 18446744073709551615u128 into r379; + shr r345.hi 64u8 into r380; + mul r377 r379 into r381; + mul r377 r380 into r382; + mul r378 r379 into r383; + mul r378 r380 into r384; + and r381 18446744073709551615u128 into r385; + shr r381 64u8 into r386; + and r382 18446744073709551615u128 into r387; + add r386 r387 into r388; + and r383 18446744073709551615u128 into r389; + add r388 r389 into r390; + and r390 18446744073709551615u128 into r391; + shr r390 64u8 into r392; + shr r382 64u8 into r393; + shr r383 64u8 into r394; + add r393 r394 into r395; + and r384 18446744073709551615u128 into r396; + add r395 r396 into r397; + add r397 r392 into r398; + and r398 18446744073709551615u128 into r399; + shr r398 64u8 into r400; + shr r384 64u8 into r401; + add r401 r400 into r402; + shl r402 64u8 into r403; + add r403 r399 into r404; + shl r391 64u8 into r405; + add r405 r385 into r406; + and r346.hi 18446744073709551615u128 into r407; + shr r346.hi 64u8 into r408; + and r345.lo 18446744073709551615u128 into r409; + shr r345.lo 64u8 into r410; + mul r407 r409 into r411; + mul r407 r410 into r412; + mul r408 r409 into r413; + mul r408 r410 into r414; + and r411 18446744073709551615u128 into r415; + shr r411 64u8 into r416; + and r412 18446744073709551615u128 into r417; + add r416 r417 into r418; + and r413 18446744073709551615u128 into r419; + add r418 r419 into r420; + and r420 18446744073709551615u128 into r421; + shr r420 64u8 into r422; + shr r412 64u8 into r423; + shr r413 64u8 into r424; + add r423 r424 into r425; + and r414 18446744073709551615u128 into r426; + add r425 r426 into r427; + add r427 r422 into r428; + and r428 18446744073709551615u128 into r429; + shr r428 64u8 into r430; + shr r414 64u8 into r431; + add r431 r430 into r432; + shl r432 64u8 into r433; + add r433 r429 into r434; + shl r421 64u8 into r435; + add r435 r415 into r436; + and r346.hi 18446744073709551615u128 into r437; + shr r346.hi 64u8 into r438; + and r345.hi 18446744073709551615u128 into r439; + shr r345.hi 64u8 into r440; + mul r437 r439 into r441; + mul r437 r440 into r442; + mul r438 r439 into r443; + mul r438 r440 into r444; + and r441 18446744073709551615u128 into r445; + shr r441 64u8 into r446; + and r442 18446744073709551615u128 into r447; + add r446 r447 into r448; + and r443 18446744073709551615u128 into r449; + add r448 r449 into r450; + and r450 18446744073709551615u128 into r451; + shr r450 64u8 into r452; + shr r442 64u8 into r453; + shr r443 64u8 into r454; + add r453 r454 into r455; + and r444 18446744073709551615u128 into r456; + add r455 r456 into r457; + add r457 r452 into r458; + and r458 18446744073709551615u128 into r459; + shr r458 64u8 into r460; + shr r444 64u8 into r461; + add r461 r460 into r462; + shl r462 64u8 into r463; + add r463 r459 into r464; + shl r451 64u8 into r465; + add r465 r445 into r466; + add.w r374 r406 into r467; + lt r467 r374 into r468; + ternary r468 1u128 0u128 into r469; + add.w r467 r436 into r470; + lt r470 r467 into r471; + ternary r471 1u128 0u128 into r472; + add r469 r472 into r473; + add.w r404 r434 into r474; + lt r474 r404 into r475; + ternary r475 1u128 0u128 into r476; + add.w r474 r466 into r477; + lt r477 r474 into r478; + ternary r478 1u128 0u128 into r479; + add.w r477 r473 into r480; + lt r480 r477 into r481; + ternary r481 1u128 0u128 into r482; + add r476 r479 into r483; + add r483 r482 into r484; + add.w r464 r484 into r485; + cast r485 r480 into r486 as U256__8JquwLopp8; + cast r470 r376 into r487 as U256__8JquwLopp8; + is.eq r486.hi 0u128 into r488; + is.eq r486.lo 0u128 into r489; + and r488 r489 into r490; + assert.eq r490 true; + gt r487.lo 0u128 into r491; + ternary r491 1u128 0u128 into r492; + add r487.hi r492 into r493; + ternary r267 r230 0u128 into r494; + lt r239.hi r247.hi into r495; + gt r239.hi r247.hi into r496; + lt r239.lo r247.lo into r497; + ternary r496 false r497 into r498; + ternary r495 true r498 into r499; + ternary r499 r239.hi r247.hi into r500; + ternary r499 r239.lo r247.lo into r501; + cast r500 r501 into r502 as U256__8JquwLopp8; + lt r239.hi r247.hi into r503; + gt r239.hi r247.hi into r504; + lt r239.lo r247.lo into r505; + ternary r504 false r505 into r506; + ternary r503 true r506 into r507; + ternary r507 r247.hi r239.hi into r508; + ternary r507 r247.lo r239.lo into r509; + cast r508 r509 into r510 as U256__8JquwLopp8; + lt r510.lo r502.lo into r511; + ternary r511 1u128 0u128 into r512; + sub.w r510.lo r502.lo into r513; + sub.w r510.hi r502.hi into r514; + sub.w r514 r512 into r515; + cast r515 r513 into r516 as U256__8JquwLopp8; + cast 0u128 r494 into r517 as U256__8JquwLopp8; + and r517.lo 18446744073709551615u128 into r518; + shr r517.lo 64u8 into r519; + and r516.lo 18446744073709551615u128 into r520; + shr r516.lo 64u8 into r521; + mul r518 r520 into r522; + mul r518 r521 into r523; + mul r519 r520 into r524; + mul r519 r521 into r525; + and r522 18446744073709551615u128 into r526; + shr r522 64u8 into r527; + and r523 18446744073709551615u128 into r528; + add r527 r528 into r529; + and r524 18446744073709551615u128 into r530; + add r529 r530 into r531; + and r531 18446744073709551615u128 into r532; + shr r531 64u8 into r533; + shr r523 64u8 into r534; + shr r524 64u8 into r535; + add r534 r535 into r536; + and r525 18446744073709551615u128 into r537; + add r536 r537 into r538; + add r538 r533 into r539; + and r539 18446744073709551615u128 into r540; + shr r539 64u8 into r541; + shr r525 64u8 into r542; + add r542 r541 into r543; + shl r543 64u8 into r544; + add r544 r540 into r545; + shl r532 64u8 into r546; + add r546 r526 into r547; + and r517.lo 18446744073709551615u128 into r548; + shr r517.lo 64u8 into r549; + and r516.hi 18446744073709551615u128 into r550; + shr r516.hi 64u8 into r551; + mul r548 r550 into r552; + mul r548 r551 into r553; + mul r549 r550 into r554; + mul r549 r551 into r555; + and r552 18446744073709551615u128 into r556; + shr r552 64u8 into r557; + and r553 18446744073709551615u128 into r558; + add r557 r558 into r559; + and r554 18446744073709551615u128 into r560; + add r559 r560 into r561; + and r561 18446744073709551615u128 into r562; + shr r561 64u8 into r563; + shr r553 64u8 into r564; + shr r554 64u8 into r565; + add r564 r565 into r566; + and r555 18446744073709551615u128 into r567; + add r566 r567 into r568; + add r568 r563 into r569; + and r569 18446744073709551615u128 into r570; + shr r569 64u8 into r571; + shr r555 64u8 into r572; + add r572 r571 into r573; + shl r573 64u8 into r574; + add r574 r570 into r575; + shl r562 64u8 into r576; + add r576 r556 into r577; + and r517.hi 18446744073709551615u128 into r578; + shr r517.hi 64u8 into r579; + and r516.lo 18446744073709551615u128 into r580; + shr r516.lo 64u8 into r581; + mul r578 r580 into r582; + mul r578 r581 into r583; + mul r579 r580 into r584; + mul r579 r581 into r585; + and r582 18446744073709551615u128 into r586; + shr r582 64u8 into r587; + and r583 18446744073709551615u128 into r588; + add r587 r588 into r589; + and r584 18446744073709551615u128 into r590; + add r589 r590 into r591; + and r591 18446744073709551615u128 into r592; + shr r591 64u8 into r593; + shr r583 64u8 into r594; + shr r584 64u8 into r595; + add r594 r595 into r596; + and r585 18446744073709551615u128 into r597; + add r596 r597 into r598; + add r598 r593 into r599; + and r599 18446744073709551615u128 into r600; + shr r599 64u8 into r601; + shr r585 64u8 into r602; + add r602 r601 into r603; + shl r603 64u8 into r604; + add r604 r600 into r605; + shl r592 64u8 into r606; + add r606 r586 into r607; + and r517.hi 18446744073709551615u128 into r608; + shr r517.hi 64u8 into r609; + and r516.hi 18446744073709551615u128 into r610; + shr r516.hi 64u8 into r611; + mul r608 r610 into r612; + mul r608 r611 into r613; + mul r609 r610 into r614; + mul r609 r611 into r615; + and r612 18446744073709551615u128 into r616; + shr r612 64u8 into r617; + and r613 18446744073709551615u128 into r618; + add r617 r618 into r619; + and r614 18446744073709551615u128 into r620; + add r619 r620 into r621; + and r621 18446744073709551615u128 into r622; + shr r621 64u8 into r623; + shr r613 64u8 into r624; + shr r614 64u8 into r625; + add r624 r625 into r626; + and r615 18446744073709551615u128 into r627; + add r626 r627 into r628; + add r628 r623 into r629; + and r629 18446744073709551615u128 into r630; + shr r629 64u8 into r631; + shr r615 64u8 into r632; + add r632 r631 into r633; + shl r633 64u8 into r634; + add r634 r630 into r635; + shl r622 64u8 into r636; + add r636 r616 into r637; + add.w r545 r577 into r638; + lt r638 r545 into r639; + ternary r639 1u128 0u128 into r640; + add.w r638 r607 into r641; + lt r641 r638 into r642; + ternary r642 1u128 0u128 into r643; + add r640 r643 into r644; + add.w r575 r605 into r645; + lt r645 r575 into r646; + ternary r646 1u128 0u128 into r647; + add.w r645 r637 into r648; + lt r648 r645 into r649; + ternary r649 1u128 0u128 into r650; + add.w r648 r644 into r651; + lt r651 r648 into r652; + ternary r652 1u128 0u128 into r653; + add r647 r650 into r654; + add r654 r653 into r655; + add.w r635 r655 into r656; + cast r656 r651 into r657 as U256__8JquwLopp8; + cast r641 r547 into r658 as U256__8JquwLopp8; + is.eq r657.hi 0u128 into r659; + is.eq r657.lo 0u128 into r660; + and r659 r660 into r661; + assert.eq r661 true; + gt r658.lo 0u128 into r662; + ternary r662 1u128 0u128 into r663; + add r658.hi r663 into r664; + ternary r260 r322.lo 0u128 into r665; + ternary r253 r294.lo r665 into r666; + ternary r267 r664 0u128 into r667; + ternary r260 r493 r667 into r668; + lte r666 r6 into r669; + lte r668 r7 into r670; + and r669 r670 into r671; + assert.eq r671 true; + gte r666 r8 into r672; + gte r668 r9 into r673; + and r672 r673 into r674; + assert.eq r674 true; + lt r30.sqrt_price.hi r40.hi into r675; + gt r30.sqrt_price.hi r40.hi into r676; + lt r30.sqrt_price.lo r40.lo into r677; + ternary r676 false r677 into r678; + ternary r675 true r678 into r679; + branch.eq r679 false to end_then_0_2; + gt r666 0u128 into r680; + assert.eq r680 true; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + lt r39.hi r30.sqrt_price.hi into r681; + gt r39.hi r30.sqrt_price.hi into r682; + lt r39.lo r30.sqrt_price.lo into r683; + ternary r682 false r683 into r684; + ternary r681 true r684 into r685; + branch.eq r685 false to end_then_0_4; + gt r668 0u128 into r686; + assert.eq r686 true; + branch.eq true true to end_otherwise_0_5; + position end_then_0_4; + position end_otherwise_0_5; + cast r3 r4 into r687 as TickKey; + hash.bhp256 r687 into r688 as field; + cast r3 r5 into r689 as TickKey; + hash.bhp256 r689 into r690 as field; + cast 0u128 0u128 into r691 as U256__8JquwLopp8; + cast 0u128 0u128 into r692 as U256__8JquwLopp8; + cast r3 0i128 0u128 r4 r691 r692 0i32 0i32 into r693 as Tick; + cast 0u128 0u128 into r694 as U256__8JquwLopp8; + cast 0u128 0u128 into r695 as U256__8JquwLopp8; + cast r3 0i128 0u128 r5 r694 r695 0i32 0i32 into r696 as Tick; + get.or_use ticks[r688] r693 into r697; + get.or_use ticks[r690] r696 into r698; + gt r697.liquidity_gross 0u128 into r699; + gt r698.liquidity_gross 0u128 into r700; + add r697.liquidity_gross r230 into r701; + add r698.liquidity_gross r230 into r702; + lte r701 r30.max_liquidity_per_tick into r703; + assert.eq r703 true; + lte r702 r30.max_liquidity_per_tick into r704; + assert.eq r704 true; + not r699 into r705; + lte r4 r30.tick into r706; + and r705 r706 into r707; + ternary r707 r30.fee_growth_global0_x_128.hi r697.fee_growth_outside0_x_128.hi into r708; + ternary r707 r30.fee_growth_global0_x_128.lo r697.fee_growth_outside0_x_128.lo into r709; + cast r708 r709 into r710 as U256__8JquwLopp8; + lte r4 r30.tick into r711; + and r705 r711 into r712; + ternary r712 r30.fee_growth_global1_x_128.hi r697.fee_growth_outside1_x_128.hi into r713; + ternary r712 r30.fee_growth_global1_x_128.lo r697.fee_growth_outside1_x_128.lo into r714; + cast r713 r714 into r715 as U256__8JquwLopp8; + not r700 into r716; + lte r5 r30.tick into r717; + and r716 r717 into r718; + ternary r718 r30.fee_growth_global0_x_128.hi r698.fee_growth_outside0_x_128.hi into r719; + ternary r718 r30.fee_growth_global0_x_128.lo r698.fee_growth_outside0_x_128.lo into r720; + cast r719 r720 into r721 as U256__8JquwLopp8; + lte r5 r30.tick into r722; + and r716 r722 into r723; + ternary r723 r30.fee_growth_global1_x_128.hi r698.fee_growth_outside1_x_128.hi into r724; + ternary r723 r30.fee_growth_global1_x_128.lo r698.fee_growth_outside1_x_128.lo into r725; + cast r724 r725 into r726 as U256__8JquwLopp8; + ternary r699 -400001i32 r12 into r727; + cast r3 r727 into r728 as TickKey; + hash.bhp256 r728 into r729 as field; + get ticks[r729] into r730; + branch.eq r705 false to end_then_0_6; + is.eq r730.pool r3 into r731; + assert.eq r731 true; + is.eq r730.tick r12 into r732; + assert.eq r732 true; + is.eq r12 -400001i32 into r733; + gt r730.liquidity_gross 0u128 into r734; + or r733 r734 into r735; + assert.eq r735 true; + lt r730.tick r4 into r736; + assert.eq r736 true; + gt r730.next r4 into r737; + assert.eq r737 true; + branch.eq true true to end_otherwise_0_7; + position end_then_0_6; + position end_otherwise_0_7; + ternary r699 r697.prev r12 into r738; + ternary r699 r697.next r730.next into r739; + cast r230 into r740 as i128; + add r697.liquidity_net r740 into r741; + cast r3 r741 r701 r4 r710 r715 r738 r739 into r742 as Tick; + set r742 into ticks[r688]; + branch.eq r705 false to end_then_0_8; + cast r730.pool r730.liquidity_net r730.liquidity_gross r730.tick r730.fee_growth_outside0_x_128 r730.fee_growth_outside1_x_128 r730.prev r4 into r743 as Tick; + set r743 into ticks[r729]; + cast r3 r739 into r744 as TickKey; + hash.bhp256 r744 into r745 as field; + get ticks[r745] into r746; + cast r746.pool r746.liquidity_net r746.liquidity_gross r746.tick r746.fee_growth_outside0_x_128 r746.fee_growth_outside1_x_128 r4 r746.next into r747 as Tick; + set r747 into ticks[r745]; + branch.eq true true to end_otherwise_0_9; + position end_then_0_8; + position end_otherwise_0_9; + get.or_use ticks[r690] r696 into r748; + ternary r700 -400001i32 r13 into r749; + cast r3 r749 into r750 as TickKey; + hash.bhp256 r750 into r751 as field; + get ticks[r751] into r752; + branch.eq r716 false to end_then_0_10; + is.eq r752.pool r3 into r753; + assert.eq r753 true; + is.eq r752.tick r13 into r754; + assert.eq r754 true; + is.eq r13 -400001i32 into r755; + gt r752.liquidity_gross 0u128 into r756; + or r755 r756 into r757; + assert.eq r757 true; + lt r752.tick r5 into r758; + assert.eq r758 true; + gt r752.next r5 into r759; + assert.eq r759 true; + branch.eq true true to end_otherwise_0_11; + position end_then_0_10; + position end_otherwise_0_11; + ternary r700 r748.prev r13 into r760; + ternary r700 r748.next r752.next into r761; + cast r230 into r762 as i128; + sub r748.liquidity_net r762 into r763; + cast r3 r763 r702 r5 r721 r726 r760 r761 into r764 as Tick; + set r764 into ticks[r690]; + branch.eq r716 false to end_then_0_12; + get ticks[r751] into r765; + cast r765.pool r765.liquidity_net r765.liquidity_gross r765.tick r765.fee_growth_outside0_x_128 r765.fee_growth_outside1_x_128 r765.prev r5 into r766 as Tick; + set r766 into ticks[r751]; + cast r3 r761 into r767 as TickKey; + hash.bhp256 r767 into r768 as field; + get ticks[r768] into r769; + cast r769.pool r769.liquidity_net r769.liquidity_gross r769.tick r769.fee_growth_outside0_x_128 r769.fee_growth_outside1_x_128 r5 r769.next into r770 as Tick; + set r770 into ticks[r768]; + branch.eq true true to end_otherwise_0_13; + position end_then_0_12; + position end_otherwise_0_13; + get ticks[r688] into r771; + get ticks[r690] into r772; + gte r30.tick r771.tick into r773; + lt r30.fee_growth_global0_x_128.lo r771.fee_growth_outside0_x_128.lo into r774; + ternary r774 1u128 0u128 into r775; + sub.w r30.fee_growth_global0_x_128.lo r771.fee_growth_outside0_x_128.lo into r776; + sub.w r30.fee_growth_global0_x_128.hi r771.fee_growth_outside0_x_128.hi into r777; + sub.w r777 r775 into r778; + cast r778 r776 into r779 as U256__8JquwLopp8; + lt r30.fee_growth_global1_x_128.lo r771.fee_growth_outside1_x_128.lo into r780; + ternary r780 1u128 0u128 into r781; + sub.w r30.fee_growth_global1_x_128.lo r771.fee_growth_outside1_x_128.lo into r782; + sub.w r30.fee_growth_global1_x_128.hi r771.fee_growth_outside1_x_128.hi into r783; + sub.w r783 r781 into r784; + cast r784 r782 into r785 as U256__8JquwLopp8; + ternary r773 r771.fee_growth_outside0_x_128.hi r779.hi into r786; + ternary r773 r771.fee_growth_outside0_x_128.lo r779.lo into r787; + cast r786 r787 into r788 as U256__8JquwLopp8; + ternary r773 r771.fee_growth_outside1_x_128.hi r785.hi into r789; + ternary r773 r771.fee_growth_outside1_x_128.lo r785.lo into r790; + cast r789 r790 into r791 as U256__8JquwLopp8; + lt r30.tick r772.tick into r792; + lt r30.fee_growth_global0_x_128.lo r772.fee_growth_outside0_x_128.lo into r793; + ternary r793 1u128 0u128 into r794; + sub.w r30.fee_growth_global0_x_128.lo r772.fee_growth_outside0_x_128.lo into r795; + sub.w r30.fee_growth_global0_x_128.hi r772.fee_growth_outside0_x_128.hi into r796; + sub.w r796 r794 into r797; + cast r797 r795 into r798 as U256__8JquwLopp8; + lt r30.fee_growth_global1_x_128.lo r772.fee_growth_outside1_x_128.lo into r799; + ternary r799 1u128 0u128 into r800; + sub.w r30.fee_growth_global1_x_128.lo r772.fee_growth_outside1_x_128.lo into r801; + sub.w r30.fee_growth_global1_x_128.hi r772.fee_growth_outside1_x_128.hi into r802; + sub.w r802 r800 into r803; + cast r803 r801 into r804 as U256__8JquwLopp8; + ternary r792 r772.fee_growth_outside0_x_128.hi r798.hi into r805; + ternary r792 r772.fee_growth_outside0_x_128.lo r798.lo into r806; + cast r805 r806 into r807 as U256__8JquwLopp8; + ternary r792 r772.fee_growth_outside1_x_128.hi r804.hi into r808; + ternary r792 r772.fee_growth_outside1_x_128.lo r804.lo into r809; + cast r808 r809 into r810 as U256__8JquwLopp8; + lt r30.fee_growth_global0_x_128.lo r788.lo into r811; + ternary r811 1u128 0u128 into r812; + sub.w r30.fee_growth_global0_x_128.lo r788.lo into r813; + sub.w r30.fee_growth_global0_x_128.hi r788.hi into r814; + sub.w r814 r812 into r815; + cast r815 r813 into r816 as U256__8JquwLopp8; + lt r816.lo r807.lo into r817; + ternary r817 1u128 0u128 into r818; + sub.w r816.lo r807.lo into r819; + sub.w r816.hi r807.hi into r820; + sub.w r820 r818 into r821; + cast r821 r819 into r822 as U256__8JquwLopp8; + lt r30.fee_growth_global1_x_128.lo r791.lo into r823; + ternary r823 1u128 0u128 into r824; + sub.w r30.fee_growth_global1_x_128.lo r791.lo into r825; + sub.w r30.fee_growth_global1_x_128.hi r791.hi into r826; + sub.w r826 r824 into r827; + cast r827 r825 into r828 as U256__8JquwLopp8; + lt r828.lo r810.lo into r829; + ternary r829 1u128 0u128 into r830; + sub.w r828.lo r810.lo into r831; + sub.w r828.hi r810.hi into r832; + sub.w r832 r830 into r833; + cast r833 r831 into r834 as U256__8JquwLopp8; + lt r822.lo r31.fee_growth_inside0_last_x_128.lo into r835; + ternary r835 1u128 0u128 into r836; + sub.w r822.lo r31.fee_growth_inside0_last_x_128.lo into r837; + sub.w r822.hi r31.fee_growth_inside0_last_x_128.hi into r838; + sub.w r838 r836 into r839; + cast r839 r837 into r840 as U256__8JquwLopp8; + and r840.hi 18446744073709551615u128 into r841; + shr r840.hi 64u8 into r842; + and r31.liquidity 18446744073709551615u128 into r843; + shr r31.liquidity 64u8 into r844; + mul r841 r843 into r845; + mul r841 r844 into r846; + mul r842 r843 into r847; + mul r842 r844 into r848; + and r845 18446744073709551615u128 into r849; + shr r845 64u8 into r850; + and r846 18446744073709551615u128 into r851; + add r850 r851 into r852; + and r847 18446744073709551615u128 into r853; + add r852 r853 into r854; + and r854 18446744073709551615u128 into r855; + shr r854 64u8 into r856; + shr r846 64u8 into r857; + shr r847 64u8 into r858; + add r857 r858 into r859; + and r848 18446744073709551615u128 into r860; + add r859 r860 into r861; + add r861 r856 into r862; + and r862 18446744073709551615u128 into r863; + shr r862 64u8 into r864; + shr r848 64u8 into r865; + add r865 r864 into r866; + shl r866 64u8 into r867; + add r867 r863 into r868; + shl r855 64u8 into r869; + add r869 r849 into r870; + and r840.lo 18446744073709551615u128 into r871; + shr r840.lo 64u8 into r872; + mul r871 r843 into r873; + mul r871 r844 into r874; + mul r872 r843 into r875; + mul r872 r844 into r876; + and r873 18446744073709551615u128 into r877; + shr r873 64u8 into r878; + and r874 18446744073709551615u128 into r879; + add r878 r879 into r880; + and r875 18446744073709551615u128 into r881; + add r880 r881 into r882; + and r882 18446744073709551615u128 into r883; + shr r882 64u8 into r884; + shr r874 64u8 into r885; + shr r875 64u8 into r886; + add r885 r886 into r887; + and r876 18446744073709551615u128 into r888; + add r887 r888 into r889; + add r889 r884 into r890; + and r890 18446744073709551615u128 into r891; + shr r890 64u8 into r892; + shr r876 64u8 into r893; + add r893 r892 into r894; + shl r894 64u8 into r895; + add r895 r891 into r896; + shl r883 64u8 into r897; + add r897 r877 into r898; + sub 340282366920938463463374607431768211455u128 r870 into r899; + lte r896 r899 into r900; + is.eq r868 0u128 into r901; + and r901 r900 into r902; + assert.eq r902 true; + add r870 r896 into r903; + lt r834.lo r31.fee_growth_inside1_last_x_128.lo into r904; + ternary r904 1u128 0u128 into r905; + sub.w r834.lo r31.fee_growth_inside1_last_x_128.lo into r906; + sub.w r834.hi r31.fee_growth_inside1_last_x_128.hi into r907; + sub.w r907 r905 into r908; + cast r908 r906 into r909 as U256__8JquwLopp8; + and r909.hi 18446744073709551615u128 into r910; + shr r909.hi 64u8 into r911; + and r31.liquidity 18446744073709551615u128 into r912; + shr r31.liquidity 64u8 into r913; + mul r910 r912 into r914; + mul r910 r913 into r915; + mul r911 r912 into r916; + mul r911 r913 into r917; + and r914 18446744073709551615u128 into r918; + shr r914 64u8 into r919; + and r915 18446744073709551615u128 into r920; + add r919 r920 into r921; + and r916 18446744073709551615u128 into r922; + add r921 r922 into r923; + and r923 18446744073709551615u128 into r924; + shr r923 64u8 into r925; + shr r915 64u8 into r926; + shr r916 64u8 into r927; + add r926 r927 into r928; + and r917 18446744073709551615u128 into r929; + add r928 r929 into r930; + add r930 r925 into r931; + and r931 18446744073709551615u128 into r932; + shr r931 64u8 into r933; + shr r917 64u8 into r934; + add r934 r933 into r935; + shl r935 64u8 into r936; + add r936 r932 into r937; + shl r924 64u8 into r938; + add r938 r918 into r939; + and r909.lo 18446744073709551615u128 into r940; + shr r909.lo 64u8 into r941; + mul r940 r912 into r942; + mul r940 r913 into r943; + mul r941 r912 into r944; + mul r941 r913 into r945; + and r942 18446744073709551615u128 into r946; + shr r942 64u8 into r947; + and r943 18446744073709551615u128 into r948; + add r947 r948 into r949; + and r944 18446744073709551615u128 into r950; + add r949 r950 into r951; + and r951 18446744073709551615u128 into r952; + shr r951 64u8 into r953; + shr r943 64u8 into r954; + shr r944 64u8 into r955; + add r954 r955 into r956; + and r945 18446744073709551615u128 into r957; + add r956 r957 into r958; + add r958 r953 into r959; + and r959 18446744073709551615u128 into r960; + shr r959 64u8 into r961; + shr r945 64u8 into r962; + add r962 r961 into r963; + shl r963 64u8 into r964; + add r964 r960 into r965; + shl r952 64u8 into r966; + add r966 r946 into r967; + sub 340282366920938463463374607431768211455u128 r939 into r968; + lte r965 r968 into r969; + is.eq r937 0u128 into r970; + and r970 r969 into r971; + assert.eq r971 true; + add r939 r965 into r972; + sub r6 r666 into r973; + sub r7 r668 into r974; + add r31.liquidity r230 into r975; + add r31.tokens_owed0 r903 into r976; + add r976 r973 into r977; + add r31.tokens_owed1 r972 into r978; + add r978 r974 into r979; + cast r2 r3 r4 r5 r975 r822 r834 r977 r979 into r980 as Position; + set r980 into positions[r2]; + lte r4 r30.tick into r981; + and r705 r981 into r982; + gt r4 r30.next_init_below into r983; + and r982 r983 into r984; + ternary r984 r4 r30.next_init_below into r985; + gt r4 r30.tick into r986; + and r705 r986 into r987; + lt r4 r30.next_init_above into r988; + and r987 r988 into r989; + ternary r989 r4 r30.next_init_above into r990; + lte r5 r30.tick into r991; + and r716 r991 into r992; + gt r5 r985 into r993; + and r992 r993 into r994; + ternary r994 r5 r985 into r995; + gt r5 r30.tick into r996; + and r716 r996 into r997; + lt r5 r990 into r998; + and r997 r998 into r999; + ternary r999 r5 r990 into r1000; + gte r30.tick r4 into r1001; + lt r30.tick r5 into r1002; + and r1001 r1002 into r1003; + add r30.liquidity r230 into r1004; + ternary r1003 r1004 r30.liquidity into r1005; + cast r30.tick r30.tick_spacing r30.sqrt_price r30.fee_protocol r1005 r30.fee_growth_global0_x_128 r30.fee_growth_global1_x_128 r30.max_liquidity_per_tick r30.protocol_fees0 r30.protocol_fees1 r995 r1000 into r1006 as Slot; + set r1006 into slots[r3]; + +function collect: + input r0 as PositionNFT.record; + input r1 as u128.public; + input r2 as u128.public; + input r3 as field.public; + input r4 as field.public; + input r5 as [MerkleProof; 2u32].private; + input r6 as [MerkleProof; 2u32].private; + is.eq self.caller aleo18sekmsl46y6skh3kvkekmw4kqqm7d6rz79akpsg58r7wpp5klyyq0qtzqf into r7; + call assert_valid_position_address r0.withdrawal; + rem r5[0u32].leaf_index 2u32 into r8; + is.eq r8 0u32 into r9; + cast 1field r5[0u32].siblings[0u32] r5[0u32].siblings[1u32] into r10 as [field; 3u32]; + cast 1field r5[0u32].siblings[1u32] r5[0u32].siblings[0u32] into r11 as [field; 3u32]; + ternary r9 r10[0u32] r11[0u32] into r12; + ternary r9 r10[1u32] r11[1u32] into r13; + ternary r9 r10[2u32] r11[2u32] into r14; + cast r12 r13 r14 into r15 as [field; 3u32]; + hash.psd4 r15 into r16 as field; + is.eq r5[0u32].siblings[2u32] 0field into r17; + div r5[0u32].leaf_index 2u32 into r18; + rem r18 2u32 into r19; + is.eq r19 0u32 into r20; + cast 0field r16 r5[0u32].siblings[2u32] into r21 as [field; 3u32]; + cast 0field r5[0u32].siblings[2u32] r16 into r22 as [field; 3u32]; + ternary r20 r21[0u32] r22[0u32] into r23; + ternary r20 r21[1u32] r22[1u32] into r24; + ternary r20 r21[2u32] r22[2u32] into r25; + cast r23 r24 r25 into r26 as [field; 3u32]; + hash.psd4 r26 into r27 as field; + is.eq r5[0u32].siblings[3u32] 0field into r28; + div r5[0u32].leaf_index 4u32 into r29; + rem r29 2u32 into r30; + is.eq r30 0u32 into r31; + cast 0field r27 r5[0u32].siblings[3u32] into r32 as [field; 3u32]; + cast 0field r5[0u32].siblings[3u32] r27 into r33 as [field; 3u32]; + ternary r31 r32[0u32] r33[0u32] into r34; + ternary r31 r32[1u32] r33[1u32] into r35; + ternary r31 r32[2u32] r33[2u32] into r36; + cast r34 r35 r36 into r37 as [field; 3u32]; + hash.psd4 r37 into r38 as field; + is.eq r5[0u32].siblings[4u32] 0field into r39; + div r5[0u32].leaf_index 8u32 into r40; + rem r40 2u32 into r41; + is.eq r41 0u32 into r42; + cast 0field r38 r5[0u32].siblings[4u32] into r43 as [field; 3u32]; + cast 0field r5[0u32].siblings[4u32] r38 into r44 as [field; 3u32]; + ternary r42 r43[0u32] r44[0u32] into r45; + ternary r42 r43[1u32] r44[1u32] into r46; + ternary r42 r43[2u32] r44[2u32] into r47; + cast r45 r46 r47 into r48 as [field; 3u32]; + hash.psd4 r48 into r49 as field; + is.eq r5[0u32].siblings[5u32] 0field into r50; + div r5[0u32].leaf_index 16u32 into r51; + rem r51 2u32 into r52; + is.eq r52 0u32 into r53; + cast 0field r49 r5[0u32].siblings[5u32] into r54 as [field; 3u32]; + cast 0field r5[0u32].siblings[5u32] r49 into r55 as [field; 3u32]; + ternary r53 r54[0u32] r55[0u32] into r56; + ternary r53 r54[1u32] r55[1u32] into r57; + ternary r53 r54[2u32] r55[2u32] into r58; + cast r56 r57 r58 into r59 as [field; 3u32]; + hash.psd4 r59 into r60 as field; + is.eq r5[0u32].siblings[6u32] 0field into r61; + div r5[0u32].leaf_index 32u32 into r62; + rem r62 2u32 into r63; + is.eq r63 0u32 into r64; + cast 0field r60 r5[0u32].siblings[6u32] into r65 as [field; 3u32]; + cast 0field r5[0u32].siblings[6u32] r60 into r66 as [field; 3u32]; + ternary r64 r65[0u32] r66[0u32] into r67; + ternary r64 r65[1u32] r66[1u32] into r68; + ternary r64 r65[2u32] r66[2u32] into r69; + cast r67 r68 r69 into r70 as [field; 3u32]; + hash.psd4 r70 into r71 as field; + is.eq r5[0u32].siblings[7u32] 0field into r72; + div r5[0u32].leaf_index 64u32 into r73; + rem r73 2u32 into r74; + is.eq r74 0u32 into r75; + cast 0field r71 r5[0u32].siblings[7u32] into r76 as [field; 3u32]; + cast 0field r5[0u32].siblings[7u32] r71 into r77 as [field; 3u32]; + ternary r75 r76[0u32] r77[0u32] into r78; + ternary r75 r76[1u32] r77[1u32] into r79; + ternary r75 r76[2u32] r77[2u32] into r80; + cast r78 r79 r80 into r81 as [field; 3u32]; + hash.psd4 r81 into r82 as field; + is.eq r5[0u32].siblings[8u32] 0field into r83; + div r5[0u32].leaf_index 128u32 into r84; + rem r84 2u32 into r85; + is.eq r85 0u32 into r86; + cast 0field r82 r5[0u32].siblings[8u32] into r87 as [field; 3u32]; + cast 0field r5[0u32].siblings[8u32] r82 into r88 as [field; 3u32]; + ternary r86 r87[0u32] r88[0u32] into r89; + ternary r86 r87[1u32] r88[1u32] into r90; + ternary r86 r87[2u32] r88[2u32] into r91; + cast r89 r90 r91 into r92 as [field; 3u32]; + hash.psd4 r92 into r93 as field; + is.eq r5[0u32].siblings[9u32] 0field into r94; + div r5[0u32].leaf_index 256u32 into r95; + rem r95 2u32 into r96; + is.eq r96 0u32 into r97; + cast 0field r93 r5[0u32].siblings[9u32] into r98 as [field; 3u32]; + cast 0field r5[0u32].siblings[9u32] r93 into r99 as [field; 3u32]; + ternary r97 r98[0u32] r99[0u32] into r100; + ternary r97 r98[1u32] r99[1u32] into r101; + ternary r97 r98[2u32] r99[2u32] into r102; + cast r100 r101 r102 into r103 as [field; 3u32]; + hash.psd4 r103 into r104 as field; + is.eq r5[0u32].siblings[10u32] 0field into r105; + div r5[0u32].leaf_index 512u32 into r106; + rem r106 2u32 into r107; + is.eq r107 0u32 into r108; + cast 0field r104 r5[0u32].siblings[10u32] into r109 as [field; 3u32]; + cast 0field r5[0u32].siblings[10u32] r104 into r110 as [field; 3u32]; + ternary r108 r109[0u32] r110[0u32] into r111; + ternary r108 r109[1u32] r110[1u32] into r112; + ternary r108 r109[2u32] r110[2u32] into r113; + cast r111 r112 r113 into r114 as [field; 3u32]; + hash.psd4 r114 into r115 as field; + is.eq r5[0u32].siblings[11u32] 0field into r116; + div r5[0u32].leaf_index 1024u32 into r117; + rem r117 2u32 into r118; + is.eq r118 0u32 into r119; + cast 0field r115 r5[0u32].siblings[11u32] into r120 as [field; 3u32]; + cast 0field r5[0u32].siblings[11u32] r115 into r121 as [field; 3u32]; + ternary r119 r120[0u32] r121[0u32] into r122; + ternary r119 r120[1u32] r121[1u32] into r123; + ternary r119 r120[2u32] r121[2u32] into r124; + cast r122 r123 r124 into r125 as [field; 3u32]; + hash.psd4 r125 into r126 as field; + is.eq r5[0u32].siblings[12u32] 0field into r127; + div r5[0u32].leaf_index 2048u32 into r128; + rem r128 2u32 into r129; + is.eq r129 0u32 into r130; + cast 0field r126 r5[0u32].siblings[12u32] into r131 as [field; 3u32]; + cast 0field r5[0u32].siblings[12u32] r126 into r132 as [field; 3u32]; + ternary r130 r131[0u32] r132[0u32] into r133; + ternary r130 r131[1u32] r132[1u32] into r134; + ternary r130 r131[2u32] r132[2u32] into r135; + cast r133 r134 r135 into r136 as [field; 3u32]; + hash.psd4 r136 into r137 as field; + is.eq r5[0u32].siblings[13u32] 0field into r138; + div r5[0u32].leaf_index 4096u32 into r139; + rem r139 2u32 into r140; + is.eq r140 0u32 into r141; + cast 0field r137 r5[0u32].siblings[13u32] into r142 as [field; 3u32]; + cast 0field r5[0u32].siblings[13u32] r137 into r143 as [field; 3u32]; + ternary r141 r142[0u32] r143[0u32] into r144; + ternary r141 r142[1u32] r143[1u32] into r145; + ternary r141 r142[2u32] r143[2u32] into r146; + cast r144 r145 r146 into r147 as [field; 3u32]; + hash.psd4 r147 into r148 as field; + is.eq r5[0u32].siblings[14u32] 0field into r149; + div r5[0u32].leaf_index 8192u32 into r150; + rem r150 2u32 into r151; + is.eq r151 0u32 into r152; + cast 0field r148 r5[0u32].siblings[14u32] into r153 as [field; 3u32]; + cast 0field r5[0u32].siblings[14u32] r148 into r154 as [field; 3u32]; + ternary r152 r153[0u32] r154[0u32] into r155; + ternary r152 r153[1u32] r154[1u32] into r156; + ternary r152 r153[2u32] r154[2u32] into r157; + cast r155 r156 r157 into r158 as [field; 3u32]; + hash.psd4 r158 into r159 as field; + is.eq r5[0u32].siblings[15u32] 0field into r160; + div r5[0u32].leaf_index 16384u32 into r161; + rem r161 2u32 into r162; + is.eq r162 0u32 into r163; + cast 0field r159 r5[0u32].siblings[15u32] into r164 as [field; 3u32]; + cast 0field r5[0u32].siblings[15u32] r159 into r165 as [field; 3u32]; + ternary r163 r164[0u32] r165[0u32] into r166; + ternary r163 r164[1u32] r165[1u32] into r167; + ternary r163 r164[2u32] r165[2u32] into r168; + cast r166 r167 r168 into r169 as [field; 3u32]; + hash.psd4 r169 into r170 as field; + ternary r160 r159 r170 into r171; + ternary r160 14u32 15u32 into r172; + ternary r149 r148 r171 into r173; + ternary r149 13u32 r172 into r174; + ternary r138 r137 r173 into r175; + ternary r138 12u32 r174 into r176; + ternary r127 r126 r175 into r177; + ternary r127 11u32 r176 into r178; + ternary r116 r115 r177 into r179; + ternary r116 10u32 r178 into r180; + ternary r105 r104 r179 into r181; + ternary r105 9u32 r180 into r182; + ternary r94 r93 r181 into r183; + ternary r94 8u32 r182 into r184; + ternary r83 r82 r183 into r185; + ternary r83 7u32 r184 into r186; + ternary r72 r71 r185 into r187; + ternary r72 6u32 r186 into r188; + ternary r61 r60 r187 into r189; + ternary r61 5u32 r188 into r190; + ternary r50 r49 r189 into r191; + ternary r50 4u32 r190 into r192; + ternary r39 r38 r191 into r193; + ternary r39 3u32 r192 into r194; + ternary r28 r27 r193 into r195; + ternary r28 2u32 r194 into r196; + ternary r17 r16 r195 into r197; + ternary r17 1u32 r196 into r198; + rem r5[1u32].leaf_index 2u32 into r199; + is.eq r199 0u32 into r200; + cast 1field r5[1u32].siblings[0u32] r5[1u32].siblings[1u32] into r201 as [field; 3u32]; + cast 1field r5[1u32].siblings[1u32] r5[1u32].siblings[0u32] into r202 as [field; 3u32]; + ternary r200 r201[0u32] r202[0u32] into r203; + ternary r200 r201[1u32] r202[1u32] into r204; + ternary r200 r201[2u32] r202[2u32] into r205; + cast r203 r204 r205 into r206 as [field; 3u32]; + hash.psd4 r206 into r207 as field; + is.eq r5[1u32].siblings[2u32] 0field into r208; + div r5[1u32].leaf_index 2u32 into r209; + rem r209 2u32 into r210; + is.eq r210 0u32 into r211; + cast 0field r207 r5[1u32].siblings[2u32] into r212 as [field; 3u32]; + cast 0field r5[1u32].siblings[2u32] r207 into r213 as [field; 3u32]; + ternary r211 r212[0u32] r213[0u32] into r214; + ternary r211 r212[1u32] r213[1u32] into r215; + ternary r211 r212[2u32] r213[2u32] into r216; + cast r214 r215 r216 into r217 as [field; 3u32]; + hash.psd4 r217 into r218 as field; + is.eq r5[1u32].siblings[3u32] 0field into r219; + div r5[1u32].leaf_index 4u32 into r220; + rem r220 2u32 into r221; + is.eq r221 0u32 into r222; + cast 0field r218 r5[1u32].siblings[3u32] into r223 as [field; 3u32]; + cast 0field r5[1u32].siblings[3u32] r218 into r224 as [field; 3u32]; + ternary r222 r223[0u32] r224[0u32] into r225; + ternary r222 r223[1u32] r224[1u32] into r226; + ternary r222 r223[2u32] r224[2u32] into r227; + cast r225 r226 r227 into r228 as [field; 3u32]; + hash.psd4 r228 into r229 as field; + is.eq r5[1u32].siblings[4u32] 0field into r230; + div r5[1u32].leaf_index 8u32 into r231; + rem r231 2u32 into r232; + is.eq r232 0u32 into r233; + cast 0field r229 r5[1u32].siblings[4u32] into r234 as [field; 3u32]; + cast 0field r5[1u32].siblings[4u32] r229 into r235 as [field; 3u32]; + ternary r233 r234[0u32] r235[0u32] into r236; + ternary r233 r234[1u32] r235[1u32] into r237; + ternary r233 r234[2u32] r235[2u32] into r238; + cast r236 r237 r238 into r239 as [field; 3u32]; + hash.psd4 r239 into r240 as field; + is.eq r5[1u32].siblings[5u32] 0field into r241; + div r5[1u32].leaf_index 16u32 into r242; + rem r242 2u32 into r243; + is.eq r243 0u32 into r244; + cast 0field r240 r5[1u32].siblings[5u32] into r245 as [field; 3u32]; + cast 0field r5[1u32].siblings[5u32] r240 into r246 as [field; 3u32]; + ternary r244 r245[0u32] r246[0u32] into r247; + ternary r244 r245[1u32] r246[1u32] into r248; + ternary r244 r245[2u32] r246[2u32] into r249; + cast r247 r248 r249 into r250 as [field; 3u32]; + hash.psd4 r250 into r251 as field; + is.eq r5[1u32].siblings[6u32] 0field into r252; + div r5[1u32].leaf_index 32u32 into r253; + rem r253 2u32 into r254; + is.eq r254 0u32 into r255; + cast 0field r251 r5[1u32].siblings[6u32] into r256 as [field; 3u32]; + cast 0field r5[1u32].siblings[6u32] r251 into r257 as [field; 3u32]; + ternary r255 r256[0u32] r257[0u32] into r258; + ternary r255 r256[1u32] r257[1u32] into r259; + ternary r255 r256[2u32] r257[2u32] into r260; + cast r258 r259 r260 into r261 as [field; 3u32]; + hash.psd4 r261 into r262 as field; + is.eq r5[1u32].siblings[7u32] 0field into r263; + div r5[1u32].leaf_index 64u32 into r264; + rem r264 2u32 into r265; + is.eq r265 0u32 into r266; + cast 0field r262 r5[1u32].siblings[7u32] into r267 as [field; 3u32]; + cast 0field r5[1u32].siblings[7u32] r262 into r268 as [field; 3u32]; + ternary r266 r267[0u32] r268[0u32] into r269; + ternary r266 r267[1u32] r268[1u32] into r270; + ternary r266 r267[2u32] r268[2u32] into r271; + cast r269 r270 r271 into r272 as [field; 3u32]; + hash.psd4 r272 into r273 as field; + is.eq r5[1u32].siblings[8u32] 0field into r274; + div r5[1u32].leaf_index 128u32 into r275; + rem r275 2u32 into r276; + is.eq r276 0u32 into r277; + cast 0field r273 r5[1u32].siblings[8u32] into r278 as [field; 3u32]; + cast 0field r5[1u32].siblings[8u32] r273 into r279 as [field; 3u32]; + ternary r277 r278[0u32] r279[0u32] into r280; + ternary r277 r278[1u32] r279[1u32] into r281; + ternary r277 r278[2u32] r279[2u32] into r282; + cast r280 r281 r282 into r283 as [field; 3u32]; + hash.psd4 r283 into r284 as field; + is.eq r5[1u32].siblings[9u32] 0field into r285; + div r5[1u32].leaf_index 256u32 into r286; + rem r286 2u32 into r287; + is.eq r287 0u32 into r288; + cast 0field r284 r5[1u32].siblings[9u32] into r289 as [field; 3u32]; + cast 0field r5[1u32].siblings[9u32] r284 into r290 as [field; 3u32]; + ternary r288 r289[0u32] r290[0u32] into r291; + ternary r288 r289[1u32] r290[1u32] into r292; + ternary r288 r289[2u32] r290[2u32] into r293; + cast r291 r292 r293 into r294 as [field; 3u32]; + hash.psd4 r294 into r295 as field; + is.eq r5[1u32].siblings[10u32] 0field into r296; + div r5[1u32].leaf_index 512u32 into r297; + rem r297 2u32 into r298; + is.eq r298 0u32 into r299; + cast 0field r295 r5[1u32].siblings[10u32] into r300 as [field; 3u32]; + cast 0field r5[1u32].siblings[10u32] r295 into r301 as [field; 3u32]; + ternary r299 r300[0u32] r301[0u32] into r302; + ternary r299 r300[1u32] r301[1u32] into r303; + ternary r299 r300[2u32] r301[2u32] into r304; + cast r302 r303 r304 into r305 as [field; 3u32]; + hash.psd4 r305 into r306 as field; + is.eq r5[1u32].siblings[11u32] 0field into r307; + div r5[1u32].leaf_index 1024u32 into r308; + rem r308 2u32 into r309; + is.eq r309 0u32 into r310; + cast 0field r306 r5[1u32].siblings[11u32] into r311 as [field; 3u32]; + cast 0field r5[1u32].siblings[11u32] r306 into r312 as [field; 3u32]; + ternary r310 r311[0u32] r312[0u32] into r313; + ternary r310 r311[1u32] r312[1u32] into r314; + ternary r310 r311[2u32] r312[2u32] into r315; + cast r313 r314 r315 into r316 as [field; 3u32]; + hash.psd4 r316 into r317 as field; + is.eq r5[1u32].siblings[12u32] 0field into r318; + div r5[1u32].leaf_index 2048u32 into r319; + rem r319 2u32 into r320; + is.eq r320 0u32 into r321; + cast 0field r317 r5[1u32].siblings[12u32] into r322 as [field; 3u32]; + cast 0field r5[1u32].siblings[12u32] r317 into r323 as [field; 3u32]; + ternary r321 r322[0u32] r323[0u32] into r324; + ternary r321 r322[1u32] r323[1u32] into r325; + ternary r321 r322[2u32] r323[2u32] into r326; + cast r324 r325 r326 into r327 as [field; 3u32]; + hash.psd4 r327 into r328 as field; + is.eq r5[1u32].siblings[13u32] 0field into r329; + div r5[1u32].leaf_index 4096u32 into r330; + rem r330 2u32 into r331; + is.eq r331 0u32 into r332; + cast 0field r328 r5[1u32].siblings[13u32] into r333 as [field; 3u32]; + cast 0field r5[1u32].siblings[13u32] r328 into r334 as [field; 3u32]; + ternary r332 r333[0u32] r334[0u32] into r335; + ternary r332 r333[1u32] r334[1u32] into r336; + ternary r332 r333[2u32] r334[2u32] into r337; + cast r335 r336 r337 into r338 as [field; 3u32]; + hash.psd4 r338 into r339 as field; + is.eq r5[1u32].siblings[14u32] 0field into r340; + div r5[1u32].leaf_index 8192u32 into r341; + rem r341 2u32 into r342; + is.eq r342 0u32 into r343; + cast 0field r339 r5[1u32].siblings[14u32] into r344 as [field; 3u32]; + cast 0field r5[1u32].siblings[14u32] r339 into r345 as [field; 3u32]; + ternary r343 r344[0u32] r345[0u32] into r346; + ternary r343 r344[1u32] r345[1u32] into r347; + ternary r343 r344[2u32] r345[2u32] into r348; + cast r346 r347 r348 into r349 as [field; 3u32]; + hash.psd4 r349 into r350 as field; + is.eq r5[1u32].siblings[15u32] 0field into r351; + div r5[1u32].leaf_index 16384u32 into r352; + rem r352 2u32 into r353; + is.eq r353 0u32 into r354; + cast 0field r350 r5[1u32].siblings[15u32] into r355 as [field; 3u32]; + cast 0field r5[1u32].siblings[15u32] r350 into r356 as [field; 3u32]; + ternary r354 r355[0u32] r356[0u32] into r357; + ternary r354 r355[1u32] r356[1u32] into r358; + ternary r354 r355[2u32] r356[2u32] into r359; + cast r357 r358 r359 into r360 as [field; 3u32]; + hash.psd4 r360 into r361 as field; + ternary r351 r350 r361 into r362; + ternary r351 14u32 15u32 into r363; + ternary r340 r339 r362 into r364; + ternary r340 13u32 r363 into r365; + ternary r329 r328 r364 into r366; + ternary r329 12u32 r365 into r367; + ternary r318 r317 r366 into r368; + ternary r318 11u32 r367 into r369; + ternary r307 r306 r368 into r370; + ternary r307 10u32 r369 into r371; + ternary r296 r295 r370 into r372; + ternary r296 9u32 r371 into r373; + ternary r285 r284 r372 into r374; + ternary r285 8u32 r373 into r375; + ternary r274 r273 r374 into r376; + ternary r274 7u32 r375 into r377; + ternary r263 r262 r376 into r378; + ternary r263 6u32 r377 into r379; + ternary r252 r251 r378 into r380; + ternary r252 5u32 r379 into r381; + ternary r241 r240 r380 into r382; + ternary r241 4u32 r381 into r383; + ternary r230 r229 r382 into r384; + ternary r230 3u32 r383 into r385; + ternary r219 r218 r384 into r386; + ternary r219 2u32 r385 into r387; + ternary r208 r207 r386 into r388; + ternary r208 1u32 r387 into r389; + assert.eq r197 r388; + assert.eq r198 r389; + cast self.signer into r390 as field; + is.eq r5[0u32].leaf_index r5[1u32].leaf_index into r391; + is.eq r5[0u32].leaf_index 0u32 into r392; + lt r390 r5[0u32].siblings[0u32] into r393; + and r391 r392 into r394; + not r394 into r395; + or r393 r395 into r396; + assert.eq r396 true; + not r392 into r397; + pow 2u32 r198 into r398; + sub r398 1u32 into r399; + and r391 r397 into r400; + not r400 into r401; + is.eq r5[0u32].leaf_index r399 into r402; + or r402 r401 into r403; + assert.eq r403 true; + gt r390 r5[0u32].siblings[0u32] into r404; + or r404 r401 into r405; + assert.eq r405 true; + not r391 into r406; + gt r390 r5[0u32].siblings[0u32] into r407; + not r406 into r408; + or r407 r408 into r409; + assert.eq r409 true; + lt r390 r5[1u32].siblings[0u32] into r410; + or r410 r408 into r411; + assert.eq r411 true; + lte r5[1u32].leaf_index r399 into r412; + or r412 r408 into r413; + assert.eq r413 true; + add r5[0u32].leaf_index 1u32 into r414; + is.eq r414 r5[1u32].leaf_index into r415; + or r415 r408 into r416; + assert.eq r416 true; + rem r6[0u32].leaf_index 2u32 into r417; + is.eq r417 0u32 into r418; + cast 1field r6[0u32].siblings[0u32] r6[0u32].siblings[1u32] into r419 as [field; 3u32]; + cast 1field r6[0u32].siblings[1u32] r6[0u32].siblings[0u32] into r420 as [field; 3u32]; + ternary r418 r419[0u32] r420[0u32] into r421; + ternary r418 r419[1u32] r420[1u32] into r422; + ternary r418 r419[2u32] r420[2u32] into r423; + cast r421 r422 r423 into r424 as [field; 3u32]; + hash.psd4 r424 into r425 as field; + is.eq r6[0u32].siblings[2u32] 0field into r426; + div r6[0u32].leaf_index 2u32 into r427; + rem r427 2u32 into r428; + is.eq r428 0u32 into r429; + cast 0field r425 r6[0u32].siblings[2u32] into r430 as [field; 3u32]; + cast 0field r6[0u32].siblings[2u32] r425 into r431 as [field; 3u32]; + ternary r429 r430[0u32] r431[0u32] into r432; + ternary r429 r430[1u32] r431[1u32] into r433; + ternary r429 r430[2u32] r431[2u32] into r434; + cast r432 r433 r434 into r435 as [field; 3u32]; + hash.psd4 r435 into r436 as field; + is.eq r6[0u32].siblings[3u32] 0field into r437; + div r6[0u32].leaf_index 4u32 into r438; + rem r438 2u32 into r439; + is.eq r439 0u32 into r440; + cast 0field r436 r6[0u32].siblings[3u32] into r441 as [field; 3u32]; + cast 0field r6[0u32].siblings[3u32] r436 into r442 as [field; 3u32]; + ternary r440 r441[0u32] r442[0u32] into r443; + ternary r440 r441[1u32] r442[1u32] into r444; + ternary r440 r441[2u32] r442[2u32] into r445; + cast r443 r444 r445 into r446 as [field; 3u32]; + hash.psd4 r446 into r447 as field; + is.eq r6[0u32].siblings[4u32] 0field into r448; + div r6[0u32].leaf_index 8u32 into r449; + rem r449 2u32 into r450; + is.eq r450 0u32 into r451; + cast 0field r447 r6[0u32].siblings[4u32] into r452 as [field; 3u32]; + cast 0field r6[0u32].siblings[4u32] r447 into r453 as [field; 3u32]; + ternary r451 r452[0u32] r453[0u32] into r454; + ternary r451 r452[1u32] r453[1u32] into r455; + ternary r451 r452[2u32] r453[2u32] into r456; + cast r454 r455 r456 into r457 as [field; 3u32]; + hash.psd4 r457 into r458 as field; + is.eq r6[0u32].siblings[5u32] 0field into r459; + div r6[0u32].leaf_index 16u32 into r460; + rem r460 2u32 into r461; + is.eq r461 0u32 into r462; + cast 0field r458 r6[0u32].siblings[5u32] into r463 as [field; 3u32]; + cast 0field r6[0u32].siblings[5u32] r458 into r464 as [field; 3u32]; + ternary r462 r463[0u32] r464[0u32] into r465; + ternary r462 r463[1u32] r464[1u32] into r466; + ternary r462 r463[2u32] r464[2u32] into r467; + cast r465 r466 r467 into r468 as [field; 3u32]; + hash.psd4 r468 into r469 as field; + is.eq r6[0u32].siblings[6u32] 0field into r470; + div r6[0u32].leaf_index 32u32 into r471; + rem r471 2u32 into r472; + is.eq r472 0u32 into r473; + cast 0field r469 r6[0u32].siblings[6u32] into r474 as [field; 3u32]; + cast 0field r6[0u32].siblings[6u32] r469 into r475 as [field; 3u32]; + ternary r473 r474[0u32] r475[0u32] into r476; + ternary r473 r474[1u32] r475[1u32] into r477; + ternary r473 r474[2u32] r475[2u32] into r478; + cast r476 r477 r478 into r479 as [field; 3u32]; + hash.psd4 r479 into r480 as field; + is.eq r6[0u32].siblings[7u32] 0field into r481; + div r6[0u32].leaf_index 64u32 into r482; + rem r482 2u32 into r483; + is.eq r483 0u32 into r484; + cast 0field r480 r6[0u32].siblings[7u32] into r485 as [field; 3u32]; + cast 0field r6[0u32].siblings[7u32] r480 into r486 as [field; 3u32]; + ternary r484 r485[0u32] r486[0u32] into r487; + ternary r484 r485[1u32] r486[1u32] into r488; + ternary r484 r485[2u32] r486[2u32] into r489; + cast r487 r488 r489 into r490 as [field; 3u32]; + hash.psd4 r490 into r491 as field; + is.eq r6[0u32].siblings[8u32] 0field into r492; + div r6[0u32].leaf_index 128u32 into r493; + rem r493 2u32 into r494; + is.eq r494 0u32 into r495; + cast 0field r491 r6[0u32].siblings[8u32] into r496 as [field; 3u32]; + cast 0field r6[0u32].siblings[8u32] r491 into r497 as [field; 3u32]; + ternary r495 r496[0u32] r497[0u32] into r498; + ternary r495 r496[1u32] r497[1u32] into r499; + ternary r495 r496[2u32] r497[2u32] into r500; + cast r498 r499 r500 into r501 as [field; 3u32]; + hash.psd4 r501 into r502 as field; + is.eq r6[0u32].siblings[9u32] 0field into r503; + div r6[0u32].leaf_index 256u32 into r504; + rem r504 2u32 into r505; + is.eq r505 0u32 into r506; + cast 0field r502 r6[0u32].siblings[9u32] into r507 as [field; 3u32]; + cast 0field r6[0u32].siblings[9u32] r502 into r508 as [field; 3u32]; + ternary r506 r507[0u32] r508[0u32] into r509; + ternary r506 r507[1u32] r508[1u32] into r510; + ternary r506 r507[2u32] r508[2u32] into r511; + cast r509 r510 r511 into r512 as [field; 3u32]; + hash.psd4 r512 into r513 as field; + is.eq r6[0u32].siblings[10u32] 0field into r514; + div r6[0u32].leaf_index 512u32 into r515; + rem r515 2u32 into r516; + is.eq r516 0u32 into r517; + cast 0field r513 r6[0u32].siblings[10u32] into r518 as [field; 3u32]; + cast 0field r6[0u32].siblings[10u32] r513 into r519 as [field; 3u32]; + ternary r517 r518[0u32] r519[0u32] into r520; + ternary r517 r518[1u32] r519[1u32] into r521; + ternary r517 r518[2u32] r519[2u32] into r522; + cast r520 r521 r522 into r523 as [field; 3u32]; + hash.psd4 r523 into r524 as field; + is.eq r6[0u32].siblings[11u32] 0field into r525; + div r6[0u32].leaf_index 1024u32 into r526; + rem r526 2u32 into r527; + is.eq r527 0u32 into r528; + cast 0field r524 r6[0u32].siblings[11u32] into r529 as [field; 3u32]; + cast 0field r6[0u32].siblings[11u32] r524 into r530 as [field; 3u32]; + ternary r528 r529[0u32] r530[0u32] into r531; + ternary r528 r529[1u32] r530[1u32] into r532; + ternary r528 r529[2u32] r530[2u32] into r533; + cast r531 r532 r533 into r534 as [field; 3u32]; + hash.psd4 r534 into r535 as field; + is.eq r6[0u32].siblings[12u32] 0field into r536; + div r6[0u32].leaf_index 2048u32 into r537; + rem r537 2u32 into r538; + is.eq r538 0u32 into r539; + cast 0field r535 r6[0u32].siblings[12u32] into r540 as [field; 3u32]; + cast 0field r6[0u32].siblings[12u32] r535 into r541 as [field; 3u32]; + ternary r539 r540[0u32] r541[0u32] into r542; + ternary r539 r540[1u32] r541[1u32] into r543; + ternary r539 r540[2u32] r541[2u32] into r544; + cast r542 r543 r544 into r545 as [field; 3u32]; + hash.psd4 r545 into r546 as field; + is.eq r6[0u32].siblings[13u32] 0field into r547; + div r6[0u32].leaf_index 4096u32 into r548; + rem r548 2u32 into r549; + is.eq r549 0u32 into r550; + cast 0field r546 r6[0u32].siblings[13u32] into r551 as [field; 3u32]; + cast 0field r6[0u32].siblings[13u32] r546 into r552 as [field; 3u32]; + ternary r550 r551[0u32] r552[0u32] into r553; + ternary r550 r551[1u32] r552[1u32] into r554; + ternary r550 r551[2u32] r552[2u32] into r555; + cast r553 r554 r555 into r556 as [field; 3u32]; + hash.psd4 r556 into r557 as field; + is.eq r6[0u32].siblings[14u32] 0field into r558; + div r6[0u32].leaf_index 8192u32 into r559; + rem r559 2u32 into r560; + is.eq r560 0u32 into r561; + cast 0field r557 r6[0u32].siblings[14u32] into r562 as [field; 3u32]; + cast 0field r6[0u32].siblings[14u32] r557 into r563 as [field; 3u32]; + ternary r561 r562[0u32] r563[0u32] into r564; + ternary r561 r562[1u32] r563[1u32] into r565; + ternary r561 r562[2u32] r563[2u32] into r566; + cast r564 r565 r566 into r567 as [field; 3u32]; + hash.psd4 r567 into r568 as field; + is.eq r6[0u32].siblings[15u32] 0field into r569; + div r6[0u32].leaf_index 16384u32 into r570; + rem r570 2u32 into r571; + is.eq r571 0u32 into r572; + cast 0field r568 r6[0u32].siblings[15u32] into r573 as [field; 3u32]; + cast 0field r6[0u32].siblings[15u32] r568 into r574 as [field; 3u32]; + ternary r572 r573[0u32] r574[0u32] into r575; + ternary r572 r573[1u32] r574[1u32] into r576; + ternary r572 r573[2u32] r574[2u32] into r577; + cast r575 r576 r577 into r578 as [field; 3u32]; + hash.psd4 r578 into r579 as field; + ternary r569 r568 r579 into r580; + ternary r569 14u32 15u32 into r581; + ternary r558 r557 r580 into r582; + ternary r558 13u32 r581 into r583; + ternary r547 r546 r582 into r584; + ternary r547 12u32 r583 into r585; + ternary r536 r535 r584 into r586; + ternary r536 11u32 r585 into r587; + ternary r525 r524 r586 into r588; + ternary r525 10u32 r587 into r589; + ternary r514 r513 r588 into r590; + ternary r514 9u32 r589 into r591; + ternary r503 r502 r590 into r592; + ternary r503 8u32 r591 into r593; + ternary r492 r491 r592 into r594; + ternary r492 7u32 r593 into r595; + ternary r481 r480 r594 into r596; + ternary r481 6u32 r595 into r597; + ternary r470 r469 r596 into r598; + ternary r470 5u32 r597 into r599; + ternary r459 r458 r598 into r600; + ternary r459 4u32 r599 into r601; + ternary r448 r447 r600 into r602; + ternary r448 3u32 r601 into r603; + ternary r437 r436 r602 into r604; + ternary r437 2u32 r603 into r605; + ternary r426 r425 r604 into r606; + ternary r426 1u32 r605 into r607; + rem r6[1u32].leaf_index 2u32 into r608; + is.eq r608 0u32 into r609; + cast 1field r6[1u32].siblings[0u32] r6[1u32].siblings[1u32] into r610 as [field; 3u32]; + cast 1field r6[1u32].siblings[1u32] r6[1u32].siblings[0u32] into r611 as [field; 3u32]; + ternary r609 r610[0u32] r611[0u32] into r612; + ternary r609 r610[1u32] r611[1u32] into r613; + ternary r609 r610[2u32] r611[2u32] into r614; + cast r612 r613 r614 into r615 as [field; 3u32]; + hash.psd4 r615 into r616 as field; + is.eq r6[1u32].siblings[2u32] 0field into r617; + div r6[1u32].leaf_index 2u32 into r618; + rem r618 2u32 into r619; + is.eq r619 0u32 into r620; + cast 0field r616 r6[1u32].siblings[2u32] into r621 as [field; 3u32]; + cast 0field r6[1u32].siblings[2u32] r616 into r622 as [field; 3u32]; + ternary r620 r621[0u32] r622[0u32] into r623; + ternary r620 r621[1u32] r622[1u32] into r624; + ternary r620 r621[2u32] r622[2u32] into r625; + cast r623 r624 r625 into r626 as [field; 3u32]; + hash.psd4 r626 into r627 as field; + is.eq r6[1u32].siblings[3u32] 0field into r628; + div r6[1u32].leaf_index 4u32 into r629; + rem r629 2u32 into r630; + is.eq r630 0u32 into r631; + cast 0field r627 r6[1u32].siblings[3u32] into r632 as [field; 3u32]; + cast 0field r6[1u32].siblings[3u32] r627 into r633 as [field; 3u32]; + ternary r631 r632[0u32] r633[0u32] into r634; + ternary r631 r632[1u32] r633[1u32] into r635; + ternary r631 r632[2u32] r633[2u32] into r636; + cast r634 r635 r636 into r637 as [field; 3u32]; + hash.psd4 r637 into r638 as field; + is.eq r6[1u32].siblings[4u32] 0field into r639; + div r6[1u32].leaf_index 8u32 into r640; + rem r640 2u32 into r641; + is.eq r641 0u32 into r642; + cast 0field r638 r6[1u32].siblings[4u32] into r643 as [field; 3u32]; + cast 0field r6[1u32].siblings[4u32] r638 into r644 as [field; 3u32]; + ternary r642 r643[0u32] r644[0u32] into r645; + ternary r642 r643[1u32] r644[1u32] into r646; + ternary r642 r643[2u32] r644[2u32] into r647; + cast r645 r646 r647 into r648 as [field; 3u32]; + hash.psd4 r648 into r649 as field; + is.eq r6[1u32].siblings[5u32] 0field into r650; + div r6[1u32].leaf_index 16u32 into r651; + rem r651 2u32 into r652; + is.eq r652 0u32 into r653; + cast 0field r649 r6[1u32].siblings[5u32] into r654 as [field; 3u32]; + cast 0field r6[1u32].siblings[5u32] r649 into r655 as [field; 3u32]; + ternary r653 r654[0u32] r655[0u32] into r656; + ternary r653 r654[1u32] r655[1u32] into r657; + ternary r653 r654[2u32] r655[2u32] into r658; + cast r656 r657 r658 into r659 as [field; 3u32]; + hash.psd4 r659 into r660 as field; + is.eq r6[1u32].siblings[6u32] 0field into r661; + div r6[1u32].leaf_index 32u32 into r662; + rem r662 2u32 into r663; + is.eq r663 0u32 into r664; + cast 0field r660 r6[1u32].siblings[6u32] into r665 as [field; 3u32]; + cast 0field r6[1u32].siblings[6u32] r660 into r666 as [field; 3u32]; + ternary r664 r665[0u32] r666[0u32] into r667; + ternary r664 r665[1u32] r666[1u32] into r668; + ternary r664 r665[2u32] r666[2u32] into r669; + cast r667 r668 r669 into r670 as [field; 3u32]; + hash.psd4 r670 into r671 as field; + is.eq r6[1u32].siblings[7u32] 0field into r672; + div r6[1u32].leaf_index 64u32 into r673; + rem r673 2u32 into r674; + is.eq r674 0u32 into r675; + cast 0field r671 r6[1u32].siblings[7u32] into r676 as [field; 3u32]; + cast 0field r6[1u32].siblings[7u32] r671 into r677 as [field; 3u32]; + ternary r675 r676[0u32] r677[0u32] into r678; + ternary r675 r676[1u32] r677[1u32] into r679; + ternary r675 r676[2u32] r677[2u32] into r680; + cast r678 r679 r680 into r681 as [field; 3u32]; + hash.psd4 r681 into r682 as field; + is.eq r6[1u32].siblings[8u32] 0field into r683; + div r6[1u32].leaf_index 128u32 into r684; + rem r684 2u32 into r685; + is.eq r685 0u32 into r686; + cast 0field r682 r6[1u32].siblings[8u32] into r687 as [field; 3u32]; + cast 0field r6[1u32].siblings[8u32] r682 into r688 as [field; 3u32]; + ternary r686 r687[0u32] r688[0u32] into r689; + ternary r686 r687[1u32] r688[1u32] into r690; + ternary r686 r687[2u32] r688[2u32] into r691; + cast r689 r690 r691 into r692 as [field; 3u32]; + hash.psd4 r692 into r693 as field; + is.eq r6[1u32].siblings[9u32] 0field into r694; + div r6[1u32].leaf_index 256u32 into r695; + rem r695 2u32 into r696; + is.eq r696 0u32 into r697; + cast 0field r693 r6[1u32].siblings[9u32] into r698 as [field; 3u32]; + cast 0field r6[1u32].siblings[9u32] r693 into r699 as [field; 3u32]; + ternary r697 r698[0u32] r699[0u32] into r700; + ternary r697 r698[1u32] r699[1u32] into r701; + ternary r697 r698[2u32] r699[2u32] into r702; + cast r700 r701 r702 into r703 as [field; 3u32]; + hash.psd4 r703 into r704 as field; + is.eq r6[1u32].siblings[10u32] 0field into r705; + div r6[1u32].leaf_index 512u32 into r706; + rem r706 2u32 into r707; + is.eq r707 0u32 into r708; + cast 0field r704 r6[1u32].siblings[10u32] into r709 as [field; 3u32]; + cast 0field r6[1u32].siblings[10u32] r704 into r710 as [field; 3u32]; + ternary r708 r709[0u32] r710[0u32] into r711; + ternary r708 r709[1u32] r710[1u32] into r712; + ternary r708 r709[2u32] r710[2u32] into r713; + cast r711 r712 r713 into r714 as [field; 3u32]; + hash.psd4 r714 into r715 as field; + is.eq r6[1u32].siblings[11u32] 0field into r716; + div r6[1u32].leaf_index 1024u32 into r717; + rem r717 2u32 into r718; + is.eq r718 0u32 into r719; + cast 0field r715 r6[1u32].siblings[11u32] into r720 as [field; 3u32]; + cast 0field r6[1u32].siblings[11u32] r715 into r721 as [field; 3u32]; + ternary r719 r720[0u32] r721[0u32] into r722; + ternary r719 r720[1u32] r721[1u32] into r723; + ternary r719 r720[2u32] r721[2u32] into r724; + cast r722 r723 r724 into r725 as [field; 3u32]; + hash.psd4 r725 into r726 as field; + is.eq r6[1u32].siblings[12u32] 0field into r727; + div r6[1u32].leaf_index 2048u32 into r728; + rem r728 2u32 into r729; + is.eq r729 0u32 into r730; + cast 0field r726 r6[1u32].siblings[12u32] into r731 as [field; 3u32]; + cast 0field r6[1u32].siblings[12u32] r726 into r732 as [field; 3u32]; + ternary r730 r731[0u32] r732[0u32] into r733; + ternary r730 r731[1u32] r732[1u32] into r734; + ternary r730 r731[2u32] r732[2u32] into r735; + cast r733 r734 r735 into r736 as [field; 3u32]; + hash.psd4 r736 into r737 as field; + is.eq r6[1u32].siblings[13u32] 0field into r738; + div r6[1u32].leaf_index 4096u32 into r739; + rem r739 2u32 into r740; + is.eq r740 0u32 into r741; + cast 0field r737 r6[1u32].siblings[13u32] into r742 as [field; 3u32]; + cast 0field r6[1u32].siblings[13u32] r737 into r743 as [field; 3u32]; + ternary r741 r742[0u32] r743[0u32] into r744; + ternary r741 r742[1u32] r743[1u32] into r745; + ternary r741 r742[2u32] r743[2u32] into r746; + cast r744 r745 r746 into r747 as [field; 3u32]; + hash.psd4 r747 into r748 as field; + is.eq r6[1u32].siblings[14u32] 0field into r749; + div r6[1u32].leaf_index 8192u32 into r750; + rem r750 2u32 into r751; + is.eq r751 0u32 into r752; + cast 0field r748 r6[1u32].siblings[14u32] into r753 as [field; 3u32]; + cast 0field r6[1u32].siblings[14u32] r748 into r754 as [field; 3u32]; + ternary r752 r753[0u32] r754[0u32] into r755; + ternary r752 r753[1u32] r754[1u32] into r756; + ternary r752 r753[2u32] r754[2u32] into r757; + cast r755 r756 r757 into r758 as [field; 3u32]; + hash.psd4 r758 into r759 as field; + is.eq r6[1u32].siblings[15u32] 0field into r760; + div r6[1u32].leaf_index 16384u32 into r761; + rem r761 2u32 into r762; + is.eq r762 0u32 into r763; + cast 0field r759 r6[1u32].siblings[15u32] into r764 as [field; 3u32]; + cast 0field r6[1u32].siblings[15u32] r759 into r765 as [field; 3u32]; + ternary r763 r764[0u32] r765[0u32] into r766; + ternary r763 r764[1u32] r765[1u32] into r767; + ternary r763 r764[2u32] r765[2u32] into r768; + cast r766 r767 r768 into r769 as [field; 3u32]; + hash.psd4 r769 into r770 as field; + ternary r760 r759 r770 into r771; + ternary r760 14u32 15u32 into r772; + ternary r749 r748 r771 into r773; + ternary r749 13u32 r772 into r774; + ternary r738 r737 r773 into r775; + ternary r738 12u32 r774 into r776; + ternary r727 r726 r775 into r777; + ternary r727 11u32 r776 into r778; + ternary r716 r715 r777 into r779; + ternary r716 10u32 r778 into r780; + ternary r705 r704 r779 into r781; + ternary r705 9u32 r780 into r782; + ternary r694 r693 r781 into r783; + ternary r694 8u32 r782 into r784; + ternary r683 r682 r783 into r785; + ternary r683 7u32 r784 into r786; + ternary r672 r671 r785 into r787; + ternary r672 6u32 r786 into r788; + ternary r661 r660 r787 into r789; + ternary r661 5u32 r788 into r790; + ternary r650 r649 r789 into r791; + ternary r650 4u32 r790 into r792; + ternary r639 r638 r791 into r793; + ternary r639 3u32 r792 into r794; + ternary r628 r627 r793 into r795; + ternary r628 2u32 r794 into r796; + ternary r617 r616 r795 into r797; + ternary r617 1u32 r796 into r798; + assert.eq r606 r797; + assert.eq r607 r798; + cast r0.withdrawal into r799 as field; + is.eq r6[0u32].leaf_index r6[1u32].leaf_index into r800; + is.eq r6[0u32].leaf_index 0u32 into r801; + lt r799 r6[0u32].siblings[0u32] into r802; + and r800 r801 into r803; + not r803 into r804; + or r802 r804 into r805; + assert.eq r805 true; + not r801 into r806; + pow 2u32 r607 into r807; + sub r807 1u32 into r808; + and r800 r806 into r809; + not r809 into r810; + is.eq r6[0u32].leaf_index r808 into r811; + or r811 r810 into r812; + assert.eq r812 true; + gt r799 r6[0u32].siblings[0u32] into r813; + or r813 r810 into r814; + assert.eq r814 true; + not r800 into r815; + gt r799 r6[0u32].siblings[0u32] into r816; + not r815 into r817; + or r816 r817 into r818; + assert.eq r818 true; + lt r799 r6[1u32].siblings[0u32] into r819; + or r819 r817 into r820; + assert.eq r820 true; + lte r6[1u32].leaf_index r808 into r821; + or r821 r817 into r822; + assert.eq r822 true; + add r6[0u32].leaf_index 1u32 into r823; + is.eq r823 r6[1u32].leaf_index into r824; + or r824 r817 into r825; + assert.eq r825 true; + assert.eq r197 r606; + cast r0.owner r0.withdrawal r0.token_id r0.token0_id r0.token1_id r0.pool r0.tick_lower r0.tick_upper into r826 as PositionNFT.record; + call.dynamic r3 'aleo' 'transfer_public_to_private' with r0.withdrawal r1 (as address.private u128.public) into r827 r828 (as dynamic.record dynamic.future); + call.dynamic r4 'aleo' 'transfer_public_to_private' with r0.withdrawal r2 (as address.private u128.public) into r829 r830 (as dynamic.record dynamic.future); + async collect r828 r830 r0.token_id r0.pool r0.tick_lower r0.tick_upper r1 r2 r3 r4 r197 r7 into r831; + output r826 as PositionNFT.record; + output r827 as dynamic.record; + output r829 as dynamic.record; + output r831 as shield_swap.aleo/collect.future; + +finalize collect: + input r0 as dynamic.future; + input r1 as dynamic.future; + input r2 as field.public; + input r3 as field.public; + input r4 as i32.public; + input r5 as i32.public; + input r6 as u128.public; + input r7 as u128.public; + input r8 as field.public; + input r9 as field.public; + input r10 as field.public; + input r11 as boolean.public; + get shield_swap_freezelist.aleo/freeze_list_root[1u8] into r12; + is.neq r12 r10 into r13; + branch.eq r13 false to end_then_0_0; + get shield_swap_freezelist.aleo/freeze_list_root[2u8] into r14; + get shield_swap_freezelist.aleo/root_updated_height[true] into r15; + get shield_swap_freezelist.aleo/previous_root_window[true] into r16; + is.eq r10 r12 into r17; + is.eq r10 r14 into r18; + sub block.height r15 into r19; + lt r19 r16 into r20; + and r18 r20 into r21; + or r17 r21 into r22; + assert.eq r22 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + contains from_wrapper_token_id[r8] into r23; + contains from_wrapper_token_id[r9] into r24; + or r23 r24 into r25; + branch.eq r25 false to end_then_0_2; + assert.eq r11 true; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + await r0; + await r1; + get pools[r3] into r26; + is.eq r26.token0 r8 into r27; + is.eq r26.token1 r9 into r28; + and r27 r28 into r29; + assert.eq r29 true; + get slots[r3] into r30; + get positions[r2] into r31; + contains frozen_position[r2] into r32; + not r32 into r33; + assert.eq r33 true; + is.eq r31.pool r3 into r34; + is.eq r31.tick_lower r4 into r35; + and r34 r35 into r36; + is.eq r31.tick_upper r5 into r37; + and r36 r37 into r38; + assert.eq r38 true; + cast 0u128 0u128 into r39 as U256__8JquwLopp8; + cast 0u128 0u128 into r40 as U256__8JquwLopp8; + cast r3 0i128 0u128 r4 r39 r40 0i32 0i32 into r41 as Tick; + cast 0u128 0u128 into r42 as U256__8JquwLopp8; + cast 0u128 0u128 into r43 as U256__8JquwLopp8; + cast r3 0i128 0u128 r5 r42 r43 0i32 0i32 into r44 as Tick; + cast r3 r4 into r45 as TickKey; + hash.bhp256 r45 into r46 as field; + get.or_use ticks[r46] r41 into r47; + cast r3 r5 into r48 as TickKey; + hash.bhp256 r48 into r49 as field; + get.or_use ticks[r49] r44 into r50; + gte r30.tick r47.tick into r51; + lt r30.fee_growth_global0_x_128.lo r47.fee_growth_outside0_x_128.lo into r52; + ternary r52 1u128 0u128 into r53; + sub.w r30.fee_growth_global0_x_128.lo r47.fee_growth_outside0_x_128.lo into r54; + sub.w r30.fee_growth_global0_x_128.hi r47.fee_growth_outside0_x_128.hi into r55; + sub.w r55 r53 into r56; + cast r56 r54 into r57 as U256__8JquwLopp8; + lt r30.fee_growth_global1_x_128.lo r47.fee_growth_outside1_x_128.lo into r58; + ternary r58 1u128 0u128 into r59; + sub.w r30.fee_growth_global1_x_128.lo r47.fee_growth_outside1_x_128.lo into r60; + sub.w r30.fee_growth_global1_x_128.hi r47.fee_growth_outside1_x_128.hi into r61; + sub.w r61 r59 into r62; + cast r62 r60 into r63 as U256__8JquwLopp8; + ternary r51 r47.fee_growth_outside0_x_128.hi r57.hi into r64; + ternary r51 r47.fee_growth_outside0_x_128.lo r57.lo into r65; + cast r64 r65 into r66 as U256__8JquwLopp8; + ternary r51 r47.fee_growth_outside1_x_128.hi r63.hi into r67; + ternary r51 r47.fee_growth_outside1_x_128.lo r63.lo into r68; + cast r67 r68 into r69 as U256__8JquwLopp8; + lt r30.tick r50.tick into r70; + lt r30.fee_growth_global0_x_128.lo r50.fee_growth_outside0_x_128.lo into r71; + ternary r71 1u128 0u128 into r72; + sub.w r30.fee_growth_global0_x_128.lo r50.fee_growth_outside0_x_128.lo into r73; + sub.w r30.fee_growth_global0_x_128.hi r50.fee_growth_outside0_x_128.hi into r74; + sub.w r74 r72 into r75; + cast r75 r73 into r76 as U256__8JquwLopp8; + lt r30.fee_growth_global1_x_128.lo r50.fee_growth_outside1_x_128.lo into r77; + ternary r77 1u128 0u128 into r78; + sub.w r30.fee_growth_global1_x_128.lo r50.fee_growth_outside1_x_128.lo into r79; + sub.w r30.fee_growth_global1_x_128.hi r50.fee_growth_outside1_x_128.hi into r80; + sub.w r80 r78 into r81; + cast r81 r79 into r82 as U256__8JquwLopp8; + ternary r70 r50.fee_growth_outside0_x_128.hi r76.hi into r83; + ternary r70 r50.fee_growth_outside0_x_128.lo r76.lo into r84; + cast r83 r84 into r85 as U256__8JquwLopp8; + ternary r70 r50.fee_growth_outside1_x_128.hi r82.hi into r86; + ternary r70 r50.fee_growth_outside1_x_128.lo r82.lo into r87; + cast r86 r87 into r88 as U256__8JquwLopp8; + lt r30.fee_growth_global0_x_128.lo r66.lo into r89; + ternary r89 1u128 0u128 into r90; + sub.w r30.fee_growth_global0_x_128.lo r66.lo into r91; + sub.w r30.fee_growth_global0_x_128.hi r66.hi into r92; + sub.w r92 r90 into r93; + cast r93 r91 into r94 as U256__8JquwLopp8; + lt r94.lo r85.lo into r95; + ternary r95 1u128 0u128 into r96; + sub.w r94.lo r85.lo into r97; + sub.w r94.hi r85.hi into r98; + sub.w r98 r96 into r99; + cast r99 r97 into r100 as U256__8JquwLopp8; + lt r30.fee_growth_global1_x_128.lo r69.lo into r101; + ternary r101 1u128 0u128 into r102; + sub.w r30.fee_growth_global1_x_128.lo r69.lo into r103; + sub.w r30.fee_growth_global1_x_128.hi r69.hi into r104; + sub.w r104 r102 into r105; + cast r105 r103 into r106 as U256__8JquwLopp8; + lt r106.lo r88.lo into r107; + ternary r107 1u128 0u128 into r108; + sub.w r106.lo r88.lo into r109; + sub.w r106.hi r88.hi into r110; + sub.w r110 r108 into r111; + cast r111 r109 into r112 as U256__8JquwLopp8; + lt r100.lo r31.fee_growth_inside0_last_x_128.lo into r113; + ternary r113 1u128 0u128 into r114; + sub.w r100.lo r31.fee_growth_inside0_last_x_128.lo into r115; + sub.w r100.hi r31.fee_growth_inside0_last_x_128.hi into r116; + sub.w r116 r114 into r117; + cast r117 r115 into r118 as U256__8JquwLopp8; + and r118.hi 18446744073709551615u128 into r119; + shr r118.hi 64u8 into r120; + and r31.liquidity 18446744073709551615u128 into r121; + shr r31.liquidity 64u8 into r122; + mul r119 r121 into r123; + mul r119 r122 into r124; + mul r120 r121 into r125; + mul r120 r122 into r126; + and r123 18446744073709551615u128 into r127; + shr r123 64u8 into r128; + and r124 18446744073709551615u128 into r129; + add r128 r129 into r130; + and r125 18446744073709551615u128 into r131; + add r130 r131 into r132; + and r132 18446744073709551615u128 into r133; + shr r132 64u8 into r134; + shr r124 64u8 into r135; + shr r125 64u8 into r136; + add r135 r136 into r137; + and r126 18446744073709551615u128 into r138; + add r137 r138 into r139; + add r139 r134 into r140; + and r140 18446744073709551615u128 into r141; + shr r140 64u8 into r142; + shr r126 64u8 into r143; + add r143 r142 into r144; + shl r144 64u8 into r145; + add r145 r141 into r146; + shl r133 64u8 into r147; + add r147 r127 into r148; + and r118.lo 18446744073709551615u128 into r149; + shr r118.lo 64u8 into r150; + mul r149 r121 into r151; + mul r149 r122 into r152; + mul r150 r121 into r153; + mul r150 r122 into r154; + and r151 18446744073709551615u128 into r155; + shr r151 64u8 into r156; + and r152 18446744073709551615u128 into r157; + add r156 r157 into r158; + and r153 18446744073709551615u128 into r159; + add r158 r159 into r160; + and r160 18446744073709551615u128 into r161; + shr r160 64u8 into r162; + shr r152 64u8 into r163; + shr r153 64u8 into r164; + add r163 r164 into r165; + and r154 18446744073709551615u128 into r166; + add r165 r166 into r167; + add r167 r162 into r168; + and r168 18446744073709551615u128 into r169; + shr r168 64u8 into r170; + shr r154 64u8 into r171; + add r171 r170 into r172; + shl r172 64u8 into r173; + add r173 r169 into r174; + shl r161 64u8 into r175; + add r175 r155 into r176; + sub 340282366920938463463374607431768211455u128 r148 into r177; + lte r174 r177 into r178; + is.eq r146 0u128 into r179; + and r179 r178 into r180; + assert.eq r180 true; + add r148 r174 into r181; + add r31.tokens_owed0 r181 into r182; + lt r112.lo r31.fee_growth_inside1_last_x_128.lo into r183; + ternary r183 1u128 0u128 into r184; + sub.w r112.lo r31.fee_growth_inside1_last_x_128.lo into r185; + sub.w r112.hi r31.fee_growth_inside1_last_x_128.hi into r186; + sub.w r186 r184 into r187; + cast r187 r185 into r188 as U256__8JquwLopp8; + and r188.hi 18446744073709551615u128 into r189; + shr r188.hi 64u8 into r190; + and r31.liquidity 18446744073709551615u128 into r191; + shr r31.liquidity 64u8 into r192; + mul r189 r191 into r193; + mul r189 r192 into r194; + mul r190 r191 into r195; + mul r190 r192 into r196; + and r193 18446744073709551615u128 into r197; + shr r193 64u8 into r198; + and r194 18446744073709551615u128 into r199; + add r198 r199 into r200; + and r195 18446744073709551615u128 into r201; + add r200 r201 into r202; + and r202 18446744073709551615u128 into r203; + shr r202 64u8 into r204; + shr r194 64u8 into r205; + shr r195 64u8 into r206; + add r205 r206 into r207; + and r196 18446744073709551615u128 into r208; + add r207 r208 into r209; + add r209 r204 into r210; + and r210 18446744073709551615u128 into r211; + shr r210 64u8 into r212; + shr r196 64u8 into r213; + add r213 r212 into r214; + shl r214 64u8 into r215; + add r215 r211 into r216; + shl r203 64u8 into r217; + add r217 r197 into r218; + and r188.lo 18446744073709551615u128 into r219; + shr r188.lo 64u8 into r220; + mul r219 r191 into r221; + mul r219 r192 into r222; + mul r220 r191 into r223; + mul r220 r192 into r224; + and r221 18446744073709551615u128 into r225; + shr r221 64u8 into r226; + and r222 18446744073709551615u128 into r227; + add r226 r227 into r228; + and r223 18446744073709551615u128 into r229; + add r228 r229 into r230; + and r230 18446744073709551615u128 into r231; + shr r230 64u8 into r232; + shr r222 64u8 into r233; + shr r223 64u8 into r234; + add r233 r234 into r235; + and r224 18446744073709551615u128 into r236; + add r235 r236 into r237; + add r237 r232 into r238; + and r238 18446744073709551615u128 into r239; + shr r238 64u8 into r240; + shr r224 64u8 into r241; + add r241 r240 into r242; + shl r242 64u8 into r243; + add r243 r239 into r244; + shl r231 64u8 into r245; + add r245 r225 into r246; + sub 340282366920938463463374607431768211455u128 r218 into r247; + lte r244 r247 into r248; + is.eq r216 0u128 into r249; + and r249 r248 into r250; + assert.eq r250 true; + add r218 r244 into r251; + add r31.tokens_owed1 r251 into r252; + lte r6 r182 into r253; + lte r7 r252 into r254; + and r253 r254 into r255; + assert.eq r255 true; + sub r182 r6 into r256; + sub r252 r7 into r257; + cast r2 r3 r4 r5 r31.liquidity r100 r112 r256 r257 into r258 as Position; + set r258 into positions[r2]; + +function burn: + input r0 as PositionNFT.record; + async burn r0.token_id into r1; + output r0.token_id as field.public; + output r1 as shield_swap.aleo/burn.future; + +finalize burn: + input r0 as field.public; + contains frozen_position[r0] into r1; + not r1 into r2; + assert.eq r2 true; + get positions[r0] into r3; + is.eq r3.liquidity 0u128 into r4; + assert.eq r4 true; + is.eq r3.tokens_owed0 0u128 into r5; + assert.eq r5 true; + is.eq r3.tokens_owed1 0u128 into r6; + assert.eq r6 true; + remove positions[r0]; + +closure verify_blinded_address: + input r0 as address; + input r1 as address; + input r2 as field; + input r3 as address; + cast r0 into r4 as field; + cast r1 into r5 as field; + cast r4 11835072102227764468342786961086432175093421716844963782363567713633field r5 r2 into r6 as [field; 4u32]; + hash.psd8.raw r6 into r7 as address; + assert.eq r7 r3; + +view view_swap_iteration: + input r0 as SwapIterCfg.public; + input r1 as i32.public; + input r2 as U256__8JquwLopp8.public; + input r3 as Tick.public; + input r4 as SwapIterState.public; + lt r2.hi r0.lim.hi into r5; + gt r2.hi r0.lim.hi into r6; + lt r2.lo r0.lim.lo into r7; + ternary r6 false r7 into r8; + ternary r5 true r8 into r9; + ternary r9 r0.lim.hi r2.hi into r10; + ternary r9 r0.lim.lo r2.lo into r11; + cast r10 r11 into r12 as U256__8JquwLopp8; + lt r0.lim.hi r2.hi into r13; + gt r0.lim.hi r2.hi into r14; + lt r0.lim.lo r2.lo into r15; + ternary r14 false r15 into r16; + ternary r13 true r16 into r17; + ternary r17 r0.lim.hi r2.hi into r18; + ternary r17 r0.lim.lo r2.lo into r19; + cast r18 r19 into r20 as U256__8JquwLopp8; + ternary r0.z r12.hi r20.hi into r21; + ternary r0.z r12.lo r20.lo into r22; + cast r21 r22 into r23 as U256__8JquwLopp8; + gt r4.rem 0u128 into r24; + and r4.crossed r24 into r25; + is.eq r4.liq 0u128 into r26; + and r25 r26 into r27; + gt r4.liq 0u128 into r28; + and r24 r28 into r29; + and r29 r4.crossed into r30; + lt r4.sp.hi r23.hi into r31; + gt r4.sp.hi r23.hi into r32; + lt r4.sp.lo r23.lo into r33; + ternary r32 false r33 into r34; + ternary r31 true r34 into r35; + ternary r35 r4.sp.hi r23.hi into r36; + ternary r35 r4.sp.lo r23.lo into r37; + cast r36 r37 into r38 as U256__8JquwLopp8; + lt r4.sp.hi r23.hi into r39; + gt r4.sp.hi r23.hi into r40; + lt r4.sp.lo r23.lo into r41; + ternary r40 false r41 into r42; + ternary r39 true r42 into r43; + ternary r43 r23.hi r4.sp.hi into r44; + ternary r43 r23.lo r4.sp.lo into r45; + cast r44 r45 into r46 as U256__8JquwLopp8; + lt r46.lo r38.lo into r47; + ternary r47 1u128 0u128 into r48; + sub.w r46.lo r38.lo into r49; + sub.w r46.hi r38.hi into r50; + sub.w r50 r48 into r51; + cast r51 r49 into r52 as U256__8JquwLopp8; + shr r52.lo 64u8 into r53; + shr r52.hi 64u8 into r54; + and r4.liq 18446744073709551615u128 into r55; + shr r4.liq 64u8 into r56; + and r52.lo 18446744073709551615u128 into r57; + shr r52.lo 64u8 into r58; + mul r55 r57 into r59; + mul r55 r58 into r60; + mul r56 r57 into r61; + mul r56 r58 into r62; + and r59 18446744073709551615u128 into r63; + shr r59 64u8 into r64; + and r60 18446744073709551615u128 into r65; + add r64 r65 into r66; + and r61 18446744073709551615u128 into r67; + add r66 r67 into r68; + and r68 18446744073709551615u128 into r69; + shr r68 64u8 into r70; + shr r60 64u8 into r71; + shr r61 64u8 into r72; + add r71 r72 into r73; + and r62 18446744073709551615u128 into r74; + add r73 r74 into r75; + add r75 r70 into r76; + and r76 18446744073709551615u128 into r77; + shr r76 64u8 into r78; + shr r62 64u8 into r79; + add r79 r78 into r80; + shl r80 64u8 into r81; + add r81 r77 into r82; + shl r69 64u8 into r83; + add r83 r63 into r84; + and r52.hi 18446744073709551615u128 into r85; + shr r52.hi 64u8 into r86; + mul r55 r85 into r87; + mul r55 r86 into r88; + mul r56 r85 into r89; + mul r56 r86 into r90; + and r87 18446744073709551615u128 into r91; + shr r87 64u8 into r92; + and r88 18446744073709551615u128 into r93; + add r92 r93 into r94; + and r89 18446744073709551615u128 into r95; + add r94 r95 into r96; + and r96 18446744073709551615u128 into r97; + shr r96 64u8 into r98; + shr r88 64u8 into r99; + shr r89 64u8 into r100; + add r99 r100 into r101; + and r90 18446744073709551615u128 into r102; + add r101 r102 into r103; + add r103 r98 into r104; + and r104 18446744073709551615u128 into r105; + shr r104 64u8 into r106; + shr r90 64u8 into r107; + add r107 r106 into r108; + shl r108 64u8 into r109; + add r109 r105 into r110; + shl r97 64u8 into r111; + add r111 r91 into r112; + lt r84 0u128 into r113; + ternary r113 1u128 0u128 into r114; + lt r82 0u128 into r115; + ternary r115 1u128 0u128 into r116; + add.w r82 r112 into r117; + lt r117 r82 into r118; + ternary r118 1u128 0u128 into r119; + add.w r117 r114 into r120; + lt r120 r117 into r121; + ternary r121 1u128 0u128 into r122; + add r116 r119 into r123; + add r123 r122 into r124; + add.w r110 r124 into r125; + cast r125 r120 into r126 as U256__8JquwLopp8; + cast r84 0u128 into r127 as U256__8JquwLopp8; + lt r126.hi r46.hi into r128; + gt r126.hi r46.hi into r129; + lt r126.lo r46.lo into r130; + ternary r129 false r130 into r131; + ternary r128 true r131 into r132; + assert.eq r132 true; + gt r46.hi 0u128 into r133; + ternary r133 r46.hi r46.lo into r134; + ternary r133 128u32 0u32 into r135; + gte r134 18446744073709551616u128 into r136; + shr r134 64u8 into r137; + ternary r136 r137 r134 into r138; + ternary r136 64u32 0u32 into r139; + gte r138 4294967296u128 into r140; + shr r138 32u8 into r141; + add r139 32u32 into r142; + ternary r140 r141 r138 into r143; + ternary r140 r142 r139 into r144; + gte r143 65536u128 into r145; + shr r143 16u8 into r146; + add r144 16u32 into r147; + ternary r145 r146 r143 into r148; + ternary r145 r147 r144 into r149; + gte r148 256u128 into r150; + shr r148 8u8 into r151; + add r149 8u32 into r152; + ternary r150 r151 r148 into r153; + ternary r150 r152 r149 into r154; + gte r153 16u128 into r155; + shr r153 4u8 into r156; + add r154 4u32 into r157; + ternary r155 r156 r153 into r158; + ternary r155 r157 r154 into r159; + gte r158 4u128 into r160; + shr r158 2u8 into r161; + add r159 2u32 into r162; + ternary r160 r161 r158 into r163; + ternary r160 r162 r159 into r164; + gte r163 2u128 into r165; + add r164 1u32 into r166; + ternary r165 r166 r164 into r167; + add r135 r167 into r168; + sub 255u32 r168 into r169; + cast r169 into r170 as u16; + and r170 127u16 into r171; + cast r171 into r172 as u8; + is.eq r172 0u8 into r173; + sub 128u8 r172 into r174; + shr.w r46.lo r174 into r175; + ternary r173 0u128 r175 into r176; + shl.w r46.hi r172 into r177; + or r177 r176 into r178; + shl.w r46.lo r172 into r179; + shl.w r46.lo r172 into r180; + gte r170 128u16 into r181; + ternary r181 r180 r178 into r182; + ternary r181 0u128 r179 into r183; + cast r182 r183 into r184 as U256__8JquwLopp8; + and r184.lo 18446744073709551615u128 into r185; + shr r184.lo 64u8 into r186; + and r184.hi 18446744073709551615u128 into r187; + shr r184.hi 64u8 into r188; + cast r171 into r189 as u8; + is.eq r189 0u8 into r190; + sub 128u8 r189 into r191; + shr.w r127.lo r191 into r192; + ternary r190 0u128 r192 into r193; + shl.w r127.hi r189 into r194; + or r194 r193 into r195; + shl.w r127.lo r189 into r196; + shl.w r127.lo r189 into r197; + ternary r181 r197 r195 into r198; + ternary r181 0u128 r196 into r199; + cast r198 r199 into r200 as U256__8JquwLopp8; + is.eq r170 0u16 into r201; + sub 256u16 r170 into r202; + and r202 127u16 into r203; + cast r203 into r204 as u8; + is.eq r204 0u8 into r205; + sub 128u8 r204 into r206; + shl.w r127.hi r206 into r207; + ternary r205 0u128 r207 into r208; + shr r127.lo r204 into r209; + or r209 r208 into r210; + shr r127.hi r204 into r211; + shr r127.hi r204 into r212; + gte r202 128u16 into r213; + ternary r213 0u128 r211 into r214; + ternary r213 r212 r210 into r215; + cast r214 r215 into r216 as U256__8JquwLopp8; + ternary r201 0u128 r216.hi into r217; + ternary r201 0u128 r216.lo into r218; + cast r217 r218 into r219 as U256__8JquwLopp8; + cast r171 into r220 as u8; + is.eq r220 0u8 into r221; + sub 128u8 r220 into r222; + shr.w r126.lo r222 into r223; + ternary r221 0u128 r223 into r224; + shl.w r126.hi r220 into r225; + or r225 r224 into r226; + shl.w r126.lo r220 into r227; + shl.w r126.lo r220 into r228; + ternary r181 r228 r226 into r229; + ternary r181 0u128 r227 into r230; + cast r229 r230 into r231 as U256__8JquwLopp8; + add.w r231.lo r219.lo into r232; + lt r232 r231.lo into r233; + ternary r233 1u128 0u128 into r234; + add.w r231.hi r219.hi into r235; + add.w r235 r234 into r236; + cast r236 r232 into r237 as U256__8JquwLopp8; + and r200.lo 18446744073709551615u128 into r238; + shr r200.lo 64u8 into r239; + and r200.hi 18446744073709551615u128 into r240; + shr r200.hi 64u8 into r241; + and r237.lo 18446744073709551615u128 into r242; + shr r237.lo 64u8 into r243; + and r237.hi 18446744073709551615u128 into r244; + shr r237.hi 64u8 into r245; + shl r245 64u8 into r246; + add r246 r244 into r247; + div r247 r188 into r248; + gt r248 18446744073709551615u128 into r249; + ternary r249 18446744073709551615u128 r248 into r250; + mul r250 r188 into r251; + sub r247 r251 into r252; + lte r252 18446744073709551615u128 into r253; + mul r250 r187 into r254; + and r252 18446744073709551615u128 into r255; + shl r255 64u8 into r256; + add r256 r243 into r257; + gt r254 r257 into r258; + and r253 r258 into r259; + sub.w r250 1u128 into r260; + ternary r259 r260 r250 into r261; + add r252 r188 into r262; + ternary r259 r262 r252 into r263; + lte r263 18446744073709551615u128 into r264; + and r259 r264 into r265; + mul r261 r187 into r266; + and r263 18446744073709551615u128 into r267; + shl r267 64u8 into r268; + add r268 r243 into r269; + gt r266 r269 into r270; + and r265 r270 into r271; + sub.w r261 1u128 into r272; + ternary r271 r272 r261 into r273; + mul r273 r185 into r274; + and r274 18446744073709551615u128 into r275; + lt r241 r275 into r276; + add r241 18446744073709551616u128 into r277; + sub r277 r275 into r278; + and r278 18446744073709551615u128 into r279; + shr r274 64u8 into r280; + ternary r276 1u128 0u128 into r281; + add r280 r281 into r282; + mul r273 r186 into r283; + add r283 r282 into r284; + and r284 18446744073709551615u128 into r285; + lt r242 r285 into r286; + add r242 18446744073709551616u128 into r287; + sub r287 r285 into r288; + and r288 18446744073709551615u128 into r289; + shr r284 64u8 into r290; + ternary r286 1u128 0u128 into r291; + add r290 r291 into r292; + mul r273 r187 into r293; + add r293 r292 into r294; + and r294 18446744073709551615u128 into r295; + lt r243 r295 into r296; + add r243 18446744073709551616u128 into r297; + sub r297 r295 into r298; + and r298 18446744073709551615u128 into r299; + shr r294 64u8 into r300; + ternary r296 1u128 0u128 into r301; + add r300 r301 into r302; + mul r273 r188 into r303; + add r303 r302 into r304; + and r304 18446744073709551615u128 into r305; + lt r244 r305 into r306; + add r244 18446744073709551616u128 into r307; + sub r307 r305 into r308; + and r308 18446744073709551615u128 into r309; + shr r304 64u8 into r310; + ternary r306 1u128 0u128 into r311; + add r310 r311 into r312; + lt r245 r312 into r313; + add r245 18446744073709551616u128 into r314; + sub r314 r312 into r315; + and r315 18446744073709551615u128 into r316; + sub.w r273 1u128 into r317; + ternary r313 r317 r273 into r318; + add r279 r185 into r319; + and r319 18446744073709551615u128 into r320; + ternary r313 r320 r279 into r321; + shr r319 64u8 into r322; + ternary r313 r322 0u128 into r323; + add r289 r186 into r324; + add r324 r323 into r325; + and r325 18446744073709551615u128 into r326; + ternary r313 r326 r289 into r327; + shr r325 64u8 into r328; + ternary r313 r328 0u128 into r329; + add r299 r187 into r330; + add r330 r329 into r331; + and r331 18446744073709551615u128 into r332; + ternary r313 r332 r299 into r333; + shr r331 64u8 into r334; + ternary r313 r334 0u128 into r335; + add r309 r188 into r336; + add r336 r335 into r337; + and r337 18446744073709551615u128 into r338; + ternary r313 r338 r309 into r339; + shr r337 64u8 into r340; + ternary r313 r340 0u128 into r341; + add r316 r341 into r342; + shl r339 64u8 into r343; + add r343 r333 into r344; + div r344 r188 into r345; + gt r345 18446744073709551615u128 into r346; + ternary r346 18446744073709551615u128 r345 into r347; + mul r347 r188 into r348; + sub r344 r348 into r349; + lte r349 18446744073709551615u128 into r350; + mul r347 r187 into r351; + and r349 18446744073709551615u128 into r352; + shl r352 64u8 into r353; + add r353 r327 into r354; + gt r351 r354 into r355; + and r350 r355 into r356; + sub.w r347 1u128 into r357; + ternary r356 r357 r347 into r358; + add r349 r188 into r359; + ternary r356 r359 r349 into r360; + lte r360 18446744073709551615u128 into r361; + and r356 r361 into r362; + mul r358 r187 into r363; + and r360 18446744073709551615u128 into r364; + shl r364 64u8 into r365; + add r365 r327 into r366; + gt r363 r366 into r367; + and r362 r367 into r368; + sub.w r358 1u128 into r369; + ternary r368 r369 r358 into r370; + mul r370 r185 into r371; + and r371 18446744073709551615u128 into r372; + lt r240 r372 into r373; + add r240 18446744073709551616u128 into r374; + sub r374 r372 into r375; + and r375 18446744073709551615u128 into r376; + shr r371 64u8 into r377; + ternary r373 1u128 0u128 into r378; + add r377 r378 into r379; + mul r370 r186 into r380; + add r380 r379 into r381; + and r381 18446744073709551615u128 into r382; + lt r321 r382 into r383; + add r321 18446744073709551616u128 into r384; + sub r384 r382 into r385; + and r385 18446744073709551615u128 into r386; + shr r381 64u8 into r387; + ternary r383 1u128 0u128 into r388; + add r387 r388 into r389; + mul r370 r187 into r390; + add r390 r389 into r391; + and r391 18446744073709551615u128 into r392; + lt r327 r392 into r393; + add r327 18446744073709551616u128 into r394; + sub r394 r392 into r395; + and r395 18446744073709551615u128 into r396; + shr r391 64u8 into r397; + ternary r393 1u128 0u128 into r398; + add r397 r398 into r399; + mul r370 r188 into r400; + add r400 r399 into r401; + and r401 18446744073709551615u128 into r402; + lt r333 r402 into r403; + add r333 18446744073709551616u128 into r404; + sub r404 r402 into r405; + and r405 18446744073709551615u128 into r406; + shr r401 64u8 into r407; + ternary r403 1u128 0u128 into r408; + add r407 r408 into r409; + lt r339 r409 into r410; + add r339 18446744073709551616u128 into r411; + sub r411 r409 into r412; + and r412 18446744073709551615u128 into r413; + sub.w r370 1u128 into r414; + ternary r410 r414 r370 into r415; + add r376 r185 into r416; + and r416 18446744073709551615u128 into r417; + ternary r410 r417 r376 into r418; + shr r416 64u8 into r419; + ternary r410 r419 0u128 into r420; + add r386 r186 into r421; + add r421 r420 into r422; + and r422 18446744073709551615u128 into r423; + ternary r410 r423 r386 into r424; + shr r422 64u8 into r425; + ternary r410 r425 0u128 into r426; + add r396 r187 into r427; + add r427 r426 into r428; + and r428 18446744073709551615u128 into r429; + ternary r410 r429 r396 into r430; + shr r428 64u8 into r431; + ternary r410 r431 0u128 into r432; + add r406 r188 into r433; + add r433 r432 into r434; + and r434 18446744073709551615u128 into r435; + ternary r410 r435 r406 into r436; + shr r434 64u8 into r437; + ternary r410 r437 0u128 into r438; + add r413 r438 into r439; + shl r436 64u8 into r440; + add r440 r430 into r441; + div r441 r188 into r442; + gt r442 18446744073709551615u128 into r443; + ternary r443 18446744073709551615u128 r442 into r444; + mul r444 r188 into r445; + sub r441 r445 into r446; + lte r446 18446744073709551615u128 into r447; + mul r444 r187 into r448; + and r446 18446744073709551615u128 into r449; + shl r449 64u8 into r450; + add r450 r424 into r451; + gt r448 r451 into r452; + and r447 r452 into r453; + sub.w r444 1u128 into r454; + ternary r453 r454 r444 into r455; + add r446 r188 into r456; + ternary r453 r456 r446 into r457; + lte r457 18446744073709551615u128 into r458; + and r453 r458 into r459; + mul r455 r187 into r460; + and r457 18446744073709551615u128 into r461; + shl r461 64u8 into r462; + add r462 r424 into r463; + gt r460 r463 into r464; + and r459 r464 into r465; + sub.w r455 1u128 into r466; + ternary r465 r466 r455 into r467; + mul r467 r185 into r468; + and r468 18446744073709551615u128 into r469; + lt r239 r469 into r470; + add r239 18446744073709551616u128 into r471; + sub r471 r469 into r472; + and r472 18446744073709551615u128 into r473; + shr r468 64u8 into r474; + ternary r470 1u128 0u128 into r475; + add r474 r475 into r476; + mul r467 r186 into r477; + add r477 r476 into r478; + and r478 18446744073709551615u128 into r479; + lt r418 r479 into r480; + add r418 18446744073709551616u128 into r481; + sub r481 r479 into r482; + and r482 18446744073709551615u128 into r483; + shr r478 64u8 into r484; + ternary r480 1u128 0u128 into r485; + add r484 r485 into r486; + mul r467 r187 into r487; + add r487 r486 into r488; + and r488 18446744073709551615u128 into r489; + lt r424 r489 into r490; + add r424 18446744073709551616u128 into r491; + sub r491 r489 into r492; + and r492 18446744073709551615u128 into r493; + shr r488 64u8 into r494; + ternary r490 1u128 0u128 into r495; + add r494 r495 into r496; + mul r467 r188 into r497; + add r497 r496 into r498; + and r498 18446744073709551615u128 into r499; + lt r430 r499 into r500; + add r430 18446744073709551616u128 into r501; + sub r501 r499 into r502; + and r502 18446744073709551615u128 into r503; + shr r498 64u8 into r504; + ternary r500 1u128 0u128 into r505; + add r504 r505 into r506; + lt r436 r506 into r507; + add r436 18446744073709551616u128 into r508; + sub r508 r506 into r509; + and r509 18446744073709551615u128 into r510; + sub.w r467 1u128 into r511; + ternary r507 r511 r467 into r512; + add r473 r185 into r513; + and r513 18446744073709551615u128 into r514; + ternary r507 r514 r473 into r515; + shr r513 64u8 into r516; + ternary r507 r516 0u128 into r517; + add r483 r186 into r518; + add r518 r517 into r519; + and r519 18446744073709551615u128 into r520; + ternary r507 r520 r483 into r521; + shr r519 64u8 into r522; + ternary r507 r522 0u128 into r523; + add r493 r187 into r524; + add r524 r523 into r525; + and r525 18446744073709551615u128 into r526; + ternary r507 r526 r493 into r527; + shr r525 64u8 into r528; + ternary r507 r528 0u128 into r529; + add r503 r188 into r530; + add r530 r529 into r531; + and r531 18446744073709551615u128 into r532; + ternary r507 r532 r503 into r533; + shr r531 64u8 into r534; + ternary r507 r534 0u128 into r535; + add r510 r535 into r536; + shl r533 64u8 into r537; + add r537 r527 into r538; + div r538 r188 into r539; + gt r539 18446744073709551615u128 into r540; + ternary r540 18446744073709551615u128 r539 into r541; + mul r541 r188 into r542; + sub r538 r542 into r543; + lte r543 18446744073709551615u128 into r544; + mul r541 r187 into r545; + and r543 18446744073709551615u128 into r546; + shl r546 64u8 into r547; + add r547 r521 into r548; + gt r545 r548 into r549; + and r544 r549 into r550; + sub.w r541 1u128 into r551; + ternary r550 r551 r541 into r552; + add r543 r188 into r553; + ternary r550 r553 r543 into r554; + lte r554 18446744073709551615u128 into r555; + and r550 r555 into r556; + mul r552 r187 into r557; + and r554 18446744073709551615u128 into r558; + shl r558 64u8 into r559; + add r559 r521 into r560; + gt r557 r560 into r561; + and r556 r561 into r562; + sub.w r552 1u128 into r563; + ternary r562 r563 r552 into r564; + mul r564 r185 into r565; + and r565 18446744073709551615u128 into r566; + lt r238 r566 into r567; + add r238 18446744073709551616u128 into r568; + sub r568 r566 into r569; + and r569 18446744073709551615u128 into r570; + shr r565 64u8 into r571; + ternary r567 1u128 0u128 into r572; + add r571 r572 into r573; + mul r564 r186 into r574; + add r574 r573 into r575; + and r575 18446744073709551615u128 into r576; + lt r515 r576 into r577; + add r515 18446744073709551616u128 into r578; + sub r578 r576 into r579; + and r579 18446744073709551615u128 into r580; + shr r575 64u8 into r581; + ternary r577 1u128 0u128 into r582; + add r581 r582 into r583; + mul r564 r187 into r584; + add r584 r583 into r585; + and r585 18446744073709551615u128 into r586; + lt r521 r586 into r587; + add r521 18446744073709551616u128 into r588; + sub r588 r586 into r589; + and r589 18446744073709551615u128 into r590; + shr r585 64u8 into r591; + ternary r587 1u128 0u128 into r592; + add r591 r592 into r593; + mul r564 r188 into r594; + add r594 r593 into r595; + and r595 18446744073709551615u128 into r596; + lt r527 r596 into r597; + add r527 18446744073709551616u128 into r598; + sub r598 r596 into r599; + and r599 18446744073709551615u128 into r600; + shr r595 64u8 into r601; + ternary r597 1u128 0u128 into r602; + add r601 r602 into r603; + lt r533 r603 into r604; + add r533 18446744073709551616u128 into r605; + sub r605 r603 into r606; + and r606 18446744073709551615u128 into r607; + sub.w r564 1u128 into r608; + ternary r604 r608 r564 into r609; + add r570 r185 into r610; + and r610 18446744073709551615u128 into r611; + ternary r604 r611 r570 into r612; + shr r610 64u8 into r613; + ternary r604 r613 0u128 into r614; + add r580 r186 into r615; + add r615 r614 into r616; + and r616 18446744073709551615u128 into r617; + ternary r604 r617 r580 into r618; + shr r616 64u8 into r619; + ternary r604 r619 0u128 into r620; + add r590 r187 into r621; + add r621 r620 into r622; + and r622 18446744073709551615u128 into r623; + ternary r604 r623 r590 into r624; + shr r622 64u8 into r625; + ternary r604 r625 0u128 into r626; + add r600 r188 into r627; + add r627 r626 into r628; + and r628 18446744073709551615u128 into r629; + ternary r604 r629 r600 into r630; + shr r628 64u8 into r631; + ternary r604 r631 0u128 into r632; + add r607 r632 into r633; + shl r318 64u8 into r634; + add r634 r415 into r635; + shl r512 64u8 into r636; + add r636 r609 into r637; + cast r635 r637 into r638 as U256__8JquwLopp8; + shl r630 64u8 into r639; + add r639 r624 into r640; + shl r618 64u8 into r641; + add r641 r612 into r642; + cast r171 into r643 as u8; + is.eq r643 0u8 into r644; + sub 128u8 r643 into r645; + shl.w r640 r645 into r646; + ternary r644 0u128 r646 into r647; + shr r642 r643 into r648; + or r648 r647 into r649; + shr r640 r643 into r650; + ternary r181 0u128 r650 into r651; + ternary r181 r650 r649 into r652; + cast r651 r652 into r653 as U256__8JquwLopp8; + is.eq r653.hi 0u128 into r654; + is.eq r653.lo 0u128 into r655; + and r654 r655 into r656; + not r656 into r657; + and r0.z r657 into r658; + is.eq r638.hi 340282366920938463463374607431768211455u128 into r659; + is.eq r638.lo 340282366920938463463374607431768211455u128 into r660; + and r659 r660 into r661; + and r658 r661 into r662; + not r662 into r663; + assert.eq r663 true; + add.w r638.lo 1u128 into r664; + lt r664 r638.lo into r665; + ternary r665 1u128 0u128 into r666; + add.w r638.hi r666 into r667; + cast r667 r664 into r668 as U256__8JquwLopp8; + ternary r658 r668.hi r638.hi into r669; + ternary r658 r668.lo r638.lo into r670; + cast r669 r670 into r671 as U256__8JquwLopp8; + and r671.lo 18446744073709551615u128 into r672; + shr r671.lo 64u8 into r673; + and r672 18446744073709551615u128 into r674; + shr r672 64u8 into r675; + and r673 18446744073709551615u128 into r676; + add r675 r676 into r677; + and r677 18446744073709551615u128 into r678; + shr r677 64u8 into r679; + shr r673 64u8 into r680; + add r680 r679 into r681; + and r681 18446744073709551615u128 into r682; + shr r681 64u8 into r683; + shl r683 64u8 into r684; + add r684 r682 into r685; + shl r678 64u8 into r686; + add r686 r674 into r687; + shr r671.lo 64u8 into r688; + and r671.hi 18446744073709551615u128 into r689; + shr r671.hi 64u8 into r690; + and r689 18446744073709551615u128 into r691; + shr r689 64u8 into r692; + and r690 18446744073709551615u128 into r693; + add r692 r693 into r694; + and r694 18446744073709551615u128 into r695; + shr r694 64u8 into r696; + shr r690 64u8 into r697; + add r697 r696 into r698; + and r698 18446744073709551615u128 into r699; + shr r698 64u8 into r700; + shl r700 64u8 into r701; + add r701 r699 into r702; + shl r695 64u8 into r703; + add r703 r691 into r704; + shr r671.hi 64u8 into r705; + lt r685 r685 into r706; + ternary r706 1u128 0u128 into r707; + add.w r685 r704 into r708; + lt r708 r685 into r709; + ternary r709 1u128 0u128 into r710; + add r707 r710 into r711; + lt r702 0u128 into r712; + ternary r712 1u128 0u128 into r713; + lt r702 r702 into r714; + ternary r714 1u128 0u128 into r715; + add.w r702 r711 into r716; + lt r716 r702 into r717; + ternary r717 1u128 0u128 into r718; + add r713 r715 into r719; + add r719 r718 into r720; + cast r720 r716 into r721 as U256__8JquwLopp8; + cast r708 r687 into r722 as U256__8JquwLopp8; + lt r721.hi r38.hi into r723; + gt r721.hi r38.hi into r724; + lt r721.lo r38.lo into r725; + ternary r724 false r725 into r726; + ternary r723 true r726 into r727; + assert.eq r727 true; + gt r38.hi 0u128 into r728; + ternary r728 r38.hi r38.lo into r729; + ternary r728 128u32 0u32 into r730; + gte r729 18446744073709551616u128 into r731; + shr r729 64u8 into r732; + ternary r731 r732 r729 into r733; + ternary r731 64u32 0u32 into r734; + gte r733 4294967296u128 into r735; + shr r733 32u8 into r736; + add r734 32u32 into r737; + ternary r735 r736 r733 into r738; + ternary r735 r737 r734 into r739; + gte r738 65536u128 into r740; + shr r738 16u8 into r741; + add r739 16u32 into r742; + ternary r740 r741 r738 into r743; + ternary r740 r742 r739 into r744; + gte r743 256u128 into r745; + shr r743 8u8 into r746; + add r744 8u32 into r747; + ternary r745 r746 r743 into r748; + ternary r745 r747 r744 into r749; + gte r748 16u128 into r750; + shr r748 4u8 into r751; + add r749 4u32 into r752; + ternary r750 r751 r748 into r753; + ternary r750 r752 r749 into r754; + gte r753 4u128 into r755; + shr r753 2u8 into r756; + add r754 2u32 into r757; + ternary r755 r756 r753 into r758; + ternary r755 r757 r754 into r759; + gte r758 2u128 into r760; + add r759 1u32 into r761; + ternary r760 r761 r759 into r762; + add r730 r762 into r763; + sub 255u32 r763 into r764; + cast r764 into r765 as u16; + and r765 127u16 into r766; + cast r766 into r767 as u8; + is.eq r767 0u8 into r768; + sub 128u8 r767 into r769; + shr.w r38.lo r769 into r770; + ternary r768 0u128 r770 into r771; + shl.w r38.hi r767 into r772; + or r772 r771 into r773; + shl.w r38.lo r767 into r774; + shl.w r38.lo r767 into r775; + gte r765 128u16 into r776; + ternary r776 r775 r773 into r777; + ternary r776 0u128 r774 into r778; + cast r777 r778 into r779 as U256__8JquwLopp8; + and r779.lo 18446744073709551615u128 into r780; + shr r779.lo 64u8 into r781; + and r779.hi 18446744073709551615u128 into r782; + shr r779.hi 64u8 into r783; + cast r766 into r784 as u8; + is.eq r784 0u8 into r785; + sub 128u8 r784 into r786; + shr.w r722.lo r786 into r787; + ternary r785 0u128 r787 into r788; + shl.w r722.hi r784 into r789; + or r789 r788 into r790; + shl.w r722.lo r784 into r791; + shl.w r722.lo r784 into r792; + ternary r776 r792 r790 into r793; + ternary r776 0u128 r791 into r794; + cast r793 r794 into r795 as U256__8JquwLopp8; + is.eq r765 0u16 into r796; + sub 256u16 r765 into r797; + and r797 127u16 into r798; + cast r798 into r799 as u8; + is.eq r799 0u8 into r800; + sub 128u8 r799 into r801; + shl.w r722.hi r801 into r802; + ternary r800 0u128 r802 into r803; + shr r722.lo r799 into r804; + or r804 r803 into r805; + shr r722.hi r799 into r806; + shr r722.hi r799 into r807; + gte r797 128u16 into r808; + ternary r808 0u128 r806 into r809; + ternary r808 r807 r805 into r810; + cast r809 r810 into r811 as U256__8JquwLopp8; + ternary r796 0u128 r811.hi into r812; + ternary r796 0u128 r811.lo into r813; + cast r812 r813 into r814 as U256__8JquwLopp8; + cast r766 into r815 as u8; + is.eq r815 0u8 into r816; + sub 128u8 r815 into r817; + shr.w r721.lo r817 into r818; + ternary r816 0u128 r818 into r819; + shl.w r721.hi r815 into r820; + or r820 r819 into r821; + shl.w r721.lo r815 into r822; + shl.w r721.lo r815 into r823; + ternary r776 r823 r821 into r824; + ternary r776 0u128 r822 into r825; + cast r824 r825 into r826 as U256__8JquwLopp8; + add.w r826.lo r814.lo into r827; + lt r827 r826.lo into r828; + ternary r828 1u128 0u128 into r829; + add.w r826.hi r814.hi into r830; + add.w r830 r829 into r831; + cast r831 r827 into r832 as U256__8JquwLopp8; + and r795.lo 18446744073709551615u128 into r833; + shr r795.lo 64u8 into r834; + and r795.hi 18446744073709551615u128 into r835; + shr r795.hi 64u8 into r836; + and r832.lo 18446744073709551615u128 into r837; + shr r832.lo 64u8 into r838; + and r832.hi 18446744073709551615u128 into r839; + shr r832.hi 64u8 into r840; + shl r840 64u8 into r841; + add r841 r839 into r842; + div r842 r783 into r843; + gt r843 18446744073709551615u128 into r844; + ternary r844 18446744073709551615u128 r843 into r845; + mul r845 r783 into r846; + sub r842 r846 into r847; + lte r847 18446744073709551615u128 into r848; + mul r845 r782 into r849; + and r847 18446744073709551615u128 into r850; + shl r850 64u8 into r851; + add r851 r838 into r852; + gt r849 r852 into r853; + and r848 r853 into r854; + sub.w r845 1u128 into r855; + ternary r854 r855 r845 into r856; + add r847 r783 into r857; + ternary r854 r857 r847 into r858; + lte r858 18446744073709551615u128 into r859; + and r854 r859 into r860; + mul r856 r782 into r861; + and r858 18446744073709551615u128 into r862; + shl r862 64u8 into r863; + add r863 r838 into r864; + gt r861 r864 into r865; + and r860 r865 into r866; + sub.w r856 1u128 into r867; + ternary r866 r867 r856 into r868; + mul r868 r780 into r869; + and r869 18446744073709551615u128 into r870; + lt r836 r870 into r871; + add r836 18446744073709551616u128 into r872; + sub r872 r870 into r873; + and r873 18446744073709551615u128 into r874; + shr r869 64u8 into r875; + ternary r871 1u128 0u128 into r876; + add r875 r876 into r877; + mul r868 r781 into r878; + add r878 r877 into r879; + and r879 18446744073709551615u128 into r880; + lt r837 r880 into r881; + add r837 18446744073709551616u128 into r882; + sub r882 r880 into r883; + and r883 18446744073709551615u128 into r884; + shr r879 64u8 into r885; + ternary r881 1u128 0u128 into r886; + add r885 r886 into r887; + mul r868 r782 into r888; + add r888 r887 into r889; + and r889 18446744073709551615u128 into r890; + lt r838 r890 into r891; + add r838 18446744073709551616u128 into r892; + sub r892 r890 into r893; + and r893 18446744073709551615u128 into r894; + shr r889 64u8 into r895; + ternary r891 1u128 0u128 into r896; + add r895 r896 into r897; + mul r868 r783 into r898; + add r898 r897 into r899; + and r899 18446744073709551615u128 into r900; + lt r839 r900 into r901; + add r839 18446744073709551616u128 into r902; + sub r902 r900 into r903; + and r903 18446744073709551615u128 into r904; + shr r899 64u8 into r905; + ternary r901 1u128 0u128 into r906; + add r905 r906 into r907; + lt r840 r907 into r908; + add r840 18446744073709551616u128 into r909; + sub r909 r907 into r910; + and r910 18446744073709551615u128 into r911; + sub.w r868 1u128 into r912; + ternary r908 r912 r868 into r913; + add r874 r780 into r914; + and r914 18446744073709551615u128 into r915; + ternary r908 r915 r874 into r916; + shr r914 64u8 into r917; + ternary r908 r917 0u128 into r918; + add r884 r781 into r919; + add r919 r918 into r920; + and r920 18446744073709551615u128 into r921; + ternary r908 r921 r884 into r922; + shr r920 64u8 into r923; + ternary r908 r923 0u128 into r924; + add r894 r782 into r925; + add r925 r924 into r926; + and r926 18446744073709551615u128 into r927; + ternary r908 r927 r894 into r928; + shr r926 64u8 into r929; + ternary r908 r929 0u128 into r930; + add r904 r783 into r931; + add r931 r930 into r932; + and r932 18446744073709551615u128 into r933; + ternary r908 r933 r904 into r934; + shr r932 64u8 into r935; + ternary r908 r935 0u128 into r936; + add r911 r936 into r937; + shl r934 64u8 into r938; + add r938 r928 into r939; + div r939 r783 into r940; + gt r940 18446744073709551615u128 into r941; + ternary r941 18446744073709551615u128 r940 into r942; + mul r942 r783 into r943; + sub r939 r943 into r944; + lte r944 18446744073709551615u128 into r945; + mul r942 r782 into r946; + and r944 18446744073709551615u128 into r947; + shl r947 64u8 into r948; + add r948 r922 into r949; + gt r946 r949 into r950; + and r945 r950 into r951; + sub.w r942 1u128 into r952; + ternary r951 r952 r942 into r953; + add r944 r783 into r954; + ternary r951 r954 r944 into r955; + lte r955 18446744073709551615u128 into r956; + and r951 r956 into r957; + mul r953 r782 into r958; + and r955 18446744073709551615u128 into r959; + shl r959 64u8 into r960; + add r960 r922 into r961; + gt r958 r961 into r962; + and r957 r962 into r963; + sub.w r953 1u128 into r964; + ternary r963 r964 r953 into r965; + mul r965 r780 into r966; + and r966 18446744073709551615u128 into r967; + lt r835 r967 into r968; + add r835 18446744073709551616u128 into r969; + sub r969 r967 into r970; + and r970 18446744073709551615u128 into r971; + shr r966 64u8 into r972; + ternary r968 1u128 0u128 into r973; + add r972 r973 into r974; + mul r965 r781 into r975; + add r975 r974 into r976; + and r976 18446744073709551615u128 into r977; + lt r916 r977 into r978; + add r916 18446744073709551616u128 into r979; + sub r979 r977 into r980; + and r980 18446744073709551615u128 into r981; + shr r976 64u8 into r982; + ternary r978 1u128 0u128 into r983; + add r982 r983 into r984; + mul r965 r782 into r985; + add r985 r984 into r986; + and r986 18446744073709551615u128 into r987; + lt r922 r987 into r988; + add r922 18446744073709551616u128 into r989; + sub r989 r987 into r990; + and r990 18446744073709551615u128 into r991; + shr r986 64u8 into r992; + ternary r988 1u128 0u128 into r993; + add r992 r993 into r994; + mul r965 r783 into r995; + add r995 r994 into r996; + and r996 18446744073709551615u128 into r997; + lt r928 r997 into r998; + add r928 18446744073709551616u128 into r999; + sub r999 r997 into r1000; + and r1000 18446744073709551615u128 into r1001; + shr r996 64u8 into r1002; + ternary r998 1u128 0u128 into r1003; + add r1002 r1003 into r1004; + lt r934 r1004 into r1005; + add r934 18446744073709551616u128 into r1006; + sub r1006 r1004 into r1007; + and r1007 18446744073709551615u128 into r1008; + sub.w r965 1u128 into r1009; + ternary r1005 r1009 r965 into r1010; + add r971 r780 into r1011; + and r1011 18446744073709551615u128 into r1012; + ternary r1005 r1012 r971 into r1013; + shr r1011 64u8 into r1014; + ternary r1005 r1014 0u128 into r1015; + add r981 r781 into r1016; + add r1016 r1015 into r1017; + and r1017 18446744073709551615u128 into r1018; + ternary r1005 r1018 r981 into r1019; + shr r1017 64u8 into r1020; + ternary r1005 r1020 0u128 into r1021; + add r991 r782 into r1022; + add r1022 r1021 into r1023; + and r1023 18446744073709551615u128 into r1024; + ternary r1005 r1024 r991 into r1025; + shr r1023 64u8 into r1026; + ternary r1005 r1026 0u128 into r1027; + add r1001 r783 into r1028; + add r1028 r1027 into r1029; + and r1029 18446744073709551615u128 into r1030; + ternary r1005 r1030 r1001 into r1031; + shr r1029 64u8 into r1032; + ternary r1005 r1032 0u128 into r1033; + add r1008 r1033 into r1034; + shl r1031 64u8 into r1035; + add r1035 r1025 into r1036; + div r1036 r783 into r1037; + gt r1037 18446744073709551615u128 into r1038; + ternary r1038 18446744073709551615u128 r1037 into r1039; + mul r1039 r783 into r1040; + sub r1036 r1040 into r1041; + lte r1041 18446744073709551615u128 into r1042; + mul r1039 r782 into r1043; + and r1041 18446744073709551615u128 into r1044; + shl r1044 64u8 into r1045; + add r1045 r1019 into r1046; + gt r1043 r1046 into r1047; + and r1042 r1047 into r1048; + sub.w r1039 1u128 into r1049; + ternary r1048 r1049 r1039 into r1050; + add r1041 r783 into r1051; + ternary r1048 r1051 r1041 into r1052; + lte r1052 18446744073709551615u128 into r1053; + and r1048 r1053 into r1054; + mul r1050 r782 into r1055; + and r1052 18446744073709551615u128 into r1056; + shl r1056 64u8 into r1057; + add r1057 r1019 into r1058; + gt r1055 r1058 into r1059; + and r1054 r1059 into r1060; + sub.w r1050 1u128 into r1061; + ternary r1060 r1061 r1050 into r1062; + mul r1062 r780 into r1063; + and r1063 18446744073709551615u128 into r1064; + lt r834 r1064 into r1065; + add r834 18446744073709551616u128 into r1066; + sub r1066 r1064 into r1067; + and r1067 18446744073709551615u128 into r1068; + shr r1063 64u8 into r1069; + ternary r1065 1u128 0u128 into r1070; + add r1069 r1070 into r1071; + mul r1062 r781 into r1072; + add r1072 r1071 into r1073; + and r1073 18446744073709551615u128 into r1074; + lt r1013 r1074 into r1075; + add r1013 18446744073709551616u128 into r1076; + sub r1076 r1074 into r1077; + and r1077 18446744073709551615u128 into r1078; + shr r1073 64u8 into r1079; + ternary r1075 1u128 0u128 into r1080; + add r1079 r1080 into r1081; + mul r1062 r782 into r1082; + add r1082 r1081 into r1083; + and r1083 18446744073709551615u128 into r1084; + lt r1019 r1084 into r1085; + add r1019 18446744073709551616u128 into r1086; + sub r1086 r1084 into r1087; + and r1087 18446744073709551615u128 into r1088; + shr r1083 64u8 into r1089; + ternary r1085 1u128 0u128 into r1090; + add r1089 r1090 into r1091; + mul r1062 r783 into r1092; + add r1092 r1091 into r1093; + and r1093 18446744073709551615u128 into r1094; + lt r1025 r1094 into r1095; + add r1025 18446744073709551616u128 into r1096; + sub r1096 r1094 into r1097; + and r1097 18446744073709551615u128 into r1098; + shr r1093 64u8 into r1099; + ternary r1095 1u128 0u128 into r1100; + add r1099 r1100 into r1101; + lt r1031 r1101 into r1102; + add r1031 18446744073709551616u128 into r1103; + sub r1103 r1101 into r1104; + and r1104 18446744073709551615u128 into r1105; + sub.w r1062 1u128 into r1106; + ternary r1102 r1106 r1062 into r1107; + add r1068 r780 into r1108; + and r1108 18446744073709551615u128 into r1109; + ternary r1102 r1109 r1068 into r1110; + shr r1108 64u8 into r1111; + ternary r1102 r1111 0u128 into r1112; + add r1078 r781 into r1113; + add r1113 r1112 into r1114; + and r1114 18446744073709551615u128 into r1115; + ternary r1102 r1115 r1078 into r1116; + shr r1114 64u8 into r1117; + ternary r1102 r1117 0u128 into r1118; + add r1088 r782 into r1119; + add r1119 r1118 into r1120; + and r1120 18446744073709551615u128 into r1121; + ternary r1102 r1121 r1088 into r1122; + shr r1120 64u8 into r1123; + ternary r1102 r1123 0u128 into r1124; + add r1098 r783 into r1125; + add r1125 r1124 into r1126; + and r1126 18446744073709551615u128 into r1127; + ternary r1102 r1127 r1098 into r1128; + shr r1126 64u8 into r1129; + ternary r1102 r1129 0u128 into r1130; + add r1105 r1130 into r1131; + shl r1128 64u8 into r1132; + add r1132 r1122 into r1133; + div r1133 r783 into r1134; + gt r1134 18446744073709551615u128 into r1135; + ternary r1135 18446744073709551615u128 r1134 into r1136; + mul r1136 r783 into r1137; + sub r1133 r1137 into r1138; + lte r1138 18446744073709551615u128 into r1139; + mul r1136 r782 into r1140; + and r1138 18446744073709551615u128 into r1141; + shl r1141 64u8 into r1142; + add r1142 r1116 into r1143; + gt r1140 r1143 into r1144; + and r1139 r1144 into r1145; + sub.w r1136 1u128 into r1146; + ternary r1145 r1146 r1136 into r1147; + add r1138 r783 into r1148; + ternary r1145 r1148 r1138 into r1149; + lte r1149 18446744073709551615u128 into r1150; + and r1145 r1150 into r1151; + mul r1147 r782 into r1152; + and r1149 18446744073709551615u128 into r1153; + shl r1153 64u8 into r1154; + add r1154 r1116 into r1155; + gt r1152 r1155 into r1156; + and r1151 r1156 into r1157; + sub.w r1147 1u128 into r1158; + ternary r1157 r1158 r1147 into r1159; + mul r1159 r780 into r1160; + and r1160 18446744073709551615u128 into r1161; + lt r833 r1161 into r1162; + add r833 18446744073709551616u128 into r1163; + sub r1163 r1161 into r1164; + and r1164 18446744073709551615u128 into r1165; + shr r1160 64u8 into r1166; + ternary r1162 1u128 0u128 into r1167; + add r1166 r1167 into r1168; + mul r1159 r781 into r1169; + add r1169 r1168 into r1170; + and r1170 18446744073709551615u128 into r1171; + lt r1110 r1171 into r1172; + add r1110 18446744073709551616u128 into r1173; + sub r1173 r1171 into r1174; + and r1174 18446744073709551615u128 into r1175; + shr r1170 64u8 into r1176; + ternary r1172 1u128 0u128 into r1177; + add r1176 r1177 into r1178; + mul r1159 r782 into r1179; + add r1179 r1178 into r1180; + and r1180 18446744073709551615u128 into r1181; + lt r1116 r1181 into r1182; + add r1116 18446744073709551616u128 into r1183; + sub r1183 r1181 into r1184; + and r1184 18446744073709551615u128 into r1185; + shr r1180 64u8 into r1186; + ternary r1182 1u128 0u128 into r1187; + add r1186 r1187 into r1188; + mul r1159 r783 into r1189; + add r1189 r1188 into r1190; + and r1190 18446744073709551615u128 into r1191; + lt r1122 r1191 into r1192; + add r1122 18446744073709551616u128 into r1193; + sub r1193 r1191 into r1194; + and r1194 18446744073709551615u128 into r1195; + shr r1190 64u8 into r1196; + ternary r1192 1u128 0u128 into r1197; + add r1196 r1197 into r1198; + lt r1128 r1198 into r1199; + add r1128 18446744073709551616u128 into r1200; + sub r1200 r1198 into r1201; + and r1201 18446744073709551615u128 into r1202; + sub.w r1159 1u128 into r1203; + ternary r1199 r1203 r1159 into r1204; + add r1165 r780 into r1205; + and r1205 18446744073709551615u128 into r1206; + ternary r1199 r1206 r1165 into r1207; + shr r1205 64u8 into r1208; + ternary r1199 r1208 0u128 into r1209; + add r1175 r781 into r1210; + add r1210 r1209 into r1211; + and r1211 18446744073709551615u128 into r1212; + ternary r1199 r1212 r1175 into r1213; + shr r1211 64u8 into r1214; + ternary r1199 r1214 0u128 into r1215; + add r1185 r782 into r1216; + add r1216 r1215 into r1217; + and r1217 18446744073709551615u128 into r1218; + ternary r1199 r1218 r1185 into r1219; + shr r1217 64u8 into r1220; + ternary r1199 r1220 0u128 into r1221; + add r1195 r783 into r1222; + add r1222 r1221 into r1223; + and r1223 18446744073709551615u128 into r1224; + ternary r1199 r1224 r1195 into r1225; + shr r1223 64u8 into r1226; + ternary r1199 r1226 0u128 into r1227; + add r1202 r1227 into r1228; + shl r913 64u8 into r1229; + add r1229 r1010 into r1230; + shl r1107 64u8 into r1231; + add r1231 r1204 into r1232; + cast r1230 r1232 into r1233 as U256__8JquwLopp8; + shl r1225 64u8 into r1234; + add r1234 r1219 into r1235; + shl r1213 64u8 into r1236; + add r1236 r1207 into r1237; + cast r766 into r1238 as u8; + is.eq r1238 0u8 into r1239; + sub 128u8 r1238 into r1240; + shl.w r1235 r1240 into r1241; + ternary r1239 0u128 r1241 into r1242; + shr r1237 r1238 into r1243; + or r1243 r1242 into r1244; + shr r1235 r1238 into r1245; + ternary r776 0u128 r1245 into r1246; + ternary r776 r1245 r1244 into r1247; + cast r1246 r1247 into r1248 as U256__8JquwLopp8; + is.eq r1248.hi 0u128 into r1249; + is.eq r1248.lo 0u128 into r1250; + and r1249 r1250 into r1251; + not r1251 into r1252; + and r0.z r1252 into r1253; + is.eq r1233.hi 340282366920938463463374607431768211455u128 into r1254; + is.eq r1233.lo 340282366920938463463374607431768211455u128 into r1255; + and r1254 r1255 into r1256; + and r1253 r1256 into r1257; + not r1257 into r1258; + assert.eq r1258 true; + add.w r1233.lo 1u128 into r1259; + lt r1259 r1233.lo into r1260; + ternary r1260 1u128 0u128 into r1261; + add.w r1233.hi r1261 into r1262; + cast r1262 r1259 into r1263 as U256__8JquwLopp8; + ternary r1253 r1263.hi r1233.hi into r1264; + ternary r1253 r1263.lo r1233.lo into r1265; + cast r1264 r1265 into r1266 as U256__8JquwLopp8; + is.neq r1266.hi 0u128 into r1267; + not r0.z into r1268; + lt r4.sp.hi r23.hi into r1269; + gt r4.sp.hi r23.hi into r1270; + lt r4.sp.lo r23.lo into r1271; + ternary r1270 false r1271 into r1272; + ternary r1269 true r1272 into r1273; + ternary r1273 r4.sp.hi r23.hi into r1274; + ternary r1273 r4.sp.lo r23.lo into r1275; + cast r1274 r1275 into r1276 as U256__8JquwLopp8; + lt r4.sp.hi r23.hi into r1277; + gt r4.sp.hi r23.hi into r1278; + lt r4.sp.lo r23.lo into r1279; + ternary r1278 false r1279 into r1280; + ternary r1277 true r1280 into r1281; + ternary r1281 r23.hi r4.sp.hi into r1282; + ternary r1281 r23.lo r4.sp.lo into r1283; + cast r1282 r1283 into r1284 as U256__8JquwLopp8; + lt r1284.lo r1276.lo into r1285; + ternary r1285 1u128 0u128 into r1286; + sub.w r1284.lo r1276.lo into r1287; + sub.w r1284.hi r1276.hi into r1288; + sub.w r1288 r1286 into r1289; + cast r1289 r1287 into r1290 as U256__8JquwLopp8; + cast 0u128 r4.liq into r1291 as U256__8JquwLopp8; + and r1291.lo 18446744073709551615u128 into r1292; + shr r1291.lo 64u8 into r1293; + and r1290.lo 18446744073709551615u128 into r1294; + shr r1290.lo 64u8 into r1295; + mul r1292 r1294 into r1296; + mul r1292 r1295 into r1297; + mul r1293 r1294 into r1298; + mul r1293 r1295 into r1299; + and r1296 18446744073709551615u128 into r1300; + shr r1296 64u8 into r1301; + and r1297 18446744073709551615u128 into r1302; + add r1301 r1302 into r1303; + and r1298 18446744073709551615u128 into r1304; + add r1303 r1304 into r1305; + and r1305 18446744073709551615u128 into r1306; + shr r1305 64u8 into r1307; + shr r1297 64u8 into r1308; + shr r1298 64u8 into r1309; + add r1308 r1309 into r1310; + and r1299 18446744073709551615u128 into r1311; + add r1310 r1311 into r1312; + add r1312 r1307 into r1313; + and r1313 18446744073709551615u128 into r1314; + shr r1313 64u8 into r1315; + shr r1299 64u8 into r1316; + add r1316 r1315 into r1317; + shl r1317 64u8 into r1318; + add r1318 r1314 into r1319; + shl r1306 64u8 into r1320; + add r1320 r1300 into r1321; + and r1291.lo 18446744073709551615u128 into r1322; + shr r1291.lo 64u8 into r1323; + and r1290.hi 18446744073709551615u128 into r1324; + shr r1290.hi 64u8 into r1325; + mul r1322 r1324 into r1326; + mul r1322 r1325 into r1327; + mul r1323 r1324 into r1328; + mul r1323 r1325 into r1329; + and r1326 18446744073709551615u128 into r1330; + shr r1326 64u8 into r1331; + and r1327 18446744073709551615u128 into r1332; + add r1331 r1332 into r1333; + and r1328 18446744073709551615u128 into r1334; + add r1333 r1334 into r1335; + and r1335 18446744073709551615u128 into r1336; + shr r1335 64u8 into r1337; + shr r1327 64u8 into r1338; + shr r1328 64u8 into r1339; + add r1338 r1339 into r1340; + and r1329 18446744073709551615u128 into r1341; + add r1340 r1341 into r1342; + add r1342 r1337 into r1343; + and r1343 18446744073709551615u128 into r1344; + shr r1343 64u8 into r1345; + shr r1329 64u8 into r1346; + add r1346 r1345 into r1347; + shl r1347 64u8 into r1348; + add r1348 r1344 into r1349; + shl r1336 64u8 into r1350; + add r1350 r1330 into r1351; + and r1291.hi 18446744073709551615u128 into r1352; + shr r1291.hi 64u8 into r1353; + and r1290.lo 18446744073709551615u128 into r1354; + shr r1290.lo 64u8 into r1355; + mul r1352 r1354 into r1356; + mul r1352 r1355 into r1357; + mul r1353 r1354 into r1358; + mul r1353 r1355 into r1359; + and r1356 18446744073709551615u128 into r1360; + shr r1356 64u8 into r1361; + and r1357 18446744073709551615u128 into r1362; + add r1361 r1362 into r1363; + and r1358 18446744073709551615u128 into r1364; + add r1363 r1364 into r1365; + and r1365 18446744073709551615u128 into r1366; + shr r1365 64u8 into r1367; + shr r1357 64u8 into r1368; + shr r1358 64u8 into r1369; + add r1368 r1369 into r1370; + and r1359 18446744073709551615u128 into r1371; + add r1370 r1371 into r1372; + add r1372 r1367 into r1373; + and r1373 18446744073709551615u128 into r1374; + shr r1373 64u8 into r1375; + shr r1359 64u8 into r1376; + add r1376 r1375 into r1377; + shl r1377 64u8 into r1378; + add r1378 r1374 into r1379; + shl r1366 64u8 into r1380; + add r1380 r1360 into r1381; + and r1291.hi 18446744073709551615u128 into r1382; + shr r1291.hi 64u8 into r1383; + and r1290.hi 18446744073709551615u128 into r1384; + shr r1290.hi 64u8 into r1385; + mul r1382 r1384 into r1386; + mul r1382 r1385 into r1387; + mul r1383 r1384 into r1388; + mul r1383 r1385 into r1389; + and r1386 18446744073709551615u128 into r1390; + shr r1386 64u8 into r1391; + and r1387 18446744073709551615u128 into r1392; + add r1391 r1392 into r1393; + and r1388 18446744073709551615u128 into r1394; + add r1393 r1394 into r1395; + and r1395 18446744073709551615u128 into r1396; + shr r1395 64u8 into r1397; + shr r1387 64u8 into r1398; + shr r1388 64u8 into r1399; + add r1398 r1399 into r1400; + and r1389 18446744073709551615u128 into r1401; + add r1400 r1401 into r1402; + add r1402 r1397 into r1403; + and r1403 18446744073709551615u128 into r1404; + shr r1403 64u8 into r1405; + shr r1389 64u8 into r1406; + add r1406 r1405 into r1407; + shl r1407 64u8 into r1408; + add r1408 r1404 into r1409; + shl r1396 64u8 into r1410; + add r1410 r1390 into r1411; + add.w r1319 r1351 into r1412; + lt r1412 r1319 into r1413; + ternary r1413 1u128 0u128 into r1414; + add.w r1412 r1381 into r1415; + lt r1415 r1412 into r1416; + ternary r1416 1u128 0u128 into r1417; + add r1414 r1417 into r1418; + add.w r1349 r1379 into r1419; + lt r1419 r1349 into r1420; + ternary r1420 1u128 0u128 into r1421; + add.w r1419 r1411 into r1422; + lt r1422 r1419 into r1423; + ternary r1423 1u128 0u128 into r1424; + add.w r1422 r1418 into r1425; + lt r1425 r1422 into r1426; + ternary r1426 1u128 0u128 into r1427; + add r1421 r1424 into r1428; + add r1428 r1427 into r1429; + add.w r1409 r1429 into r1430; + cast r1430 r1425 into r1431 as U256__8JquwLopp8; + cast r1415 r1321 into r1432 as U256__8JquwLopp8; + gt r1432.lo 0u128 into r1433; + and r1268 r1433 into r1434; + is.eq r1432.hi 340282366920938463463374607431768211455u128 into r1435; + and r1434 r1435 into r1436; + is.neq r1431.hi 0u128 into r1437; + is.neq r1431.lo 0u128 into r1438; + or r1437 r1438 into r1439; + or r1439 r1436 into r1440; + gt r1432.lo 0u128 into r1441; + and r1268 r1441 into r1442; + lt r1432.hi 340282366920938463463374607431768211455u128 into r1443; + and r1442 r1443 into r1444; + add.w r1432.hi 1u128 into r1445; + ternary r1444 r1445 r1432.hi into r1446; + ternary r0.z r1266.lo r1446 into r1447; + ternary r0.z r1446 r1266.lo into r1448; + cast r0.fee_pips into r1449 as u128; + sub 1000000u128 r1449 into r1450; + and r4.rem 18446744073709551615u128 into r1451; + shr r4.rem 64u8 into r1452; + and r1450 18446744073709551615u128 into r1453; + shr r1450 64u8 into r1454; + mul r1451 r1453 into r1455; + mul r1451 r1454 into r1456; + mul r1452 r1453 into r1457; + mul r1452 r1454 into r1458; + and r1455 18446744073709551615u128 into r1459; + shr r1455 64u8 into r1460; + and r1456 18446744073709551615u128 into r1461; + add r1460 r1461 into r1462; + and r1457 18446744073709551615u128 into r1463; + add r1462 r1463 into r1464; + and r1464 18446744073709551615u128 into r1465; + shr r1464 64u8 into r1466; + shr r1456 64u8 into r1467; + shr r1457 64u8 into r1468; + add r1467 r1468 into r1469; + and r1458 18446744073709551615u128 into r1470; + add r1469 r1470 into r1471; + add r1471 r1466 into r1472; + and r1472 18446744073709551615u128 into r1473; + shr r1472 64u8 into r1474; + shr r1458 64u8 into r1475; + add r1475 r1474 into r1476; + shl r1476 64u8 into r1477; + add r1477 r1473 into r1478; + shl r1465 64u8 into r1479; + add r1479 r1459 into r1480; + lt r1478 1000000u128 into r1481; + assert.eq r1481 true; + shr r1480 96u8 into r1482; + and r1482 4294967295u128 into r1483; + shl r1478 32u8 into r1484; + add r1484 r1483 into r1485; + div r1485 1000000u128 into r1486; + rem r1485 1000000u128 into r1487; + shr r1480 64u8 into r1488; + and r1488 4294967295u128 into r1489; + shl r1487 32u8 into r1490; + add r1490 r1489 into r1491; + shl r1486 32u8 into r1492; + div r1491 1000000u128 into r1493; + add r1492 r1493 into r1494; + rem r1491 1000000u128 into r1495; + shr r1480 32u8 into r1496; + and r1496 4294967295u128 into r1497; + shl r1495 32u8 into r1498; + add r1498 r1497 into r1499; + shl r1494 32u8 into r1500; + div r1499 1000000u128 into r1501; + add r1500 r1501 into r1502; + rem r1499 1000000u128 into r1503; + shr r1480 0u8 into r1504; + and r1504 4294967295u128 into r1505; + shl r1503 32u8 into r1506; + add r1506 r1505 into r1507; + shl r1502 32u8 into r1508; + div r1507 1000000u128 into r1509; + add r1508 r1509 into r1510; + rem r1507 1000000u128 into r1511; + not r1267 into r1512; + not r1440 into r1513; + and r1512 r1513 into r1514; + gte r1510 r1447 into r1515; + and r1514 r1515 into r1516; + ternary r1516 r23.hi r4.sp.hi into r1517; + ternary r1516 r23.lo r4.sp.lo into r1518; + cast r1517 r1518 into r1519 as U256__8JquwLopp8; + ternary r1516 r1447 0u128 into r1520; + ternary r1516 r1448 0u128 into r1521; + cast r0.fee_pips into r1522 as u128; + cast r0.fee_pips into r1523 as u128; + sub 1000000u128 r1523 into r1524; + and r1520 18446744073709551615u128 into r1525; + shr r1520 64u8 into r1526; + and r1522 18446744073709551615u128 into r1527; + shr r1522 64u8 into r1528; + mul r1525 r1527 into r1529; + mul r1525 r1528 into r1530; + mul r1526 r1527 into r1531; + mul r1526 r1528 into r1532; + and r1529 18446744073709551615u128 into r1533; + shr r1529 64u8 into r1534; + and r1530 18446744073709551615u128 into r1535; + add r1534 r1535 into r1536; + and r1531 18446744073709551615u128 into r1537; + add r1536 r1537 into r1538; + and r1538 18446744073709551615u128 into r1539; + shr r1538 64u8 into r1540; + shr r1530 64u8 into r1541; + shr r1531 64u8 into r1542; + add r1541 r1542 into r1543; + and r1532 18446744073709551615u128 into r1544; + add r1543 r1544 into r1545; + add r1545 r1540 into r1546; + and r1546 18446744073709551615u128 into r1547; + shr r1546 64u8 into r1548; + shr r1532 64u8 into r1549; + add r1549 r1548 into r1550; + shl r1550 64u8 into r1551; + add r1551 r1547 into r1552; + shl r1539 64u8 into r1553; + add r1553 r1533 into r1554; + lt r1552 r1524 into r1555; + assert.eq r1555 true; + shr r1554 96u8 into r1556; + and r1556 4294967295u128 into r1557; + shl r1552 32u8 into r1558; + add r1558 r1557 into r1559; + div r1559 r1524 into r1560; + rem r1559 r1524 into r1561; + shr r1554 64u8 into r1562; + and r1562 4294967295u128 into r1563; + shl r1561 32u8 into r1564; + add r1564 r1563 into r1565; + shl r1560 32u8 into r1566; + div r1565 r1524 into r1567; + add r1566 r1567 into r1568; + rem r1565 r1524 into r1569; + shr r1554 32u8 into r1570; + and r1570 4294967295u128 into r1571; + shl r1569 32u8 into r1572; + add r1572 r1571 into r1573; + shl r1568 32u8 into r1574; + div r1573 r1524 into r1575; + add r1574 r1575 into r1576; + rem r1573 r1524 into r1577; + shr r1554 0u8 into r1578; + and r1578 4294967295u128 into r1579; + shl r1577 32u8 into r1580; + add r1580 r1579 into r1581; + shl r1576 32u8 into r1582; + div r1581 r1524 into r1583; + add r1582 r1583 into r1584; + rem r1581 r1524 into r1585; + gt r1585 0u128 into r1586; + ternary r1586 1u128 0u128 into r1587; + add r1584 r1587 into r1588; + ternary r1516 r1588 0u128 into r1589; + ternary r27 r23.hi r4.sp.hi into r1590; + ternary r27 r23.lo r4.sp.lo into r1591; + cast r1590 r1591 into r1592 as U256__8JquwLopp8; + ternary r30 r1519.hi r1592.hi into r1593; + ternary r30 r1519.lo r1592.lo into r1594; + cast r1593 r1594 into r1595 as U256__8JquwLopp8; + ternary r30 r1520 0u128 into r1596; + ternary r30 r1521 0u128 into r1597; + ternary r30 r1589 0u128 into r1598; + add r1596 r1598 into r1599; + gt r1599 r4.rem into r1600; + ternary r1600 r4.rem r1599 into r1601; + sub r1601 r1596 into r1602; + cast r0.fee_protocol into r1603 as u128; + mul r1602 r1603 into r1604; + div r1604 16u128 into r1605; + sub r1602 r1605 into r1606; + add r4.pf r1605 into r1607; + sub r4.rem r1601 into r1608; + add r4.out r1597 into r1609; + gt r4.liq 0u128 into r1610; + ternary r1610 r4.liq 1u128 into r1611; + div r1606 r1611 into r1612; + rem r1606 r1611 into r1613; + lt r1613 r1611 into r1614; + assert.eq r1614 true; + gte r1613 170141183460469231731687303715884105728u128 into r1615; + add.w r1613 r1613 into r1616; + gte r1616 r1611 into r1617; + or r1615 r1617 into r1618; + sub.w r1616 r1611 into r1619; + ternary r1618 r1619 r1616 into r1620; + ternary r1618 170141183460469231731687303715884105728u128 0u128 into r1621; + gte r1620 170141183460469231731687303715884105728u128 into r1622; + add.w r1620 r1620 into r1623; + gte r1623 r1611 into r1624; + or r1622 r1624 into r1625; + sub.w r1623 r1611 into r1626; + ternary r1625 r1626 r1623 into r1627; + add r1621 85070591730234615865843651857942052864u128 into r1628; + ternary r1625 r1628 r1621 into r1629; + gte r1627 170141183460469231731687303715884105728u128 into r1630; + add.w r1627 r1627 into r1631; + gte r1631 r1611 into r1632; + or r1630 r1632 into r1633; + sub.w r1631 r1611 into r1634; + ternary r1633 r1634 r1631 into r1635; + add r1629 42535295865117307932921825928971026432u128 into r1636; + ternary r1633 r1636 r1629 into r1637; + gte r1635 170141183460469231731687303715884105728u128 into r1638; + add.w r1635 r1635 into r1639; + gte r1639 r1611 into r1640; + or r1638 r1640 into r1641; + sub.w r1639 r1611 into r1642; + ternary r1641 r1642 r1639 into r1643; + add r1637 21267647932558653966460912964485513216u128 into r1644; + ternary r1641 r1644 r1637 into r1645; + gte r1643 170141183460469231731687303715884105728u128 into r1646; + add.w r1643 r1643 into r1647; + gte r1647 r1611 into r1648; + or r1646 r1648 into r1649; + sub.w r1647 r1611 into r1650; + ternary r1649 r1650 r1647 into r1651; + add r1645 10633823966279326983230456482242756608u128 into r1652; + ternary r1649 r1652 r1645 into r1653; + gte r1651 170141183460469231731687303715884105728u128 into r1654; + add.w r1651 r1651 into r1655; + gte r1655 r1611 into r1656; + or r1654 r1656 into r1657; + sub.w r1655 r1611 into r1658; + ternary r1657 r1658 r1655 into r1659; + add r1653 5316911983139663491615228241121378304u128 into r1660; + ternary r1657 r1660 r1653 into r1661; + gte r1659 170141183460469231731687303715884105728u128 into r1662; + add.w r1659 r1659 into r1663; + gte r1663 r1611 into r1664; + or r1662 r1664 into r1665; + sub.w r1663 r1611 into r1666; + ternary r1665 r1666 r1663 into r1667; + add r1661 2658455991569831745807614120560689152u128 into r1668; + ternary r1665 r1668 r1661 into r1669; + gte r1667 170141183460469231731687303715884105728u128 into r1670; + add.w r1667 r1667 into r1671; + gte r1671 r1611 into r1672; + or r1670 r1672 into r1673; + sub.w r1671 r1611 into r1674; + ternary r1673 r1674 r1671 into r1675; + add r1669 1329227995784915872903807060280344576u128 into r1676; + ternary r1673 r1676 r1669 into r1677; + gte r1675 170141183460469231731687303715884105728u128 into r1678; + add.w r1675 r1675 into r1679; + gte r1679 r1611 into r1680; + or r1678 r1680 into r1681; + sub.w r1679 r1611 into r1682; + ternary r1681 r1682 r1679 into r1683; + add r1677 664613997892457936451903530140172288u128 into r1684; + ternary r1681 r1684 r1677 into r1685; + gte r1683 170141183460469231731687303715884105728u128 into r1686; + add.w r1683 r1683 into r1687; + gte r1687 r1611 into r1688; + or r1686 r1688 into r1689; + sub.w r1687 r1611 into r1690; + ternary r1689 r1690 r1687 into r1691; + add r1685 332306998946228968225951765070086144u128 into r1692; + ternary r1689 r1692 r1685 into r1693; + gte r1691 170141183460469231731687303715884105728u128 into r1694; + add.w r1691 r1691 into r1695; + gte r1695 r1611 into r1696; + or r1694 r1696 into r1697; + sub.w r1695 r1611 into r1698; + ternary r1697 r1698 r1695 into r1699; + add r1693 166153499473114484112975882535043072u128 into r1700; + ternary r1697 r1700 r1693 into r1701; + gte r1699 170141183460469231731687303715884105728u128 into r1702; + add.w r1699 r1699 into r1703; + gte r1703 r1611 into r1704; + or r1702 r1704 into r1705; + sub.w r1703 r1611 into r1706; + ternary r1705 r1706 r1703 into r1707; + add r1701 83076749736557242056487941267521536u128 into r1708; + ternary r1705 r1708 r1701 into r1709; + gte r1707 170141183460469231731687303715884105728u128 into r1710; + add.w r1707 r1707 into r1711; + gte r1711 r1611 into r1712; + or r1710 r1712 into r1713; + sub.w r1711 r1611 into r1714; + ternary r1713 r1714 r1711 into r1715; + add r1709 41538374868278621028243970633760768u128 into r1716; + ternary r1713 r1716 r1709 into r1717; + gte r1715 170141183460469231731687303715884105728u128 into r1718; + add.w r1715 r1715 into r1719; + gte r1719 r1611 into r1720; + or r1718 r1720 into r1721; + sub.w r1719 r1611 into r1722; + ternary r1721 r1722 r1719 into r1723; + add r1717 20769187434139310514121985316880384u128 into r1724; + ternary r1721 r1724 r1717 into r1725; + gte r1723 170141183460469231731687303715884105728u128 into r1726; + add.w r1723 r1723 into r1727; + gte r1727 r1611 into r1728; + or r1726 r1728 into r1729; + sub.w r1727 r1611 into r1730; + ternary r1729 r1730 r1727 into r1731; + add r1725 10384593717069655257060992658440192u128 into r1732; + ternary r1729 r1732 r1725 into r1733; + gte r1731 170141183460469231731687303715884105728u128 into r1734; + add.w r1731 r1731 into r1735; + gte r1735 r1611 into r1736; + or r1734 r1736 into r1737; + sub.w r1735 r1611 into r1738; + ternary r1737 r1738 r1735 into r1739; + add r1733 5192296858534827628530496329220096u128 into r1740; + ternary r1737 r1740 r1733 into r1741; + gte r1739 170141183460469231731687303715884105728u128 into r1742; + add.w r1739 r1739 into r1743; + gte r1743 r1611 into r1744; + or r1742 r1744 into r1745; + sub.w r1743 r1611 into r1746; + ternary r1745 r1746 r1743 into r1747; + add r1741 2596148429267413814265248164610048u128 into r1748; + ternary r1745 r1748 r1741 into r1749; + gte r1747 170141183460469231731687303715884105728u128 into r1750; + add.w r1747 r1747 into r1751; + gte r1751 r1611 into r1752; + or r1750 r1752 into r1753; + sub.w r1751 r1611 into r1754; + ternary r1753 r1754 r1751 into r1755; + add r1749 1298074214633706907132624082305024u128 into r1756; + ternary r1753 r1756 r1749 into r1757; + gte r1755 170141183460469231731687303715884105728u128 into r1758; + add.w r1755 r1755 into r1759; + gte r1759 r1611 into r1760; + or r1758 r1760 into r1761; + sub.w r1759 r1611 into r1762; + ternary r1761 r1762 r1759 into r1763; + add r1757 649037107316853453566312041152512u128 into r1764; + ternary r1761 r1764 r1757 into r1765; + gte r1763 170141183460469231731687303715884105728u128 into r1766; + add.w r1763 r1763 into r1767; + gte r1767 r1611 into r1768; + or r1766 r1768 into r1769; + sub.w r1767 r1611 into r1770; + ternary r1769 r1770 r1767 into r1771; + add r1765 324518553658426726783156020576256u128 into r1772; + ternary r1769 r1772 r1765 into r1773; + gte r1771 170141183460469231731687303715884105728u128 into r1774; + add.w r1771 r1771 into r1775; + gte r1775 r1611 into r1776; + or r1774 r1776 into r1777; + sub.w r1775 r1611 into r1778; + ternary r1777 r1778 r1775 into r1779; + add r1773 162259276829213363391578010288128u128 into r1780; + ternary r1777 r1780 r1773 into r1781; + gte r1779 170141183460469231731687303715884105728u128 into r1782; + add.w r1779 r1779 into r1783; + gte r1783 r1611 into r1784; + or r1782 r1784 into r1785; + sub.w r1783 r1611 into r1786; + ternary r1785 r1786 r1783 into r1787; + add r1781 81129638414606681695789005144064u128 into r1788; + ternary r1785 r1788 r1781 into r1789; + gte r1787 170141183460469231731687303715884105728u128 into r1790; + add.w r1787 r1787 into r1791; + gte r1791 r1611 into r1792; + or r1790 r1792 into r1793; + sub.w r1791 r1611 into r1794; + ternary r1793 r1794 r1791 into r1795; + add r1789 40564819207303340847894502572032u128 into r1796; + ternary r1793 r1796 r1789 into r1797; + gte r1795 170141183460469231731687303715884105728u128 into r1798; + add.w r1795 r1795 into r1799; + gte r1799 r1611 into r1800; + or r1798 r1800 into r1801; + sub.w r1799 r1611 into r1802; + ternary r1801 r1802 r1799 into r1803; + add r1797 20282409603651670423947251286016u128 into r1804; + ternary r1801 r1804 r1797 into r1805; + gte r1803 170141183460469231731687303715884105728u128 into r1806; + add.w r1803 r1803 into r1807; + gte r1807 r1611 into r1808; + or r1806 r1808 into r1809; + sub.w r1807 r1611 into r1810; + ternary r1809 r1810 r1807 into r1811; + add r1805 10141204801825835211973625643008u128 into r1812; + ternary r1809 r1812 r1805 into r1813; + gte r1811 170141183460469231731687303715884105728u128 into r1814; + add.w r1811 r1811 into r1815; + gte r1815 r1611 into r1816; + or r1814 r1816 into r1817; + sub.w r1815 r1611 into r1818; + ternary r1817 r1818 r1815 into r1819; + add r1813 5070602400912917605986812821504u128 into r1820; + ternary r1817 r1820 r1813 into r1821; + gte r1819 170141183460469231731687303715884105728u128 into r1822; + add.w r1819 r1819 into r1823; + gte r1823 r1611 into r1824; + or r1822 r1824 into r1825; + sub.w r1823 r1611 into r1826; + ternary r1825 r1826 r1823 into r1827; + add r1821 2535301200456458802993406410752u128 into r1828; + ternary r1825 r1828 r1821 into r1829; + gte r1827 170141183460469231731687303715884105728u128 into r1830; + add.w r1827 r1827 into r1831; + gte r1831 r1611 into r1832; + or r1830 r1832 into r1833; + sub.w r1831 r1611 into r1834; + ternary r1833 r1834 r1831 into r1835; + add r1829 1267650600228229401496703205376u128 into r1836; + ternary r1833 r1836 r1829 into r1837; + gte r1835 170141183460469231731687303715884105728u128 into r1838; + add.w r1835 r1835 into r1839; + gte r1839 r1611 into r1840; + or r1838 r1840 into r1841; + sub.w r1839 r1611 into r1842; + ternary r1841 r1842 r1839 into r1843; + add r1837 633825300114114700748351602688u128 into r1844; + ternary r1841 r1844 r1837 into r1845; + gte r1843 170141183460469231731687303715884105728u128 into r1846; + add.w r1843 r1843 into r1847; + gte r1847 r1611 into r1848; + or r1846 r1848 into r1849; + sub.w r1847 r1611 into r1850; + ternary r1849 r1850 r1847 into r1851; + add r1845 316912650057057350374175801344u128 into r1852; + ternary r1849 r1852 r1845 into r1853; + gte r1851 170141183460469231731687303715884105728u128 into r1854; + add.w r1851 r1851 into r1855; + gte r1855 r1611 into r1856; + or r1854 r1856 into r1857; + sub.w r1855 r1611 into r1858; + ternary r1857 r1858 r1855 into r1859; + add r1853 158456325028528675187087900672u128 into r1860; + ternary r1857 r1860 r1853 into r1861; + gte r1859 170141183460469231731687303715884105728u128 into r1862; + add.w r1859 r1859 into r1863; + gte r1863 r1611 into r1864; + or r1862 r1864 into r1865; + sub.w r1863 r1611 into r1866; + ternary r1865 r1866 r1863 into r1867; + add r1861 79228162514264337593543950336u128 into r1868; + ternary r1865 r1868 r1861 into r1869; + gte r1867 170141183460469231731687303715884105728u128 into r1870; + add.w r1867 r1867 into r1871; + gte r1871 r1611 into r1872; + or r1870 r1872 into r1873; + sub.w r1871 r1611 into r1874; + ternary r1873 r1874 r1871 into r1875; + add r1869 39614081257132168796771975168u128 into r1876; + ternary r1873 r1876 r1869 into r1877; + gte r1875 170141183460469231731687303715884105728u128 into r1878; + add.w r1875 r1875 into r1879; + gte r1879 r1611 into r1880; + or r1878 r1880 into r1881; + sub.w r1879 r1611 into r1882; + ternary r1881 r1882 r1879 into r1883; + add r1877 19807040628566084398385987584u128 into r1884; + ternary r1881 r1884 r1877 into r1885; + gte r1883 170141183460469231731687303715884105728u128 into r1886; + add.w r1883 r1883 into r1887; + gte r1887 r1611 into r1888; + or r1886 r1888 into r1889; + sub.w r1887 r1611 into r1890; + ternary r1889 r1890 r1887 into r1891; + add r1885 9903520314283042199192993792u128 into r1892; + ternary r1889 r1892 r1885 into r1893; + gte r1891 170141183460469231731687303715884105728u128 into r1894; + add.w r1891 r1891 into r1895; + gte r1895 r1611 into r1896; + or r1894 r1896 into r1897; + sub.w r1895 r1611 into r1898; + ternary r1897 r1898 r1895 into r1899; + add r1893 4951760157141521099596496896u128 into r1900; + ternary r1897 r1900 r1893 into r1901; + gte r1899 170141183460469231731687303715884105728u128 into r1902; + add.w r1899 r1899 into r1903; + gte r1903 r1611 into r1904; + or r1902 r1904 into r1905; + sub.w r1903 r1611 into r1906; + ternary r1905 r1906 r1903 into r1907; + add r1901 2475880078570760549798248448u128 into r1908; + ternary r1905 r1908 r1901 into r1909; + gte r1907 170141183460469231731687303715884105728u128 into r1910; + add.w r1907 r1907 into r1911; + gte r1911 r1611 into r1912; + or r1910 r1912 into r1913; + sub.w r1911 r1611 into r1914; + ternary r1913 r1914 r1911 into r1915; + add r1909 1237940039285380274899124224u128 into r1916; + ternary r1913 r1916 r1909 into r1917; + gte r1915 170141183460469231731687303715884105728u128 into r1918; + add.w r1915 r1915 into r1919; + gte r1919 r1611 into r1920; + or r1918 r1920 into r1921; + sub.w r1919 r1611 into r1922; + ternary r1921 r1922 r1919 into r1923; + add r1917 618970019642690137449562112u128 into r1924; + ternary r1921 r1924 r1917 into r1925; + gte r1923 170141183460469231731687303715884105728u128 into r1926; + add.w r1923 r1923 into r1927; + gte r1927 r1611 into r1928; + or r1926 r1928 into r1929; + sub.w r1927 r1611 into r1930; + ternary r1929 r1930 r1927 into r1931; + add r1925 309485009821345068724781056u128 into r1932; + ternary r1929 r1932 r1925 into r1933; + gte r1931 170141183460469231731687303715884105728u128 into r1934; + add.w r1931 r1931 into r1935; + gte r1935 r1611 into r1936; + or r1934 r1936 into r1937; + sub.w r1935 r1611 into r1938; + ternary r1937 r1938 r1935 into r1939; + add r1933 154742504910672534362390528u128 into r1940; + ternary r1937 r1940 r1933 into r1941; + gte r1939 170141183460469231731687303715884105728u128 into r1942; + add.w r1939 r1939 into r1943; + gte r1943 r1611 into r1944; + or r1942 r1944 into r1945; + sub.w r1943 r1611 into r1946; + ternary r1945 r1946 r1943 into r1947; + add r1941 77371252455336267181195264u128 into r1948; + ternary r1945 r1948 r1941 into r1949; + gte r1947 170141183460469231731687303715884105728u128 into r1950; + add.w r1947 r1947 into r1951; + gte r1951 r1611 into r1952; + or r1950 r1952 into r1953; + sub.w r1951 r1611 into r1954; + ternary r1953 r1954 r1951 into r1955; + add r1949 38685626227668133590597632u128 into r1956; + ternary r1953 r1956 r1949 into r1957; + gte r1955 170141183460469231731687303715884105728u128 into r1958; + add.w r1955 r1955 into r1959; + gte r1959 r1611 into r1960; + or r1958 r1960 into r1961; + sub.w r1959 r1611 into r1962; + ternary r1961 r1962 r1959 into r1963; + add r1957 19342813113834066795298816u128 into r1964; + ternary r1961 r1964 r1957 into r1965; + gte r1963 170141183460469231731687303715884105728u128 into r1966; + add.w r1963 r1963 into r1967; + gte r1967 r1611 into r1968; + or r1966 r1968 into r1969; + sub.w r1967 r1611 into r1970; + ternary r1969 r1970 r1967 into r1971; + add r1965 9671406556917033397649408u128 into r1972; + ternary r1969 r1972 r1965 into r1973; + gte r1971 170141183460469231731687303715884105728u128 into r1974; + add.w r1971 r1971 into r1975; + gte r1975 r1611 into r1976; + or r1974 r1976 into r1977; + sub.w r1975 r1611 into r1978; + ternary r1977 r1978 r1975 into r1979; + add r1973 4835703278458516698824704u128 into r1980; + ternary r1977 r1980 r1973 into r1981; + gte r1979 170141183460469231731687303715884105728u128 into r1982; + add.w r1979 r1979 into r1983; + gte r1983 r1611 into r1984; + or r1982 r1984 into r1985; + sub.w r1983 r1611 into r1986; + ternary r1985 r1986 r1983 into r1987; + add r1981 2417851639229258349412352u128 into r1988; + ternary r1985 r1988 r1981 into r1989; + gte r1987 170141183460469231731687303715884105728u128 into r1990; + add.w r1987 r1987 into r1991; + gte r1991 r1611 into r1992; + or r1990 r1992 into r1993; + sub.w r1991 r1611 into r1994; + ternary r1993 r1994 r1991 into r1995; + add r1989 1208925819614629174706176u128 into r1996; + ternary r1993 r1996 r1989 into r1997; + gte r1995 170141183460469231731687303715884105728u128 into r1998; + add.w r1995 r1995 into r1999; + gte r1999 r1611 into r2000; + or r1998 r2000 into r2001; + sub.w r1999 r1611 into r2002; + ternary r2001 r2002 r1999 into r2003; + add r1997 604462909807314587353088u128 into r2004; + ternary r2001 r2004 r1997 into r2005; + gte r2003 170141183460469231731687303715884105728u128 into r2006; + add.w r2003 r2003 into r2007; + gte r2007 r1611 into r2008; + or r2006 r2008 into r2009; + sub.w r2007 r1611 into r2010; + ternary r2009 r2010 r2007 into r2011; + add r2005 302231454903657293676544u128 into r2012; + ternary r2009 r2012 r2005 into r2013; + gte r2011 170141183460469231731687303715884105728u128 into r2014; + add.w r2011 r2011 into r2015; + gte r2015 r1611 into r2016; + or r2014 r2016 into r2017; + sub.w r2015 r1611 into r2018; + ternary r2017 r2018 r2015 into r2019; + add r2013 151115727451828646838272u128 into r2020; + ternary r2017 r2020 r2013 into r2021; + gte r2019 170141183460469231731687303715884105728u128 into r2022; + add.w r2019 r2019 into r2023; + gte r2023 r1611 into r2024; + or r2022 r2024 into r2025; + sub.w r2023 r1611 into r2026; + ternary r2025 r2026 r2023 into r2027; + add r2021 75557863725914323419136u128 into r2028; + ternary r2025 r2028 r2021 into r2029; + gte r2027 170141183460469231731687303715884105728u128 into r2030; + add.w r2027 r2027 into r2031; + gte r2031 r1611 into r2032; + or r2030 r2032 into r2033; + sub.w r2031 r1611 into r2034; + ternary r2033 r2034 r2031 into r2035; + add r2029 37778931862957161709568u128 into r2036; + ternary r2033 r2036 r2029 into r2037; + gte r2035 170141183460469231731687303715884105728u128 into r2038; + add.w r2035 r2035 into r2039; + gte r2039 r1611 into r2040; + or r2038 r2040 into r2041; + sub.w r2039 r1611 into r2042; + ternary r2041 r2042 r2039 into r2043; + add r2037 18889465931478580854784u128 into r2044; + ternary r2041 r2044 r2037 into r2045; + gte r2043 170141183460469231731687303715884105728u128 into r2046; + add.w r2043 r2043 into r2047; + gte r2047 r1611 into r2048; + or r2046 r2048 into r2049; + sub.w r2047 r1611 into r2050; + ternary r2049 r2050 r2047 into r2051; + add r2045 9444732965739290427392u128 into r2052; + ternary r2049 r2052 r2045 into r2053; + gte r2051 170141183460469231731687303715884105728u128 into r2054; + add.w r2051 r2051 into r2055; + gte r2055 r1611 into r2056; + or r2054 r2056 into r2057; + sub.w r2055 r1611 into r2058; + ternary r2057 r2058 r2055 into r2059; + add r2053 4722366482869645213696u128 into r2060; + ternary r2057 r2060 r2053 into r2061; + gte r2059 170141183460469231731687303715884105728u128 into r2062; + add.w r2059 r2059 into r2063; + gte r2063 r1611 into r2064; + or r2062 r2064 into r2065; + sub.w r2063 r1611 into r2066; + ternary r2065 r2066 r2063 into r2067; + add r2061 2361183241434822606848u128 into r2068; + ternary r2065 r2068 r2061 into r2069; + gte r2067 170141183460469231731687303715884105728u128 into r2070; + add.w r2067 r2067 into r2071; + gte r2071 r1611 into r2072; + or r2070 r2072 into r2073; + sub.w r2071 r1611 into r2074; + ternary r2073 r2074 r2071 into r2075; + add r2069 1180591620717411303424u128 into r2076; + ternary r2073 r2076 r2069 into r2077; + gte r2075 170141183460469231731687303715884105728u128 into r2078; + add.w r2075 r2075 into r2079; + gte r2079 r1611 into r2080; + or r2078 r2080 into r2081; + sub.w r2079 r1611 into r2082; + ternary r2081 r2082 r2079 into r2083; + add r2077 590295810358705651712u128 into r2084; + ternary r2081 r2084 r2077 into r2085; + gte r2083 170141183460469231731687303715884105728u128 into r2086; + add.w r2083 r2083 into r2087; + gte r2087 r1611 into r2088; + or r2086 r2088 into r2089; + sub.w r2087 r1611 into r2090; + ternary r2089 r2090 r2087 into r2091; + add r2085 295147905179352825856u128 into r2092; + ternary r2089 r2092 r2085 into r2093; + gte r2091 170141183460469231731687303715884105728u128 into r2094; + add.w r2091 r2091 into r2095; + gte r2095 r1611 into r2096; + or r2094 r2096 into r2097; + sub.w r2095 r1611 into r2098; + ternary r2097 r2098 r2095 into r2099; + add r2093 147573952589676412928u128 into r2100; + ternary r2097 r2100 r2093 into r2101; + gte r2099 170141183460469231731687303715884105728u128 into r2102; + add.w r2099 r2099 into r2103; + gte r2103 r1611 into r2104; + or r2102 r2104 into r2105; + sub.w r2103 r1611 into r2106; + ternary r2105 r2106 r2103 into r2107; + add r2101 73786976294838206464u128 into r2108; + ternary r2105 r2108 r2101 into r2109; + gte r2107 170141183460469231731687303715884105728u128 into r2110; + add.w r2107 r2107 into r2111; + gte r2111 r1611 into r2112; + or r2110 r2112 into r2113; + sub.w r2111 r1611 into r2114; + ternary r2113 r2114 r2111 into r2115; + add r2109 36893488147419103232u128 into r2116; + ternary r2113 r2116 r2109 into r2117; + gte r2115 170141183460469231731687303715884105728u128 into r2118; + add.w r2115 r2115 into r2119; + gte r2119 r1611 into r2120; + or r2118 r2120 into r2121; + sub.w r2119 r1611 into r2122; + ternary r2121 r2122 r2119 into r2123; + add r2117 18446744073709551616u128 into r2124; + ternary r2121 r2124 r2117 into r2125; + gte r2123 170141183460469231731687303715884105728u128 into r2126; + add.w r2123 r2123 into r2127; + gte r2127 r1611 into r2128; + or r2126 r2128 into r2129; + sub.w r2127 r1611 into r2130; + ternary r2129 r2130 r2127 into r2131; + add r2125 9223372036854775808u128 into r2132; + ternary r2129 r2132 r2125 into r2133; + gte r2131 170141183460469231731687303715884105728u128 into r2134; + add.w r2131 r2131 into r2135; + gte r2135 r1611 into r2136; + or r2134 r2136 into r2137; + sub.w r2135 r1611 into r2138; + ternary r2137 r2138 r2135 into r2139; + add r2133 4611686018427387904u128 into r2140; + ternary r2137 r2140 r2133 into r2141; + gte r2139 170141183460469231731687303715884105728u128 into r2142; + add.w r2139 r2139 into r2143; + gte r2143 r1611 into r2144; + or r2142 r2144 into r2145; + sub.w r2143 r1611 into r2146; + ternary r2145 r2146 r2143 into r2147; + add r2141 2305843009213693952u128 into r2148; + ternary r2145 r2148 r2141 into r2149; + gte r2147 170141183460469231731687303715884105728u128 into r2150; + add.w r2147 r2147 into r2151; + gte r2151 r1611 into r2152; + or r2150 r2152 into r2153; + sub.w r2151 r1611 into r2154; + ternary r2153 r2154 r2151 into r2155; + add r2149 1152921504606846976u128 into r2156; + ternary r2153 r2156 r2149 into r2157; + gte r2155 170141183460469231731687303715884105728u128 into r2158; + add.w r2155 r2155 into r2159; + gte r2159 r1611 into r2160; + or r2158 r2160 into r2161; + sub.w r2159 r1611 into r2162; + ternary r2161 r2162 r2159 into r2163; + add r2157 576460752303423488u128 into r2164; + ternary r2161 r2164 r2157 into r2165; + gte r2163 170141183460469231731687303715884105728u128 into r2166; + add.w r2163 r2163 into r2167; + gte r2167 r1611 into r2168; + or r2166 r2168 into r2169; + sub.w r2167 r1611 into r2170; + ternary r2169 r2170 r2167 into r2171; + add r2165 288230376151711744u128 into r2172; + ternary r2169 r2172 r2165 into r2173; + gte r2171 170141183460469231731687303715884105728u128 into r2174; + add.w r2171 r2171 into r2175; + gte r2175 r1611 into r2176; + or r2174 r2176 into r2177; + sub.w r2175 r1611 into r2178; + ternary r2177 r2178 r2175 into r2179; + add r2173 144115188075855872u128 into r2180; + ternary r2177 r2180 r2173 into r2181; + gte r2179 170141183460469231731687303715884105728u128 into r2182; + add.w r2179 r2179 into r2183; + gte r2183 r1611 into r2184; + or r2182 r2184 into r2185; + sub.w r2183 r1611 into r2186; + ternary r2185 r2186 r2183 into r2187; + add r2181 72057594037927936u128 into r2188; + ternary r2185 r2188 r2181 into r2189; + gte r2187 170141183460469231731687303715884105728u128 into r2190; + add.w r2187 r2187 into r2191; + gte r2191 r1611 into r2192; + or r2190 r2192 into r2193; + sub.w r2191 r1611 into r2194; + ternary r2193 r2194 r2191 into r2195; + add r2189 36028797018963968u128 into r2196; + ternary r2193 r2196 r2189 into r2197; + gte r2195 170141183460469231731687303715884105728u128 into r2198; + add.w r2195 r2195 into r2199; + gte r2199 r1611 into r2200; + or r2198 r2200 into r2201; + sub.w r2199 r1611 into r2202; + ternary r2201 r2202 r2199 into r2203; + add r2197 18014398509481984u128 into r2204; + ternary r2201 r2204 r2197 into r2205; + gte r2203 170141183460469231731687303715884105728u128 into r2206; + add.w r2203 r2203 into r2207; + gte r2207 r1611 into r2208; + or r2206 r2208 into r2209; + sub.w r2207 r1611 into r2210; + ternary r2209 r2210 r2207 into r2211; + add r2205 9007199254740992u128 into r2212; + ternary r2209 r2212 r2205 into r2213; + gte r2211 170141183460469231731687303715884105728u128 into r2214; + add.w r2211 r2211 into r2215; + gte r2215 r1611 into r2216; + or r2214 r2216 into r2217; + sub.w r2215 r1611 into r2218; + ternary r2217 r2218 r2215 into r2219; + add r2213 4503599627370496u128 into r2220; + ternary r2217 r2220 r2213 into r2221; + gte r2219 170141183460469231731687303715884105728u128 into r2222; + add.w r2219 r2219 into r2223; + gte r2223 r1611 into r2224; + or r2222 r2224 into r2225; + sub.w r2223 r1611 into r2226; + ternary r2225 r2226 r2223 into r2227; + add r2221 2251799813685248u128 into r2228; + ternary r2225 r2228 r2221 into r2229; + gte r2227 170141183460469231731687303715884105728u128 into r2230; + add.w r2227 r2227 into r2231; + gte r2231 r1611 into r2232; + or r2230 r2232 into r2233; + sub.w r2231 r1611 into r2234; + ternary r2233 r2234 r2231 into r2235; + add r2229 1125899906842624u128 into r2236; + ternary r2233 r2236 r2229 into r2237; + gte r2235 170141183460469231731687303715884105728u128 into r2238; + add.w r2235 r2235 into r2239; + gte r2239 r1611 into r2240; + or r2238 r2240 into r2241; + sub.w r2239 r1611 into r2242; + ternary r2241 r2242 r2239 into r2243; + add r2237 562949953421312u128 into r2244; + ternary r2241 r2244 r2237 into r2245; + gte r2243 170141183460469231731687303715884105728u128 into r2246; + add.w r2243 r2243 into r2247; + gte r2247 r1611 into r2248; + or r2246 r2248 into r2249; + sub.w r2247 r1611 into r2250; + ternary r2249 r2250 r2247 into r2251; + add r2245 281474976710656u128 into r2252; + ternary r2249 r2252 r2245 into r2253; + gte r2251 170141183460469231731687303715884105728u128 into r2254; + add.w r2251 r2251 into r2255; + gte r2255 r1611 into r2256; + or r2254 r2256 into r2257; + sub.w r2255 r1611 into r2258; + ternary r2257 r2258 r2255 into r2259; + add r2253 140737488355328u128 into r2260; + ternary r2257 r2260 r2253 into r2261; + gte r2259 170141183460469231731687303715884105728u128 into r2262; + add.w r2259 r2259 into r2263; + gte r2263 r1611 into r2264; + or r2262 r2264 into r2265; + sub.w r2263 r1611 into r2266; + ternary r2265 r2266 r2263 into r2267; + add r2261 70368744177664u128 into r2268; + ternary r2265 r2268 r2261 into r2269; + gte r2267 170141183460469231731687303715884105728u128 into r2270; + add.w r2267 r2267 into r2271; + gte r2271 r1611 into r2272; + or r2270 r2272 into r2273; + sub.w r2271 r1611 into r2274; + ternary r2273 r2274 r2271 into r2275; + add r2269 35184372088832u128 into r2276; + ternary r2273 r2276 r2269 into r2277; + gte r2275 170141183460469231731687303715884105728u128 into r2278; + add.w r2275 r2275 into r2279; + gte r2279 r1611 into r2280; + or r2278 r2280 into r2281; + sub.w r2279 r1611 into r2282; + ternary r2281 r2282 r2279 into r2283; + add r2277 17592186044416u128 into r2284; + ternary r2281 r2284 r2277 into r2285; + gte r2283 170141183460469231731687303715884105728u128 into r2286; + add.w r2283 r2283 into r2287; + gte r2287 r1611 into r2288; + or r2286 r2288 into r2289; + sub.w r2287 r1611 into r2290; + ternary r2289 r2290 r2287 into r2291; + add r2285 8796093022208u128 into r2292; + ternary r2289 r2292 r2285 into r2293; + gte r2291 170141183460469231731687303715884105728u128 into r2294; + add.w r2291 r2291 into r2295; + gte r2295 r1611 into r2296; + or r2294 r2296 into r2297; + sub.w r2295 r1611 into r2298; + ternary r2297 r2298 r2295 into r2299; + add r2293 4398046511104u128 into r2300; + ternary r2297 r2300 r2293 into r2301; + gte r2299 170141183460469231731687303715884105728u128 into r2302; + add.w r2299 r2299 into r2303; + gte r2303 r1611 into r2304; + or r2302 r2304 into r2305; + sub.w r2303 r1611 into r2306; + ternary r2305 r2306 r2303 into r2307; + add r2301 2199023255552u128 into r2308; + ternary r2305 r2308 r2301 into r2309; + gte r2307 170141183460469231731687303715884105728u128 into r2310; + add.w r2307 r2307 into r2311; + gte r2311 r1611 into r2312; + or r2310 r2312 into r2313; + sub.w r2311 r1611 into r2314; + ternary r2313 r2314 r2311 into r2315; + add r2309 1099511627776u128 into r2316; + ternary r2313 r2316 r2309 into r2317; + gte r2315 170141183460469231731687303715884105728u128 into r2318; + add.w r2315 r2315 into r2319; + gte r2319 r1611 into r2320; + or r2318 r2320 into r2321; + sub.w r2319 r1611 into r2322; + ternary r2321 r2322 r2319 into r2323; + add r2317 549755813888u128 into r2324; + ternary r2321 r2324 r2317 into r2325; + gte r2323 170141183460469231731687303715884105728u128 into r2326; + add.w r2323 r2323 into r2327; + gte r2327 r1611 into r2328; + or r2326 r2328 into r2329; + sub.w r2327 r1611 into r2330; + ternary r2329 r2330 r2327 into r2331; + add r2325 274877906944u128 into r2332; + ternary r2329 r2332 r2325 into r2333; + gte r2331 170141183460469231731687303715884105728u128 into r2334; + add.w r2331 r2331 into r2335; + gte r2335 r1611 into r2336; + or r2334 r2336 into r2337; + sub.w r2335 r1611 into r2338; + ternary r2337 r2338 r2335 into r2339; + add r2333 137438953472u128 into r2340; + ternary r2337 r2340 r2333 into r2341; + gte r2339 170141183460469231731687303715884105728u128 into r2342; + add.w r2339 r2339 into r2343; + gte r2343 r1611 into r2344; + or r2342 r2344 into r2345; + sub.w r2343 r1611 into r2346; + ternary r2345 r2346 r2343 into r2347; + add r2341 68719476736u128 into r2348; + ternary r2345 r2348 r2341 into r2349; + gte r2347 170141183460469231731687303715884105728u128 into r2350; + add.w r2347 r2347 into r2351; + gte r2351 r1611 into r2352; + or r2350 r2352 into r2353; + sub.w r2351 r1611 into r2354; + ternary r2353 r2354 r2351 into r2355; + add r2349 34359738368u128 into r2356; + ternary r2353 r2356 r2349 into r2357; + gte r2355 170141183460469231731687303715884105728u128 into r2358; + add.w r2355 r2355 into r2359; + gte r2359 r1611 into r2360; + or r2358 r2360 into r2361; + sub.w r2359 r1611 into r2362; + ternary r2361 r2362 r2359 into r2363; + add r2357 17179869184u128 into r2364; + ternary r2361 r2364 r2357 into r2365; + gte r2363 170141183460469231731687303715884105728u128 into r2366; + add.w r2363 r2363 into r2367; + gte r2367 r1611 into r2368; + or r2366 r2368 into r2369; + sub.w r2367 r1611 into r2370; + ternary r2369 r2370 r2367 into r2371; + add r2365 8589934592u128 into r2372; + ternary r2369 r2372 r2365 into r2373; + gte r2371 170141183460469231731687303715884105728u128 into r2374; + add.w r2371 r2371 into r2375; + gte r2375 r1611 into r2376; + or r2374 r2376 into r2377; + sub.w r2375 r1611 into r2378; + ternary r2377 r2378 r2375 into r2379; + add r2373 4294967296u128 into r2380; + ternary r2377 r2380 r2373 into r2381; + gte r2379 170141183460469231731687303715884105728u128 into r2382; + add.w r2379 r2379 into r2383; + gte r2383 r1611 into r2384; + or r2382 r2384 into r2385; + sub.w r2383 r1611 into r2386; + ternary r2385 r2386 r2383 into r2387; + add r2381 2147483648u128 into r2388; + ternary r2385 r2388 r2381 into r2389; + gte r2387 170141183460469231731687303715884105728u128 into r2390; + add.w r2387 r2387 into r2391; + gte r2391 r1611 into r2392; + or r2390 r2392 into r2393; + sub.w r2391 r1611 into r2394; + ternary r2393 r2394 r2391 into r2395; + add r2389 1073741824u128 into r2396; + ternary r2393 r2396 r2389 into r2397; + gte r2395 170141183460469231731687303715884105728u128 into r2398; + add.w r2395 r2395 into r2399; + gte r2399 r1611 into r2400; + or r2398 r2400 into r2401; + sub.w r2399 r1611 into r2402; + ternary r2401 r2402 r2399 into r2403; + add r2397 536870912u128 into r2404; + ternary r2401 r2404 r2397 into r2405; + gte r2403 170141183460469231731687303715884105728u128 into r2406; + add.w r2403 r2403 into r2407; + gte r2407 r1611 into r2408; + or r2406 r2408 into r2409; + sub.w r2407 r1611 into r2410; + ternary r2409 r2410 r2407 into r2411; + add r2405 268435456u128 into r2412; + ternary r2409 r2412 r2405 into r2413; + gte r2411 170141183460469231731687303715884105728u128 into r2414; + add.w r2411 r2411 into r2415; + gte r2415 r1611 into r2416; + or r2414 r2416 into r2417; + sub.w r2415 r1611 into r2418; + ternary r2417 r2418 r2415 into r2419; + add r2413 134217728u128 into r2420; + ternary r2417 r2420 r2413 into r2421; + gte r2419 170141183460469231731687303715884105728u128 into r2422; + add.w r2419 r2419 into r2423; + gte r2423 r1611 into r2424; + or r2422 r2424 into r2425; + sub.w r2423 r1611 into r2426; + ternary r2425 r2426 r2423 into r2427; + add r2421 67108864u128 into r2428; + ternary r2425 r2428 r2421 into r2429; + gte r2427 170141183460469231731687303715884105728u128 into r2430; + add.w r2427 r2427 into r2431; + gte r2431 r1611 into r2432; + or r2430 r2432 into r2433; + sub.w r2431 r1611 into r2434; + ternary r2433 r2434 r2431 into r2435; + add r2429 33554432u128 into r2436; + ternary r2433 r2436 r2429 into r2437; + gte r2435 170141183460469231731687303715884105728u128 into r2438; + add.w r2435 r2435 into r2439; + gte r2439 r1611 into r2440; + or r2438 r2440 into r2441; + sub.w r2439 r1611 into r2442; + ternary r2441 r2442 r2439 into r2443; + add r2437 16777216u128 into r2444; + ternary r2441 r2444 r2437 into r2445; + gte r2443 170141183460469231731687303715884105728u128 into r2446; + add.w r2443 r2443 into r2447; + gte r2447 r1611 into r2448; + or r2446 r2448 into r2449; + sub.w r2447 r1611 into r2450; + ternary r2449 r2450 r2447 into r2451; + add r2445 8388608u128 into r2452; + ternary r2449 r2452 r2445 into r2453; + gte r2451 170141183460469231731687303715884105728u128 into r2454; + add.w r2451 r2451 into r2455; + gte r2455 r1611 into r2456; + or r2454 r2456 into r2457; + sub.w r2455 r1611 into r2458; + ternary r2457 r2458 r2455 into r2459; + add r2453 4194304u128 into r2460; + ternary r2457 r2460 r2453 into r2461; + gte r2459 170141183460469231731687303715884105728u128 into r2462; + add.w r2459 r2459 into r2463; + gte r2463 r1611 into r2464; + or r2462 r2464 into r2465; + sub.w r2463 r1611 into r2466; + ternary r2465 r2466 r2463 into r2467; + add r2461 2097152u128 into r2468; + ternary r2465 r2468 r2461 into r2469; + gte r2467 170141183460469231731687303715884105728u128 into r2470; + add.w r2467 r2467 into r2471; + gte r2471 r1611 into r2472; + or r2470 r2472 into r2473; + sub.w r2471 r1611 into r2474; + ternary r2473 r2474 r2471 into r2475; + add r2469 1048576u128 into r2476; + ternary r2473 r2476 r2469 into r2477; + gte r2475 170141183460469231731687303715884105728u128 into r2478; + add.w r2475 r2475 into r2479; + gte r2479 r1611 into r2480; + or r2478 r2480 into r2481; + sub.w r2479 r1611 into r2482; + ternary r2481 r2482 r2479 into r2483; + add r2477 524288u128 into r2484; + ternary r2481 r2484 r2477 into r2485; + gte r2483 170141183460469231731687303715884105728u128 into r2486; + add.w r2483 r2483 into r2487; + gte r2487 r1611 into r2488; + or r2486 r2488 into r2489; + sub.w r2487 r1611 into r2490; + ternary r2489 r2490 r2487 into r2491; + add r2485 262144u128 into r2492; + ternary r2489 r2492 r2485 into r2493; + gte r2491 170141183460469231731687303715884105728u128 into r2494; + add.w r2491 r2491 into r2495; + gte r2495 r1611 into r2496; + or r2494 r2496 into r2497; + sub.w r2495 r1611 into r2498; + ternary r2497 r2498 r2495 into r2499; + add r2493 131072u128 into r2500; + ternary r2497 r2500 r2493 into r2501; + gte r2499 170141183460469231731687303715884105728u128 into r2502; + add.w r2499 r2499 into r2503; + gte r2503 r1611 into r2504; + or r2502 r2504 into r2505; + sub.w r2503 r1611 into r2506; + ternary r2505 r2506 r2503 into r2507; + add r2501 65536u128 into r2508; + ternary r2505 r2508 r2501 into r2509; + gte r2507 170141183460469231731687303715884105728u128 into r2510; + add.w r2507 r2507 into r2511; + gte r2511 r1611 into r2512; + or r2510 r2512 into r2513; + sub.w r2511 r1611 into r2514; + ternary r2513 r2514 r2511 into r2515; + add r2509 32768u128 into r2516; + ternary r2513 r2516 r2509 into r2517; + gte r2515 170141183460469231731687303715884105728u128 into r2518; + add.w r2515 r2515 into r2519; + gte r2519 r1611 into r2520; + or r2518 r2520 into r2521; + sub.w r2519 r1611 into r2522; + ternary r2521 r2522 r2519 into r2523; + add r2517 16384u128 into r2524; + ternary r2521 r2524 r2517 into r2525; + gte r2523 170141183460469231731687303715884105728u128 into r2526; + add.w r2523 r2523 into r2527; + gte r2527 r1611 into r2528; + or r2526 r2528 into r2529; + sub.w r2527 r1611 into r2530; + ternary r2529 r2530 r2527 into r2531; + add r2525 8192u128 into r2532; + ternary r2529 r2532 r2525 into r2533; + gte r2531 170141183460469231731687303715884105728u128 into r2534; + add.w r2531 r2531 into r2535; + gte r2535 r1611 into r2536; + or r2534 r2536 into r2537; + sub.w r2535 r1611 into r2538; + ternary r2537 r2538 r2535 into r2539; + add r2533 4096u128 into r2540; + ternary r2537 r2540 r2533 into r2541; + gte r2539 170141183460469231731687303715884105728u128 into r2542; + add.w r2539 r2539 into r2543; + gte r2543 r1611 into r2544; + or r2542 r2544 into r2545; + sub.w r2543 r1611 into r2546; + ternary r2545 r2546 r2543 into r2547; + add r2541 2048u128 into r2548; + ternary r2545 r2548 r2541 into r2549; + gte r2547 170141183460469231731687303715884105728u128 into r2550; + add.w r2547 r2547 into r2551; + gte r2551 r1611 into r2552; + or r2550 r2552 into r2553; + sub.w r2551 r1611 into r2554; + ternary r2553 r2554 r2551 into r2555; + add r2549 1024u128 into r2556; + ternary r2553 r2556 r2549 into r2557; + gte r2555 170141183460469231731687303715884105728u128 into r2558; + add.w r2555 r2555 into r2559; + gte r2559 r1611 into r2560; + or r2558 r2560 into r2561; + sub.w r2559 r1611 into r2562; + ternary r2561 r2562 r2559 into r2563; + add r2557 512u128 into r2564; + ternary r2561 r2564 r2557 into r2565; + gte r2563 170141183460469231731687303715884105728u128 into r2566; + add.w r2563 r2563 into r2567; + gte r2567 r1611 into r2568; + or r2566 r2568 into r2569; + sub.w r2567 r1611 into r2570; + ternary r2569 r2570 r2567 into r2571; + add r2565 256u128 into r2572; + ternary r2569 r2572 r2565 into r2573; + gte r2571 170141183460469231731687303715884105728u128 into r2574; + add.w r2571 r2571 into r2575; + gte r2575 r1611 into r2576; + or r2574 r2576 into r2577; + sub.w r2575 r1611 into r2578; + ternary r2577 r2578 r2575 into r2579; + add r2573 128u128 into r2580; + ternary r2577 r2580 r2573 into r2581; + gte r2579 170141183460469231731687303715884105728u128 into r2582; + add.w r2579 r2579 into r2583; + gte r2583 r1611 into r2584; + or r2582 r2584 into r2585; + sub.w r2583 r1611 into r2586; + ternary r2585 r2586 r2583 into r2587; + add r2581 64u128 into r2588; + ternary r2585 r2588 r2581 into r2589; + gte r2587 170141183460469231731687303715884105728u128 into r2590; + add.w r2587 r2587 into r2591; + gte r2591 r1611 into r2592; + or r2590 r2592 into r2593; + sub.w r2591 r1611 into r2594; + ternary r2593 r2594 r2591 into r2595; + add r2589 32u128 into r2596; + ternary r2593 r2596 r2589 into r2597; + gte r2595 170141183460469231731687303715884105728u128 into r2598; + add.w r2595 r2595 into r2599; + gte r2599 r1611 into r2600; + or r2598 r2600 into r2601; + sub.w r2599 r1611 into r2602; + ternary r2601 r2602 r2599 into r2603; + add r2597 16u128 into r2604; + ternary r2601 r2604 r2597 into r2605; + gte r2603 170141183460469231731687303715884105728u128 into r2606; + add.w r2603 r2603 into r2607; + gte r2607 r1611 into r2608; + or r2606 r2608 into r2609; + sub.w r2607 r1611 into r2610; + ternary r2609 r2610 r2607 into r2611; + add r2605 8u128 into r2612; + ternary r2609 r2612 r2605 into r2613; + gte r2611 170141183460469231731687303715884105728u128 into r2614; + add.w r2611 r2611 into r2615; + gte r2615 r1611 into r2616; + or r2614 r2616 into r2617; + sub.w r2615 r1611 into r2618; + ternary r2617 r2618 r2615 into r2619; + add r2613 4u128 into r2620; + ternary r2617 r2620 r2613 into r2621; + gte r2619 170141183460469231731687303715884105728u128 into r2622; + add.w r2619 r2619 into r2623; + gte r2623 r1611 into r2624; + or r2622 r2624 into r2625; + sub.w r2623 r1611 into r2626; + ternary r2625 r2626 r2623 into r2627; + add r2621 2u128 into r2628; + ternary r2625 r2628 r2621 into r2629; + gte r2627 170141183460469231731687303715884105728u128 into r2630; + add.w r2627 r2627 into r2631; + gte r2631 r1611 into r2632; + or r2630 r2632 into r2633; + add r2629 1u128 into r2634; + ternary r2633 r2634 r2629 into r2635; + ternary r1610 r1612 0u128 into r2636; + ternary r1610 r2635 0u128 into r2637; + cast r2636 r2637 into r2638 as U256__8JquwLopp8; + add.w r4.fg.lo r2638.lo into r2639; + lt r2639 r4.fg.lo into r2640; + ternary r2640 1u128 0u128 into r2641; + add.w r4.fg.hi r2638.hi into r2642; + add.w r2642 r2641 into r2643; + cast r2643 r2639 into r2644 as U256__8JquwLopp8; + is.eq r1595.hi r2.hi into r2645; + is.eq r1595.lo r2.lo into r2646; + and r2645 r2646 into r2647; + and r4.crossed r2647 into r2648; + ternary r0.z r2644.hi r0.slot_fg0.hi into r2649; + ternary r0.z r2644.lo r0.slot_fg0.lo into r2650; + cast r2649 r2650 into r2651 as U256__8JquwLopp8; + ternary r0.z r0.slot_fg1.hi r2644.hi into r2652; + ternary r0.z r0.slot_fg1.lo r2644.lo into r2653; + cast r2652 r2653 into r2654 as U256__8JquwLopp8; + lt r2651.lo r3.fee_growth_outside0_x_128.lo into r2655; + ternary r2655 1u128 0u128 into r2656; + sub.w r2651.lo r3.fee_growth_outside0_x_128.lo into r2657; + sub.w r2651.hi r3.fee_growth_outside0_x_128.hi into r2658; + sub.w r2658 r2656 into r2659; + cast r2659 r2657 into r2660 as U256__8JquwLopp8; + lt r2654.lo r3.fee_growth_outside1_x_128.lo into r2661; + ternary r2661 1u128 0u128 into r2662; + sub.w r2654.lo r3.fee_growth_outside1_x_128.lo into r2663; + sub.w r2654.hi r3.fee_growth_outside1_x_128.hi into r2664; + sub.w r2664 r2662 into r2665; + cast r2665 r2663 into r2666 as U256__8JquwLopp8; + ternary r2648 r2660.hi r3.fee_growth_outside0_x_128.hi into r2667; + ternary r2648 r2660.lo r3.fee_growth_outside0_x_128.lo into r2668; + cast r2667 r2668 into r2669 as U256__8JquwLopp8; + ternary r2648 r2666.hi r3.fee_growth_outside1_x_128.hi into r2670; + ternary r2648 r2666.lo r3.fee_growth_outside1_x_128.lo into r2671; + cast r2670 r2671 into r2672 as U256__8JquwLopp8; + ternary r2648 r3.pool r3.pool into r2673; + ternary r2648 r3.liquidity_net r3.liquidity_net into r2674; + ternary r2648 r3.liquidity_gross r3.liquidity_gross into r2675; + ternary r2648 r3.tick r3.tick into r2676; + ternary r2648 r3.prev r3.prev into r2677; + ternary r2648 r3.next r3.next into r2678; + cast r2673 r2674 r2675 r2676 r2669 r2672 r2677 r2678 into r2679 as Tick; + sub 0i128 r3.liquidity_net into r2680; + ternary r0.z r2680 r3.liquidity_net into r2681; + ternary r2648 r2681 0i128 into r2682; + sub 0i128 r2682 into r2683; + gt r2682 0i128 into r2684; + ternary r2684 r2682 0i128 into r2685; + gt r2683 0i128 into r2686; + ternary r2686 r2683 0i128 into r2687; + cast r2685 into r2688 as u128; + cast r2687 into r2689 as u128; + gte r4.liq r2689 into r2690; + assert.eq r2690 true; + sub r4.liq r2689 into r2691; + add r4.liq r2688 into r2692; + lt r2682 0i128 into r2693; + ternary r2693 r2691 r2692 into r2694; + ternary r2648 r2694 r4.liq into r2695; + sub r1 1i32 into r2696; + ternary r0.z r2696 r1 into r2697; + ternary r2648 r2697 r4.tk into r2698; + ternary r0.z r3.prev r1 into r2699; + ternary r2648 r2699 r4.nb into r2700; + ternary r0.z r1 r3.next into r2701; + ternary r2648 r2701 r4.na into r2702; + cast r1595 r1608 r1609 r2644 r2695 r2698 r2648 r1607 r2700 r2702 into r2703 as SwapIterState; + output r2703 as SwapIterState.public; + output r2679 as Tick.public; + +view view_bounded_partial: + input r0 as U256__8JquwLopp8.public; + input r1 as u128.public; + input r2 as u128.public; + input r3 as u128.public; + input r4 as U256__8JquwLopp8.public; + input r5 as u128.public; + input r6 as U256__8JquwLopp8.public; + input r7 as U256__8JquwLopp8.public; + input r8 as u32.public; + input r9 as u8.public; + input r10 as boolean.public; + lt r6.hi r7.hi into r11; + gt r6.hi r7.hi into r12; + lt r6.lo r7.lo into r13; + ternary r12 false r13 into r14; + ternary r11 true r14 into r15; + ternary r15 r7.hi r6.hi into r16; + ternary r15 r7.lo r6.lo into r17; + cast r16 r17 into r18 as U256__8JquwLopp8; + lt r7.hi r6.hi into r19; + gt r7.hi r6.hi into r20; + lt r7.lo r6.lo into r21; + ternary r20 false r21 into r22; + ternary r19 true r22 into r23; + ternary r23 r7.hi r6.hi into r24; + ternary r23 r7.lo r6.lo into r25; + cast r24 r25 into r26 as U256__8JquwLopp8; + ternary r10 r18.hi r26.hi into r27; + ternary r10 r18.lo r26.lo into r28; + cast r27 r28 into r29 as U256__8JquwLopp8; + is.eq r29.hi r6.hi into r30; + is.eq r29.lo r6.lo into r31; + and r30 r31 into r32; + lt r29.hi r0.hi into r33; + gt r29.hi r0.hi into r34; + lt r29.lo r0.lo into r35; + ternary r34 false r35 into r36; + ternary r33 true r36 into r37; + lt r0.hi r29.hi into r38; + gt r0.hi r29.hi into r39; + lt r0.lo r29.lo into r40; + ternary r39 false r40 into r41; + ternary r38 true r41 into r42; + ternary r10 r37 r42 into r43; + gt r2 0u128 into r44; + gt r1 0u128 into r45; + and r44 r45 into r46; + and r46 r43 into r47; + cast r8 into r48 as u128; + sub 1000000u128 r48 into r49; + and r2 18446744073709551615u128 into r50; + shr r2 64u8 into r51; + and r49 18446744073709551615u128 into r52; + shr r49 64u8 into r53; + mul r50 r52 into r54; + mul r50 r53 into r55; + mul r51 r52 into r56; + mul r51 r53 into r57; + and r54 18446744073709551615u128 into r58; + shr r54 64u8 into r59; + and r55 18446744073709551615u128 into r60; + add r59 r60 into r61; + and r56 18446744073709551615u128 into r62; + add r61 r62 into r63; + and r63 18446744073709551615u128 into r64; + shr r63 64u8 into r65; + shr r55 64u8 into r66; + shr r56 64u8 into r67; + add r66 r67 into r68; + and r57 18446744073709551615u128 into r69; + add r68 r69 into r70; + add r70 r65 into r71; + and r71 18446744073709551615u128 into r72; + shr r71 64u8 into r73; + shr r57 64u8 into r74; + add r74 r73 into r75; + shl r75 64u8 into r76; + add r76 r72 into r77; + shl r64 64u8 into r78; + add r78 r58 into r79; + lt r77 1000000u128 into r80; + assert.eq r80 true; + shr r79 96u8 into r81; + and r81 4294967295u128 into r82; + shl r77 32u8 into r83; + add r83 r82 into r84; + div r84 1000000u128 into r85; + rem r84 1000000u128 into r86; + shr r79 64u8 into r87; + and r87 4294967295u128 into r88; + shl r86 32u8 into r89; + add r89 r88 into r90; + shl r85 32u8 into r91; + div r90 1000000u128 into r92; + add r91 r92 into r93; + rem r90 1000000u128 into r94; + shr r79 32u8 into r95; + and r95 4294967295u128 into r96; + shl r94 32u8 into r97; + add r97 r96 into r98; + shl r93 32u8 into r99; + div r98 1000000u128 into r100; + add r99 r100 into r101; + rem r98 1000000u128 into r102; + shr r79 0u8 into r103; + and r103 4294967295u128 into r104; + shl r102 32u8 into r105; + add r105 r104 into r106; + shl r101 32u8 into r107; + div r106 1000000u128 into r108; + add r107 r108 into r109; + rem r106 1000000u128 into r110; + lt r0.hi r29.hi into r111; + gt r0.hi r29.hi into r112; + lt r0.lo r29.lo into r113; + ternary r112 false r113 into r114; + ternary r111 true r114 into r115; + ternary r115 r0.hi r29.hi into r116; + ternary r115 r0.lo r29.lo into r117; + cast r116 r117 into r118 as U256__8JquwLopp8; + lt r0.hi r29.hi into r119; + gt r0.hi r29.hi into r120; + lt r0.lo r29.lo into r121; + ternary r120 false r121 into r122; + ternary r119 true r122 into r123; + ternary r123 r29.hi r0.hi into r124; + ternary r123 r29.lo r0.lo into r125; + cast r124 r125 into r126 as U256__8JquwLopp8; + lt r126.lo r118.lo into r127; + ternary r127 1u128 0u128 into r128; + sub.w r126.lo r118.lo into r129; + sub.w r126.hi r118.hi into r130; + sub.w r130 r128 into r131; + cast r131 r129 into r132 as U256__8JquwLopp8; + shr r132.lo 64u8 into r133; + shr r132.hi 64u8 into r134; + and r1 18446744073709551615u128 into r135; + shr r1 64u8 into r136; + and r132.lo 18446744073709551615u128 into r137; + shr r132.lo 64u8 into r138; + mul r135 r137 into r139; + mul r135 r138 into r140; + mul r136 r137 into r141; + mul r136 r138 into r142; + and r139 18446744073709551615u128 into r143; + shr r139 64u8 into r144; + and r140 18446744073709551615u128 into r145; + add r144 r145 into r146; + and r141 18446744073709551615u128 into r147; + add r146 r147 into r148; + and r148 18446744073709551615u128 into r149; + shr r148 64u8 into r150; + shr r140 64u8 into r151; + shr r141 64u8 into r152; + add r151 r152 into r153; + and r142 18446744073709551615u128 into r154; + add r153 r154 into r155; + add r155 r150 into r156; + and r156 18446744073709551615u128 into r157; + shr r156 64u8 into r158; + shr r142 64u8 into r159; + add r159 r158 into r160; + shl r160 64u8 into r161; + add r161 r157 into r162; + shl r149 64u8 into r163; + add r163 r143 into r164; + and r132.hi 18446744073709551615u128 into r165; + shr r132.hi 64u8 into r166; + mul r135 r165 into r167; + mul r135 r166 into r168; + mul r136 r165 into r169; + mul r136 r166 into r170; + and r167 18446744073709551615u128 into r171; + shr r167 64u8 into r172; + and r168 18446744073709551615u128 into r173; + add r172 r173 into r174; + and r169 18446744073709551615u128 into r175; + add r174 r175 into r176; + and r176 18446744073709551615u128 into r177; + shr r176 64u8 into r178; + shr r168 64u8 into r179; + shr r169 64u8 into r180; + add r179 r180 into r181; + and r170 18446744073709551615u128 into r182; + add r181 r182 into r183; + add r183 r178 into r184; + and r184 18446744073709551615u128 into r185; + shr r184 64u8 into r186; + shr r170 64u8 into r187; + add r187 r186 into r188; + shl r188 64u8 into r189; + add r189 r185 into r190; + shl r177 64u8 into r191; + add r191 r171 into r192; + lt r164 0u128 into r193; + ternary r193 1u128 0u128 into r194; + lt r162 0u128 into r195; + ternary r195 1u128 0u128 into r196; + add.w r162 r192 into r197; + lt r197 r162 into r198; + ternary r198 1u128 0u128 into r199; + add.w r197 r194 into r200; + lt r200 r197 into r201; + ternary r201 1u128 0u128 into r202; + add r196 r199 into r203; + add r203 r202 into r204; + add.w r190 r204 into r205; + cast r205 r200 into r206 as U256__8JquwLopp8; + cast r164 0u128 into r207 as U256__8JquwLopp8; + lt r206.hi r126.hi into r208; + gt r206.hi r126.hi into r209; + lt r206.lo r126.lo into r210; + ternary r209 false r210 into r211; + ternary r208 true r211 into r212; + assert.eq r212 true; + gt r126.hi 0u128 into r213; + ternary r213 r126.hi r126.lo into r214; + ternary r213 128u32 0u32 into r215; + gte r214 18446744073709551616u128 into r216; + shr r214 64u8 into r217; + ternary r216 r217 r214 into r218; + ternary r216 64u32 0u32 into r219; + gte r218 4294967296u128 into r220; + shr r218 32u8 into r221; + add r219 32u32 into r222; + ternary r220 r221 r218 into r223; + ternary r220 r222 r219 into r224; + gte r223 65536u128 into r225; + shr r223 16u8 into r226; + add r224 16u32 into r227; + ternary r225 r226 r223 into r228; + ternary r225 r227 r224 into r229; + gte r228 256u128 into r230; + shr r228 8u8 into r231; + add r229 8u32 into r232; + ternary r230 r231 r228 into r233; + ternary r230 r232 r229 into r234; + gte r233 16u128 into r235; + shr r233 4u8 into r236; + add r234 4u32 into r237; + ternary r235 r236 r233 into r238; + ternary r235 r237 r234 into r239; + gte r238 4u128 into r240; + shr r238 2u8 into r241; + add r239 2u32 into r242; + ternary r240 r241 r238 into r243; + ternary r240 r242 r239 into r244; + gte r243 2u128 into r245; + add r244 1u32 into r246; + ternary r245 r246 r244 into r247; + add r215 r247 into r248; + sub 255u32 r248 into r249; + cast r249 into r250 as u16; + and r250 127u16 into r251; + cast r251 into r252 as u8; + is.eq r252 0u8 into r253; + sub 128u8 r252 into r254; + shr.w r126.lo r254 into r255; + ternary r253 0u128 r255 into r256; + shl.w r126.hi r252 into r257; + or r257 r256 into r258; + shl.w r126.lo r252 into r259; + shl.w r126.lo r252 into r260; + gte r250 128u16 into r261; + ternary r261 r260 r258 into r262; + ternary r261 0u128 r259 into r263; + cast r262 r263 into r264 as U256__8JquwLopp8; + and r264.lo 18446744073709551615u128 into r265; + shr r264.lo 64u8 into r266; + and r264.hi 18446744073709551615u128 into r267; + shr r264.hi 64u8 into r268; + cast r251 into r269 as u8; + is.eq r269 0u8 into r270; + sub 128u8 r269 into r271; + shr.w r207.lo r271 into r272; + ternary r270 0u128 r272 into r273; + shl.w r207.hi r269 into r274; + or r274 r273 into r275; + shl.w r207.lo r269 into r276; + shl.w r207.lo r269 into r277; + ternary r261 r277 r275 into r278; + ternary r261 0u128 r276 into r279; + cast r278 r279 into r280 as U256__8JquwLopp8; + is.eq r250 0u16 into r281; + sub 256u16 r250 into r282; + and r282 127u16 into r283; + cast r283 into r284 as u8; + is.eq r284 0u8 into r285; + sub 128u8 r284 into r286; + shl.w r207.hi r286 into r287; + ternary r285 0u128 r287 into r288; + shr r207.lo r284 into r289; + or r289 r288 into r290; + shr r207.hi r284 into r291; + shr r207.hi r284 into r292; + gte r282 128u16 into r293; + ternary r293 0u128 r291 into r294; + ternary r293 r292 r290 into r295; + cast r294 r295 into r296 as U256__8JquwLopp8; + ternary r281 0u128 r296.hi into r297; + ternary r281 0u128 r296.lo into r298; + cast r297 r298 into r299 as U256__8JquwLopp8; + cast r251 into r300 as u8; + is.eq r300 0u8 into r301; + sub 128u8 r300 into r302; + shr.w r206.lo r302 into r303; + ternary r301 0u128 r303 into r304; + shl.w r206.hi r300 into r305; + or r305 r304 into r306; + shl.w r206.lo r300 into r307; + shl.w r206.lo r300 into r308; + ternary r261 r308 r306 into r309; + ternary r261 0u128 r307 into r310; + cast r309 r310 into r311 as U256__8JquwLopp8; + add.w r311.lo r299.lo into r312; + lt r312 r311.lo into r313; + ternary r313 1u128 0u128 into r314; + add.w r311.hi r299.hi into r315; + add.w r315 r314 into r316; + cast r316 r312 into r317 as U256__8JquwLopp8; + and r280.lo 18446744073709551615u128 into r318; + shr r280.lo 64u8 into r319; + and r280.hi 18446744073709551615u128 into r320; + shr r280.hi 64u8 into r321; + and r317.lo 18446744073709551615u128 into r322; + shr r317.lo 64u8 into r323; + and r317.hi 18446744073709551615u128 into r324; + shr r317.hi 64u8 into r325; + shl r325 64u8 into r326; + add r326 r324 into r327; + div r327 r268 into r328; + gt r328 18446744073709551615u128 into r329; + ternary r329 18446744073709551615u128 r328 into r330; + mul r330 r268 into r331; + sub r327 r331 into r332; + lte r332 18446744073709551615u128 into r333; + mul r330 r267 into r334; + and r332 18446744073709551615u128 into r335; + shl r335 64u8 into r336; + add r336 r323 into r337; + gt r334 r337 into r338; + and r333 r338 into r339; + sub.w r330 1u128 into r340; + ternary r339 r340 r330 into r341; + add r332 r268 into r342; + ternary r339 r342 r332 into r343; + lte r343 18446744073709551615u128 into r344; + and r339 r344 into r345; + mul r341 r267 into r346; + and r343 18446744073709551615u128 into r347; + shl r347 64u8 into r348; + add r348 r323 into r349; + gt r346 r349 into r350; + and r345 r350 into r351; + sub.w r341 1u128 into r352; + ternary r351 r352 r341 into r353; + mul r353 r265 into r354; + and r354 18446744073709551615u128 into r355; + lt r321 r355 into r356; + add r321 18446744073709551616u128 into r357; + sub r357 r355 into r358; + and r358 18446744073709551615u128 into r359; + shr r354 64u8 into r360; + ternary r356 1u128 0u128 into r361; + add r360 r361 into r362; + mul r353 r266 into r363; + add r363 r362 into r364; + and r364 18446744073709551615u128 into r365; + lt r322 r365 into r366; + add r322 18446744073709551616u128 into r367; + sub r367 r365 into r368; + and r368 18446744073709551615u128 into r369; + shr r364 64u8 into r370; + ternary r366 1u128 0u128 into r371; + add r370 r371 into r372; + mul r353 r267 into r373; + add r373 r372 into r374; + and r374 18446744073709551615u128 into r375; + lt r323 r375 into r376; + add r323 18446744073709551616u128 into r377; + sub r377 r375 into r378; + and r378 18446744073709551615u128 into r379; + shr r374 64u8 into r380; + ternary r376 1u128 0u128 into r381; + add r380 r381 into r382; + mul r353 r268 into r383; + add r383 r382 into r384; + and r384 18446744073709551615u128 into r385; + lt r324 r385 into r386; + add r324 18446744073709551616u128 into r387; + sub r387 r385 into r388; + and r388 18446744073709551615u128 into r389; + shr r384 64u8 into r390; + ternary r386 1u128 0u128 into r391; + add r390 r391 into r392; + lt r325 r392 into r393; + add r325 18446744073709551616u128 into r394; + sub r394 r392 into r395; + and r395 18446744073709551615u128 into r396; + sub.w r353 1u128 into r397; + ternary r393 r397 r353 into r398; + add r359 r265 into r399; + and r399 18446744073709551615u128 into r400; + ternary r393 r400 r359 into r401; + shr r399 64u8 into r402; + ternary r393 r402 0u128 into r403; + add r369 r266 into r404; + add r404 r403 into r405; + and r405 18446744073709551615u128 into r406; + ternary r393 r406 r369 into r407; + shr r405 64u8 into r408; + ternary r393 r408 0u128 into r409; + add r379 r267 into r410; + add r410 r409 into r411; + and r411 18446744073709551615u128 into r412; + ternary r393 r412 r379 into r413; + shr r411 64u8 into r414; + ternary r393 r414 0u128 into r415; + add r389 r268 into r416; + add r416 r415 into r417; + and r417 18446744073709551615u128 into r418; + ternary r393 r418 r389 into r419; + shr r417 64u8 into r420; + ternary r393 r420 0u128 into r421; + add r396 r421 into r422; + shl r419 64u8 into r423; + add r423 r413 into r424; + div r424 r268 into r425; + gt r425 18446744073709551615u128 into r426; + ternary r426 18446744073709551615u128 r425 into r427; + mul r427 r268 into r428; + sub r424 r428 into r429; + lte r429 18446744073709551615u128 into r430; + mul r427 r267 into r431; + and r429 18446744073709551615u128 into r432; + shl r432 64u8 into r433; + add r433 r407 into r434; + gt r431 r434 into r435; + and r430 r435 into r436; + sub.w r427 1u128 into r437; + ternary r436 r437 r427 into r438; + add r429 r268 into r439; + ternary r436 r439 r429 into r440; + lte r440 18446744073709551615u128 into r441; + and r436 r441 into r442; + mul r438 r267 into r443; + and r440 18446744073709551615u128 into r444; + shl r444 64u8 into r445; + add r445 r407 into r446; + gt r443 r446 into r447; + and r442 r447 into r448; + sub.w r438 1u128 into r449; + ternary r448 r449 r438 into r450; + mul r450 r265 into r451; + and r451 18446744073709551615u128 into r452; + lt r320 r452 into r453; + add r320 18446744073709551616u128 into r454; + sub r454 r452 into r455; + and r455 18446744073709551615u128 into r456; + shr r451 64u8 into r457; + ternary r453 1u128 0u128 into r458; + add r457 r458 into r459; + mul r450 r266 into r460; + add r460 r459 into r461; + and r461 18446744073709551615u128 into r462; + lt r401 r462 into r463; + add r401 18446744073709551616u128 into r464; + sub r464 r462 into r465; + and r465 18446744073709551615u128 into r466; + shr r461 64u8 into r467; + ternary r463 1u128 0u128 into r468; + add r467 r468 into r469; + mul r450 r267 into r470; + add r470 r469 into r471; + and r471 18446744073709551615u128 into r472; + lt r407 r472 into r473; + add r407 18446744073709551616u128 into r474; + sub r474 r472 into r475; + and r475 18446744073709551615u128 into r476; + shr r471 64u8 into r477; + ternary r473 1u128 0u128 into r478; + add r477 r478 into r479; + mul r450 r268 into r480; + add r480 r479 into r481; + and r481 18446744073709551615u128 into r482; + lt r413 r482 into r483; + add r413 18446744073709551616u128 into r484; + sub r484 r482 into r485; + and r485 18446744073709551615u128 into r486; + shr r481 64u8 into r487; + ternary r483 1u128 0u128 into r488; + add r487 r488 into r489; + lt r419 r489 into r490; + add r419 18446744073709551616u128 into r491; + sub r491 r489 into r492; + and r492 18446744073709551615u128 into r493; + sub.w r450 1u128 into r494; + ternary r490 r494 r450 into r495; + add r456 r265 into r496; + and r496 18446744073709551615u128 into r497; + ternary r490 r497 r456 into r498; + shr r496 64u8 into r499; + ternary r490 r499 0u128 into r500; + add r466 r266 into r501; + add r501 r500 into r502; + and r502 18446744073709551615u128 into r503; + ternary r490 r503 r466 into r504; + shr r502 64u8 into r505; + ternary r490 r505 0u128 into r506; + add r476 r267 into r507; + add r507 r506 into r508; + and r508 18446744073709551615u128 into r509; + ternary r490 r509 r476 into r510; + shr r508 64u8 into r511; + ternary r490 r511 0u128 into r512; + add r486 r268 into r513; + add r513 r512 into r514; + and r514 18446744073709551615u128 into r515; + ternary r490 r515 r486 into r516; + shr r514 64u8 into r517; + ternary r490 r517 0u128 into r518; + add r493 r518 into r519; + shl r516 64u8 into r520; + add r520 r510 into r521; + div r521 r268 into r522; + gt r522 18446744073709551615u128 into r523; + ternary r523 18446744073709551615u128 r522 into r524; + mul r524 r268 into r525; + sub r521 r525 into r526; + lte r526 18446744073709551615u128 into r527; + mul r524 r267 into r528; + and r526 18446744073709551615u128 into r529; + shl r529 64u8 into r530; + add r530 r504 into r531; + gt r528 r531 into r532; + and r527 r532 into r533; + sub.w r524 1u128 into r534; + ternary r533 r534 r524 into r535; + add r526 r268 into r536; + ternary r533 r536 r526 into r537; + lte r537 18446744073709551615u128 into r538; + and r533 r538 into r539; + mul r535 r267 into r540; + and r537 18446744073709551615u128 into r541; + shl r541 64u8 into r542; + add r542 r504 into r543; + gt r540 r543 into r544; + and r539 r544 into r545; + sub.w r535 1u128 into r546; + ternary r545 r546 r535 into r547; + mul r547 r265 into r548; + and r548 18446744073709551615u128 into r549; + lt r319 r549 into r550; + add r319 18446744073709551616u128 into r551; + sub r551 r549 into r552; + and r552 18446744073709551615u128 into r553; + shr r548 64u8 into r554; + ternary r550 1u128 0u128 into r555; + add r554 r555 into r556; + mul r547 r266 into r557; + add r557 r556 into r558; + and r558 18446744073709551615u128 into r559; + lt r498 r559 into r560; + add r498 18446744073709551616u128 into r561; + sub r561 r559 into r562; + and r562 18446744073709551615u128 into r563; + shr r558 64u8 into r564; + ternary r560 1u128 0u128 into r565; + add r564 r565 into r566; + mul r547 r267 into r567; + add r567 r566 into r568; + and r568 18446744073709551615u128 into r569; + lt r504 r569 into r570; + add r504 18446744073709551616u128 into r571; + sub r571 r569 into r572; + and r572 18446744073709551615u128 into r573; + shr r568 64u8 into r574; + ternary r570 1u128 0u128 into r575; + add r574 r575 into r576; + mul r547 r268 into r577; + add r577 r576 into r578; + and r578 18446744073709551615u128 into r579; + lt r510 r579 into r580; + add r510 18446744073709551616u128 into r581; + sub r581 r579 into r582; + and r582 18446744073709551615u128 into r583; + shr r578 64u8 into r584; + ternary r580 1u128 0u128 into r585; + add r584 r585 into r586; + lt r516 r586 into r587; + add r516 18446744073709551616u128 into r588; + sub r588 r586 into r589; + and r589 18446744073709551615u128 into r590; + sub.w r547 1u128 into r591; + ternary r587 r591 r547 into r592; + add r553 r265 into r593; + and r593 18446744073709551615u128 into r594; + ternary r587 r594 r553 into r595; + shr r593 64u8 into r596; + ternary r587 r596 0u128 into r597; + add r563 r266 into r598; + add r598 r597 into r599; + and r599 18446744073709551615u128 into r600; + ternary r587 r600 r563 into r601; + shr r599 64u8 into r602; + ternary r587 r602 0u128 into r603; + add r573 r267 into r604; + add r604 r603 into r605; + and r605 18446744073709551615u128 into r606; + ternary r587 r606 r573 into r607; + shr r605 64u8 into r608; + ternary r587 r608 0u128 into r609; + add r583 r268 into r610; + add r610 r609 into r611; + and r611 18446744073709551615u128 into r612; + ternary r587 r612 r583 into r613; + shr r611 64u8 into r614; + ternary r587 r614 0u128 into r615; + add r590 r615 into r616; + shl r613 64u8 into r617; + add r617 r607 into r618; + div r618 r268 into r619; + gt r619 18446744073709551615u128 into r620; + ternary r620 18446744073709551615u128 r619 into r621; + mul r621 r268 into r622; + sub r618 r622 into r623; + lte r623 18446744073709551615u128 into r624; + mul r621 r267 into r625; + and r623 18446744073709551615u128 into r626; + shl r626 64u8 into r627; + add r627 r601 into r628; + gt r625 r628 into r629; + and r624 r629 into r630; + sub.w r621 1u128 into r631; + ternary r630 r631 r621 into r632; + add r623 r268 into r633; + ternary r630 r633 r623 into r634; + lte r634 18446744073709551615u128 into r635; + and r630 r635 into r636; + mul r632 r267 into r637; + and r634 18446744073709551615u128 into r638; + shl r638 64u8 into r639; + add r639 r601 into r640; + gt r637 r640 into r641; + and r636 r641 into r642; + sub.w r632 1u128 into r643; + ternary r642 r643 r632 into r644; + mul r644 r265 into r645; + and r645 18446744073709551615u128 into r646; + lt r318 r646 into r647; + add r318 18446744073709551616u128 into r648; + sub r648 r646 into r649; + and r649 18446744073709551615u128 into r650; + shr r645 64u8 into r651; + ternary r647 1u128 0u128 into r652; + add r651 r652 into r653; + mul r644 r266 into r654; + add r654 r653 into r655; + and r655 18446744073709551615u128 into r656; + lt r595 r656 into r657; + add r595 18446744073709551616u128 into r658; + sub r658 r656 into r659; + and r659 18446744073709551615u128 into r660; + shr r655 64u8 into r661; + ternary r657 1u128 0u128 into r662; + add r661 r662 into r663; + mul r644 r267 into r664; + add r664 r663 into r665; + and r665 18446744073709551615u128 into r666; + lt r601 r666 into r667; + add r601 18446744073709551616u128 into r668; + sub r668 r666 into r669; + and r669 18446744073709551615u128 into r670; + shr r665 64u8 into r671; + ternary r667 1u128 0u128 into r672; + add r671 r672 into r673; + mul r644 r268 into r674; + add r674 r673 into r675; + and r675 18446744073709551615u128 into r676; + lt r607 r676 into r677; + add r607 18446744073709551616u128 into r678; + sub r678 r676 into r679; + and r679 18446744073709551615u128 into r680; + shr r675 64u8 into r681; + ternary r677 1u128 0u128 into r682; + add r681 r682 into r683; + lt r613 r683 into r684; + add r613 18446744073709551616u128 into r685; + sub r685 r683 into r686; + and r686 18446744073709551615u128 into r687; + sub.w r644 1u128 into r688; + ternary r684 r688 r644 into r689; + add r650 r265 into r690; + and r690 18446744073709551615u128 into r691; + ternary r684 r691 r650 into r692; + shr r690 64u8 into r693; + ternary r684 r693 0u128 into r694; + add r660 r266 into r695; + add r695 r694 into r696; + and r696 18446744073709551615u128 into r697; + ternary r684 r697 r660 into r698; + shr r696 64u8 into r699; + ternary r684 r699 0u128 into r700; + add r670 r267 into r701; + add r701 r700 into r702; + and r702 18446744073709551615u128 into r703; + ternary r684 r703 r670 into r704; + shr r702 64u8 into r705; + ternary r684 r705 0u128 into r706; + add r680 r268 into r707; + add r707 r706 into r708; + and r708 18446744073709551615u128 into r709; + ternary r684 r709 r680 into r710; + shr r708 64u8 into r711; + ternary r684 r711 0u128 into r712; + add r687 r712 into r713; + shl r398 64u8 into r714; + add r714 r495 into r715; + shl r592 64u8 into r716; + add r716 r689 into r717; + cast r715 r717 into r718 as U256__8JquwLopp8; + shl r710 64u8 into r719; + add r719 r704 into r720; + shl r698 64u8 into r721; + add r721 r692 into r722; + cast r251 into r723 as u8; + is.eq r723 0u8 into r724; + sub 128u8 r723 into r725; + shl.w r720 r725 into r726; + ternary r724 0u128 r726 into r727; + shr r722 r723 into r728; + or r728 r727 into r729; + shr r720 r723 into r730; + ternary r261 0u128 r730 into r731; + ternary r261 r730 r729 into r732; + cast r731 r732 into r733 as U256__8JquwLopp8; + is.eq r733.hi 0u128 into r734; + is.eq r733.lo 0u128 into r735; + and r734 r735 into r736; + not r736 into r737; + is.eq r718.hi 340282366920938463463374607431768211455u128 into r738; + is.eq r718.lo 340282366920938463463374607431768211455u128 into r739; + and r738 r739 into r740; + and r737 r740 into r741; + not r741 into r742; + assert.eq r742 true; + add.w r718.lo 1u128 into r743; + lt r743 r718.lo into r744; + ternary r744 1u128 0u128 into r745; + add.w r718.hi r745 into r746; + cast r746 r743 into r747 as U256__8JquwLopp8; + ternary r737 r747.hi r718.hi into r748; + ternary r737 r747.lo r718.lo into r749; + cast r748 r749 into r750 as U256__8JquwLopp8; + and r750.lo 18446744073709551615u128 into r751; + shr r750.lo 64u8 into r752; + and r751 18446744073709551615u128 into r753; + shr r751 64u8 into r754; + and r752 18446744073709551615u128 into r755; + add r754 r755 into r756; + and r756 18446744073709551615u128 into r757; + shr r756 64u8 into r758; + shr r752 64u8 into r759; + add r759 r758 into r760; + and r760 18446744073709551615u128 into r761; + shr r760 64u8 into r762; + shl r762 64u8 into r763; + add r763 r761 into r764; + shl r757 64u8 into r765; + add r765 r753 into r766; + shr r750.lo 64u8 into r767; + and r750.hi 18446744073709551615u128 into r768; + shr r750.hi 64u8 into r769; + and r768 18446744073709551615u128 into r770; + shr r768 64u8 into r771; + and r769 18446744073709551615u128 into r772; + add r771 r772 into r773; + and r773 18446744073709551615u128 into r774; + shr r773 64u8 into r775; + shr r769 64u8 into r776; + add r776 r775 into r777; + and r777 18446744073709551615u128 into r778; + shr r777 64u8 into r779; + shl r779 64u8 into r780; + add r780 r778 into r781; + shl r774 64u8 into r782; + add r782 r770 into r783; + shr r750.hi 64u8 into r784; + lt r764 r764 into r785; + ternary r785 1u128 0u128 into r786; + add.w r764 r783 into r787; + lt r787 r764 into r788; + ternary r788 1u128 0u128 into r789; + add r786 r789 into r790; + lt r781 0u128 into r791; + ternary r791 1u128 0u128 into r792; + lt r781 r781 into r793; + ternary r793 1u128 0u128 into r794; + add.w r781 r790 into r795; + lt r795 r781 into r796; + ternary r796 1u128 0u128 into r797; + add r792 r794 into r798; + add r798 r797 into r799; + cast r799 r795 into r800 as U256__8JquwLopp8; + cast r787 r766 into r801 as U256__8JquwLopp8; + lt r800.hi r118.hi into r802; + gt r800.hi r118.hi into r803; + lt r800.lo r118.lo into r804; + ternary r803 false r804 into r805; + ternary r802 true r805 into r806; + assert.eq r806 true; + gt r118.hi 0u128 into r807; + ternary r807 r118.hi r118.lo into r808; + ternary r807 128u32 0u32 into r809; + gte r808 18446744073709551616u128 into r810; + shr r808 64u8 into r811; + ternary r810 r811 r808 into r812; + ternary r810 64u32 0u32 into r813; + gte r812 4294967296u128 into r814; + shr r812 32u8 into r815; + add r813 32u32 into r816; + ternary r814 r815 r812 into r817; + ternary r814 r816 r813 into r818; + gte r817 65536u128 into r819; + shr r817 16u8 into r820; + add r818 16u32 into r821; + ternary r819 r820 r817 into r822; + ternary r819 r821 r818 into r823; + gte r822 256u128 into r824; + shr r822 8u8 into r825; + add r823 8u32 into r826; + ternary r824 r825 r822 into r827; + ternary r824 r826 r823 into r828; + gte r827 16u128 into r829; + shr r827 4u8 into r830; + add r828 4u32 into r831; + ternary r829 r830 r827 into r832; + ternary r829 r831 r828 into r833; + gte r832 4u128 into r834; + shr r832 2u8 into r835; + add r833 2u32 into r836; + ternary r834 r835 r832 into r837; + ternary r834 r836 r833 into r838; + gte r837 2u128 into r839; + add r838 1u32 into r840; + ternary r839 r840 r838 into r841; + add r809 r841 into r842; + sub 255u32 r842 into r843; + cast r843 into r844 as u16; + and r844 127u16 into r845; + cast r845 into r846 as u8; + is.eq r846 0u8 into r847; + sub 128u8 r846 into r848; + shr.w r118.lo r848 into r849; + ternary r847 0u128 r849 into r850; + shl.w r118.hi r846 into r851; + or r851 r850 into r852; + shl.w r118.lo r846 into r853; + shl.w r118.lo r846 into r854; + gte r844 128u16 into r855; + ternary r855 r854 r852 into r856; + ternary r855 0u128 r853 into r857; + cast r856 r857 into r858 as U256__8JquwLopp8; + and r858.lo 18446744073709551615u128 into r859; + shr r858.lo 64u8 into r860; + and r858.hi 18446744073709551615u128 into r861; + shr r858.hi 64u8 into r862; + cast r845 into r863 as u8; + is.eq r863 0u8 into r864; + sub 128u8 r863 into r865; + shr.w r801.lo r865 into r866; + ternary r864 0u128 r866 into r867; + shl.w r801.hi r863 into r868; + or r868 r867 into r869; + shl.w r801.lo r863 into r870; + shl.w r801.lo r863 into r871; + ternary r855 r871 r869 into r872; + ternary r855 0u128 r870 into r873; + cast r872 r873 into r874 as U256__8JquwLopp8; + is.eq r844 0u16 into r875; + sub 256u16 r844 into r876; + and r876 127u16 into r877; + cast r877 into r878 as u8; + is.eq r878 0u8 into r879; + sub 128u8 r878 into r880; + shl.w r801.hi r880 into r881; + ternary r879 0u128 r881 into r882; + shr r801.lo r878 into r883; + or r883 r882 into r884; + shr r801.hi r878 into r885; + shr r801.hi r878 into r886; + gte r876 128u16 into r887; + ternary r887 0u128 r885 into r888; + ternary r887 r886 r884 into r889; + cast r888 r889 into r890 as U256__8JquwLopp8; + ternary r875 0u128 r890.hi into r891; + ternary r875 0u128 r890.lo into r892; + cast r891 r892 into r893 as U256__8JquwLopp8; + cast r845 into r894 as u8; + is.eq r894 0u8 into r895; + sub 128u8 r894 into r896; + shr.w r800.lo r896 into r897; + ternary r895 0u128 r897 into r898; + shl.w r800.hi r894 into r899; + or r899 r898 into r900; + shl.w r800.lo r894 into r901; + shl.w r800.lo r894 into r902; + ternary r855 r902 r900 into r903; + ternary r855 0u128 r901 into r904; + cast r903 r904 into r905 as U256__8JquwLopp8; + add.w r905.lo r893.lo into r906; + lt r906 r905.lo into r907; + ternary r907 1u128 0u128 into r908; + add.w r905.hi r893.hi into r909; + add.w r909 r908 into r910; + cast r910 r906 into r911 as U256__8JquwLopp8; + and r874.lo 18446744073709551615u128 into r912; + shr r874.lo 64u8 into r913; + and r874.hi 18446744073709551615u128 into r914; + shr r874.hi 64u8 into r915; + and r911.lo 18446744073709551615u128 into r916; + shr r911.lo 64u8 into r917; + and r911.hi 18446744073709551615u128 into r918; + shr r911.hi 64u8 into r919; + shl r919 64u8 into r920; + add r920 r918 into r921; + div r921 r862 into r922; + gt r922 18446744073709551615u128 into r923; + ternary r923 18446744073709551615u128 r922 into r924; + mul r924 r862 into r925; + sub r921 r925 into r926; + lte r926 18446744073709551615u128 into r927; + mul r924 r861 into r928; + and r926 18446744073709551615u128 into r929; + shl r929 64u8 into r930; + add r930 r917 into r931; + gt r928 r931 into r932; + and r927 r932 into r933; + sub.w r924 1u128 into r934; + ternary r933 r934 r924 into r935; + add r926 r862 into r936; + ternary r933 r936 r926 into r937; + lte r937 18446744073709551615u128 into r938; + and r933 r938 into r939; + mul r935 r861 into r940; + and r937 18446744073709551615u128 into r941; + shl r941 64u8 into r942; + add r942 r917 into r943; + gt r940 r943 into r944; + and r939 r944 into r945; + sub.w r935 1u128 into r946; + ternary r945 r946 r935 into r947; + mul r947 r859 into r948; + and r948 18446744073709551615u128 into r949; + lt r915 r949 into r950; + add r915 18446744073709551616u128 into r951; + sub r951 r949 into r952; + and r952 18446744073709551615u128 into r953; + shr r948 64u8 into r954; + ternary r950 1u128 0u128 into r955; + add r954 r955 into r956; + mul r947 r860 into r957; + add r957 r956 into r958; + and r958 18446744073709551615u128 into r959; + lt r916 r959 into r960; + add r916 18446744073709551616u128 into r961; + sub r961 r959 into r962; + and r962 18446744073709551615u128 into r963; + shr r958 64u8 into r964; + ternary r960 1u128 0u128 into r965; + add r964 r965 into r966; + mul r947 r861 into r967; + add r967 r966 into r968; + and r968 18446744073709551615u128 into r969; + lt r917 r969 into r970; + add r917 18446744073709551616u128 into r971; + sub r971 r969 into r972; + and r972 18446744073709551615u128 into r973; + shr r968 64u8 into r974; + ternary r970 1u128 0u128 into r975; + add r974 r975 into r976; + mul r947 r862 into r977; + add r977 r976 into r978; + and r978 18446744073709551615u128 into r979; + lt r918 r979 into r980; + add r918 18446744073709551616u128 into r981; + sub r981 r979 into r982; + and r982 18446744073709551615u128 into r983; + shr r978 64u8 into r984; + ternary r980 1u128 0u128 into r985; + add r984 r985 into r986; + lt r919 r986 into r987; + add r919 18446744073709551616u128 into r988; + sub r988 r986 into r989; + and r989 18446744073709551615u128 into r990; + sub.w r947 1u128 into r991; + ternary r987 r991 r947 into r992; + add r953 r859 into r993; + and r993 18446744073709551615u128 into r994; + ternary r987 r994 r953 into r995; + shr r993 64u8 into r996; + ternary r987 r996 0u128 into r997; + add r963 r860 into r998; + add r998 r997 into r999; + and r999 18446744073709551615u128 into r1000; + ternary r987 r1000 r963 into r1001; + shr r999 64u8 into r1002; + ternary r987 r1002 0u128 into r1003; + add r973 r861 into r1004; + add r1004 r1003 into r1005; + and r1005 18446744073709551615u128 into r1006; + ternary r987 r1006 r973 into r1007; + shr r1005 64u8 into r1008; + ternary r987 r1008 0u128 into r1009; + add r983 r862 into r1010; + add r1010 r1009 into r1011; + and r1011 18446744073709551615u128 into r1012; + ternary r987 r1012 r983 into r1013; + shr r1011 64u8 into r1014; + ternary r987 r1014 0u128 into r1015; + add r990 r1015 into r1016; + shl r1013 64u8 into r1017; + add r1017 r1007 into r1018; + div r1018 r862 into r1019; + gt r1019 18446744073709551615u128 into r1020; + ternary r1020 18446744073709551615u128 r1019 into r1021; + mul r1021 r862 into r1022; + sub r1018 r1022 into r1023; + lte r1023 18446744073709551615u128 into r1024; + mul r1021 r861 into r1025; + and r1023 18446744073709551615u128 into r1026; + shl r1026 64u8 into r1027; + add r1027 r1001 into r1028; + gt r1025 r1028 into r1029; + and r1024 r1029 into r1030; + sub.w r1021 1u128 into r1031; + ternary r1030 r1031 r1021 into r1032; + add r1023 r862 into r1033; + ternary r1030 r1033 r1023 into r1034; + lte r1034 18446744073709551615u128 into r1035; + and r1030 r1035 into r1036; + mul r1032 r861 into r1037; + and r1034 18446744073709551615u128 into r1038; + shl r1038 64u8 into r1039; + add r1039 r1001 into r1040; + gt r1037 r1040 into r1041; + and r1036 r1041 into r1042; + sub.w r1032 1u128 into r1043; + ternary r1042 r1043 r1032 into r1044; + mul r1044 r859 into r1045; + and r1045 18446744073709551615u128 into r1046; + lt r914 r1046 into r1047; + add r914 18446744073709551616u128 into r1048; + sub r1048 r1046 into r1049; + and r1049 18446744073709551615u128 into r1050; + shr r1045 64u8 into r1051; + ternary r1047 1u128 0u128 into r1052; + add r1051 r1052 into r1053; + mul r1044 r860 into r1054; + add r1054 r1053 into r1055; + and r1055 18446744073709551615u128 into r1056; + lt r995 r1056 into r1057; + add r995 18446744073709551616u128 into r1058; + sub r1058 r1056 into r1059; + and r1059 18446744073709551615u128 into r1060; + shr r1055 64u8 into r1061; + ternary r1057 1u128 0u128 into r1062; + add r1061 r1062 into r1063; + mul r1044 r861 into r1064; + add r1064 r1063 into r1065; + and r1065 18446744073709551615u128 into r1066; + lt r1001 r1066 into r1067; + add r1001 18446744073709551616u128 into r1068; + sub r1068 r1066 into r1069; + and r1069 18446744073709551615u128 into r1070; + shr r1065 64u8 into r1071; + ternary r1067 1u128 0u128 into r1072; + add r1071 r1072 into r1073; + mul r1044 r862 into r1074; + add r1074 r1073 into r1075; + and r1075 18446744073709551615u128 into r1076; + lt r1007 r1076 into r1077; + add r1007 18446744073709551616u128 into r1078; + sub r1078 r1076 into r1079; + and r1079 18446744073709551615u128 into r1080; + shr r1075 64u8 into r1081; + ternary r1077 1u128 0u128 into r1082; + add r1081 r1082 into r1083; + lt r1013 r1083 into r1084; + add r1013 18446744073709551616u128 into r1085; + sub r1085 r1083 into r1086; + and r1086 18446744073709551615u128 into r1087; + sub.w r1044 1u128 into r1088; + ternary r1084 r1088 r1044 into r1089; + add r1050 r859 into r1090; + and r1090 18446744073709551615u128 into r1091; + ternary r1084 r1091 r1050 into r1092; + shr r1090 64u8 into r1093; + ternary r1084 r1093 0u128 into r1094; + add r1060 r860 into r1095; + add r1095 r1094 into r1096; + and r1096 18446744073709551615u128 into r1097; + ternary r1084 r1097 r1060 into r1098; + shr r1096 64u8 into r1099; + ternary r1084 r1099 0u128 into r1100; + add r1070 r861 into r1101; + add r1101 r1100 into r1102; + and r1102 18446744073709551615u128 into r1103; + ternary r1084 r1103 r1070 into r1104; + shr r1102 64u8 into r1105; + ternary r1084 r1105 0u128 into r1106; + add r1080 r862 into r1107; + add r1107 r1106 into r1108; + and r1108 18446744073709551615u128 into r1109; + ternary r1084 r1109 r1080 into r1110; + shr r1108 64u8 into r1111; + ternary r1084 r1111 0u128 into r1112; + add r1087 r1112 into r1113; + shl r1110 64u8 into r1114; + add r1114 r1104 into r1115; + div r1115 r862 into r1116; + gt r1116 18446744073709551615u128 into r1117; + ternary r1117 18446744073709551615u128 r1116 into r1118; + mul r1118 r862 into r1119; + sub r1115 r1119 into r1120; + lte r1120 18446744073709551615u128 into r1121; + mul r1118 r861 into r1122; + and r1120 18446744073709551615u128 into r1123; + shl r1123 64u8 into r1124; + add r1124 r1098 into r1125; + gt r1122 r1125 into r1126; + and r1121 r1126 into r1127; + sub.w r1118 1u128 into r1128; + ternary r1127 r1128 r1118 into r1129; + add r1120 r862 into r1130; + ternary r1127 r1130 r1120 into r1131; + lte r1131 18446744073709551615u128 into r1132; + and r1127 r1132 into r1133; + mul r1129 r861 into r1134; + and r1131 18446744073709551615u128 into r1135; + shl r1135 64u8 into r1136; + add r1136 r1098 into r1137; + gt r1134 r1137 into r1138; + and r1133 r1138 into r1139; + sub.w r1129 1u128 into r1140; + ternary r1139 r1140 r1129 into r1141; + mul r1141 r859 into r1142; + and r1142 18446744073709551615u128 into r1143; + lt r913 r1143 into r1144; + add r913 18446744073709551616u128 into r1145; + sub r1145 r1143 into r1146; + and r1146 18446744073709551615u128 into r1147; + shr r1142 64u8 into r1148; + ternary r1144 1u128 0u128 into r1149; + add r1148 r1149 into r1150; + mul r1141 r860 into r1151; + add r1151 r1150 into r1152; + and r1152 18446744073709551615u128 into r1153; + lt r1092 r1153 into r1154; + add r1092 18446744073709551616u128 into r1155; + sub r1155 r1153 into r1156; + and r1156 18446744073709551615u128 into r1157; + shr r1152 64u8 into r1158; + ternary r1154 1u128 0u128 into r1159; + add r1158 r1159 into r1160; + mul r1141 r861 into r1161; + add r1161 r1160 into r1162; + and r1162 18446744073709551615u128 into r1163; + lt r1098 r1163 into r1164; + add r1098 18446744073709551616u128 into r1165; + sub r1165 r1163 into r1166; + and r1166 18446744073709551615u128 into r1167; + shr r1162 64u8 into r1168; + ternary r1164 1u128 0u128 into r1169; + add r1168 r1169 into r1170; + mul r1141 r862 into r1171; + add r1171 r1170 into r1172; + and r1172 18446744073709551615u128 into r1173; + lt r1104 r1173 into r1174; + add r1104 18446744073709551616u128 into r1175; + sub r1175 r1173 into r1176; + and r1176 18446744073709551615u128 into r1177; + shr r1172 64u8 into r1178; + ternary r1174 1u128 0u128 into r1179; + add r1178 r1179 into r1180; + lt r1110 r1180 into r1181; + add r1110 18446744073709551616u128 into r1182; + sub r1182 r1180 into r1183; + and r1183 18446744073709551615u128 into r1184; + sub.w r1141 1u128 into r1185; + ternary r1181 r1185 r1141 into r1186; + add r1147 r859 into r1187; + and r1187 18446744073709551615u128 into r1188; + ternary r1181 r1188 r1147 into r1189; + shr r1187 64u8 into r1190; + ternary r1181 r1190 0u128 into r1191; + add r1157 r860 into r1192; + add r1192 r1191 into r1193; + and r1193 18446744073709551615u128 into r1194; + ternary r1181 r1194 r1157 into r1195; + shr r1193 64u8 into r1196; + ternary r1181 r1196 0u128 into r1197; + add r1167 r861 into r1198; + add r1198 r1197 into r1199; + and r1199 18446744073709551615u128 into r1200; + ternary r1181 r1200 r1167 into r1201; + shr r1199 64u8 into r1202; + ternary r1181 r1202 0u128 into r1203; + add r1177 r862 into r1204; + add r1204 r1203 into r1205; + and r1205 18446744073709551615u128 into r1206; + ternary r1181 r1206 r1177 into r1207; + shr r1205 64u8 into r1208; + ternary r1181 r1208 0u128 into r1209; + add r1184 r1209 into r1210; + shl r1207 64u8 into r1211; + add r1211 r1201 into r1212; + div r1212 r862 into r1213; + gt r1213 18446744073709551615u128 into r1214; + ternary r1214 18446744073709551615u128 r1213 into r1215; + mul r1215 r862 into r1216; + sub r1212 r1216 into r1217; + lte r1217 18446744073709551615u128 into r1218; + mul r1215 r861 into r1219; + and r1217 18446744073709551615u128 into r1220; + shl r1220 64u8 into r1221; + add r1221 r1195 into r1222; + gt r1219 r1222 into r1223; + and r1218 r1223 into r1224; + sub.w r1215 1u128 into r1225; + ternary r1224 r1225 r1215 into r1226; + add r1217 r862 into r1227; + ternary r1224 r1227 r1217 into r1228; + lte r1228 18446744073709551615u128 into r1229; + and r1224 r1229 into r1230; + mul r1226 r861 into r1231; + and r1228 18446744073709551615u128 into r1232; + shl r1232 64u8 into r1233; + add r1233 r1195 into r1234; + gt r1231 r1234 into r1235; + and r1230 r1235 into r1236; + sub.w r1226 1u128 into r1237; + ternary r1236 r1237 r1226 into r1238; + mul r1238 r859 into r1239; + and r1239 18446744073709551615u128 into r1240; + lt r912 r1240 into r1241; + add r912 18446744073709551616u128 into r1242; + sub r1242 r1240 into r1243; + and r1243 18446744073709551615u128 into r1244; + shr r1239 64u8 into r1245; + ternary r1241 1u128 0u128 into r1246; + add r1245 r1246 into r1247; + mul r1238 r860 into r1248; + add r1248 r1247 into r1249; + and r1249 18446744073709551615u128 into r1250; + lt r1189 r1250 into r1251; + add r1189 18446744073709551616u128 into r1252; + sub r1252 r1250 into r1253; + and r1253 18446744073709551615u128 into r1254; + shr r1249 64u8 into r1255; + ternary r1251 1u128 0u128 into r1256; + add r1255 r1256 into r1257; + mul r1238 r861 into r1258; + add r1258 r1257 into r1259; + and r1259 18446744073709551615u128 into r1260; + lt r1195 r1260 into r1261; + add r1195 18446744073709551616u128 into r1262; + sub r1262 r1260 into r1263; + and r1263 18446744073709551615u128 into r1264; + shr r1259 64u8 into r1265; + ternary r1261 1u128 0u128 into r1266; + add r1265 r1266 into r1267; + mul r1238 r862 into r1268; + add r1268 r1267 into r1269; + and r1269 18446744073709551615u128 into r1270; + lt r1201 r1270 into r1271; + add r1201 18446744073709551616u128 into r1272; + sub r1272 r1270 into r1273; + and r1273 18446744073709551615u128 into r1274; + shr r1269 64u8 into r1275; + ternary r1271 1u128 0u128 into r1276; + add r1275 r1276 into r1277; + lt r1207 r1277 into r1278; + add r1207 18446744073709551616u128 into r1279; + sub r1279 r1277 into r1280; + and r1280 18446744073709551615u128 into r1281; + sub.w r1238 1u128 into r1282; + ternary r1278 r1282 r1238 into r1283; + add r1244 r859 into r1284; + and r1284 18446744073709551615u128 into r1285; + ternary r1278 r1285 r1244 into r1286; + shr r1284 64u8 into r1287; + ternary r1278 r1287 0u128 into r1288; + add r1254 r860 into r1289; + add r1289 r1288 into r1290; + and r1290 18446744073709551615u128 into r1291; + ternary r1278 r1291 r1254 into r1292; + shr r1290 64u8 into r1293; + ternary r1278 r1293 0u128 into r1294; + add r1264 r861 into r1295; + add r1295 r1294 into r1296; + and r1296 18446744073709551615u128 into r1297; + ternary r1278 r1297 r1264 into r1298; + shr r1296 64u8 into r1299; + ternary r1278 r1299 0u128 into r1300; + add r1274 r862 into r1301; + add r1301 r1300 into r1302; + and r1302 18446744073709551615u128 into r1303; + ternary r1278 r1303 r1274 into r1304; + shr r1302 64u8 into r1305; + ternary r1278 r1305 0u128 into r1306; + add r1281 r1306 into r1307; + shl r992 64u8 into r1308; + add r1308 r1089 into r1309; + shl r1186 64u8 into r1310; + add r1310 r1283 into r1311; + cast r1309 r1311 into r1312 as U256__8JquwLopp8; + shl r1304 64u8 into r1313; + add r1313 r1298 into r1314; + shl r1292 64u8 into r1315; + add r1315 r1286 into r1316; + cast r845 into r1317 as u8; + is.eq r1317 0u8 into r1318; + sub 128u8 r1317 into r1319; + shl.w r1314 r1319 into r1320; + ternary r1318 0u128 r1320 into r1321; + shr r1316 r1317 into r1322; + or r1322 r1321 into r1323; + shr r1314 r1317 into r1324; + ternary r855 0u128 r1324 into r1325; + ternary r855 r1324 r1323 into r1326; + cast r1325 r1326 into r1327 as U256__8JquwLopp8; + is.eq r1327.hi 0u128 into r1328; + is.eq r1327.lo 0u128 into r1329; + and r1328 r1329 into r1330; + not r1330 into r1331; + is.eq r1312.hi 340282366920938463463374607431768211455u128 into r1332; + is.eq r1312.lo 340282366920938463463374607431768211455u128 into r1333; + and r1332 r1333 into r1334; + and r1331 r1334 into r1335; + not r1335 into r1336; + assert.eq r1336 true; + add.w r1312.lo 1u128 into r1337; + lt r1337 r1312.lo into r1338; + ternary r1338 1u128 0u128 into r1339; + add.w r1312.hi r1339 into r1340; + cast r1340 r1337 into r1341 as U256__8JquwLopp8; + ternary r1331 r1341.hi r1312.hi into r1342; + ternary r1331 r1341.lo r1312.lo into r1343; + cast r1342 r1343 into r1344 as U256__8JquwLopp8; + is.neq r1344.hi 0u128 into r1345; + lt r0.hi r29.hi into r1346; + gt r0.hi r29.hi into r1347; + lt r0.lo r29.lo into r1348; + ternary r1347 false r1348 into r1349; + ternary r1346 true r1349 into r1350; + ternary r1350 r0.hi r29.hi into r1351; + ternary r1350 r0.lo r29.lo into r1352; + cast r1351 r1352 into r1353 as U256__8JquwLopp8; + lt r0.hi r29.hi into r1354; + gt r0.hi r29.hi into r1355; + lt r0.lo r29.lo into r1356; + ternary r1355 false r1356 into r1357; + ternary r1354 true r1357 into r1358; + ternary r1358 r29.hi r0.hi into r1359; + ternary r1358 r29.lo r0.lo into r1360; + cast r1359 r1360 into r1361 as U256__8JquwLopp8; + lt r1361.lo r1353.lo into r1362; + ternary r1362 1u128 0u128 into r1363; + sub.w r1361.lo r1353.lo into r1364; + sub.w r1361.hi r1353.hi into r1365; + sub.w r1365 r1363 into r1366; + cast r1366 r1364 into r1367 as U256__8JquwLopp8; + cast 0u128 r1 into r1368 as U256__8JquwLopp8; + and r1368.lo 18446744073709551615u128 into r1369; + shr r1368.lo 64u8 into r1370; + and r1367.lo 18446744073709551615u128 into r1371; + shr r1367.lo 64u8 into r1372; + mul r1369 r1371 into r1373; + mul r1369 r1372 into r1374; + mul r1370 r1371 into r1375; + mul r1370 r1372 into r1376; + and r1373 18446744073709551615u128 into r1377; + shr r1373 64u8 into r1378; + and r1374 18446744073709551615u128 into r1379; + add r1378 r1379 into r1380; + and r1375 18446744073709551615u128 into r1381; + add r1380 r1381 into r1382; + and r1382 18446744073709551615u128 into r1383; + shr r1382 64u8 into r1384; + shr r1374 64u8 into r1385; + shr r1375 64u8 into r1386; + add r1385 r1386 into r1387; + and r1376 18446744073709551615u128 into r1388; + add r1387 r1388 into r1389; + add r1389 r1384 into r1390; + and r1390 18446744073709551615u128 into r1391; + shr r1390 64u8 into r1392; + shr r1376 64u8 into r1393; + add r1393 r1392 into r1394; + shl r1394 64u8 into r1395; + add r1395 r1391 into r1396; + shl r1383 64u8 into r1397; + add r1397 r1377 into r1398; + and r1368.lo 18446744073709551615u128 into r1399; + shr r1368.lo 64u8 into r1400; + and r1367.hi 18446744073709551615u128 into r1401; + shr r1367.hi 64u8 into r1402; + mul r1399 r1401 into r1403; + mul r1399 r1402 into r1404; + mul r1400 r1401 into r1405; + mul r1400 r1402 into r1406; + and r1403 18446744073709551615u128 into r1407; + shr r1403 64u8 into r1408; + and r1404 18446744073709551615u128 into r1409; + add r1408 r1409 into r1410; + and r1405 18446744073709551615u128 into r1411; + add r1410 r1411 into r1412; + and r1412 18446744073709551615u128 into r1413; + shr r1412 64u8 into r1414; + shr r1404 64u8 into r1415; + shr r1405 64u8 into r1416; + add r1415 r1416 into r1417; + and r1406 18446744073709551615u128 into r1418; + add r1417 r1418 into r1419; + add r1419 r1414 into r1420; + and r1420 18446744073709551615u128 into r1421; + shr r1420 64u8 into r1422; + shr r1406 64u8 into r1423; + add r1423 r1422 into r1424; + shl r1424 64u8 into r1425; + add r1425 r1421 into r1426; + shl r1413 64u8 into r1427; + add r1427 r1407 into r1428; + and r1368.hi 18446744073709551615u128 into r1429; + shr r1368.hi 64u8 into r1430; + and r1367.lo 18446744073709551615u128 into r1431; + shr r1367.lo 64u8 into r1432; + mul r1429 r1431 into r1433; + mul r1429 r1432 into r1434; + mul r1430 r1431 into r1435; + mul r1430 r1432 into r1436; + and r1433 18446744073709551615u128 into r1437; + shr r1433 64u8 into r1438; + and r1434 18446744073709551615u128 into r1439; + add r1438 r1439 into r1440; + and r1435 18446744073709551615u128 into r1441; + add r1440 r1441 into r1442; + and r1442 18446744073709551615u128 into r1443; + shr r1442 64u8 into r1444; + shr r1434 64u8 into r1445; + shr r1435 64u8 into r1446; + add r1445 r1446 into r1447; + and r1436 18446744073709551615u128 into r1448; + add r1447 r1448 into r1449; + add r1449 r1444 into r1450; + and r1450 18446744073709551615u128 into r1451; + shr r1450 64u8 into r1452; + shr r1436 64u8 into r1453; + add r1453 r1452 into r1454; + shl r1454 64u8 into r1455; + add r1455 r1451 into r1456; + shl r1443 64u8 into r1457; + add r1457 r1437 into r1458; + and r1368.hi 18446744073709551615u128 into r1459; + shr r1368.hi 64u8 into r1460; + and r1367.hi 18446744073709551615u128 into r1461; + shr r1367.hi 64u8 into r1462; + mul r1459 r1461 into r1463; + mul r1459 r1462 into r1464; + mul r1460 r1461 into r1465; + mul r1460 r1462 into r1466; + and r1463 18446744073709551615u128 into r1467; + shr r1463 64u8 into r1468; + and r1464 18446744073709551615u128 into r1469; + add r1468 r1469 into r1470; + and r1465 18446744073709551615u128 into r1471; + add r1470 r1471 into r1472; + and r1472 18446744073709551615u128 into r1473; + shr r1472 64u8 into r1474; + shr r1464 64u8 into r1475; + shr r1465 64u8 into r1476; + add r1475 r1476 into r1477; + and r1466 18446744073709551615u128 into r1478; + add r1477 r1478 into r1479; + add r1479 r1474 into r1480; + and r1480 18446744073709551615u128 into r1481; + shr r1480 64u8 into r1482; + shr r1466 64u8 into r1483; + add r1483 r1482 into r1484; + shl r1484 64u8 into r1485; + add r1485 r1481 into r1486; + shl r1473 64u8 into r1487; + add r1487 r1467 into r1488; + add.w r1396 r1428 into r1489; + lt r1489 r1396 into r1490; + ternary r1490 1u128 0u128 into r1491; + add.w r1489 r1458 into r1492; + lt r1492 r1489 into r1493; + ternary r1493 1u128 0u128 into r1494; + add r1491 r1494 into r1495; + add.w r1426 r1456 into r1496; + lt r1496 r1426 into r1497; + ternary r1497 1u128 0u128 into r1498; + add.w r1496 r1488 into r1499; + lt r1499 r1496 into r1500; + ternary r1500 1u128 0u128 into r1501; + add.w r1499 r1495 into r1502; + lt r1502 r1499 into r1503; + ternary r1503 1u128 0u128 into r1504; + add r1498 r1501 into r1505; + add r1505 r1504 into r1506; + add.w r1486 r1506 into r1507; + cast r1507 r1502 into r1508 as U256__8JquwLopp8; + cast r1492 r1398 into r1509 as U256__8JquwLopp8; + gt r1509.lo 0u128 into r1510; + is.eq r1509.hi 340282366920938463463374607431768211455u128 into r1511; + and r1510 r1511 into r1512; + is.neq r1508.hi 0u128 into r1513; + is.neq r1508.lo 0u128 into r1514; + or r1513 r1514 into r1515; + or r1515 r1512 into r1516; + gt r1509.lo 0u128 into r1517; + lt r1509.hi 340282366920938463463374607431768211455u128 into r1518; + and r1517 r1518 into r1519; + add.w r1509.hi 1u128 into r1520; + ternary r1519 r1520 r1509.hi into r1521; + ternary r10 r1344.lo r1521 into r1522; + ternary r10 r1345 r1516 into r1523; + not r1523 into r1524; + gte r109 r1522 into r1525; + and r1524 r1525 into r1526; + not r10 into r1527; + and r1527 r32 into r1528; + and r1528 r1526 into r1529; + lt r29.lo 1u128 into r1530; + ternary r1530 1u128 0u128 into r1531; + sub.w r29.lo 1u128 into r1532; + sub.w r29.hi r1531 into r1533; + cast r1533 r1532 into r1534 as U256__8JquwLopp8; + ternary r1529 r1534.hi r29.hi into r1535; + ternary r1529 r1534.lo r29.lo into r1536; + cast r1535 r1536 into r1537 as U256__8JquwLopp8; + gt r1 0u128 into r1538; + ternary r1538 r1 1u128 into r1539; + is.eq r109 0u128 into r1540; + cast 0u128 r1539 into r1541 as U256__8JquwLopp8; + shr r1541.lo 64u8 into r1542; + and r1541.lo 18446744073709551615u128 into r1543; + shr r1541.lo 64u8 into r1544; + and r1543 18446744073709551615u128 into r1545; + shr r1543 64u8 into r1546; + and r1544 18446744073709551615u128 into r1547; + add r1546 r1547 into r1548; + and r1548 18446744073709551615u128 into r1549; + shr r1548 64u8 into r1550; + shr r1544 64u8 into r1551; + add r1551 r1550 into r1552; + and r1552 18446744073709551615u128 into r1553; + shr r1552 64u8 into r1554; + shl r1554 64u8 into r1555; + add r1555 r1553 into r1556; + shl r1549 64u8 into r1557; + add r1557 r1545 into r1558; + shr r1541.hi 64u8 into r1559; + and r1541.hi 18446744073709551615u128 into r1560; + shr r1541.hi 64u8 into r1561; + and r1560 18446744073709551615u128 into r1562; + shr r1560 64u8 into r1563; + and r1561 18446744073709551615u128 into r1564; + add r1563 r1564 into r1565; + and r1565 18446744073709551615u128 into r1566; + shr r1565 64u8 into r1567; + shr r1561 64u8 into r1568; + add r1568 r1567 into r1569; + and r1569 18446744073709551615u128 into r1570; + shr r1569 64u8 into r1571; + shl r1571 64u8 into r1572; + add r1572 r1570 into r1573; + shl r1566 64u8 into r1574; + add r1574 r1562 into r1575; + lt r1558 0u128 into r1576; + ternary r1576 1u128 0u128 into r1577; + lt r1558 r1558 into r1578; + ternary r1578 1u128 0u128 into r1579; + add r1577 r1579 into r1580; + lt r1556 r1556 into r1581; + ternary r1581 1u128 0u128 into r1582; + add.w r1556 r1575 into r1583; + lt r1583 r1556 into r1584; + ternary r1584 1u128 0u128 into r1585; + add.w r1583 r1580 into r1586; + lt r1586 r1583 into r1587; + ternary r1587 1u128 0u128 into r1588; + add r1582 r1585 into r1589; + add r1589 r1588 into r1590; + add.w r1573 r1590 into r1591; + cast r1591 r1586 into r1592 as U256__8JquwLopp8; + cast r1558 0u128 into r1593 as U256__8JquwLopp8; + lt r1592.hi r0.hi into r1594; + gt r1592.hi r0.hi into r1595; + lt r1592.lo r0.lo into r1596; + ternary r1595 false r1596 into r1597; + ternary r1594 true r1597 into r1598; + assert.eq r1598 true; + gt r0.hi 0u128 into r1599; + ternary r1599 r0.hi r0.lo into r1600; + ternary r1599 128u32 0u32 into r1601; + gte r1600 18446744073709551616u128 into r1602; + shr r1600 64u8 into r1603; + ternary r1602 r1603 r1600 into r1604; + ternary r1602 64u32 0u32 into r1605; + gte r1604 4294967296u128 into r1606; + shr r1604 32u8 into r1607; + add r1605 32u32 into r1608; + ternary r1606 r1607 r1604 into r1609; + ternary r1606 r1608 r1605 into r1610; + gte r1609 65536u128 into r1611; + shr r1609 16u8 into r1612; + add r1610 16u32 into r1613; + ternary r1611 r1612 r1609 into r1614; + ternary r1611 r1613 r1610 into r1615; + gte r1614 256u128 into r1616; + shr r1614 8u8 into r1617; + add r1615 8u32 into r1618; + ternary r1616 r1617 r1614 into r1619; + ternary r1616 r1618 r1615 into r1620; + gte r1619 16u128 into r1621; + shr r1619 4u8 into r1622; + add r1620 4u32 into r1623; + ternary r1621 r1622 r1619 into r1624; + ternary r1621 r1623 r1620 into r1625; + gte r1624 4u128 into r1626; + shr r1624 2u8 into r1627; + add r1625 2u32 into r1628; + ternary r1626 r1627 r1624 into r1629; + ternary r1626 r1628 r1625 into r1630; + gte r1629 2u128 into r1631; + add r1630 1u32 into r1632; + ternary r1631 r1632 r1630 into r1633; + add r1601 r1633 into r1634; + sub 255u32 r1634 into r1635; + cast r1635 into r1636 as u16; + and r1636 127u16 into r1637; + cast r1637 into r1638 as u8; + is.eq r1638 0u8 into r1639; + sub 128u8 r1638 into r1640; + shr.w r0.lo r1640 into r1641; + ternary r1639 0u128 r1641 into r1642; + shl.w r0.hi r1638 into r1643; + or r1643 r1642 into r1644; + shl.w r0.lo r1638 into r1645; + shl.w r0.lo r1638 into r1646; + gte r1636 128u16 into r1647; + ternary r1647 r1646 r1644 into r1648; + ternary r1647 0u128 r1645 into r1649; + cast r1648 r1649 into r1650 as U256__8JquwLopp8; + and r1650.lo 18446744073709551615u128 into r1651; + shr r1650.lo 64u8 into r1652; + and r1650.hi 18446744073709551615u128 into r1653; + shr r1650.hi 64u8 into r1654; + cast r1637 into r1655 as u8; + is.eq r1655 0u8 into r1656; + sub 128u8 r1655 into r1657; + shr.w r1593.lo r1657 into r1658; + ternary r1656 0u128 r1658 into r1659; + shl.w r1593.hi r1655 into r1660; + or r1660 r1659 into r1661; + shl.w r1593.lo r1655 into r1662; + shl.w r1593.lo r1655 into r1663; + ternary r1647 r1663 r1661 into r1664; + ternary r1647 0u128 r1662 into r1665; + cast r1664 r1665 into r1666 as U256__8JquwLopp8; + is.eq r1636 0u16 into r1667; + sub 256u16 r1636 into r1668; + and r1668 127u16 into r1669; + cast r1669 into r1670 as u8; + is.eq r1670 0u8 into r1671; + sub 128u8 r1670 into r1672; + shl.w r1593.hi r1672 into r1673; + ternary r1671 0u128 r1673 into r1674; + shr r1593.lo r1670 into r1675; + or r1675 r1674 into r1676; + shr r1593.hi r1670 into r1677; + shr r1593.hi r1670 into r1678; + gte r1668 128u16 into r1679; + ternary r1679 0u128 r1677 into r1680; + ternary r1679 r1678 r1676 into r1681; + cast r1680 r1681 into r1682 as U256__8JquwLopp8; + ternary r1667 0u128 r1682.hi into r1683; + ternary r1667 0u128 r1682.lo into r1684; + cast r1683 r1684 into r1685 as U256__8JquwLopp8; + cast r1637 into r1686 as u8; + is.eq r1686 0u8 into r1687; + sub 128u8 r1686 into r1688; + shr.w r1592.lo r1688 into r1689; + ternary r1687 0u128 r1689 into r1690; + shl.w r1592.hi r1686 into r1691; + or r1691 r1690 into r1692; + shl.w r1592.lo r1686 into r1693; + shl.w r1592.lo r1686 into r1694; + ternary r1647 r1694 r1692 into r1695; + ternary r1647 0u128 r1693 into r1696; + cast r1695 r1696 into r1697 as U256__8JquwLopp8; + add.w r1697.lo r1685.lo into r1698; + lt r1698 r1697.lo into r1699; + ternary r1699 1u128 0u128 into r1700; + add.w r1697.hi r1685.hi into r1701; + add.w r1701 r1700 into r1702; + cast r1702 r1698 into r1703 as U256__8JquwLopp8; + and r1666.lo 18446744073709551615u128 into r1704; + shr r1666.lo 64u8 into r1705; + and r1666.hi 18446744073709551615u128 into r1706; + shr r1666.hi 64u8 into r1707; + and r1703.lo 18446744073709551615u128 into r1708; + shr r1703.lo 64u8 into r1709; + and r1703.hi 18446744073709551615u128 into r1710; + shr r1703.hi 64u8 into r1711; + shl r1711 64u8 into r1712; + add r1712 r1710 into r1713; + div r1713 r1654 into r1714; + gt r1714 18446744073709551615u128 into r1715; + ternary r1715 18446744073709551615u128 r1714 into r1716; + mul r1716 r1654 into r1717; + sub r1713 r1717 into r1718; + lte r1718 18446744073709551615u128 into r1719; + mul r1716 r1653 into r1720; + and r1718 18446744073709551615u128 into r1721; + shl r1721 64u8 into r1722; + add r1722 r1709 into r1723; + gt r1720 r1723 into r1724; + and r1719 r1724 into r1725; + sub.w r1716 1u128 into r1726; + ternary r1725 r1726 r1716 into r1727; + add r1718 r1654 into r1728; + ternary r1725 r1728 r1718 into r1729; + lte r1729 18446744073709551615u128 into r1730; + and r1725 r1730 into r1731; + mul r1727 r1653 into r1732; + and r1729 18446744073709551615u128 into r1733; + shl r1733 64u8 into r1734; + add r1734 r1709 into r1735; + gt r1732 r1735 into r1736; + and r1731 r1736 into r1737; + sub.w r1727 1u128 into r1738; + ternary r1737 r1738 r1727 into r1739; + mul r1739 r1651 into r1740; + and r1740 18446744073709551615u128 into r1741; + lt r1707 r1741 into r1742; + add r1707 18446744073709551616u128 into r1743; + sub r1743 r1741 into r1744; + and r1744 18446744073709551615u128 into r1745; + shr r1740 64u8 into r1746; + ternary r1742 1u128 0u128 into r1747; + add r1746 r1747 into r1748; + mul r1739 r1652 into r1749; + add r1749 r1748 into r1750; + and r1750 18446744073709551615u128 into r1751; + lt r1708 r1751 into r1752; + add r1708 18446744073709551616u128 into r1753; + sub r1753 r1751 into r1754; + and r1754 18446744073709551615u128 into r1755; + shr r1750 64u8 into r1756; + ternary r1752 1u128 0u128 into r1757; + add r1756 r1757 into r1758; + mul r1739 r1653 into r1759; + add r1759 r1758 into r1760; + and r1760 18446744073709551615u128 into r1761; + lt r1709 r1761 into r1762; + add r1709 18446744073709551616u128 into r1763; + sub r1763 r1761 into r1764; + and r1764 18446744073709551615u128 into r1765; + shr r1760 64u8 into r1766; + ternary r1762 1u128 0u128 into r1767; + add r1766 r1767 into r1768; + mul r1739 r1654 into r1769; + add r1769 r1768 into r1770; + and r1770 18446744073709551615u128 into r1771; + lt r1710 r1771 into r1772; + add r1710 18446744073709551616u128 into r1773; + sub r1773 r1771 into r1774; + and r1774 18446744073709551615u128 into r1775; + shr r1770 64u8 into r1776; + ternary r1772 1u128 0u128 into r1777; + add r1776 r1777 into r1778; + lt r1711 r1778 into r1779; + add r1711 18446744073709551616u128 into r1780; + sub r1780 r1778 into r1781; + and r1781 18446744073709551615u128 into r1782; + sub.w r1739 1u128 into r1783; + ternary r1779 r1783 r1739 into r1784; + add r1745 r1651 into r1785; + and r1785 18446744073709551615u128 into r1786; + ternary r1779 r1786 r1745 into r1787; + shr r1785 64u8 into r1788; + ternary r1779 r1788 0u128 into r1789; + add r1755 r1652 into r1790; + add r1790 r1789 into r1791; + and r1791 18446744073709551615u128 into r1792; + ternary r1779 r1792 r1755 into r1793; + shr r1791 64u8 into r1794; + ternary r1779 r1794 0u128 into r1795; + add r1765 r1653 into r1796; + add r1796 r1795 into r1797; + and r1797 18446744073709551615u128 into r1798; + ternary r1779 r1798 r1765 into r1799; + shr r1797 64u8 into r1800; + ternary r1779 r1800 0u128 into r1801; + add r1775 r1654 into r1802; + add r1802 r1801 into r1803; + and r1803 18446744073709551615u128 into r1804; + ternary r1779 r1804 r1775 into r1805; + shr r1803 64u8 into r1806; + ternary r1779 r1806 0u128 into r1807; + add r1782 r1807 into r1808; + shl r1805 64u8 into r1809; + add r1809 r1799 into r1810; + div r1810 r1654 into r1811; + gt r1811 18446744073709551615u128 into r1812; + ternary r1812 18446744073709551615u128 r1811 into r1813; + mul r1813 r1654 into r1814; + sub r1810 r1814 into r1815; + lte r1815 18446744073709551615u128 into r1816; + mul r1813 r1653 into r1817; + and r1815 18446744073709551615u128 into r1818; + shl r1818 64u8 into r1819; + add r1819 r1793 into r1820; + gt r1817 r1820 into r1821; + and r1816 r1821 into r1822; + sub.w r1813 1u128 into r1823; + ternary r1822 r1823 r1813 into r1824; + add r1815 r1654 into r1825; + ternary r1822 r1825 r1815 into r1826; + lte r1826 18446744073709551615u128 into r1827; + and r1822 r1827 into r1828; + mul r1824 r1653 into r1829; + and r1826 18446744073709551615u128 into r1830; + shl r1830 64u8 into r1831; + add r1831 r1793 into r1832; + gt r1829 r1832 into r1833; + and r1828 r1833 into r1834; + sub.w r1824 1u128 into r1835; + ternary r1834 r1835 r1824 into r1836; + mul r1836 r1651 into r1837; + and r1837 18446744073709551615u128 into r1838; + lt r1706 r1838 into r1839; + add r1706 18446744073709551616u128 into r1840; + sub r1840 r1838 into r1841; + and r1841 18446744073709551615u128 into r1842; + shr r1837 64u8 into r1843; + ternary r1839 1u128 0u128 into r1844; + add r1843 r1844 into r1845; + mul r1836 r1652 into r1846; + add r1846 r1845 into r1847; + and r1847 18446744073709551615u128 into r1848; + lt r1787 r1848 into r1849; + add r1787 18446744073709551616u128 into r1850; + sub r1850 r1848 into r1851; + and r1851 18446744073709551615u128 into r1852; + shr r1847 64u8 into r1853; + ternary r1849 1u128 0u128 into r1854; + add r1853 r1854 into r1855; + mul r1836 r1653 into r1856; + add r1856 r1855 into r1857; + and r1857 18446744073709551615u128 into r1858; + lt r1793 r1858 into r1859; + add r1793 18446744073709551616u128 into r1860; + sub r1860 r1858 into r1861; + and r1861 18446744073709551615u128 into r1862; + shr r1857 64u8 into r1863; + ternary r1859 1u128 0u128 into r1864; + add r1863 r1864 into r1865; + mul r1836 r1654 into r1866; + add r1866 r1865 into r1867; + and r1867 18446744073709551615u128 into r1868; + lt r1799 r1868 into r1869; + add r1799 18446744073709551616u128 into r1870; + sub r1870 r1868 into r1871; + and r1871 18446744073709551615u128 into r1872; + shr r1867 64u8 into r1873; + ternary r1869 1u128 0u128 into r1874; + add r1873 r1874 into r1875; + lt r1805 r1875 into r1876; + add r1805 18446744073709551616u128 into r1877; + sub r1877 r1875 into r1878; + and r1878 18446744073709551615u128 into r1879; + sub.w r1836 1u128 into r1880; + ternary r1876 r1880 r1836 into r1881; + add r1842 r1651 into r1882; + and r1882 18446744073709551615u128 into r1883; + ternary r1876 r1883 r1842 into r1884; + shr r1882 64u8 into r1885; + ternary r1876 r1885 0u128 into r1886; + add r1852 r1652 into r1887; + add r1887 r1886 into r1888; + and r1888 18446744073709551615u128 into r1889; + ternary r1876 r1889 r1852 into r1890; + shr r1888 64u8 into r1891; + ternary r1876 r1891 0u128 into r1892; + add r1862 r1653 into r1893; + add r1893 r1892 into r1894; + and r1894 18446744073709551615u128 into r1895; + ternary r1876 r1895 r1862 into r1896; + shr r1894 64u8 into r1897; + ternary r1876 r1897 0u128 into r1898; + add r1872 r1654 into r1899; + add r1899 r1898 into r1900; + and r1900 18446744073709551615u128 into r1901; + ternary r1876 r1901 r1872 into r1902; + shr r1900 64u8 into r1903; + ternary r1876 r1903 0u128 into r1904; + add r1879 r1904 into r1905; + shl r1902 64u8 into r1906; + add r1906 r1896 into r1907; + div r1907 r1654 into r1908; + gt r1908 18446744073709551615u128 into r1909; + ternary r1909 18446744073709551615u128 r1908 into r1910; + mul r1910 r1654 into r1911; + sub r1907 r1911 into r1912; + lte r1912 18446744073709551615u128 into r1913; + mul r1910 r1653 into r1914; + and r1912 18446744073709551615u128 into r1915; + shl r1915 64u8 into r1916; + add r1916 r1890 into r1917; + gt r1914 r1917 into r1918; + and r1913 r1918 into r1919; + sub.w r1910 1u128 into r1920; + ternary r1919 r1920 r1910 into r1921; + add r1912 r1654 into r1922; + ternary r1919 r1922 r1912 into r1923; + lte r1923 18446744073709551615u128 into r1924; + and r1919 r1924 into r1925; + mul r1921 r1653 into r1926; + and r1923 18446744073709551615u128 into r1927; + shl r1927 64u8 into r1928; + add r1928 r1890 into r1929; + gt r1926 r1929 into r1930; + and r1925 r1930 into r1931; + sub.w r1921 1u128 into r1932; + ternary r1931 r1932 r1921 into r1933; + mul r1933 r1651 into r1934; + and r1934 18446744073709551615u128 into r1935; + lt r1705 r1935 into r1936; + add r1705 18446744073709551616u128 into r1937; + sub r1937 r1935 into r1938; + and r1938 18446744073709551615u128 into r1939; + shr r1934 64u8 into r1940; + ternary r1936 1u128 0u128 into r1941; + add r1940 r1941 into r1942; + mul r1933 r1652 into r1943; + add r1943 r1942 into r1944; + and r1944 18446744073709551615u128 into r1945; + lt r1884 r1945 into r1946; + add r1884 18446744073709551616u128 into r1947; + sub r1947 r1945 into r1948; + and r1948 18446744073709551615u128 into r1949; + shr r1944 64u8 into r1950; + ternary r1946 1u128 0u128 into r1951; + add r1950 r1951 into r1952; + mul r1933 r1653 into r1953; + add r1953 r1952 into r1954; + and r1954 18446744073709551615u128 into r1955; + lt r1890 r1955 into r1956; + add r1890 18446744073709551616u128 into r1957; + sub r1957 r1955 into r1958; + and r1958 18446744073709551615u128 into r1959; + shr r1954 64u8 into r1960; + ternary r1956 1u128 0u128 into r1961; + add r1960 r1961 into r1962; + mul r1933 r1654 into r1963; + add r1963 r1962 into r1964; + and r1964 18446744073709551615u128 into r1965; + lt r1896 r1965 into r1966; + add r1896 18446744073709551616u128 into r1967; + sub r1967 r1965 into r1968; + and r1968 18446744073709551615u128 into r1969; + shr r1964 64u8 into r1970; + ternary r1966 1u128 0u128 into r1971; + add r1970 r1971 into r1972; + lt r1902 r1972 into r1973; + add r1902 18446744073709551616u128 into r1974; + sub r1974 r1972 into r1975; + and r1975 18446744073709551615u128 into r1976; + sub.w r1933 1u128 into r1977; + ternary r1973 r1977 r1933 into r1978; + add r1939 r1651 into r1979; + and r1979 18446744073709551615u128 into r1980; + ternary r1973 r1980 r1939 into r1981; + shr r1979 64u8 into r1982; + ternary r1973 r1982 0u128 into r1983; + add r1949 r1652 into r1984; + add r1984 r1983 into r1985; + and r1985 18446744073709551615u128 into r1986; + ternary r1973 r1986 r1949 into r1987; + shr r1985 64u8 into r1988; + ternary r1973 r1988 0u128 into r1989; + add r1959 r1653 into r1990; + add r1990 r1989 into r1991; + and r1991 18446744073709551615u128 into r1992; + ternary r1973 r1992 r1959 into r1993; + shr r1991 64u8 into r1994; + ternary r1973 r1994 0u128 into r1995; + add r1969 r1654 into r1996; + add r1996 r1995 into r1997; + and r1997 18446744073709551615u128 into r1998; + ternary r1973 r1998 r1969 into r1999; + shr r1997 64u8 into r2000; + ternary r1973 r2000 0u128 into r2001; + add r1976 r2001 into r2002; + shl r1999 64u8 into r2003; + add r2003 r1993 into r2004; + div r2004 r1654 into r2005; + gt r2005 18446744073709551615u128 into r2006; + ternary r2006 18446744073709551615u128 r2005 into r2007; + mul r2007 r1654 into r2008; + sub r2004 r2008 into r2009; + lte r2009 18446744073709551615u128 into r2010; + mul r2007 r1653 into r2011; + and r2009 18446744073709551615u128 into r2012; + shl r2012 64u8 into r2013; + add r2013 r1987 into r2014; + gt r2011 r2014 into r2015; + and r2010 r2015 into r2016; + sub.w r2007 1u128 into r2017; + ternary r2016 r2017 r2007 into r2018; + add r2009 r1654 into r2019; + ternary r2016 r2019 r2009 into r2020; + lte r2020 18446744073709551615u128 into r2021; + and r2016 r2021 into r2022; + mul r2018 r1653 into r2023; + and r2020 18446744073709551615u128 into r2024; + shl r2024 64u8 into r2025; + add r2025 r1987 into r2026; + gt r2023 r2026 into r2027; + and r2022 r2027 into r2028; + sub.w r2018 1u128 into r2029; + ternary r2028 r2029 r2018 into r2030; + mul r2030 r1651 into r2031; + and r2031 18446744073709551615u128 into r2032; + lt r1704 r2032 into r2033; + add r1704 18446744073709551616u128 into r2034; + sub r2034 r2032 into r2035; + and r2035 18446744073709551615u128 into r2036; + shr r2031 64u8 into r2037; + ternary r2033 1u128 0u128 into r2038; + add r2037 r2038 into r2039; + mul r2030 r1652 into r2040; + add r2040 r2039 into r2041; + and r2041 18446744073709551615u128 into r2042; + lt r1981 r2042 into r2043; + add r1981 18446744073709551616u128 into r2044; + sub r2044 r2042 into r2045; + and r2045 18446744073709551615u128 into r2046; + shr r2041 64u8 into r2047; + ternary r2043 1u128 0u128 into r2048; + add r2047 r2048 into r2049; + mul r2030 r1653 into r2050; + add r2050 r2049 into r2051; + and r2051 18446744073709551615u128 into r2052; + lt r1987 r2052 into r2053; + add r1987 18446744073709551616u128 into r2054; + sub r2054 r2052 into r2055; + and r2055 18446744073709551615u128 into r2056; + shr r2051 64u8 into r2057; + ternary r2053 1u128 0u128 into r2058; + add r2057 r2058 into r2059; + mul r2030 r1654 into r2060; + add r2060 r2059 into r2061; + and r2061 18446744073709551615u128 into r2062; + lt r1993 r2062 into r2063; + add r1993 18446744073709551616u128 into r2064; + sub r2064 r2062 into r2065; + and r2065 18446744073709551615u128 into r2066; + shr r2061 64u8 into r2067; + ternary r2063 1u128 0u128 into r2068; + add r2067 r2068 into r2069; + lt r1999 r2069 into r2070; + add r1999 18446744073709551616u128 into r2071; + sub r2071 r2069 into r2072; + and r2072 18446744073709551615u128 into r2073; + sub.w r2030 1u128 into r2074; + ternary r2070 r2074 r2030 into r2075; + add r2036 r1651 into r2076; + and r2076 18446744073709551615u128 into r2077; + ternary r2070 r2077 r2036 into r2078; + shr r2076 64u8 into r2079; + ternary r2070 r2079 0u128 into r2080; + add r2046 r1652 into r2081; + add r2081 r2080 into r2082; + and r2082 18446744073709551615u128 into r2083; + ternary r2070 r2083 r2046 into r2084; + shr r2082 64u8 into r2085; + ternary r2070 r2085 0u128 into r2086; + add r2056 r1653 into r2087; + add r2087 r2086 into r2088; + and r2088 18446744073709551615u128 into r2089; + ternary r2070 r2089 r2056 into r2090; + shr r2088 64u8 into r2091; + ternary r2070 r2091 0u128 into r2092; + add r2066 r1654 into r2093; + add r2093 r2092 into r2094; + and r2094 18446744073709551615u128 into r2095; + ternary r2070 r2095 r2066 into r2096; + shr r2094 64u8 into r2097; + ternary r2070 r2097 0u128 into r2098; + add r2073 r2098 into r2099; + shl r1784 64u8 into r2100; + add r2100 r1881 into r2101; + shl r1978 64u8 into r2102; + add r2102 r2075 into r2103; + cast r2101 r2103 into r2104 as U256__8JquwLopp8; + shl r2096 64u8 into r2105; + add r2105 r2090 into r2106; + shl r2084 64u8 into r2107; + add r2107 r2078 into r2108; + cast r1637 into r2109 as u8; + sub 128u8 r2109 into r2110; + shr r2108 r2109 into r2111; + shr r2106 r2109 into r2112; + cast r2104.hi r2104.lo into r2113 as U256__8JquwLopp8; + cast 0u128 r109 into r2114 as U256__8JquwLopp8; + add.w r2113.lo r2114.lo into r2115; + lt r2115 r2113.lo into r2116; + ternary r2116 1u128 0u128 into r2117; + add.w r2113.hi r2114.hi into r2118; + add.w r2118 r2117 into r2119; + cast r2119 r2115 into r2120 as U256__8JquwLopp8; + cast r2120.hi r2120.lo into r2121 as U256__8JquwLopp8; + is.eq r2121.hi 0u128 into r2122; + is.eq r2121.lo 0u128 into r2123; + and r2122 r2123 into r2124; + ternary r2124 0u128 r2121.hi into r2125; + ternary r2124 1u128 r2121.lo into r2126; + cast r2125 r2126 into r2127 as U256__8JquwLopp8; + cast 0u128 r1539 into r2128 as U256__8JquwLopp8; + shr r2128.lo 64u8 into r2129; + and r2128.lo 18446744073709551615u128 into r2130; + shr r2128.lo 64u8 into r2131; + and r2130 18446744073709551615u128 into r2132; + shr r2130 64u8 into r2133; + and r2131 18446744073709551615u128 into r2134; + add r2133 r2134 into r2135; + and r2135 18446744073709551615u128 into r2136; + shr r2135 64u8 into r2137; + shr r2131 64u8 into r2138; + add r2138 r2137 into r2139; + and r2139 18446744073709551615u128 into r2140; + shr r2139 64u8 into r2141; + shl r2141 64u8 into r2142; + add r2142 r2140 into r2143; + shl r2136 64u8 into r2144; + add r2144 r2132 into r2145; + shr r2128.hi 64u8 into r2146; + and r2128.hi 18446744073709551615u128 into r2147; + shr r2128.hi 64u8 into r2148; + and r2147 18446744073709551615u128 into r2149; + shr r2147 64u8 into r2150; + and r2148 18446744073709551615u128 into r2151; + add r2150 r2151 into r2152; + and r2152 18446744073709551615u128 into r2153; + shr r2152 64u8 into r2154; + shr r2148 64u8 into r2155; + add r2155 r2154 into r2156; + and r2156 18446744073709551615u128 into r2157; + shr r2156 64u8 into r2158; + shl r2158 64u8 into r2159; + add r2159 r2157 into r2160; + shl r2153 64u8 into r2161; + add r2161 r2149 into r2162; + lt r2145 0u128 into r2163; + ternary r2163 1u128 0u128 into r2164; + lt r2145 r2145 into r2165; + ternary r2165 1u128 0u128 into r2166; + add r2164 r2166 into r2167; + lt r2143 r2143 into r2168; + ternary r2168 1u128 0u128 into r2169; + add.w r2143 r2162 into r2170; + lt r2170 r2143 into r2171; + ternary r2171 1u128 0u128 into r2172; + add.w r2170 r2167 into r2173; + lt r2173 r2170 into r2174; + ternary r2174 1u128 0u128 into r2175; + add r2169 r2172 into r2176; + add r2176 r2175 into r2177; + add.w r2160 r2177 into r2178; + cast r2178 r2173 into r2179 as U256__8JquwLopp8; + cast r2145 0u128 into r2180 as U256__8JquwLopp8; + lt r2179.hi r2127.hi into r2181; + gt r2179.hi r2127.hi into r2182; + lt r2179.lo r2127.lo into r2183; + ternary r2182 false r2183 into r2184; + ternary r2181 true r2184 into r2185; + assert.eq r2185 true; + gt r2127.hi 0u128 into r2186; + ternary r2186 r2127.hi r2127.lo into r2187; + ternary r2186 128u32 0u32 into r2188; + gte r2187 18446744073709551616u128 into r2189; + shr r2187 64u8 into r2190; + ternary r2189 r2190 r2187 into r2191; + ternary r2189 64u32 0u32 into r2192; + gte r2191 4294967296u128 into r2193; + shr r2191 32u8 into r2194; + add r2192 32u32 into r2195; + ternary r2193 r2194 r2191 into r2196; + ternary r2193 r2195 r2192 into r2197; + gte r2196 65536u128 into r2198; + shr r2196 16u8 into r2199; + add r2197 16u32 into r2200; + ternary r2198 r2199 r2196 into r2201; + ternary r2198 r2200 r2197 into r2202; + gte r2201 256u128 into r2203; + shr r2201 8u8 into r2204; + add r2202 8u32 into r2205; + ternary r2203 r2204 r2201 into r2206; + ternary r2203 r2205 r2202 into r2207; + gte r2206 16u128 into r2208; + shr r2206 4u8 into r2209; + add r2207 4u32 into r2210; + ternary r2208 r2209 r2206 into r2211; + ternary r2208 r2210 r2207 into r2212; + gte r2211 4u128 into r2213; + shr r2211 2u8 into r2214; + add r2212 2u32 into r2215; + ternary r2213 r2214 r2211 into r2216; + ternary r2213 r2215 r2212 into r2217; + gte r2216 2u128 into r2218; + add r2217 1u32 into r2219; + ternary r2218 r2219 r2217 into r2220; + add r2188 r2220 into r2221; + sub 255u32 r2221 into r2222; + cast r2222 into r2223 as u16; + and r2223 127u16 into r2224; + cast r2224 into r2225 as u8; + is.eq r2225 0u8 into r2226; + sub 128u8 r2225 into r2227; + shr.w r2127.lo r2227 into r2228; + ternary r2226 0u128 r2228 into r2229; + shl.w r2127.hi r2225 into r2230; + or r2230 r2229 into r2231; + shl.w r2127.lo r2225 into r2232; + shl.w r2127.lo r2225 into r2233; + gte r2223 128u16 into r2234; + ternary r2234 r2233 r2231 into r2235; + ternary r2234 0u128 r2232 into r2236; + cast r2235 r2236 into r2237 as U256__8JquwLopp8; + and r2237.lo 18446744073709551615u128 into r2238; + shr r2237.lo 64u8 into r2239; + and r2237.hi 18446744073709551615u128 into r2240; + shr r2237.hi 64u8 into r2241; + cast r2224 into r2242 as u8; + is.eq r2242 0u8 into r2243; + sub 128u8 r2242 into r2244; + shr.w r2180.lo r2244 into r2245; + ternary r2243 0u128 r2245 into r2246; + shl.w r2180.hi r2242 into r2247; + or r2247 r2246 into r2248; + shl.w r2180.lo r2242 into r2249; + shl.w r2180.lo r2242 into r2250; + ternary r2234 r2250 r2248 into r2251; + ternary r2234 0u128 r2249 into r2252; + cast r2251 r2252 into r2253 as U256__8JquwLopp8; + is.eq r2223 0u16 into r2254; + sub 256u16 r2223 into r2255; + and r2255 127u16 into r2256; + cast r2256 into r2257 as u8; + is.eq r2257 0u8 into r2258; + sub 128u8 r2257 into r2259; + shl.w r2180.hi r2259 into r2260; + ternary r2258 0u128 r2260 into r2261; + shr r2180.lo r2257 into r2262; + or r2262 r2261 into r2263; + shr r2180.hi r2257 into r2264; + shr r2180.hi r2257 into r2265; + gte r2255 128u16 into r2266; + ternary r2266 0u128 r2264 into r2267; + ternary r2266 r2265 r2263 into r2268; + cast r2267 r2268 into r2269 as U256__8JquwLopp8; + ternary r2254 0u128 r2269.hi into r2270; + ternary r2254 0u128 r2269.lo into r2271; + cast r2270 r2271 into r2272 as U256__8JquwLopp8; + cast r2224 into r2273 as u8; + is.eq r2273 0u8 into r2274; + sub 128u8 r2273 into r2275; + shr.w r2179.lo r2275 into r2276; + ternary r2274 0u128 r2276 into r2277; + shl.w r2179.hi r2273 into r2278; + or r2278 r2277 into r2279; + shl.w r2179.lo r2273 into r2280; + shl.w r2179.lo r2273 into r2281; + ternary r2234 r2281 r2279 into r2282; + ternary r2234 0u128 r2280 into r2283; + cast r2282 r2283 into r2284 as U256__8JquwLopp8; + add.w r2284.lo r2272.lo into r2285; + lt r2285 r2284.lo into r2286; + ternary r2286 1u128 0u128 into r2287; + add.w r2284.hi r2272.hi into r2288; + add.w r2288 r2287 into r2289; + cast r2289 r2285 into r2290 as U256__8JquwLopp8; + and r2253.lo 18446744073709551615u128 into r2291; + shr r2253.lo 64u8 into r2292; + and r2253.hi 18446744073709551615u128 into r2293; + shr r2253.hi 64u8 into r2294; + and r2290.lo 18446744073709551615u128 into r2295; + shr r2290.lo 64u8 into r2296; + and r2290.hi 18446744073709551615u128 into r2297; + shr r2290.hi 64u8 into r2298; + shl r2298 64u8 into r2299; + add r2299 r2297 into r2300; + div r2300 r2241 into r2301; + gt r2301 18446744073709551615u128 into r2302; + ternary r2302 18446744073709551615u128 r2301 into r2303; + mul r2303 r2241 into r2304; + sub r2300 r2304 into r2305; + lte r2305 18446744073709551615u128 into r2306; + mul r2303 r2240 into r2307; + and r2305 18446744073709551615u128 into r2308; + shl r2308 64u8 into r2309; + add r2309 r2296 into r2310; + gt r2307 r2310 into r2311; + and r2306 r2311 into r2312; + sub.w r2303 1u128 into r2313; + ternary r2312 r2313 r2303 into r2314; + add r2305 r2241 into r2315; + ternary r2312 r2315 r2305 into r2316; + lte r2316 18446744073709551615u128 into r2317; + and r2312 r2317 into r2318; + mul r2314 r2240 into r2319; + and r2316 18446744073709551615u128 into r2320; + shl r2320 64u8 into r2321; + add r2321 r2296 into r2322; + gt r2319 r2322 into r2323; + and r2318 r2323 into r2324; + sub.w r2314 1u128 into r2325; + ternary r2324 r2325 r2314 into r2326; + mul r2326 r2238 into r2327; + and r2327 18446744073709551615u128 into r2328; + lt r2294 r2328 into r2329; + add r2294 18446744073709551616u128 into r2330; + sub r2330 r2328 into r2331; + and r2331 18446744073709551615u128 into r2332; + shr r2327 64u8 into r2333; + ternary r2329 1u128 0u128 into r2334; + add r2333 r2334 into r2335; + mul r2326 r2239 into r2336; + add r2336 r2335 into r2337; + and r2337 18446744073709551615u128 into r2338; + lt r2295 r2338 into r2339; + add r2295 18446744073709551616u128 into r2340; + sub r2340 r2338 into r2341; + and r2341 18446744073709551615u128 into r2342; + shr r2337 64u8 into r2343; + ternary r2339 1u128 0u128 into r2344; + add r2343 r2344 into r2345; + mul r2326 r2240 into r2346; + add r2346 r2345 into r2347; + and r2347 18446744073709551615u128 into r2348; + lt r2296 r2348 into r2349; + add r2296 18446744073709551616u128 into r2350; + sub r2350 r2348 into r2351; + and r2351 18446744073709551615u128 into r2352; + shr r2347 64u8 into r2353; + ternary r2349 1u128 0u128 into r2354; + add r2353 r2354 into r2355; + mul r2326 r2241 into r2356; + add r2356 r2355 into r2357; + and r2357 18446744073709551615u128 into r2358; + lt r2297 r2358 into r2359; + add r2297 18446744073709551616u128 into r2360; + sub r2360 r2358 into r2361; + and r2361 18446744073709551615u128 into r2362; + shr r2357 64u8 into r2363; + ternary r2359 1u128 0u128 into r2364; + add r2363 r2364 into r2365; + lt r2298 r2365 into r2366; + add r2298 18446744073709551616u128 into r2367; + sub r2367 r2365 into r2368; + and r2368 18446744073709551615u128 into r2369; + sub.w r2326 1u128 into r2370; + ternary r2366 r2370 r2326 into r2371; + add r2332 r2238 into r2372; + and r2372 18446744073709551615u128 into r2373; + ternary r2366 r2373 r2332 into r2374; + shr r2372 64u8 into r2375; + ternary r2366 r2375 0u128 into r2376; + add r2342 r2239 into r2377; + add r2377 r2376 into r2378; + and r2378 18446744073709551615u128 into r2379; + ternary r2366 r2379 r2342 into r2380; + shr r2378 64u8 into r2381; + ternary r2366 r2381 0u128 into r2382; + add r2352 r2240 into r2383; + add r2383 r2382 into r2384; + and r2384 18446744073709551615u128 into r2385; + ternary r2366 r2385 r2352 into r2386; + shr r2384 64u8 into r2387; + ternary r2366 r2387 0u128 into r2388; + add r2362 r2241 into r2389; + add r2389 r2388 into r2390; + and r2390 18446744073709551615u128 into r2391; + ternary r2366 r2391 r2362 into r2392; + shr r2390 64u8 into r2393; + ternary r2366 r2393 0u128 into r2394; + add r2369 r2394 into r2395; + shl r2392 64u8 into r2396; + add r2396 r2386 into r2397; + div r2397 r2241 into r2398; + gt r2398 18446744073709551615u128 into r2399; + ternary r2399 18446744073709551615u128 r2398 into r2400; + mul r2400 r2241 into r2401; + sub r2397 r2401 into r2402; + lte r2402 18446744073709551615u128 into r2403; + mul r2400 r2240 into r2404; + and r2402 18446744073709551615u128 into r2405; + shl r2405 64u8 into r2406; + add r2406 r2380 into r2407; + gt r2404 r2407 into r2408; + and r2403 r2408 into r2409; + sub.w r2400 1u128 into r2410; + ternary r2409 r2410 r2400 into r2411; + add r2402 r2241 into r2412; + ternary r2409 r2412 r2402 into r2413; + lte r2413 18446744073709551615u128 into r2414; + and r2409 r2414 into r2415; + mul r2411 r2240 into r2416; + and r2413 18446744073709551615u128 into r2417; + shl r2417 64u8 into r2418; + add r2418 r2380 into r2419; + gt r2416 r2419 into r2420; + and r2415 r2420 into r2421; + sub.w r2411 1u128 into r2422; + ternary r2421 r2422 r2411 into r2423; + mul r2423 r2238 into r2424; + and r2424 18446744073709551615u128 into r2425; + lt r2293 r2425 into r2426; + add r2293 18446744073709551616u128 into r2427; + sub r2427 r2425 into r2428; + and r2428 18446744073709551615u128 into r2429; + shr r2424 64u8 into r2430; + ternary r2426 1u128 0u128 into r2431; + add r2430 r2431 into r2432; + mul r2423 r2239 into r2433; + add r2433 r2432 into r2434; + and r2434 18446744073709551615u128 into r2435; + lt r2374 r2435 into r2436; + add r2374 18446744073709551616u128 into r2437; + sub r2437 r2435 into r2438; + and r2438 18446744073709551615u128 into r2439; + shr r2434 64u8 into r2440; + ternary r2436 1u128 0u128 into r2441; + add r2440 r2441 into r2442; + mul r2423 r2240 into r2443; + add r2443 r2442 into r2444; + and r2444 18446744073709551615u128 into r2445; + lt r2380 r2445 into r2446; + add r2380 18446744073709551616u128 into r2447; + sub r2447 r2445 into r2448; + and r2448 18446744073709551615u128 into r2449; + shr r2444 64u8 into r2450; + ternary r2446 1u128 0u128 into r2451; + add r2450 r2451 into r2452; + mul r2423 r2241 into r2453; + add r2453 r2452 into r2454; + and r2454 18446744073709551615u128 into r2455; + lt r2386 r2455 into r2456; + add r2386 18446744073709551616u128 into r2457; + sub r2457 r2455 into r2458; + and r2458 18446744073709551615u128 into r2459; + shr r2454 64u8 into r2460; + ternary r2456 1u128 0u128 into r2461; + add r2460 r2461 into r2462; + lt r2392 r2462 into r2463; + add r2392 18446744073709551616u128 into r2464; + sub r2464 r2462 into r2465; + and r2465 18446744073709551615u128 into r2466; + sub.w r2423 1u128 into r2467; + ternary r2463 r2467 r2423 into r2468; + add r2429 r2238 into r2469; + and r2469 18446744073709551615u128 into r2470; + ternary r2463 r2470 r2429 into r2471; + shr r2469 64u8 into r2472; + ternary r2463 r2472 0u128 into r2473; + add r2439 r2239 into r2474; + add r2474 r2473 into r2475; + and r2475 18446744073709551615u128 into r2476; + ternary r2463 r2476 r2439 into r2477; + shr r2475 64u8 into r2478; + ternary r2463 r2478 0u128 into r2479; + add r2449 r2240 into r2480; + add r2480 r2479 into r2481; + and r2481 18446744073709551615u128 into r2482; + ternary r2463 r2482 r2449 into r2483; + shr r2481 64u8 into r2484; + ternary r2463 r2484 0u128 into r2485; + add r2459 r2241 into r2486; + add r2486 r2485 into r2487; + and r2487 18446744073709551615u128 into r2488; + ternary r2463 r2488 r2459 into r2489; + shr r2487 64u8 into r2490; + ternary r2463 r2490 0u128 into r2491; + add r2466 r2491 into r2492; + shl r2489 64u8 into r2493; + add r2493 r2483 into r2494; + div r2494 r2241 into r2495; + gt r2495 18446744073709551615u128 into r2496; + ternary r2496 18446744073709551615u128 r2495 into r2497; + mul r2497 r2241 into r2498; + sub r2494 r2498 into r2499; + lte r2499 18446744073709551615u128 into r2500; + mul r2497 r2240 into r2501; + and r2499 18446744073709551615u128 into r2502; + shl r2502 64u8 into r2503; + add r2503 r2477 into r2504; + gt r2501 r2504 into r2505; + and r2500 r2505 into r2506; + sub.w r2497 1u128 into r2507; + ternary r2506 r2507 r2497 into r2508; + add r2499 r2241 into r2509; + ternary r2506 r2509 r2499 into r2510; + lte r2510 18446744073709551615u128 into r2511; + and r2506 r2511 into r2512; + mul r2508 r2240 into r2513; + and r2510 18446744073709551615u128 into r2514; + shl r2514 64u8 into r2515; + add r2515 r2477 into r2516; + gt r2513 r2516 into r2517; + and r2512 r2517 into r2518; + sub.w r2508 1u128 into r2519; + ternary r2518 r2519 r2508 into r2520; + mul r2520 r2238 into r2521; + and r2521 18446744073709551615u128 into r2522; + lt r2292 r2522 into r2523; + add r2292 18446744073709551616u128 into r2524; + sub r2524 r2522 into r2525; + and r2525 18446744073709551615u128 into r2526; + shr r2521 64u8 into r2527; + ternary r2523 1u128 0u128 into r2528; + add r2527 r2528 into r2529; + mul r2520 r2239 into r2530; + add r2530 r2529 into r2531; + and r2531 18446744073709551615u128 into r2532; + lt r2471 r2532 into r2533; + add r2471 18446744073709551616u128 into r2534; + sub r2534 r2532 into r2535; + and r2535 18446744073709551615u128 into r2536; + shr r2531 64u8 into r2537; + ternary r2533 1u128 0u128 into r2538; + add r2537 r2538 into r2539; + mul r2520 r2240 into r2540; + add r2540 r2539 into r2541; + and r2541 18446744073709551615u128 into r2542; + lt r2477 r2542 into r2543; + add r2477 18446744073709551616u128 into r2544; + sub r2544 r2542 into r2545; + and r2545 18446744073709551615u128 into r2546; + shr r2541 64u8 into r2547; + ternary r2543 1u128 0u128 into r2548; + add r2547 r2548 into r2549; + mul r2520 r2241 into r2550; + add r2550 r2549 into r2551; + and r2551 18446744073709551615u128 into r2552; + lt r2483 r2552 into r2553; + add r2483 18446744073709551616u128 into r2554; + sub r2554 r2552 into r2555; + and r2555 18446744073709551615u128 into r2556; + shr r2551 64u8 into r2557; + ternary r2553 1u128 0u128 into r2558; + add r2557 r2558 into r2559; + lt r2489 r2559 into r2560; + add r2489 18446744073709551616u128 into r2561; + sub r2561 r2559 into r2562; + and r2562 18446744073709551615u128 into r2563; + sub.w r2520 1u128 into r2564; + ternary r2560 r2564 r2520 into r2565; + add r2526 r2238 into r2566; + and r2566 18446744073709551615u128 into r2567; + ternary r2560 r2567 r2526 into r2568; + shr r2566 64u8 into r2569; + ternary r2560 r2569 0u128 into r2570; + add r2536 r2239 into r2571; + add r2571 r2570 into r2572; + and r2572 18446744073709551615u128 into r2573; + ternary r2560 r2573 r2536 into r2574; + shr r2572 64u8 into r2575; + ternary r2560 r2575 0u128 into r2576; + add r2546 r2240 into r2577; + add r2577 r2576 into r2578; + and r2578 18446744073709551615u128 into r2579; + ternary r2560 r2579 r2546 into r2580; + shr r2578 64u8 into r2581; + ternary r2560 r2581 0u128 into r2582; + add r2556 r2241 into r2583; + add r2583 r2582 into r2584; + and r2584 18446744073709551615u128 into r2585; + ternary r2560 r2585 r2556 into r2586; + shr r2584 64u8 into r2587; + ternary r2560 r2587 0u128 into r2588; + add r2563 r2588 into r2589; + shl r2586 64u8 into r2590; + add r2590 r2580 into r2591; + div r2591 r2241 into r2592; + gt r2592 18446744073709551615u128 into r2593; + ternary r2593 18446744073709551615u128 r2592 into r2594; + mul r2594 r2241 into r2595; + sub r2591 r2595 into r2596; + lte r2596 18446744073709551615u128 into r2597; + mul r2594 r2240 into r2598; + and r2596 18446744073709551615u128 into r2599; + shl r2599 64u8 into r2600; + add r2600 r2574 into r2601; + gt r2598 r2601 into r2602; + and r2597 r2602 into r2603; + sub.w r2594 1u128 into r2604; + ternary r2603 r2604 r2594 into r2605; + add r2596 r2241 into r2606; + ternary r2603 r2606 r2596 into r2607; + lte r2607 18446744073709551615u128 into r2608; + and r2603 r2608 into r2609; + mul r2605 r2240 into r2610; + and r2607 18446744073709551615u128 into r2611; + shl r2611 64u8 into r2612; + add r2612 r2574 into r2613; + gt r2610 r2613 into r2614; + and r2609 r2614 into r2615; + sub.w r2605 1u128 into r2616; + ternary r2615 r2616 r2605 into r2617; + mul r2617 r2238 into r2618; + and r2618 18446744073709551615u128 into r2619; + lt r2291 r2619 into r2620; + add r2291 18446744073709551616u128 into r2621; + sub r2621 r2619 into r2622; + and r2622 18446744073709551615u128 into r2623; + shr r2618 64u8 into r2624; + ternary r2620 1u128 0u128 into r2625; + add r2624 r2625 into r2626; + mul r2617 r2239 into r2627; + add r2627 r2626 into r2628; + and r2628 18446744073709551615u128 into r2629; + lt r2568 r2629 into r2630; + add r2568 18446744073709551616u128 into r2631; + sub r2631 r2629 into r2632; + and r2632 18446744073709551615u128 into r2633; + shr r2628 64u8 into r2634; + ternary r2630 1u128 0u128 into r2635; + add r2634 r2635 into r2636; + mul r2617 r2240 into r2637; + add r2637 r2636 into r2638; + and r2638 18446744073709551615u128 into r2639; + lt r2574 r2639 into r2640; + add r2574 18446744073709551616u128 into r2641; + sub r2641 r2639 into r2642; + and r2642 18446744073709551615u128 into r2643; + shr r2638 64u8 into r2644; + ternary r2640 1u128 0u128 into r2645; + add r2644 r2645 into r2646; + mul r2617 r2241 into r2647; + add r2647 r2646 into r2648; + and r2648 18446744073709551615u128 into r2649; + lt r2580 r2649 into r2650; + add r2580 18446744073709551616u128 into r2651; + sub r2651 r2649 into r2652; + and r2652 18446744073709551615u128 into r2653; + shr r2648 64u8 into r2654; + ternary r2650 1u128 0u128 into r2655; + add r2654 r2655 into r2656; + lt r2586 r2656 into r2657; + add r2586 18446744073709551616u128 into r2658; + sub r2658 r2656 into r2659; + and r2659 18446744073709551615u128 into r2660; + sub.w r2617 1u128 into r2661; + ternary r2657 r2661 r2617 into r2662; + add r2623 r2238 into r2663; + and r2663 18446744073709551615u128 into r2664; + ternary r2657 r2664 r2623 into r2665; + shr r2663 64u8 into r2666; + ternary r2657 r2666 0u128 into r2667; + add r2633 r2239 into r2668; + add r2668 r2667 into r2669; + and r2669 18446744073709551615u128 into r2670; + ternary r2657 r2670 r2633 into r2671; + shr r2669 64u8 into r2672; + ternary r2657 r2672 0u128 into r2673; + add r2643 r2240 into r2674; + add r2674 r2673 into r2675; + and r2675 18446744073709551615u128 into r2676; + ternary r2657 r2676 r2643 into r2677; + shr r2675 64u8 into r2678; + ternary r2657 r2678 0u128 into r2679; + add r2653 r2241 into r2680; + add r2680 r2679 into r2681; + and r2681 18446744073709551615u128 into r2682; + ternary r2657 r2682 r2653 into r2683; + shr r2681 64u8 into r2684; + ternary r2657 r2684 0u128 into r2685; + add r2660 r2685 into r2686; + shl r2371 64u8 into r2687; + add r2687 r2468 into r2688; + shl r2565 64u8 into r2689; + add r2689 r2662 into r2690; + cast r2688 r2690 into r2691 as U256__8JquwLopp8; + shl r2683 64u8 into r2692; + add r2692 r2677 into r2693; + shl r2671 64u8 into r2694; + add r2694 r2665 into r2695; + cast r2224 into r2696 as u8; + is.eq r2696 0u8 into r2697; + sub 128u8 r2696 into r2698; + shl.w r2693 r2698 into r2699; + ternary r2697 0u128 r2699 into r2700; + shr r2695 r2696 into r2701; + or r2701 r2700 into r2702; + shr r2693 r2696 into r2703; + ternary r2234 0u128 r2703 into r2704; + ternary r2234 r2703 r2702 into r2705; + cast r2704 r2705 into r2706 as U256__8JquwLopp8; + is.eq r2706.hi 0u128 into r2707; + is.eq r2706.lo 0u128 into r2708; + and r2707 r2708 into r2709; + not r2709 into r2710; + is.eq r2691.hi 340282366920938463463374607431768211455u128 into r2711; + is.eq r2691.lo 340282366920938463463374607431768211455u128 into r2712; + and r2711 r2712 into r2713; + and r2710 r2713 into r2714; + not r2714 into r2715; + assert.eq r2715 true; + add.w r2691.lo 1u128 into r2716; + lt r2716 r2691.lo into r2717; + ternary r2717 1u128 0u128 into r2718; + add.w r2691.hi r2718 into r2719; + cast r2719 r2716 into r2720 as U256__8JquwLopp8; + ternary r2710 r2720.hi r2691.hi into r2721; + ternary r2710 r2720.lo r2691.lo into r2722; + cast r2721 r2722 into r2723 as U256__8JquwLopp8; + ternary r1540 r0.hi r2723.hi into r2724; + ternary r1540 r0.lo r2723.lo into r2725; + cast r2724 r2725 into r2726 as U256__8JquwLopp8; + cast 0u128 r109 into r2727 as U256__8JquwLopp8; + cast 0u128 r1539 into r2728 as U256__8JquwLopp8; + shr r2727.lo 64u8 into r2729; + and r2727.lo 18446744073709551615u128 into r2730; + shr r2727.lo 64u8 into r2731; + and r2730 18446744073709551615u128 into r2732; + shr r2730 64u8 into r2733; + and r2731 18446744073709551615u128 into r2734; + add r2733 r2734 into r2735; + and r2735 18446744073709551615u128 into r2736; + shr r2735 64u8 into r2737; + shr r2731 64u8 into r2738; + add r2738 r2737 into r2739; + and r2739 18446744073709551615u128 into r2740; + shr r2739 64u8 into r2741; + shl r2741 64u8 into r2742; + add r2742 r2740 into r2743; + shl r2736 64u8 into r2744; + add r2744 r2732 into r2745; + shr r2727.hi 64u8 into r2746; + and r2727.hi 18446744073709551615u128 into r2747; + shr r2727.hi 64u8 into r2748; + and r2747 18446744073709551615u128 into r2749; + shr r2747 64u8 into r2750; + and r2748 18446744073709551615u128 into r2751; + add r2750 r2751 into r2752; + and r2752 18446744073709551615u128 into r2753; + shr r2752 64u8 into r2754; + shr r2748 64u8 into r2755; + add r2755 r2754 into r2756; + and r2756 18446744073709551615u128 into r2757; + shr r2756 64u8 into r2758; + shl r2758 64u8 into r2759; + add r2759 r2757 into r2760; + shl r2753 64u8 into r2761; + add r2761 r2749 into r2762; + lt r2745 0u128 into r2763; + ternary r2763 1u128 0u128 into r2764; + lt r2745 r2745 into r2765; + ternary r2765 1u128 0u128 into r2766; + add r2764 r2766 into r2767; + lt r2743 r2743 into r2768; + ternary r2768 1u128 0u128 into r2769; + add.w r2743 r2762 into r2770; + lt r2770 r2743 into r2771; + ternary r2771 1u128 0u128 into r2772; + add.w r2770 r2767 into r2773; + lt r2773 r2770 into r2774; + ternary r2774 1u128 0u128 into r2775; + add r2769 r2772 into r2776; + add r2776 r2775 into r2777; + add.w r2760 r2777 into r2778; + cast r2778 r2773 into r2779 as U256__8JquwLopp8; + cast r2745 0u128 into r2780 as U256__8JquwLopp8; + lt r2779.hi r2728.hi into r2781; + gt r2779.hi r2728.hi into r2782; + lt r2779.lo r2728.lo into r2783; + ternary r2782 false r2783 into r2784; + ternary r2781 true r2784 into r2785; + assert.eq r2785 true; + gt r2728.hi 0u128 into r2786; + ternary r2786 r2728.hi r2728.lo into r2787; + ternary r2786 128u32 0u32 into r2788; + gte r2787 18446744073709551616u128 into r2789; + shr r2787 64u8 into r2790; + ternary r2789 r2790 r2787 into r2791; + ternary r2789 64u32 0u32 into r2792; + gte r2791 4294967296u128 into r2793; + shr r2791 32u8 into r2794; + add r2792 32u32 into r2795; + ternary r2793 r2794 r2791 into r2796; + ternary r2793 r2795 r2792 into r2797; + gte r2796 65536u128 into r2798; + shr r2796 16u8 into r2799; + add r2797 16u32 into r2800; + ternary r2798 r2799 r2796 into r2801; + ternary r2798 r2800 r2797 into r2802; + gte r2801 256u128 into r2803; + shr r2801 8u8 into r2804; + add r2802 8u32 into r2805; + ternary r2803 r2804 r2801 into r2806; + ternary r2803 r2805 r2802 into r2807; + gte r2806 16u128 into r2808; + shr r2806 4u8 into r2809; + add r2807 4u32 into r2810; + ternary r2808 r2809 r2806 into r2811; + ternary r2808 r2810 r2807 into r2812; + gte r2811 4u128 into r2813; + shr r2811 2u8 into r2814; + add r2812 2u32 into r2815; + ternary r2813 r2814 r2811 into r2816; + ternary r2813 r2815 r2812 into r2817; + gte r2816 2u128 into r2818; + add r2817 1u32 into r2819; + ternary r2818 r2819 r2817 into r2820; + add r2788 r2820 into r2821; + sub 255u32 r2821 into r2822; + cast r2822 into r2823 as u16; + and r2823 127u16 into r2824; + cast r2824 into r2825 as u8; + is.eq r2825 0u8 into r2826; + sub 128u8 r2825 into r2827; + shr.w r2728.lo r2827 into r2828; + ternary r2826 0u128 r2828 into r2829; + shl.w r2728.hi r2825 into r2830; + or r2830 r2829 into r2831; + shl.w r2728.lo r2825 into r2832; + shl.w r2728.lo r2825 into r2833; + gte r2823 128u16 into r2834; + ternary r2834 r2833 r2831 into r2835; + ternary r2834 0u128 r2832 into r2836; + cast r2835 r2836 into r2837 as U256__8JquwLopp8; + and r2837.lo 18446744073709551615u128 into r2838; + shr r2837.lo 64u8 into r2839; + and r2837.hi 18446744073709551615u128 into r2840; + shr r2837.hi 64u8 into r2841; + cast r2824 into r2842 as u8; + is.eq r2842 0u8 into r2843; + sub 128u8 r2842 into r2844; + shr.w r2780.lo r2844 into r2845; + ternary r2843 0u128 r2845 into r2846; + shl.w r2780.hi r2842 into r2847; + or r2847 r2846 into r2848; + shl.w r2780.lo r2842 into r2849; + shl.w r2780.lo r2842 into r2850; + ternary r2834 r2850 r2848 into r2851; + ternary r2834 0u128 r2849 into r2852; + cast r2851 r2852 into r2853 as U256__8JquwLopp8; + is.eq r2823 0u16 into r2854; + sub 256u16 r2823 into r2855; + and r2855 127u16 into r2856; + cast r2856 into r2857 as u8; + is.eq r2857 0u8 into r2858; + sub 128u8 r2857 into r2859; + shl.w r2780.hi r2859 into r2860; + ternary r2858 0u128 r2860 into r2861; + shr r2780.lo r2857 into r2862; + or r2862 r2861 into r2863; + shr r2780.hi r2857 into r2864; + shr r2780.hi r2857 into r2865; + gte r2855 128u16 into r2866; + ternary r2866 0u128 r2864 into r2867; + ternary r2866 r2865 r2863 into r2868; + cast r2867 r2868 into r2869 as U256__8JquwLopp8; + ternary r2854 0u128 r2869.hi into r2870; + ternary r2854 0u128 r2869.lo into r2871; + cast r2870 r2871 into r2872 as U256__8JquwLopp8; + cast r2824 into r2873 as u8; + is.eq r2873 0u8 into r2874; + sub 128u8 r2873 into r2875; + shr.w r2779.lo r2875 into r2876; + ternary r2874 0u128 r2876 into r2877; + shl.w r2779.hi r2873 into r2878; + or r2878 r2877 into r2879; + shl.w r2779.lo r2873 into r2880; + shl.w r2779.lo r2873 into r2881; + ternary r2834 r2881 r2879 into r2882; + ternary r2834 0u128 r2880 into r2883; + cast r2882 r2883 into r2884 as U256__8JquwLopp8; + add.w r2884.lo r2872.lo into r2885; + lt r2885 r2884.lo into r2886; + ternary r2886 1u128 0u128 into r2887; + add.w r2884.hi r2872.hi into r2888; + add.w r2888 r2887 into r2889; + cast r2889 r2885 into r2890 as U256__8JquwLopp8; + and r2853.lo 18446744073709551615u128 into r2891; + shr r2853.lo 64u8 into r2892; + and r2853.hi 18446744073709551615u128 into r2893; + shr r2853.hi 64u8 into r2894; + and r2890.lo 18446744073709551615u128 into r2895; + shr r2890.lo 64u8 into r2896; + and r2890.hi 18446744073709551615u128 into r2897; + shr r2890.hi 64u8 into r2898; + shl r2898 64u8 into r2899; + add r2899 r2897 into r2900; + div r2900 r2841 into r2901; + gt r2901 18446744073709551615u128 into r2902; + ternary r2902 18446744073709551615u128 r2901 into r2903; + mul r2903 r2841 into r2904; + sub r2900 r2904 into r2905; + lte r2905 18446744073709551615u128 into r2906; + mul r2903 r2840 into r2907; + and r2905 18446744073709551615u128 into r2908; + shl r2908 64u8 into r2909; + add r2909 r2896 into r2910; + gt r2907 r2910 into r2911; + and r2906 r2911 into r2912; + sub.w r2903 1u128 into r2913; + ternary r2912 r2913 r2903 into r2914; + add r2905 r2841 into r2915; + ternary r2912 r2915 r2905 into r2916; + lte r2916 18446744073709551615u128 into r2917; + and r2912 r2917 into r2918; + mul r2914 r2840 into r2919; + and r2916 18446744073709551615u128 into r2920; + shl r2920 64u8 into r2921; + add r2921 r2896 into r2922; + gt r2919 r2922 into r2923; + and r2918 r2923 into r2924; + sub.w r2914 1u128 into r2925; + ternary r2924 r2925 r2914 into r2926; + mul r2926 r2838 into r2927; + and r2927 18446744073709551615u128 into r2928; + lt r2894 r2928 into r2929; + add r2894 18446744073709551616u128 into r2930; + sub r2930 r2928 into r2931; + and r2931 18446744073709551615u128 into r2932; + shr r2927 64u8 into r2933; + ternary r2929 1u128 0u128 into r2934; + add r2933 r2934 into r2935; + mul r2926 r2839 into r2936; + add r2936 r2935 into r2937; + and r2937 18446744073709551615u128 into r2938; + lt r2895 r2938 into r2939; + add r2895 18446744073709551616u128 into r2940; + sub r2940 r2938 into r2941; + and r2941 18446744073709551615u128 into r2942; + shr r2937 64u8 into r2943; + ternary r2939 1u128 0u128 into r2944; + add r2943 r2944 into r2945; + mul r2926 r2840 into r2946; + add r2946 r2945 into r2947; + and r2947 18446744073709551615u128 into r2948; + lt r2896 r2948 into r2949; + add r2896 18446744073709551616u128 into r2950; + sub r2950 r2948 into r2951; + and r2951 18446744073709551615u128 into r2952; + shr r2947 64u8 into r2953; + ternary r2949 1u128 0u128 into r2954; + add r2953 r2954 into r2955; + mul r2926 r2841 into r2956; + add r2956 r2955 into r2957; + and r2957 18446744073709551615u128 into r2958; + lt r2897 r2958 into r2959; + add r2897 18446744073709551616u128 into r2960; + sub r2960 r2958 into r2961; + and r2961 18446744073709551615u128 into r2962; + shr r2957 64u8 into r2963; + ternary r2959 1u128 0u128 into r2964; + add r2963 r2964 into r2965; + lt r2898 r2965 into r2966; + add r2898 18446744073709551616u128 into r2967; + sub r2967 r2965 into r2968; + and r2968 18446744073709551615u128 into r2969; + sub.w r2926 1u128 into r2970; + ternary r2966 r2970 r2926 into r2971; + add r2932 r2838 into r2972; + and r2972 18446744073709551615u128 into r2973; + ternary r2966 r2973 r2932 into r2974; + shr r2972 64u8 into r2975; + ternary r2966 r2975 0u128 into r2976; + add r2942 r2839 into r2977; + add r2977 r2976 into r2978; + and r2978 18446744073709551615u128 into r2979; + ternary r2966 r2979 r2942 into r2980; + shr r2978 64u8 into r2981; + ternary r2966 r2981 0u128 into r2982; + add r2952 r2840 into r2983; + add r2983 r2982 into r2984; + and r2984 18446744073709551615u128 into r2985; + ternary r2966 r2985 r2952 into r2986; + shr r2984 64u8 into r2987; + ternary r2966 r2987 0u128 into r2988; + add r2962 r2841 into r2989; + add r2989 r2988 into r2990; + and r2990 18446744073709551615u128 into r2991; + ternary r2966 r2991 r2962 into r2992; + shr r2990 64u8 into r2993; + ternary r2966 r2993 0u128 into r2994; + add r2969 r2994 into r2995; + shl r2992 64u8 into r2996; + add r2996 r2986 into r2997; + div r2997 r2841 into r2998; + gt r2998 18446744073709551615u128 into r2999; + ternary r2999 18446744073709551615u128 r2998 into r3000; + mul r3000 r2841 into r3001; + sub r2997 r3001 into r3002; + lte r3002 18446744073709551615u128 into r3003; + mul r3000 r2840 into r3004; + and r3002 18446744073709551615u128 into r3005; + shl r3005 64u8 into r3006; + add r3006 r2980 into r3007; + gt r3004 r3007 into r3008; + and r3003 r3008 into r3009; + sub.w r3000 1u128 into r3010; + ternary r3009 r3010 r3000 into r3011; + add r3002 r2841 into r3012; + ternary r3009 r3012 r3002 into r3013; + lte r3013 18446744073709551615u128 into r3014; + and r3009 r3014 into r3015; + mul r3011 r2840 into r3016; + and r3013 18446744073709551615u128 into r3017; + shl r3017 64u8 into r3018; + add r3018 r2980 into r3019; + gt r3016 r3019 into r3020; + and r3015 r3020 into r3021; + sub.w r3011 1u128 into r3022; + ternary r3021 r3022 r3011 into r3023; + mul r3023 r2838 into r3024; + and r3024 18446744073709551615u128 into r3025; + lt r2893 r3025 into r3026; + add r2893 18446744073709551616u128 into r3027; + sub r3027 r3025 into r3028; + and r3028 18446744073709551615u128 into r3029; + shr r3024 64u8 into r3030; + ternary r3026 1u128 0u128 into r3031; + add r3030 r3031 into r3032; + mul r3023 r2839 into r3033; + add r3033 r3032 into r3034; + and r3034 18446744073709551615u128 into r3035; + lt r2974 r3035 into r3036; + add r2974 18446744073709551616u128 into r3037; + sub r3037 r3035 into r3038; + and r3038 18446744073709551615u128 into r3039; + shr r3034 64u8 into r3040; + ternary r3036 1u128 0u128 into r3041; + add r3040 r3041 into r3042; + mul r3023 r2840 into r3043; + add r3043 r3042 into r3044; + and r3044 18446744073709551615u128 into r3045; + lt r2980 r3045 into r3046; + add r2980 18446744073709551616u128 into r3047; + sub r3047 r3045 into r3048; + and r3048 18446744073709551615u128 into r3049; + shr r3044 64u8 into r3050; + ternary r3046 1u128 0u128 into r3051; + add r3050 r3051 into r3052; + mul r3023 r2841 into r3053; + add r3053 r3052 into r3054; + and r3054 18446744073709551615u128 into r3055; + lt r2986 r3055 into r3056; + add r2986 18446744073709551616u128 into r3057; + sub r3057 r3055 into r3058; + and r3058 18446744073709551615u128 into r3059; + shr r3054 64u8 into r3060; + ternary r3056 1u128 0u128 into r3061; + add r3060 r3061 into r3062; + lt r2992 r3062 into r3063; + add r2992 18446744073709551616u128 into r3064; + sub r3064 r3062 into r3065; + and r3065 18446744073709551615u128 into r3066; + sub.w r3023 1u128 into r3067; + ternary r3063 r3067 r3023 into r3068; + add r3029 r2838 into r3069; + and r3069 18446744073709551615u128 into r3070; + ternary r3063 r3070 r3029 into r3071; + shr r3069 64u8 into r3072; + ternary r3063 r3072 0u128 into r3073; + add r3039 r2839 into r3074; + add r3074 r3073 into r3075; + and r3075 18446744073709551615u128 into r3076; + ternary r3063 r3076 r3039 into r3077; + shr r3075 64u8 into r3078; + ternary r3063 r3078 0u128 into r3079; + add r3049 r2840 into r3080; + add r3080 r3079 into r3081; + and r3081 18446744073709551615u128 into r3082; + ternary r3063 r3082 r3049 into r3083; + shr r3081 64u8 into r3084; + ternary r3063 r3084 0u128 into r3085; + add r3059 r2841 into r3086; + add r3086 r3085 into r3087; + and r3087 18446744073709551615u128 into r3088; + ternary r3063 r3088 r3059 into r3089; + shr r3087 64u8 into r3090; + ternary r3063 r3090 0u128 into r3091; + add r3066 r3091 into r3092; + shl r3089 64u8 into r3093; + add r3093 r3083 into r3094; + div r3094 r2841 into r3095; + gt r3095 18446744073709551615u128 into r3096; + ternary r3096 18446744073709551615u128 r3095 into r3097; + mul r3097 r2841 into r3098; + sub r3094 r3098 into r3099; + lte r3099 18446744073709551615u128 into r3100; + mul r3097 r2840 into r3101; + and r3099 18446744073709551615u128 into r3102; + shl r3102 64u8 into r3103; + add r3103 r3077 into r3104; + gt r3101 r3104 into r3105; + and r3100 r3105 into r3106; + sub.w r3097 1u128 into r3107; + ternary r3106 r3107 r3097 into r3108; + add r3099 r2841 into r3109; + ternary r3106 r3109 r3099 into r3110; + lte r3110 18446744073709551615u128 into r3111; + and r3106 r3111 into r3112; + mul r3108 r2840 into r3113; + and r3110 18446744073709551615u128 into r3114; + shl r3114 64u8 into r3115; + add r3115 r3077 into r3116; + gt r3113 r3116 into r3117; + and r3112 r3117 into r3118; + sub.w r3108 1u128 into r3119; + ternary r3118 r3119 r3108 into r3120; + mul r3120 r2838 into r3121; + and r3121 18446744073709551615u128 into r3122; + lt r2892 r3122 into r3123; + add r2892 18446744073709551616u128 into r3124; + sub r3124 r3122 into r3125; + and r3125 18446744073709551615u128 into r3126; + shr r3121 64u8 into r3127; + ternary r3123 1u128 0u128 into r3128; + add r3127 r3128 into r3129; + mul r3120 r2839 into r3130; + add r3130 r3129 into r3131; + and r3131 18446744073709551615u128 into r3132; + lt r3071 r3132 into r3133; + add r3071 18446744073709551616u128 into r3134; + sub r3134 r3132 into r3135; + and r3135 18446744073709551615u128 into r3136; + shr r3131 64u8 into r3137; + ternary r3133 1u128 0u128 into r3138; + add r3137 r3138 into r3139; + mul r3120 r2840 into r3140; + add r3140 r3139 into r3141; + and r3141 18446744073709551615u128 into r3142; + lt r3077 r3142 into r3143; + add r3077 18446744073709551616u128 into r3144; + sub r3144 r3142 into r3145; + and r3145 18446744073709551615u128 into r3146; + shr r3141 64u8 into r3147; + ternary r3143 1u128 0u128 into r3148; + add r3147 r3148 into r3149; + mul r3120 r2841 into r3150; + add r3150 r3149 into r3151; + and r3151 18446744073709551615u128 into r3152; + lt r3083 r3152 into r3153; + add r3083 18446744073709551616u128 into r3154; + sub r3154 r3152 into r3155; + and r3155 18446744073709551615u128 into r3156; + shr r3151 64u8 into r3157; + ternary r3153 1u128 0u128 into r3158; + add r3157 r3158 into r3159; + lt r3089 r3159 into r3160; + add r3089 18446744073709551616u128 into r3161; + sub r3161 r3159 into r3162; + and r3162 18446744073709551615u128 into r3163; + sub.w r3120 1u128 into r3164; + ternary r3160 r3164 r3120 into r3165; + add r3126 r2838 into r3166; + and r3166 18446744073709551615u128 into r3167; + ternary r3160 r3167 r3126 into r3168; + shr r3166 64u8 into r3169; + ternary r3160 r3169 0u128 into r3170; + add r3136 r2839 into r3171; + add r3171 r3170 into r3172; + and r3172 18446744073709551615u128 into r3173; + ternary r3160 r3173 r3136 into r3174; + shr r3172 64u8 into r3175; + ternary r3160 r3175 0u128 into r3176; + add r3146 r2840 into r3177; + add r3177 r3176 into r3178; + and r3178 18446744073709551615u128 into r3179; + ternary r3160 r3179 r3146 into r3180; + shr r3178 64u8 into r3181; + ternary r3160 r3181 0u128 into r3182; + add r3156 r2841 into r3183; + add r3183 r3182 into r3184; + and r3184 18446744073709551615u128 into r3185; + ternary r3160 r3185 r3156 into r3186; + shr r3184 64u8 into r3187; + ternary r3160 r3187 0u128 into r3188; + add r3163 r3188 into r3189; + shl r3186 64u8 into r3190; + add r3190 r3180 into r3191; + div r3191 r2841 into r3192; + gt r3192 18446744073709551615u128 into r3193; + ternary r3193 18446744073709551615u128 r3192 into r3194; + mul r3194 r2841 into r3195; + sub r3191 r3195 into r3196; + lte r3196 18446744073709551615u128 into r3197; + mul r3194 r2840 into r3198; + and r3196 18446744073709551615u128 into r3199; + shl r3199 64u8 into r3200; + add r3200 r3174 into r3201; + gt r3198 r3201 into r3202; + and r3197 r3202 into r3203; + sub.w r3194 1u128 into r3204; + ternary r3203 r3204 r3194 into r3205; + add r3196 r2841 into r3206; + ternary r3203 r3206 r3196 into r3207; + lte r3207 18446744073709551615u128 into r3208; + and r3203 r3208 into r3209; + mul r3205 r2840 into r3210; + and r3207 18446744073709551615u128 into r3211; + shl r3211 64u8 into r3212; + add r3212 r3174 into r3213; + gt r3210 r3213 into r3214; + and r3209 r3214 into r3215; + sub.w r3205 1u128 into r3216; + ternary r3215 r3216 r3205 into r3217; + mul r3217 r2838 into r3218; + and r3218 18446744073709551615u128 into r3219; + lt r2891 r3219 into r3220; + add r2891 18446744073709551616u128 into r3221; + sub r3221 r3219 into r3222; + and r3222 18446744073709551615u128 into r3223; + shr r3218 64u8 into r3224; + ternary r3220 1u128 0u128 into r3225; + add r3224 r3225 into r3226; + mul r3217 r2839 into r3227; + add r3227 r3226 into r3228; + and r3228 18446744073709551615u128 into r3229; + lt r3168 r3229 into r3230; + add r3168 18446744073709551616u128 into r3231; + sub r3231 r3229 into r3232; + and r3232 18446744073709551615u128 into r3233; + shr r3228 64u8 into r3234; + ternary r3230 1u128 0u128 into r3235; + add r3234 r3235 into r3236; + mul r3217 r2840 into r3237; + add r3237 r3236 into r3238; + and r3238 18446744073709551615u128 into r3239; + lt r3174 r3239 into r3240; + add r3174 18446744073709551616u128 into r3241; + sub r3241 r3239 into r3242; + and r3242 18446744073709551615u128 into r3243; + shr r3238 64u8 into r3244; + ternary r3240 1u128 0u128 into r3245; + add r3244 r3245 into r3246; + mul r3217 r2841 into r3247; + add r3247 r3246 into r3248; + and r3248 18446744073709551615u128 into r3249; + lt r3180 r3249 into r3250; + add r3180 18446744073709551616u128 into r3251; + sub r3251 r3249 into r3252; + and r3252 18446744073709551615u128 into r3253; + shr r3248 64u8 into r3254; + ternary r3250 1u128 0u128 into r3255; + add r3254 r3255 into r3256; + lt r3186 r3256 into r3257; + add r3186 18446744073709551616u128 into r3258; + sub r3258 r3256 into r3259; + and r3259 18446744073709551615u128 into r3260; + sub.w r3217 1u128 into r3261; + ternary r3257 r3261 r3217 into r3262; + add r3223 r2838 into r3263; + and r3263 18446744073709551615u128 into r3264; + ternary r3257 r3264 r3223 into r3265; + shr r3263 64u8 into r3266; + ternary r3257 r3266 0u128 into r3267; + add r3233 r2839 into r3268; + add r3268 r3267 into r3269; + and r3269 18446744073709551615u128 into r3270; + ternary r3257 r3270 r3233 into r3271; + shr r3269 64u8 into r3272; + ternary r3257 r3272 0u128 into r3273; + add r3243 r2840 into r3274; + add r3274 r3273 into r3275; + and r3275 18446744073709551615u128 into r3276; + ternary r3257 r3276 r3243 into r3277; + shr r3275 64u8 into r3278; + ternary r3257 r3278 0u128 into r3279; + add r3253 r2841 into r3280; + add r3280 r3279 into r3281; + and r3281 18446744073709551615u128 into r3282; + ternary r3257 r3282 r3253 into r3283; + shr r3281 64u8 into r3284; + ternary r3257 r3284 0u128 into r3285; + add r3260 r3285 into r3286; + shl r2971 64u8 into r3287; + add r3287 r3068 into r3288; + shl r3165 64u8 into r3289; + add r3289 r3262 into r3290; + cast r3288 r3290 into r3291 as U256__8JquwLopp8; + shl r3283 64u8 into r3292; + add r3292 r3277 into r3293; + shl r3271 64u8 into r3294; + add r3294 r3265 into r3295; + cast r2824 into r3296 as u8; + sub 128u8 r3296 into r3297; + shr r3295 r3296 into r3298; + shr r3293 r3296 into r3299; + cast r3291.hi r3291.lo into r3300 as U256__8JquwLopp8; + add.w r0.lo r3300.lo into r3301; + lt r3301 r0.lo into r3302; + ternary r3302 1u128 0u128 into r3303; + add.w r0.hi r3300.hi into r3304; + add.w r3304 r3303 into r3305; + cast r3305 r3301 into r3306 as U256__8JquwLopp8; + cast r3306.hi r3306.lo into r3307 as U256__8JquwLopp8; + ternary r10 r2726.hi r3307.hi into r3308; + ternary r10 r2726.lo r3307.lo into r3309; + cast r3308 r3309 into r3310 as U256__8JquwLopp8; + ternary r1526 r1537.hi r3310.hi into r3311; + ternary r1526 r1537.lo r3310.lo into r3312; + cast r3311 r3312 into r3313 as U256__8JquwLopp8; + lt r0.hi r3313.hi into r3314; + gt r0.hi r3313.hi into r3315; + lt r0.lo r3313.lo into r3316; + ternary r3315 false r3316 into r3317; + ternary r3314 true r3317 into r3318; + ternary r3318 r0.hi r3313.hi into r3319; + ternary r3318 r0.lo r3313.lo into r3320; + cast r3319 r3320 into r3321 as U256__8JquwLopp8; + lt r0.hi r3313.hi into r3322; + gt r0.hi r3313.hi into r3323; + lt r0.lo r3313.lo into r3324; + ternary r3323 false r3324 into r3325; + ternary r3322 true r3325 into r3326; + ternary r3326 r3313.hi r0.hi into r3327; + ternary r3326 r3313.lo r0.lo into r3328; + cast r3327 r3328 into r3329 as U256__8JquwLopp8; + lt r3329.lo r3321.lo into r3330; + ternary r3330 1u128 0u128 into r3331; + sub.w r3329.lo r3321.lo into r3332; + sub.w r3329.hi r3321.hi into r3333; + sub.w r3333 r3331 into r3334; + cast r3334 r3332 into r3335 as U256__8JquwLopp8; + cast 0u128 r1 into r3336 as U256__8JquwLopp8; + and r3336.lo 18446744073709551615u128 into r3337; + shr r3336.lo 64u8 into r3338; + and r3335.lo 18446744073709551615u128 into r3339; + shr r3335.lo 64u8 into r3340; + mul r3337 r3339 into r3341; + mul r3337 r3340 into r3342; + mul r3338 r3339 into r3343; + mul r3338 r3340 into r3344; + and r3341 18446744073709551615u128 into r3345; + shr r3341 64u8 into r3346; + and r3342 18446744073709551615u128 into r3347; + add r3346 r3347 into r3348; + and r3343 18446744073709551615u128 into r3349; + add r3348 r3349 into r3350; + and r3350 18446744073709551615u128 into r3351; + shr r3350 64u8 into r3352; + shr r3342 64u8 into r3353; + shr r3343 64u8 into r3354; + add r3353 r3354 into r3355; + and r3344 18446744073709551615u128 into r3356; + add r3355 r3356 into r3357; + add r3357 r3352 into r3358; + and r3358 18446744073709551615u128 into r3359; + shr r3358 64u8 into r3360; + shr r3344 64u8 into r3361; + add r3361 r3360 into r3362; + shl r3362 64u8 into r3363; + add r3363 r3359 into r3364; + shl r3351 64u8 into r3365; + add r3365 r3345 into r3366; + and r3336.lo 18446744073709551615u128 into r3367; + shr r3336.lo 64u8 into r3368; + and r3335.hi 18446744073709551615u128 into r3369; + shr r3335.hi 64u8 into r3370; + mul r3367 r3369 into r3371; + mul r3367 r3370 into r3372; + mul r3368 r3369 into r3373; + mul r3368 r3370 into r3374; + and r3371 18446744073709551615u128 into r3375; + shr r3371 64u8 into r3376; + and r3372 18446744073709551615u128 into r3377; + add r3376 r3377 into r3378; + and r3373 18446744073709551615u128 into r3379; + add r3378 r3379 into r3380; + and r3380 18446744073709551615u128 into r3381; + shr r3380 64u8 into r3382; + shr r3372 64u8 into r3383; + shr r3373 64u8 into r3384; + add r3383 r3384 into r3385; + and r3374 18446744073709551615u128 into r3386; + add r3385 r3386 into r3387; + add r3387 r3382 into r3388; + and r3388 18446744073709551615u128 into r3389; + shr r3388 64u8 into r3390; + shr r3374 64u8 into r3391; + add r3391 r3390 into r3392; + shl r3392 64u8 into r3393; + add r3393 r3389 into r3394; + shl r3381 64u8 into r3395; + add r3395 r3375 into r3396; + and r3336.hi 18446744073709551615u128 into r3397; + shr r3336.hi 64u8 into r3398; + and r3335.lo 18446744073709551615u128 into r3399; + shr r3335.lo 64u8 into r3400; + mul r3397 r3399 into r3401; + mul r3397 r3400 into r3402; + mul r3398 r3399 into r3403; + mul r3398 r3400 into r3404; + and r3401 18446744073709551615u128 into r3405; + shr r3401 64u8 into r3406; + and r3402 18446744073709551615u128 into r3407; + add r3406 r3407 into r3408; + and r3403 18446744073709551615u128 into r3409; + add r3408 r3409 into r3410; + and r3410 18446744073709551615u128 into r3411; + shr r3410 64u8 into r3412; + shr r3402 64u8 into r3413; + shr r3403 64u8 into r3414; + add r3413 r3414 into r3415; + and r3404 18446744073709551615u128 into r3416; + add r3415 r3416 into r3417; + add r3417 r3412 into r3418; + and r3418 18446744073709551615u128 into r3419; + shr r3418 64u8 into r3420; + shr r3404 64u8 into r3421; + add r3421 r3420 into r3422; + shl r3422 64u8 into r3423; + add r3423 r3419 into r3424; + shl r3411 64u8 into r3425; + add r3425 r3405 into r3426; + and r3336.hi 18446744073709551615u128 into r3427; + shr r3336.hi 64u8 into r3428; + and r3335.hi 18446744073709551615u128 into r3429; + shr r3335.hi 64u8 into r3430; + mul r3427 r3429 into r3431; + mul r3427 r3430 into r3432; + mul r3428 r3429 into r3433; + mul r3428 r3430 into r3434; + and r3431 18446744073709551615u128 into r3435; + shr r3431 64u8 into r3436; + and r3432 18446744073709551615u128 into r3437; + add r3436 r3437 into r3438; + and r3433 18446744073709551615u128 into r3439; + add r3438 r3439 into r3440; + and r3440 18446744073709551615u128 into r3441; + shr r3440 64u8 into r3442; + shr r3432 64u8 into r3443; + shr r3433 64u8 into r3444; + add r3443 r3444 into r3445; + and r3434 18446744073709551615u128 into r3446; + add r3445 r3446 into r3447; + add r3447 r3442 into r3448; + and r3448 18446744073709551615u128 into r3449; + shr r3448 64u8 into r3450; + shr r3434 64u8 into r3451; + add r3451 r3450 into r3452; + shl r3452 64u8 into r3453; + add r3453 r3449 into r3454; + shl r3441 64u8 into r3455; + add r3455 r3435 into r3456; + add.w r3364 r3396 into r3457; + lt r3457 r3364 into r3458; + ternary r3458 1u128 0u128 into r3459; + add.w r3457 r3426 into r3460; + lt r3460 r3457 into r3461; + ternary r3461 1u128 0u128 into r3462; + add r3459 r3462 into r3463; + add.w r3394 r3424 into r3464; + lt r3464 r3394 into r3465; + ternary r3465 1u128 0u128 into r3466; + add.w r3464 r3456 into r3467; + lt r3467 r3464 into r3468; + ternary r3468 1u128 0u128 into r3469; + add.w r3467 r3463 into r3470; + lt r3470 r3467 into r3471; + ternary r3471 1u128 0u128 into r3472; + add r3466 r3469 into r3473; + add r3473 r3472 into r3474; + add.w r3454 r3474 into r3475; + cast r3475 r3470 into r3476 as U256__8JquwLopp8; + cast r3460 r3366 into r3477 as U256__8JquwLopp8; + is.neq r3476.hi 0u128 into r3478; + is.neq r3476.lo 0u128 into r3479; + or r3478 r3479 into r3480; + lt r0.hi r3313.hi into r3481; + gt r0.hi r3313.hi into r3482; + lt r0.lo r3313.lo into r3483; + ternary r3482 false r3483 into r3484; + ternary r3481 true r3484 into r3485; + ternary r3485 r0.hi r3313.hi into r3486; + ternary r3485 r0.lo r3313.lo into r3487; + cast r3486 r3487 into r3488 as U256__8JquwLopp8; + lt r0.hi r3313.hi into r3489; + gt r0.hi r3313.hi into r3490; + lt r0.lo r3313.lo into r3491; + ternary r3490 false r3491 into r3492; + ternary r3489 true r3492 into r3493; + ternary r3493 r3313.hi r0.hi into r3494; + ternary r3493 r3313.lo r0.lo into r3495; + cast r3494 r3495 into r3496 as U256__8JquwLopp8; + lt r3496.lo r3488.lo into r3497; + ternary r3497 1u128 0u128 into r3498; + sub.w r3496.lo r3488.lo into r3499; + sub.w r3496.hi r3488.hi into r3500; + sub.w r3500 r3498 into r3501; + cast r3501 r3499 into r3502 as U256__8JquwLopp8; + shr r3502.lo 64u8 into r3503; + shr r3502.hi 64u8 into r3504; + and r3502.lo 18446744073709551615u128 into r3505; + shr r3502.lo 64u8 into r3506; + mul r135 r3505 into r3507; + mul r135 r3506 into r3508; + mul r136 r3505 into r3509; + mul r136 r3506 into r3510; + and r3507 18446744073709551615u128 into r3511; + shr r3507 64u8 into r3512; + and r3508 18446744073709551615u128 into r3513; + add r3512 r3513 into r3514; + and r3509 18446744073709551615u128 into r3515; + add r3514 r3515 into r3516; + and r3516 18446744073709551615u128 into r3517; + shr r3516 64u8 into r3518; + shr r3508 64u8 into r3519; + shr r3509 64u8 into r3520; + add r3519 r3520 into r3521; + and r3510 18446744073709551615u128 into r3522; + add r3521 r3522 into r3523; + add r3523 r3518 into r3524; + and r3524 18446744073709551615u128 into r3525; + shr r3524 64u8 into r3526; + shr r3510 64u8 into r3527; + add r3527 r3526 into r3528; + shl r3528 64u8 into r3529; + add r3529 r3525 into r3530; + shl r3517 64u8 into r3531; + add r3531 r3511 into r3532; + and r3502.hi 18446744073709551615u128 into r3533; + shr r3502.hi 64u8 into r3534; + mul r135 r3533 into r3535; + mul r135 r3534 into r3536; + mul r136 r3533 into r3537; + mul r136 r3534 into r3538; + and r3535 18446744073709551615u128 into r3539; + shr r3535 64u8 into r3540; + and r3536 18446744073709551615u128 into r3541; + add r3540 r3541 into r3542; + and r3537 18446744073709551615u128 into r3543; + add r3542 r3543 into r3544; + and r3544 18446744073709551615u128 into r3545; + shr r3544 64u8 into r3546; + shr r3536 64u8 into r3547; + shr r3537 64u8 into r3548; + add r3547 r3548 into r3549; + and r3538 18446744073709551615u128 into r3550; + add r3549 r3550 into r3551; + add r3551 r3546 into r3552; + and r3552 18446744073709551615u128 into r3553; + shr r3552 64u8 into r3554; + shr r3538 64u8 into r3555; + add r3555 r3554 into r3556; + shl r3556 64u8 into r3557; + add r3557 r3553 into r3558; + shl r3545 64u8 into r3559; + add r3559 r3539 into r3560; + lt r3532 0u128 into r3561; + ternary r3561 1u128 0u128 into r3562; + lt r3530 0u128 into r3563; + ternary r3563 1u128 0u128 into r3564; + add.w r3530 r3560 into r3565; + lt r3565 r3530 into r3566; + ternary r3566 1u128 0u128 into r3567; + add.w r3565 r3562 into r3568; + lt r3568 r3565 into r3569; + ternary r3569 1u128 0u128 into r3570; + add r3564 r3567 into r3571; + add r3571 r3570 into r3572; + add.w r3558 r3572 into r3573; + cast r3573 r3568 into r3574 as U256__8JquwLopp8; + cast r3532 0u128 into r3575 as U256__8JquwLopp8; + lt r3574.hi r3496.hi into r3576; + gt r3574.hi r3496.hi into r3577; + lt r3574.lo r3496.lo into r3578; + ternary r3577 false r3578 into r3579; + ternary r3576 true r3579 into r3580; + assert.eq r3580 true; + gt r3496.hi 0u128 into r3581; + ternary r3581 r3496.hi r3496.lo into r3582; + ternary r3581 128u32 0u32 into r3583; + gte r3582 18446744073709551616u128 into r3584; + shr r3582 64u8 into r3585; + ternary r3584 r3585 r3582 into r3586; + ternary r3584 64u32 0u32 into r3587; + gte r3586 4294967296u128 into r3588; + shr r3586 32u8 into r3589; + add r3587 32u32 into r3590; + ternary r3588 r3589 r3586 into r3591; + ternary r3588 r3590 r3587 into r3592; + gte r3591 65536u128 into r3593; + shr r3591 16u8 into r3594; + add r3592 16u32 into r3595; + ternary r3593 r3594 r3591 into r3596; + ternary r3593 r3595 r3592 into r3597; + gte r3596 256u128 into r3598; + shr r3596 8u8 into r3599; + add r3597 8u32 into r3600; + ternary r3598 r3599 r3596 into r3601; + ternary r3598 r3600 r3597 into r3602; + gte r3601 16u128 into r3603; + shr r3601 4u8 into r3604; + add r3602 4u32 into r3605; + ternary r3603 r3604 r3601 into r3606; + ternary r3603 r3605 r3602 into r3607; + gte r3606 4u128 into r3608; + shr r3606 2u8 into r3609; + add r3607 2u32 into r3610; + ternary r3608 r3609 r3606 into r3611; + ternary r3608 r3610 r3607 into r3612; + gte r3611 2u128 into r3613; + add r3612 1u32 into r3614; + ternary r3613 r3614 r3612 into r3615; + add r3583 r3615 into r3616; + sub 255u32 r3616 into r3617; + cast r3617 into r3618 as u16; + and r3618 127u16 into r3619; + cast r3619 into r3620 as u8; + is.eq r3620 0u8 into r3621; + sub 128u8 r3620 into r3622; + shr.w r3496.lo r3622 into r3623; + ternary r3621 0u128 r3623 into r3624; + shl.w r3496.hi r3620 into r3625; + or r3625 r3624 into r3626; + shl.w r3496.lo r3620 into r3627; + shl.w r3496.lo r3620 into r3628; + gte r3618 128u16 into r3629; + ternary r3629 r3628 r3626 into r3630; + ternary r3629 0u128 r3627 into r3631; + cast r3630 r3631 into r3632 as U256__8JquwLopp8; + and r3632.lo 18446744073709551615u128 into r3633; + shr r3632.lo 64u8 into r3634; + and r3632.hi 18446744073709551615u128 into r3635; + shr r3632.hi 64u8 into r3636; + cast r3619 into r3637 as u8; + is.eq r3637 0u8 into r3638; + sub 128u8 r3637 into r3639; + shr.w r3575.lo r3639 into r3640; + ternary r3638 0u128 r3640 into r3641; + shl.w r3575.hi r3637 into r3642; + or r3642 r3641 into r3643; + shl.w r3575.lo r3637 into r3644; + shl.w r3575.lo r3637 into r3645; + ternary r3629 r3645 r3643 into r3646; + ternary r3629 0u128 r3644 into r3647; + cast r3646 r3647 into r3648 as U256__8JquwLopp8; + is.eq r3618 0u16 into r3649; + sub 256u16 r3618 into r3650; + and r3650 127u16 into r3651; + cast r3651 into r3652 as u8; + is.eq r3652 0u8 into r3653; + sub 128u8 r3652 into r3654; + shl.w r3575.hi r3654 into r3655; + ternary r3653 0u128 r3655 into r3656; + shr r3575.lo r3652 into r3657; + or r3657 r3656 into r3658; + shr r3575.hi r3652 into r3659; + shr r3575.hi r3652 into r3660; + gte r3650 128u16 into r3661; + ternary r3661 0u128 r3659 into r3662; + ternary r3661 r3660 r3658 into r3663; + cast r3662 r3663 into r3664 as U256__8JquwLopp8; + ternary r3649 0u128 r3664.hi into r3665; + ternary r3649 0u128 r3664.lo into r3666; + cast r3665 r3666 into r3667 as U256__8JquwLopp8; + cast r3619 into r3668 as u8; + is.eq r3668 0u8 into r3669; + sub 128u8 r3668 into r3670; + shr.w r3574.lo r3670 into r3671; + ternary r3669 0u128 r3671 into r3672; + shl.w r3574.hi r3668 into r3673; + or r3673 r3672 into r3674; + shl.w r3574.lo r3668 into r3675; + shl.w r3574.lo r3668 into r3676; + ternary r3629 r3676 r3674 into r3677; + ternary r3629 0u128 r3675 into r3678; + cast r3677 r3678 into r3679 as U256__8JquwLopp8; + add.w r3679.lo r3667.lo into r3680; + lt r3680 r3679.lo into r3681; + ternary r3681 1u128 0u128 into r3682; + add.w r3679.hi r3667.hi into r3683; + add.w r3683 r3682 into r3684; + cast r3684 r3680 into r3685 as U256__8JquwLopp8; + and r3648.lo 18446744073709551615u128 into r3686; + shr r3648.lo 64u8 into r3687; + and r3648.hi 18446744073709551615u128 into r3688; + shr r3648.hi 64u8 into r3689; + and r3685.lo 18446744073709551615u128 into r3690; + shr r3685.lo 64u8 into r3691; + and r3685.hi 18446744073709551615u128 into r3692; + shr r3685.hi 64u8 into r3693; + shl r3693 64u8 into r3694; + add r3694 r3692 into r3695; + div r3695 r3636 into r3696; + gt r3696 18446744073709551615u128 into r3697; + ternary r3697 18446744073709551615u128 r3696 into r3698; + mul r3698 r3636 into r3699; + sub r3695 r3699 into r3700; + lte r3700 18446744073709551615u128 into r3701; + mul r3698 r3635 into r3702; + and r3700 18446744073709551615u128 into r3703; + shl r3703 64u8 into r3704; + add r3704 r3691 into r3705; + gt r3702 r3705 into r3706; + and r3701 r3706 into r3707; + sub.w r3698 1u128 into r3708; + ternary r3707 r3708 r3698 into r3709; + add r3700 r3636 into r3710; + ternary r3707 r3710 r3700 into r3711; + lte r3711 18446744073709551615u128 into r3712; + and r3707 r3712 into r3713; + mul r3709 r3635 into r3714; + and r3711 18446744073709551615u128 into r3715; + shl r3715 64u8 into r3716; + add r3716 r3691 into r3717; + gt r3714 r3717 into r3718; + and r3713 r3718 into r3719; + sub.w r3709 1u128 into r3720; + ternary r3719 r3720 r3709 into r3721; + mul r3721 r3633 into r3722; + and r3722 18446744073709551615u128 into r3723; + lt r3689 r3723 into r3724; + add r3689 18446744073709551616u128 into r3725; + sub r3725 r3723 into r3726; + and r3726 18446744073709551615u128 into r3727; + shr r3722 64u8 into r3728; + ternary r3724 1u128 0u128 into r3729; + add r3728 r3729 into r3730; + mul r3721 r3634 into r3731; + add r3731 r3730 into r3732; + and r3732 18446744073709551615u128 into r3733; + lt r3690 r3733 into r3734; + add r3690 18446744073709551616u128 into r3735; + sub r3735 r3733 into r3736; + and r3736 18446744073709551615u128 into r3737; + shr r3732 64u8 into r3738; + ternary r3734 1u128 0u128 into r3739; + add r3738 r3739 into r3740; + mul r3721 r3635 into r3741; + add r3741 r3740 into r3742; + and r3742 18446744073709551615u128 into r3743; + lt r3691 r3743 into r3744; + add r3691 18446744073709551616u128 into r3745; + sub r3745 r3743 into r3746; + and r3746 18446744073709551615u128 into r3747; + shr r3742 64u8 into r3748; + ternary r3744 1u128 0u128 into r3749; + add r3748 r3749 into r3750; + mul r3721 r3636 into r3751; + add r3751 r3750 into r3752; + and r3752 18446744073709551615u128 into r3753; + lt r3692 r3753 into r3754; + add r3692 18446744073709551616u128 into r3755; + sub r3755 r3753 into r3756; + and r3756 18446744073709551615u128 into r3757; + shr r3752 64u8 into r3758; + ternary r3754 1u128 0u128 into r3759; + add r3758 r3759 into r3760; + lt r3693 r3760 into r3761; + add r3693 18446744073709551616u128 into r3762; + sub r3762 r3760 into r3763; + and r3763 18446744073709551615u128 into r3764; + sub.w r3721 1u128 into r3765; + ternary r3761 r3765 r3721 into r3766; + add r3727 r3633 into r3767; + and r3767 18446744073709551615u128 into r3768; + ternary r3761 r3768 r3727 into r3769; + shr r3767 64u8 into r3770; + ternary r3761 r3770 0u128 into r3771; + add r3737 r3634 into r3772; + add r3772 r3771 into r3773; + and r3773 18446744073709551615u128 into r3774; + ternary r3761 r3774 r3737 into r3775; + shr r3773 64u8 into r3776; + ternary r3761 r3776 0u128 into r3777; + add r3747 r3635 into r3778; + add r3778 r3777 into r3779; + and r3779 18446744073709551615u128 into r3780; + ternary r3761 r3780 r3747 into r3781; + shr r3779 64u8 into r3782; + ternary r3761 r3782 0u128 into r3783; + add r3757 r3636 into r3784; + add r3784 r3783 into r3785; + and r3785 18446744073709551615u128 into r3786; + ternary r3761 r3786 r3757 into r3787; + shr r3785 64u8 into r3788; + ternary r3761 r3788 0u128 into r3789; + add r3764 r3789 into r3790; + shl r3787 64u8 into r3791; + add r3791 r3781 into r3792; + div r3792 r3636 into r3793; + gt r3793 18446744073709551615u128 into r3794; + ternary r3794 18446744073709551615u128 r3793 into r3795; + mul r3795 r3636 into r3796; + sub r3792 r3796 into r3797; + lte r3797 18446744073709551615u128 into r3798; + mul r3795 r3635 into r3799; + and r3797 18446744073709551615u128 into r3800; + shl r3800 64u8 into r3801; + add r3801 r3775 into r3802; + gt r3799 r3802 into r3803; + and r3798 r3803 into r3804; + sub.w r3795 1u128 into r3805; + ternary r3804 r3805 r3795 into r3806; + add r3797 r3636 into r3807; + ternary r3804 r3807 r3797 into r3808; + lte r3808 18446744073709551615u128 into r3809; + and r3804 r3809 into r3810; + mul r3806 r3635 into r3811; + and r3808 18446744073709551615u128 into r3812; + shl r3812 64u8 into r3813; + add r3813 r3775 into r3814; + gt r3811 r3814 into r3815; + and r3810 r3815 into r3816; + sub.w r3806 1u128 into r3817; + ternary r3816 r3817 r3806 into r3818; + mul r3818 r3633 into r3819; + and r3819 18446744073709551615u128 into r3820; + lt r3688 r3820 into r3821; + add r3688 18446744073709551616u128 into r3822; + sub r3822 r3820 into r3823; + and r3823 18446744073709551615u128 into r3824; + shr r3819 64u8 into r3825; + ternary r3821 1u128 0u128 into r3826; + add r3825 r3826 into r3827; + mul r3818 r3634 into r3828; + add r3828 r3827 into r3829; + and r3829 18446744073709551615u128 into r3830; + lt r3769 r3830 into r3831; + add r3769 18446744073709551616u128 into r3832; + sub r3832 r3830 into r3833; + and r3833 18446744073709551615u128 into r3834; + shr r3829 64u8 into r3835; + ternary r3831 1u128 0u128 into r3836; + add r3835 r3836 into r3837; + mul r3818 r3635 into r3838; + add r3838 r3837 into r3839; + and r3839 18446744073709551615u128 into r3840; + lt r3775 r3840 into r3841; + add r3775 18446744073709551616u128 into r3842; + sub r3842 r3840 into r3843; + and r3843 18446744073709551615u128 into r3844; + shr r3839 64u8 into r3845; + ternary r3841 1u128 0u128 into r3846; + add r3845 r3846 into r3847; + mul r3818 r3636 into r3848; + add r3848 r3847 into r3849; + and r3849 18446744073709551615u128 into r3850; + lt r3781 r3850 into r3851; + add r3781 18446744073709551616u128 into r3852; + sub r3852 r3850 into r3853; + and r3853 18446744073709551615u128 into r3854; + shr r3849 64u8 into r3855; + ternary r3851 1u128 0u128 into r3856; + add r3855 r3856 into r3857; + lt r3787 r3857 into r3858; + add r3787 18446744073709551616u128 into r3859; + sub r3859 r3857 into r3860; + and r3860 18446744073709551615u128 into r3861; + sub.w r3818 1u128 into r3862; + ternary r3858 r3862 r3818 into r3863; + add r3824 r3633 into r3864; + and r3864 18446744073709551615u128 into r3865; + ternary r3858 r3865 r3824 into r3866; + shr r3864 64u8 into r3867; + ternary r3858 r3867 0u128 into r3868; + add r3834 r3634 into r3869; + add r3869 r3868 into r3870; + and r3870 18446744073709551615u128 into r3871; + ternary r3858 r3871 r3834 into r3872; + shr r3870 64u8 into r3873; + ternary r3858 r3873 0u128 into r3874; + add r3844 r3635 into r3875; + add r3875 r3874 into r3876; + and r3876 18446744073709551615u128 into r3877; + ternary r3858 r3877 r3844 into r3878; + shr r3876 64u8 into r3879; + ternary r3858 r3879 0u128 into r3880; + add r3854 r3636 into r3881; + add r3881 r3880 into r3882; + and r3882 18446744073709551615u128 into r3883; + ternary r3858 r3883 r3854 into r3884; + shr r3882 64u8 into r3885; + ternary r3858 r3885 0u128 into r3886; + add r3861 r3886 into r3887; + shl r3884 64u8 into r3888; + add r3888 r3878 into r3889; + div r3889 r3636 into r3890; + gt r3890 18446744073709551615u128 into r3891; + ternary r3891 18446744073709551615u128 r3890 into r3892; + mul r3892 r3636 into r3893; + sub r3889 r3893 into r3894; + lte r3894 18446744073709551615u128 into r3895; + mul r3892 r3635 into r3896; + and r3894 18446744073709551615u128 into r3897; + shl r3897 64u8 into r3898; + add r3898 r3872 into r3899; + gt r3896 r3899 into r3900; + and r3895 r3900 into r3901; + sub.w r3892 1u128 into r3902; + ternary r3901 r3902 r3892 into r3903; + add r3894 r3636 into r3904; + ternary r3901 r3904 r3894 into r3905; + lte r3905 18446744073709551615u128 into r3906; + and r3901 r3906 into r3907; + mul r3903 r3635 into r3908; + and r3905 18446744073709551615u128 into r3909; + shl r3909 64u8 into r3910; + add r3910 r3872 into r3911; + gt r3908 r3911 into r3912; + and r3907 r3912 into r3913; + sub.w r3903 1u128 into r3914; + ternary r3913 r3914 r3903 into r3915; + mul r3915 r3633 into r3916; + and r3916 18446744073709551615u128 into r3917; + lt r3687 r3917 into r3918; + add r3687 18446744073709551616u128 into r3919; + sub r3919 r3917 into r3920; + and r3920 18446744073709551615u128 into r3921; + shr r3916 64u8 into r3922; + ternary r3918 1u128 0u128 into r3923; + add r3922 r3923 into r3924; + mul r3915 r3634 into r3925; + add r3925 r3924 into r3926; + and r3926 18446744073709551615u128 into r3927; + lt r3866 r3927 into r3928; + add r3866 18446744073709551616u128 into r3929; + sub r3929 r3927 into r3930; + and r3930 18446744073709551615u128 into r3931; + shr r3926 64u8 into r3932; + ternary r3928 1u128 0u128 into r3933; + add r3932 r3933 into r3934; + mul r3915 r3635 into r3935; + add r3935 r3934 into r3936; + and r3936 18446744073709551615u128 into r3937; + lt r3872 r3937 into r3938; + add r3872 18446744073709551616u128 into r3939; + sub r3939 r3937 into r3940; + and r3940 18446744073709551615u128 into r3941; + shr r3936 64u8 into r3942; + ternary r3938 1u128 0u128 into r3943; + add r3942 r3943 into r3944; + mul r3915 r3636 into r3945; + add r3945 r3944 into r3946; + and r3946 18446744073709551615u128 into r3947; + lt r3878 r3947 into r3948; + add r3878 18446744073709551616u128 into r3949; + sub r3949 r3947 into r3950; + and r3950 18446744073709551615u128 into r3951; + shr r3946 64u8 into r3952; + ternary r3948 1u128 0u128 into r3953; + add r3952 r3953 into r3954; + lt r3884 r3954 into r3955; + add r3884 18446744073709551616u128 into r3956; + sub r3956 r3954 into r3957; + and r3957 18446744073709551615u128 into r3958; + sub.w r3915 1u128 into r3959; + ternary r3955 r3959 r3915 into r3960; + add r3921 r3633 into r3961; + and r3961 18446744073709551615u128 into r3962; + ternary r3955 r3962 r3921 into r3963; + shr r3961 64u8 into r3964; + ternary r3955 r3964 0u128 into r3965; + add r3931 r3634 into r3966; + add r3966 r3965 into r3967; + and r3967 18446744073709551615u128 into r3968; + ternary r3955 r3968 r3931 into r3969; + shr r3967 64u8 into r3970; + ternary r3955 r3970 0u128 into r3971; + add r3941 r3635 into r3972; + add r3972 r3971 into r3973; + and r3973 18446744073709551615u128 into r3974; + ternary r3955 r3974 r3941 into r3975; + shr r3973 64u8 into r3976; + ternary r3955 r3976 0u128 into r3977; + add r3951 r3636 into r3978; + add r3978 r3977 into r3979; + and r3979 18446744073709551615u128 into r3980; + ternary r3955 r3980 r3951 into r3981; + shr r3979 64u8 into r3982; + ternary r3955 r3982 0u128 into r3983; + add r3958 r3983 into r3984; + shl r3981 64u8 into r3985; + add r3985 r3975 into r3986; + div r3986 r3636 into r3987; + gt r3987 18446744073709551615u128 into r3988; + ternary r3988 18446744073709551615u128 r3987 into r3989; + mul r3989 r3636 into r3990; + sub r3986 r3990 into r3991; + lte r3991 18446744073709551615u128 into r3992; + mul r3989 r3635 into r3993; + and r3991 18446744073709551615u128 into r3994; + shl r3994 64u8 into r3995; + add r3995 r3969 into r3996; + gt r3993 r3996 into r3997; + and r3992 r3997 into r3998; + sub.w r3989 1u128 into r3999; + ternary r3998 r3999 r3989 into r4000; + add r3991 r3636 into r4001; + ternary r3998 r4001 r3991 into r4002; + lte r4002 18446744073709551615u128 into r4003; + and r3998 r4003 into r4004; + mul r4000 r3635 into r4005; + and r4002 18446744073709551615u128 into r4006; + shl r4006 64u8 into r4007; + add r4007 r3969 into r4008; + gt r4005 r4008 into r4009; + and r4004 r4009 into r4010; + sub.w r4000 1u128 into r4011; + ternary r4010 r4011 r4000 into r4012; + mul r4012 r3633 into r4013; + and r4013 18446744073709551615u128 into r4014; + lt r3686 r4014 into r4015; + add r3686 18446744073709551616u128 into r4016; + sub r4016 r4014 into r4017; + and r4017 18446744073709551615u128 into r4018; + shr r4013 64u8 into r4019; + ternary r4015 1u128 0u128 into r4020; + add r4019 r4020 into r4021; + mul r4012 r3634 into r4022; + add r4022 r4021 into r4023; + and r4023 18446744073709551615u128 into r4024; + lt r3963 r4024 into r4025; + add r3963 18446744073709551616u128 into r4026; + sub r4026 r4024 into r4027; + and r4027 18446744073709551615u128 into r4028; + shr r4023 64u8 into r4029; + ternary r4025 1u128 0u128 into r4030; + add r4029 r4030 into r4031; + mul r4012 r3635 into r4032; + add r4032 r4031 into r4033; + and r4033 18446744073709551615u128 into r4034; + lt r3969 r4034 into r4035; + add r3969 18446744073709551616u128 into r4036; + sub r4036 r4034 into r4037; + and r4037 18446744073709551615u128 into r4038; + shr r4033 64u8 into r4039; + ternary r4035 1u128 0u128 into r4040; + add r4039 r4040 into r4041; + mul r4012 r3636 into r4042; + add r4042 r4041 into r4043; + and r4043 18446744073709551615u128 into r4044; + lt r3975 r4044 into r4045; + add r3975 18446744073709551616u128 into r4046; + sub r4046 r4044 into r4047; + and r4047 18446744073709551615u128 into r4048; + shr r4043 64u8 into r4049; + ternary r4045 1u128 0u128 into r4050; + add r4049 r4050 into r4051; + lt r3981 r4051 into r4052; + add r3981 18446744073709551616u128 into r4053; + sub r4053 r4051 into r4054; + and r4054 18446744073709551615u128 into r4055; + sub.w r4012 1u128 into r4056; + ternary r4052 r4056 r4012 into r4057; + add r4018 r3633 into r4058; + and r4058 18446744073709551615u128 into r4059; + ternary r4052 r4059 r4018 into r4060; + shr r4058 64u8 into r4061; + ternary r4052 r4061 0u128 into r4062; + add r4028 r3634 into r4063; + add r4063 r4062 into r4064; + and r4064 18446744073709551615u128 into r4065; + ternary r4052 r4065 r4028 into r4066; + shr r4064 64u8 into r4067; + ternary r4052 r4067 0u128 into r4068; + add r4038 r3635 into r4069; + add r4069 r4068 into r4070; + and r4070 18446744073709551615u128 into r4071; + ternary r4052 r4071 r4038 into r4072; + shr r4070 64u8 into r4073; + ternary r4052 r4073 0u128 into r4074; + add r4048 r3636 into r4075; + add r4075 r4074 into r4076; + and r4076 18446744073709551615u128 into r4077; + ternary r4052 r4077 r4048 into r4078; + shr r4076 64u8 into r4079; + ternary r4052 r4079 0u128 into r4080; + add r4055 r4080 into r4081; + shl r3766 64u8 into r4082; + add r4082 r3863 into r4083; + shl r3960 64u8 into r4084; + add r4084 r4057 into r4085; + cast r4083 r4085 into r4086 as U256__8JquwLopp8; + shl r4078 64u8 into r4087; + add r4087 r4072 into r4088; + shl r4066 64u8 into r4089; + add r4089 r4060 into r4090; + cast r3619 into r4091 as u8; + sub 128u8 r4091 into r4092; + shr r4090 r4091 into r4093; + shr r4088 r4091 into r4094; + cast r4086.hi r4086.lo into r4095 as U256__8JquwLopp8; + and r4095.lo 18446744073709551615u128 into r4096; + shr r4095.lo 64u8 into r4097; + and r4096 18446744073709551615u128 into r4098; + shr r4096 64u8 into r4099; + and r4097 18446744073709551615u128 into r4100; + add r4099 r4100 into r4101; + and r4101 18446744073709551615u128 into r4102; + shr r4101 64u8 into r4103; + shr r4097 64u8 into r4104; + add r4104 r4103 into r4105; + and r4105 18446744073709551615u128 into r4106; + shr r4105 64u8 into r4107; + shl r4107 64u8 into r4108; + add r4108 r4106 into r4109; + shl r4102 64u8 into r4110; + add r4110 r4098 into r4111; + shr r4095.lo 64u8 into r4112; + and r4095.hi 18446744073709551615u128 into r4113; + shr r4095.hi 64u8 into r4114; + and r4113 18446744073709551615u128 into r4115; + shr r4113 64u8 into r4116; + and r4114 18446744073709551615u128 into r4117; + add r4116 r4117 into r4118; + and r4118 18446744073709551615u128 into r4119; + shr r4118 64u8 into r4120; + shr r4114 64u8 into r4121; + add r4121 r4120 into r4122; + and r4122 18446744073709551615u128 into r4123; + shr r4122 64u8 into r4124; + shl r4124 64u8 into r4125; + add r4125 r4123 into r4126; + shl r4119 64u8 into r4127; + add r4127 r4115 into r4128; + shr r4095.hi 64u8 into r4129; + lt r4109 r4109 into r4130; + ternary r4130 1u128 0u128 into r4131; + add.w r4109 r4128 into r4132; + lt r4132 r4109 into r4133; + ternary r4133 1u128 0u128 into r4134; + add r4131 r4134 into r4135; + lt r4126 0u128 into r4136; + ternary r4136 1u128 0u128 into r4137; + lt r4126 r4126 into r4138; + ternary r4138 1u128 0u128 into r4139; + add.w r4126 r4135 into r4140; + lt r4140 r4126 into r4141; + ternary r4141 1u128 0u128 into r4142; + add r4137 r4139 into r4143; + add r4143 r4142 into r4144; + cast r4144 r4140 into r4145 as U256__8JquwLopp8; + cast r4132 r4111 into r4146 as U256__8JquwLopp8; + lt r4145.hi r3488.hi into r4147; + gt r4145.hi r3488.hi into r4148; + lt r4145.lo r3488.lo into r4149; + ternary r4148 false r4149 into r4150; + ternary r4147 true r4150 into r4151; + assert.eq r4151 true; + gt r3488.hi 0u128 into r4152; + ternary r4152 r3488.hi r3488.lo into r4153; + ternary r4152 128u32 0u32 into r4154; + gte r4153 18446744073709551616u128 into r4155; + shr r4153 64u8 into r4156; + ternary r4155 r4156 r4153 into r4157; + ternary r4155 64u32 0u32 into r4158; + gte r4157 4294967296u128 into r4159; + shr r4157 32u8 into r4160; + add r4158 32u32 into r4161; + ternary r4159 r4160 r4157 into r4162; + ternary r4159 r4161 r4158 into r4163; + gte r4162 65536u128 into r4164; + shr r4162 16u8 into r4165; + add r4163 16u32 into r4166; + ternary r4164 r4165 r4162 into r4167; + ternary r4164 r4166 r4163 into r4168; + gte r4167 256u128 into r4169; + shr r4167 8u8 into r4170; + add r4168 8u32 into r4171; + ternary r4169 r4170 r4167 into r4172; + ternary r4169 r4171 r4168 into r4173; + gte r4172 16u128 into r4174; + shr r4172 4u8 into r4175; + add r4173 4u32 into r4176; + ternary r4174 r4175 r4172 into r4177; + ternary r4174 r4176 r4173 into r4178; + gte r4177 4u128 into r4179; + shr r4177 2u8 into r4180; + add r4178 2u32 into r4181; + ternary r4179 r4180 r4177 into r4182; + ternary r4179 r4181 r4178 into r4183; + gte r4182 2u128 into r4184; + add r4183 1u32 into r4185; + ternary r4184 r4185 r4183 into r4186; + add r4154 r4186 into r4187; + sub 255u32 r4187 into r4188; + cast r4188 into r4189 as u16; + and r4189 127u16 into r4190; + cast r4190 into r4191 as u8; + is.eq r4191 0u8 into r4192; + sub 128u8 r4191 into r4193; + shr.w r3488.lo r4193 into r4194; + ternary r4192 0u128 r4194 into r4195; + shl.w r3488.hi r4191 into r4196; + or r4196 r4195 into r4197; + shl.w r3488.lo r4191 into r4198; + shl.w r3488.lo r4191 into r4199; + gte r4189 128u16 into r4200; + ternary r4200 r4199 r4197 into r4201; + ternary r4200 0u128 r4198 into r4202; + cast r4201 r4202 into r4203 as U256__8JquwLopp8; + and r4203.lo 18446744073709551615u128 into r4204; + shr r4203.lo 64u8 into r4205; + and r4203.hi 18446744073709551615u128 into r4206; + shr r4203.hi 64u8 into r4207; + cast r4190 into r4208 as u8; + is.eq r4208 0u8 into r4209; + sub 128u8 r4208 into r4210; + shr.w r4146.lo r4210 into r4211; + ternary r4209 0u128 r4211 into r4212; + shl.w r4146.hi r4208 into r4213; + or r4213 r4212 into r4214; + shl.w r4146.lo r4208 into r4215; + shl.w r4146.lo r4208 into r4216; + ternary r4200 r4216 r4214 into r4217; + ternary r4200 0u128 r4215 into r4218; + cast r4217 r4218 into r4219 as U256__8JquwLopp8; + is.eq r4189 0u16 into r4220; + sub 256u16 r4189 into r4221; + and r4221 127u16 into r4222; + cast r4222 into r4223 as u8; + is.eq r4223 0u8 into r4224; + sub 128u8 r4223 into r4225; + shl.w r4146.hi r4225 into r4226; + ternary r4224 0u128 r4226 into r4227; + shr r4146.lo r4223 into r4228; + or r4228 r4227 into r4229; + shr r4146.hi r4223 into r4230; + shr r4146.hi r4223 into r4231; + gte r4221 128u16 into r4232; + ternary r4232 0u128 r4230 into r4233; + ternary r4232 r4231 r4229 into r4234; + cast r4233 r4234 into r4235 as U256__8JquwLopp8; + ternary r4220 0u128 r4235.hi into r4236; + ternary r4220 0u128 r4235.lo into r4237; + cast r4236 r4237 into r4238 as U256__8JquwLopp8; + cast r4190 into r4239 as u8; + is.eq r4239 0u8 into r4240; + sub 128u8 r4239 into r4241; + shr.w r4145.lo r4241 into r4242; + ternary r4240 0u128 r4242 into r4243; + shl.w r4145.hi r4239 into r4244; + or r4244 r4243 into r4245; + shl.w r4145.lo r4239 into r4246; + shl.w r4145.lo r4239 into r4247; + ternary r4200 r4247 r4245 into r4248; + ternary r4200 0u128 r4246 into r4249; + cast r4248 r4249 into r4250 as U256__8JquwLopp8; + add.w r4250.lo r4238.lo into r4251; + lt r4251 r4250.lo into r4252; + ternary r4252 1u128 0u128 into r4253; + add.w r4250.hi r4238.hi into r4254; + add.w r4254 r4253 into r4255; + cast r4255 r4251 into r4256 as U256__8JquwLopp8; + and r4219.lo 18446744073709551615u128 into r4257; + shr r4219.lo 64u8 into r4258; + and r4219.hi 18446744073709551615u128 into r4259; + shr r4219.hi 64u8 into r4260; + and r4256.lo 18446744073709551615u128 into r4261; + shr r4256.lo 64u8 into r4262; + and r4256.hi 18446744073709551615u128 into r4263; + shr r4256.hi 64u8 into r4264; + shl r4264 64u8 into r4265; + add r4265 r4263 into r4266; + div r4266 r4207 into r4267; + gt r4267 18446744073709551615u128 into r4268; + ternary r4268 18446744073709551615u128 r4267 into r4269; + mul r4269 r4207 into r4270; + sub r4266 r4270 into r4271; + lte r4271 18446744073709551615u128 into r4272; + mul r4269 r4206 into r4273; + and r4271 18446744073709551615u128 into r4274; + shl r4274 64u8 into r4275; + add r4275 r4262 into r4276; + gt r4273 r4276 into r4277; + and r4272 r4277 into r4278; + sub.w r4269 1u128 into r4279; + ternary r4278 r4279 r4269 into r4280; + add r4271 r4207 into r4281; + ternary r4278 r4281 r4271 into r4282; + lte r4282 18446744073709551615u128 into r4283; + and r4278 r4283 into r4284; + mul r4280 r4206 into r4285; + and r4282 18446744073709551615u128 into r4286; + shl r4286 64u8 into r4287; + add r4287 r4262 into r4288; + gt r4285 r4288 into r4289; + and r4284 r4289 into r4290; + sub.w r4280 1u128 into r4291; + ternary r4290 r4291 r4280 into r4292; + mul r4292 r4204 into r4293; + and r4293 18446744073709551615u128 into r4294; + lt r4260 r4294 into r4295; + add r4260 18446744073709551616u128 into r4296; + sub r4296 r4294 into r4297; + and r4297 18446744073709551615u128 into r4298; + shr r4293 64u8 into r4299; + ternary r4295 1u128 0u128 into r4300; + add r4299 r4300 into r4301; + mul r4292 r4205 into r4302; + add r4302 r4301 into r4303; + and r4303 18446744073709551615u128 into r4304; + lt r4261 r4304 into r4305; + add r4261 18446744073709551616u128 into r4306; + sub r4306 r4304 into r4307; + and r4307 18446744073709551615u128 into r4308; + shr r4303 64u8 into r4309; + ternary r4305 1u128 0u128 into r4310; + add r4309 r4310 into r4311; + mul r4292 r4206 into r4312; + add r4312 r4311 into r4313; + and r4313 18446744073709551615u128 into r4314; + lt r4262 r4314 into r4315; + add r4262 18446744073709551616u128 into r4316; + sub r4316 r4314 into r4317; + and r4317 18446744073709551615u128 into r4318; + shr r4313 64u8 into r4319; + ternary r4315 1u128 0u128 into r4320; + add r4319 r4320 into r4321; + mul r4292 r4207 into r4322; + add r4322 r4321 into r4323; + and r4323 18446744073709551615u128 into r4324; + lt r4263 r4324 into r4325; + add r4263 18446744073709551616u128 into r4326; + sub r4326 r4324 into r4327; + and r4327 18446744073709551615u128 into r4328; + shr r4323 64u8 into r4329; + ternary r4325 1u128 0u128 into r4330; + add r4329 r4330 into r4331; + lt r4264 r4331 into r4332; + add r4264 18446744073709551616u128 into r4333; + sub r4333 r4331 into r4334; + and r4334 18446744073709551615u128 into r4335; + sub.w r4292 1u128 into r4336; + ternary r4332 r4336 r4292 into r4337; + add r4298 r4204 into r4338; + and r4338 18446744073709551615u128 into r4339; + ternary r4332 r4339 r4298 into r4340; + shr r4338 64u8 into r4341; + ternary r4332 r4341 0u128 into r4342; + add r4308 r4205 into r4343; + add r4343 r4342 into r4344; + and r4344 18446744073709551615u128 into r4345; + ternary r4332 r4345 r4308 into r4346; + shr r4344 64u8 into r4347; + ternary r4332 r4347 0u128 into r4348; + add r4318 r4206 into r4349; + add r4349 r4348 into r4350; + and r4350 18446744073709551615u128 into r4351; + ternary r4332 r4351 r4318 into r4352; + shr r4350 64u8 into r4353; + ternary r4332 r4353 0u128 into r4354; + add r4328 r4207 into r4355; + add r4355 r4354 into r4356; + and r4356 18446744073709551615u128 into r4357; + ternary r4332 r4357 r4328 into r4358; + shr r4356 64u8 into r4359; + ternary r4332 r4359 0u128 into r4360; + add r4335 r4360 into r4361; + shl r4358 64u8 into r4362; + add r4362 r4352 into r4363; + div r4363 r4207 into r4364; + gt r4364 18446744073709551615u128 into r4365; + ternary r4365 18446744073709551615u128 r4364 into r4366; + mul r4366 r4207 into r4367; + sub r4363 r4367 into r4368; + lte r4368 18446744073709551615u128 into r4369; + mul r4366 r4206 into r4370; + and r4368 18446744073709551615u128 into r4371; + shl r4371 64u8 into r4372; + add r4372 r4346 into r4373; + gt r4370 r4373 into r4374; + and r4369 r4374 into r4375; + sub.w r4366 1u128 into r4376; + ternary r4375 r4376 r4366 into r4377; + add r4368 r4207 into r4378; + ternary r4375 r4378 r4368 into r4379; + lte r4379 18446744073709551615u128 into r4380; + and r4375 r4380 into r4381; + mul r4377 r4206 into r4382; + and r4379 18446744073709551615u128 into r4383; + shl r4383 64u8 into r4384; + add r4384 r4346 into r4385; + gt r4382 r4385 into r4386; + and r4381 r4386 into r4387; + sub.w r4377 1u128 into r4388; + ternary r4387 r4388 r4377 into r4389; + mul r4389 r4204 into r4390; + and r4390 18446744073709551615u128 into r4391; + lt r4259 r4391 into r4392; + add r4259 18446744073709551616u128 into r4393; + sub r4393 r4391 into r4394; + and r4394 18446744073709551615u128 into r4395; + shr r4390 64u8 into r4396; + ternary r4392 1u128 0u128 into r4397; + add r4396 r4397 into r4398; + mul r4389 r4205 into r4399; + add r4399 r4398 into r4400; + and r4400 18446744073709551615u128 into r4401; + lt r4340 r4401 into r4402; + add r4340 18446744073709551616u128 into r4403; + sub r4403 r4401 into r4404; + and r4404 18446744073709551615u128 into r4405; + shr r4400 64u8 into r4406; + ternary r4402 1u128 0u128 into r4407; + add r4406 r4407 into r4408; + mul r4389 r4206 into r4409; + add r4409 r4408 into r4410; + and r4410 18446744073709551615u128 into r4411; + lt r4346 r4411 into r4412; + add r4346 18446744073709551616u128 into r4413; + sub r4413 r4411 into r4414; + and r4414 18446744073709551615u128 into r4415; + shr r4410 64u8 into r4416; + ternary r4412 1u128 0u128 into r4417; + add r4416 r4417 into r4418; + mul r4389 r4207 into r4419; + add r4419 r4418 into r4420; + and r4420 18446744073709551615u128 into r4421; + lt r4352 r4421 into r4422; + add r4352 18446744073709551616u128 into r4423; + sub r4423 r4421 into r4424; + and r4424 18446744073709551615u128 into r4425; + shr r4420 64u8 into r4426; + ternary r4422 1u128 0u128 into r4427; + add r4426 r4427 into r4428; + lt r4358 r4428 into r4429; + add r4358 18446744073709551616u128 into r4430; + sub r4430 r4428 into r4431; + and r4431 18446744073709551615u128 into r4432; + sub.w r4389 1u128 into r4433; + ternary r4429 r4433 r4389 into r4434; + add r4395 r4204 into r4435; + and r4435 18446744073709551615u128 into r4436; + ternary r4429 r4436 r4395 into r4437; + shr r4435 64u8 into r4438; + ternary r4429 r4438 0u128 into r4439; + add r4405 r4205 into r4440; + add r4440 r4439 into r4441; + and r4441 18446744073709551615u128 into r4442; + ternary r4429 r4442 r4405 into r4443; + shr r4441 64u8 into r4444; + ternary r4429 r4444 0u128 into r4445; + add r4415 r4206 into r4446; + add r4446 r4445 into r4447; + and r4447 18446744073709551615u128 into r4448; + ternary r4429 r4448 r4415 into r4449; + shr r4447 64u8 into r4450; + ternary r4429 r4450 0u128 into r4451; + add r4425 r4207 into r4452; + add r4452 r4451 into r4453; + and r4453 18446744073709551615u128 into r4454; + ternary r4429 r4454 r4425 into r4455; + shr r4453 64u8 into r4456; + ternary r4429 r4456 0u128 into r4457; + add r4432 r4457 into r4458; + shl r4455 64u8 into r4459; + add r4459 r4449 into r4460; + div r4460 r4207 into r4461; + gt r4461 18446744073709551615u128 into r4462; + ternary r4462 18446744073709551615u128 r4461 into r4463; + mul r4463 r4207 into r4464; + sub r4460 r4464 into r4465; + lte r4465 18446744073709551615u128 into r4466; + mul r4463 r4206 into r4467; + and r4465 18446744073709551615u128 into r4468; + shl r4468 64u8 into r4469; + add r4469 r4443 into r4470; + gt r4467 r4470 into r4471; + and r4466 r4471 into r4472; + sub.w r4463 1u128 into r4473; + ternary r4472 r4473 r4463 into r4474; + add r4465 r4207 into r4475; + ternary r4472 r4475 r4465 into r4476; + lte r4476 18446744073709551615u128 into r4477; + and r4472 r4477 into r4478; + mul r4474 r4206 into r4479; + and r4476 18446744073709551615u128 into r4480; + shl r4480 64u8 into r4481; + add r4481 r4443 into r4482; + gt r4479 r4482 into r4483; + and r4478 r4483 into r4484; + sub.w r4474 1u128 into r4485; + ternary r4484 r4485 r4474 into r4486; + mul r4486 r4204 into r4487; + and r4487 18446744073709551615u128 into r4488; + lt r4258 r4488 into r4489; + add r4258 18446744073709551616u128 into r4490; + sub r4490 r4488 into r4491; + and r4491 18446744073709551615u128 into r4492; + shr r4487 64u8 into r4493; + ternary r4489 1u128 0u128 into r4494; + add r4493 r4494 into r4495; + mul r4486 r4205 into r4496; + add r4496 r4495 into r4497; + and r4497 18446744073709551615u128 into r4498; + lt r4437 r4498 into r4499; + add r4437 18446744073709551616u128 into r4500; + sub r4500 r4498 into r4501; + and r4501 18446744073709551615u128 into r4502; + shr r4497 64u8 into r4503; + ternary r4499 1u128 0u128 into r4504; + add r4503 r4504 into r4505; + mul r4486 r4206 into r4506; + add r4506 r4505 into r4507; + and r4507 18446744073709551615u128 into r4508; + lt r4443 r4508 into r4509; + add r4443 18446744073709551616u128 into r4510; + sub r4510 r4508 into r4511; + and r4511 18446744073709551615u128 into r4512; + shr r4507 64u8 into r4513; + ternary r4509 1u128 0u128 into r4514; + add r4513 r4514 into r4515; + mul r4486 r4207 into r4516; + add r4516 r4515 into r4517; + and r4517 18446744073709551615u128 into r4518; + lt r4449 r4518 into r4519; + add r4449 18446744073709551616u128 into r4520; + sub r4520 r4518 into r4521; + and r4521 18446744073709551615u128 into r4522; + shr r4517 64u8 into r4523; + ternary r4519 1u128 0u128 into r4524; + add r4523 r4524 into r4525; + lt r4455 r4525 into r4526; + add r4455 18446744073709551616u128 into r4527; + sub r4527 r4525 into r4528; + and r4528 18446744073709551615u128 into r4529; + sub.w r4486 1u128 into r4530; + ternary r4526 r4530 r4486 into r4531; + add r4492 r4204 into r4532; + and r4532 18446744073709551615u128 into r4533; + ternary r4526 r4533 r4492 into r4534; + shr r4532 64u8 into r4535; + ternary r4526 r4535 0u128 into r4536; + add r4502 r4205 into r4537; + add r4537 r4536 into r4538; + and r4538 18446744073709551615u128 into r4539; + ternary r4526 r4539 r4502 into r4540; + shr r4538 64u8 into r4541; + ternary r4526 r4541 0u128 into r4542; + add r4512 r4206 into r4543; + add r4543 r4542 into r4544; + and r4544 18446744073709551615u128 into r4545; + ternary r4526 r4545 r4512 into r4546; + shr r4544 64u8 into r4547; + ternary r4526 r4547 0u128 into r4548; + add r4522 r4207 into r4549; + add r4549 r4548 into r4550; + and r4550 18446744073709551615u128 into r4551; + ternary r4526 r4551 r4522 into r4552; + shr r4550 64u8 into r4553; + ternary r4526 r4553 0u128 into r4554; + add r4529 r4554 into r4555; + shl r4552 64u8 into r4556; + add r4556 r4546 into r4557; + div r4557 r4207 into r4558; + gt r4558 18446744073709551615u128 into r4559; + ternary r4559 18446744073709551615u128 r4558 into r4560; + mul r4560 r4207 into r4561; + sub r4557 r4561 into r4562; + lte r4562 18446744073709551615u128 into r4563; + mul r4560 r4206 into r4564; + and r4562 18446744073709551615u128 into r4565; + shl r4565 64u8 into r4566; + add r4566 r4540 into r4567; + gt r4564 r4567 into r4568; + and r4563 r4568 into r4569; + sub.w r4560 1u128 into r4570; + ternary r4569 r4570 r4560 into r4571; + add r4562 r4207 into r4572; + ternary r4569 r4572 r4562 into r4573; + lte r4573 18446744073709551615u128 into r4574; + and r4569 r4574 into r4575; + mul r4571 r4206 into r4576; + and r4573 18446744073709551615u128 into r4577; + shl r4577 64u8 into r4578; + add r4578 r4540 into r4579; + gt r4576 r4579 into r4580; + and r4575 r4580 into r4581; + sub.w r4571 1u128 into r4582; + ternary r4581 r4582 r4571 into r4583; + mul r4583 r4204 into r4584; + and r4584 18446744073709551615u128 into r4585; + lt r4257 r4585 into r4586; + add r4257 18446744073709551616u128 into r4587; + sub r4587 r4585 into r4588; + and r4588 18446744073709551615u128 into r4589; + shr r4584 64u8 into r4590; + ternary r4586 1u128 0u128 into r4591; + add r4590 r4591 into r4592; + mul r4583 r4205 into r4593; + add r4593 r4592 into r4594; + and r4594 18446744073709551615u128 into r4595; + lt r4534 r4595 into r4596; + add r4534 18446744073709551616u128 into r4597; + sub r4597 r4595 into r4598; + and r4598 18446744073709551615u128 into r4599; + shr r4594 64u8 into r4600; + ternary r4596 1u128 0u128 into r4601; + add r4600 r4601 into r4602; + mul r4583 r4206 into r4603; + add r4603 r4602 into r4604; + and r4604 18446744073709551615u128 into r4605; + lt r4540 r4605 into r4606; + add r4540 18446744073709551616u128 into r4607; + sub r4607 r4605 into r4608; + and r4608 18446744073709551615u128 into r4609; + shr r4604 64u8 into r4610; + ternary r4606 1u128 0u128 into r4611; + add r4610 r4611 into r4612; + mul r4583 r4207 into r4613; + add r4613 r4612 into r4614; + and r4614 18446744073709551615u128 into r4615; + lt r4546 r4615 into r4616; + add r4546 18446744073709551616u128 into r4617; + sub r4617 r4615 into r4618; + and r4618 18446744073709551615u128 into r4619; + shr r4614 64u8 into r4620; + ternary r4616 1u128 0u128 into r4621; + add r4620 r4621 into r4622; + lt r4552 r4622 into r4623; + add r4552 18446744073709551616u128 into r4624; + sub r4624 r4622 into r4625; + and r4625 18446744073709551615u128 into r4626; + sub.w r4583 1u128 into r4627; + ternary r4623 r4627 r4583 into r4628; + add r4589 r4204 into r4629; + and r4629 18446744073709551615u128 into r4630; + ternary r4623 r4630 r4589 into r4631; + shr r4629 64u8 into r4632; + ternary r4623 r4632 0u128 into r4633; + add r4599 r4205 into r4634; + add r4634 r4633 into r4635; + and r4635 18446744073709551615u128 into r4636; + ternary r4623 r4636 r4599 into r4637; + shr r4635 64u8 into r4638; + ternary r4623 r4638 0u128 into r4639; + add r4609 r4206 into r4640; + add r4640 r4639 into r4641; + and r4641 18446744073709551615u128 into r4642; + ternary r4623 r4642 r4609 into r4643; + shr r4641 64u8 into r4644; + ternary r4623 r4644 0u128 into r4645; + add r4619 r4207 into r4646; + add r4646 r4645 into r4647; + and r4647 18446744073709551615u128 into r4648; + ternary r4623 r4648 r4619 into r4649; + shr r4647 64u8 into r4650; + ternary r4623 r4650 0u128 into r4651; + add r4626 r4651 into r4652; + shl r4337 64u8 into r4653; + add r4653 r4434 into r4654; + shl r4531 64u8 into r4655; + add r4655 r4628 into r4656; + cast r4654 r4656 into r4657 as U256__8JquwLopp8; + shl r4649 64u8 into r4658; + add r4658 r4643 into r4659; + shl r4637 64u8 into r4660; + add r4660 r4631 into r4661; + cast r4190 into r4662 as u8; + sub 128u8 r4662 into r4663; + shr r4661 r4662 into r4664; + shr r4659 r4662 into r4665; + cast r4657.hi r4657.lo into r4666 as U256__8JquwLopp8; + is.neq r4666.hi 0u128 into r4667; + ternary r10 r3477.hi r4666.lo into r4668; + ternary r10 r3480 r4667 into r4669; + not r4669 into r4670; + and r47 r4670 into r4671; + gt r109 0u128 into r4672; + and r4671 r4672 into r4673; + ternary r4673 r3313.hi r0.hi into r4674; + ternary r4673 r3313.lo r0.lo into r4675; + cast r4674 r4675 into r4676 as U256__8JquwLopp8; + ternary r4673 r4668 0u128 into r4677; + lt r0.hi r1537.hi into r4678; + gt r0.hi r1537.hi into r4679; + lt r0.lo r1537.lo into r4680; + ternary r4679 false r4680 into r4681; + ternary r4678 true r4681 into r4682; + ternary r4682 r0.hi r1537.hi into r4683; + ternary r4682 r0.lo r1537.lo into r4684; + cast r4683 r4684 into r4685 as U256__8JquwLopp8; + lt r0.hi r1537.hi into r4686; + gt r0.hi r1537.hi into r4687; + lt r0.lo r1537.lo into r4688; + ternary r4687 false r4688 into r4689; + ternary r4686 true r4689 into r4690; + ternary r4690 r1537.hi r0.hi into r4691; + ternary r4690 r1537.lo r0.lo into r4692; + cast r4691 r4692 into r4693 as U256__8JquwLopp8; + lt r4693.lo r4685.lo into r4694; + ternary r4694 1u128 0u128 into r4695; + sub.w r4693.lo r4685.lo into r4696; + sub.w r4693.hi r4685.hi into r4697; + sub.w r4697 r4695 into r4698; + cast r4698 r4696 into r4699 as U256__8JquwLopp8; + cast 0u128 r1 into r4700 as U256__8JquwLopp8; + and r4700.lo 18446744073709551615u128 into r4701; + shr r4700.lo 64u8 into r4702; + and r4699.lo 18446744073709551615u128 into r4703; + shr r4699.lo 64u8 into r4704; + mul r4701 r4703 into r4705; + mul r4701 r4704 into r4706; + mul r4702 r4703 into r4707; + mul r4702 r4704 into r4708; + and r4705 18446744073709551615u128 into r4709; + shr r4705 64u8 into r4710; + and r4706 18446744073709551615u128 into r4711; + add r4710 r4711 into r4712; + and r4707 18446744073709551615u128 into r4713; + add r4712 r4713 into r4714; + and r4714 18446744073709551615u128 into r4715; + shr r4714 64u8 into r4716; + shr r4706 64u8 into r4717; + shr r4707 64u8 into r4718; + add r4717 r4718 into r4719; + and r4708 18446744073709551615u128 into r4720; + add r4719 r4720 into r4721; + add r4721 r4716 into r4722; + and r4722 18446744073709551615u128 into r4723; + shr r4722 64u8 into r4724; + shr r4708 64u8 into r4725; + add r4725 r4724 into r4726; + shl r4726 64u8 into r4727; + add r4727 r4723 into r4728; + shl r4715 64u8 into r4729; + add r4729 r4709 into r4730; + and r4700.lo 18446744073709551615u128 into r4731; + shr r4700.lo 64u8 into r4732; + and r4699.hi 18446744073709551615u128 into r4733; + shr r4699.hi 64u8 into r4734; + mul r4731 r4733 into r4735; + mul r4731 r4734 into r4736; + mul r4732 r4733 into r4737; + mul r4732 r4734 into r4738; + and r4735 18446744073709551615u128 into r4739; + shr r4735 64u8 into r4740; + and r4736 18446744073709551615u128 into r4741; + add r4740 r4741 into r4742; + and r4737 18446744073709551615u128 into r4743; + add r4742 r4743 into r4744; + and r4744 18446744073709551615u128 into r4745; + shr r4744 64u8 into r4746; + shr r4736 64u8 into r4747; + shr r4737 64u8 into r4748; + add r4747 r4748 into r4749; + and r4738 18446744073709551615u128 into r4750; + add r4749 r4750 into r4751; + add r4751 r4746 into r4752; + and r4752 18446744073709551615u128 into r4753; + shr r4752 64u8 into r4754; + shr r4738 64u8 into r4755; + add r4755 r4754 into r4756; + shl r4756 64u8 into r4757; + add r4757 r4753 into r4758; + shl r4745 64u8 into r4759; + add r4759 r4739 into r4760; + and r4700.hi 18446744073709551615u128 into r4761; + shr r4700.hi 64u8 into r4762; + and r4699.lo 18446744073709551615u128 into r4763; + shr r4699.lo 64u8 into r4764; + mul r4761 r4763 into r4765; + mul r4761 r4764 into r4766; + mul r4762 r4763 into r4767; + mul r4762 r4764 into r4768; + and r4765 18446744073709551615u128 into r4769; + shr r4765 64u8 into r4770; + and r4766 18446744073709551615u128 into r4771; + add r4770 r4771 into r4772; + and r4767 18446744073709551615u128 into r4773; + add r4772 r4773 into r4774; + and r4774 18446744073709551615u128 into r4775; + shr r4774 64u8 into r4776; + shr r4766 64u8 into r4777; + shr r4767 64u8 into r4778; + add r4777 r4778 into r4779; + and r4768 18446744073709551615u128 into r4780; + add r4779 r4780 into r4781; + add r4781 r4776 into r4782; + and r4782 18446744073709551615u128 into r4783; + shr r4782 64u8 into r4784; + shr r4768 64u8 into r4785; + add r4785 r4784 into r4786; + shl r4786 64u8 into r4787; + add r4787 r4783 into r4788; + shl r4775 64u8 into r4789; + add r4789 r4769 into r4790; + and r4700.hi 18446744073709551615u128 into r4791; + shr r4700.hi 64u8 into r4792; + and r4699.hi 18446744073709551615u128 into r4793; + shr r4699.hi 64u8 into r4794; + mul r4791 r4793 into r4795; + mul r4791 r4794 into r4796; + mul r4792 r4793 into r4797; + mul r4792 r4794 into r4798; + and r4795 18446744073709551615u128 into r4799; + shr r4795 64u8 into r4800; + and r4796 18446744073709551615u128 into r4801; + add r4800 r4801 into r4802; + and r4797 18446744073709551615u128 into r4803; + add r4802 r4803 into r4804; + and r4804 18446744073709551615u128 into r4805; + shr r4804 64u8 into r4806; + shr r4796 64u8 into r4807; + shr r4797 64u8 into r4808; + add r4807 r4808 into r4809; + and r4798 18446744073709551615u128 into r4810; + add r4809 r4810 into r4811; + add r4811 r4806 into r4812; + and r4812 18446744073709551615u128 into r4813; + shr r4812 64u8 into r4814; + shr r4798 64u8 into r4815; + add r4815 r4814 into r4816; + shl r4816 64u8 into r4817; + add r4817 r4813 into r4818; + shl r4805 64u8 into r4819; + add r4819 r4799 into r4820; + add.w r4728 r4760 into r4821; + lt r4821 r4728 into r4822; + ternary r4822 1u128 0u128 into r4823; + add.w r4821 r4790 into r4824; + lt r4824 r4821 into r4825; + ternary r4825 1u128 0u128 into r4826; + add r4823 r4826 into r4827; + add.w r4758 r4788 into r4828; + lt r4828 r4758 into r4829; + ternary r4829 1u128 0u128 into r4830; + add.w r4828 r4820 into r4831; + lt r4831 r4828 into r4832; + ternary r4832 1u128 0u128 into r4833; + add.w r4831 r4827 into r4834; + lt r4834 r4831 into r4835; + ternary r4835 1u128 0u128 into r4836; + add r4830 r4833 into r4837; + add r4837 r4836 into r4838; + cast r4824 r4730 into r4839 as U256__8JquwLopp8; + gt r4839.lo 0u128 into r4840; + lt r4839.hi 340282366920938463463374607431768211455u128 into r4841; + and r4840 r4841 into r4842; + add.w r4839.hi 1u128 into r4843; + ternary r4842 r4843 r4839.hi into r4844; + ternary r1529 r4844 r1522 into r4845; + ternary r1526 r4845 r109 into r4846; + ternary r4673 r4846 0u128 into r4847; + cast r8 into r4848 as u128; + sub 1000000u128 r4848 into r4849; + and r4847 18446744073709551615u128 into r4850; + shr r4847 64u8 into r4851; + mul r4850 1000000u128 into r4852; + mul r4851 1000000u128 into r4853; + and r4852 18446744073709551615u128 into r4854; + shr r4852 64u8 into r4855; + and r4853 18446744073709551615u128 into r4856; + add r4855 r4856 into r4857; + and r4857 18446744073709551615u128 into r4858; + shr r4857 64u8 into r4859; + shr r4853 64u8 into r4860; + add r4860 r4859 into r4861; + and r4861 18446744073709551615u128 into r4862; + shr r4861 64u8 into r4863; + shl r4863 64u8 into r4864; + add r4864 r4862 into r4865; + shl r4858 64u8 into r4866; + add r4866 r4854 into r4867; + lt r4865 r4849 into r4868; + assert.eq r4868 true; + shr r4867 96u8 into r4869; + and r4869 4294967295u128 into r4870; + shl r4865 32u8 into r4871; + add r4871 r4870 into r4872; + div r4872 r4849 into r4873; + rem r4872 r4849 into r4874; + shr r4867 64u8 into r4875; + and r4875 4294967295u128 into r4876; + shl r4874 32u8 into r4877; + add r4877 r4876 into r4878; + shl r4873 32u8 into r4879; + div r4878 r4849 into r4880; + add r4879 r4880 into r4881; + rem r4878 r4849 into r4882; + shr r4867 32u8 into r4883; + and r4883 4294967295u128 into r4884; + shl r4882 32u8 into r4885; + add r4885 r4884 into r4886; + shl r4881 32u8 into r4887; + div r4886 r4849 into r4888; + add r4887 r4888 into r4889; + rem r4886 r4849 into r4890; + shr r4867 0u8 into r4891; + and r4891 4294967295u128 into r4892; + shl r4890 32u8 into r4893; + add r4893 r4892 into r4894; + shl r4889 32u8 into r4895; + div r4894 r4849 into r4896; + add r4895 r4896 into r4897; + rem r4894 r4849 into r4898; + gt r4898 0u128 into r4899; + ternary r4899 1u128 0u128 into r4900; + add r4897 r4900 into r4901; + ternary r1526 r4901 r2 into r4902; + ternary r4673 r4902 0u128 into r4903; + gt r4903 r2 into r4904; + ternary r4904 r2 r4903 into r4905; + sub r2 r4905 into r4906; + sub r4905 r4847 into r4907; + cast r9 into r4908 as u128; + mul r4907 r4908 into r4909; + div r4909 16u128 into r4910; + sub r4907 r4910 into r4911; + div r4911 r1539 into r4912; + rem r4911 r1539 into r4913; + lt r4913 r1539 into r4914; + assert.eq r4914 true; + gte r4913 170141183460469231731687303715884105728u128 into r4915; + add.w r4913 r4913 into r4916; + gte r4916 r1539 into r4917; + or r4915 r4917 into r4918; + sub.w r4916 r1539 into r4919; + ternary r4918 r4919 r4916 into r4920; + ternary r4918 170141183460469231731687303715884105728u128 0u128 into r4921; + gte r4920 170141183460469231731687303715884105728u128 into r4922; + add.w r4920 r4920 into r4923; + gte r4923 r1539 into r4924; + or r4922 r4924 into r4925; + sub.w r4923 r1539 into r4926; + ternary r4925 r4926 r4923 into r4927; + add r4921 85070591730234615865843651857942052864u128 into r4928; + ternary r4925 r4928 r4921 into r4929; + gte r4927 170141183460469231731687303715884105728u128 into r4930; + add.w r4927 r4927 into r4931; + gte r4931 r1539 into r4932; + or r4930 r4932 into r4933; + sub.w r4931 r1539 into r4934; + ternary r4933 r4934 r4931 into r4935; + add r4929 42535295865117307932921825928971026432u128 into r4936; + ternary r4933 r4936 r4929 into r4937; + gte r4935 170141183460469231731687303715884105728u128 into r4938; + add.w r4935 r4935 into r4939; + gte r4939 r1539 into r4940; + or r4938 r4940 into r4941; + sub.w r4939 r1539 into r4942; + ternary r4941 r4942 r4939 into r4943; + add r4937 21267647932558653966460912964485513216u128 into r4944; + ternary r4941 r4944 r4937 into r4945; + gte r4943 170141183460469231731687303715884105728u128 into r4946; + add.w r4943 r4943 into r4947; + gte r4947 r1539 into r4948; + or r4946 r4948 into r4949; + sub.w r4947 r1539 into r4950; + ternary r4949 r4950 r4947 into r4951; + add r4945 10633823966279326983230456482242756608u128 into r4952; + ternary r4949 r4952 r4945 into r4953; + gte r4951 170141183460469231731687303715884105728u128 into r4954; + add.w r4951 r4951 into r4955; + gte r4955 r1539 into r4956; + or r4954 r4956 into r4957; + sub.w r4955 r1539 into r4958; + ternary r4957 r4958 r4955 into r4959; + add r4953 5316911983139663491615228241121378304u128 into r4960; + ternary r4957 r4960 r4953 into r4961; + gte r4959 170141183460469231731687303715884105728u128 into r4962; + add.w r4959 r4959 into r4963; + gte r4963 r1539 into r4964; + or r4962 r4964 into r4965; + sub.w r4963 r1539 into r4966; + ternary r4965 r4966 r4963 into r4967; + add r4961 2658455991569831745807614120560689152u128 into r4968; + ternary r4965 r4968 r4961 into r4969; + gte r4967 170141183460469231731687303715884105728u128 into r4970; + add.w r4967 r4967 into r4971; + gte r4971 r1539 into r4972; + or r4970 r4972 into r4973; + sub.w r4971 r1539 into r4974; + ternary r4973 r4974 r4971 into r4975; + add r4969 1329227995784915872903807060280344576u128 into r4976; + ternary r4973 r4976 r4969 into r4977; + gte r4975 170141183460469231731687303715884105728u128 into r4978; + add.w r4975 r4975 into r4979; + gte r4979 r1539 into r4980; + or r4978 r4980 into r4981; + sub.w r4979 r1539 into r4982; + ternary r4981 r4982 r4979 into r4983; + add r4977 664613997892457936451903530140172288u128 into r4984; + ternary r4981 r4984 r4977 into r4985; + gte r4983 170141183460469231731687303715884105728u128 into r4986; + add.w r4983 r4983 into r4987; + gte r4987 r1539 into r4988; + or r4986 r4988 into r4989; + sub.w r4987 r1539 into r4990; + ternary r4989 r4990 r4987 into r4991; + add r4985 332306998946228968225951765070086144u128 into r4992; + ternary r4989 r4992 r4985 into r4993; + gte r4991 170141183460469231731687303715884105728u128 into r4994; + add.w r4991 r4991 into r4995; + gte r4995 r1539 into r4996; + or r4994 r4996 into r4997; + sub.w r4995 r1539 into r4998; + ternary r4997 r4998 r4995 into r4999; + add r4993 166153499473114484112975882535043072u128 into r5000; + ternary r4997 r5000 r4993 into r5001; + gte r4999 170141183460469231731687303715884105728u128 into r5002; + add.w r4999 r4999 into r5003; + gte r5003 r1539 into r5004; + or r5002 r5004 into r5005; + sub.w r5003 r1539 into r5006; + ternary r5005 r5006 r5003 into r5007; + add r5001 83076749736557242056487941267521536u128 into r5008; + ternary r5005 r5008 r5001 into r5009; + gte r5007 170141183460469231731687303715884105728u128 into r5010; + add.w r5007 r5007 into r5011; + gte r5011 r1539 into r5012; + or r5010 r5012 into r5013; + sub.w r5011 r1539 into r5014; + ternary r5013 r5014 r5011 into r5015; + add r5009 41538374868278621028243970633760768u128 into r5016; + ternary r5013 r5016 r5009 into r5017; + gte r5015 170141183460469231731687303715884105728u128 into r5018; + add.w r5015 r5015 into r5019; + gte r5019 r1539 into r5020; + or r5018 r5020 into r5021; + sub.w r5019 r1539 into r5022; + ternary r5021 r5022 r5019 into r5023; + add r5017 20769187434139310514121985316880384u128 into r5024; + ternary r5021 r5024 r5017 into r5025; + gte r5023 170141183460469231731687303715884105728u128 into r5026; + add.w r5023 r5023 into r5027; + gte r5027 r1539 into r5028; + or r5026 r5028 into r5029; + sub.w r5027 r1539 into r5030; + ternary r5029 r5030 r5027 into r5031; + add r5025 10384593717069655257060992658440192u128 into r5032; + ternary r5029 r5032 r5025 into r5033; + gte r5031 170141183460469231731687303715884105728u128 into r5034; + add.w r5031 r5031 into r5035; + gte r5035 r1539 into r5036; + or r5034 r5036 into r5037; + sub.w r5035 r1539 into r5038; + ternary r5037 r5038 r5035 into r5039; + add r5033 5192296858534827628530496329220096u128 into r5040; + ternary r5037 r5040 r5033 into r5041; + gte r5039 170141183460469231731687303715884105728u128 into r5042; + add.w r5039 r5039 into r5043; + gte r5043 r1539 into r5044; + or r5042 r5044 into r5045; + sub.w r5043 r1539 into r5046; + ternary r5045 r5046 r5043 into r5047; + add r5041 2596148429267413814265248164610048u128 into r5048; + ternary r5045 r5048 r5041 into r5049; + gte r5047 170141183460469231731687303715884105728u128 into r5050; + add.w r5047 r5047 into r5051; + gte r5051 r1539 into r5052; + or r5050 r5052 into r5053; + sub.w r5051 r1539 into r5054; + ternary r5053 r5054 r5051 into r5055; + add r5049 1298074214633706907132624082305024u128 into r5056; + ternary r5053 r5056 r5049 into r5057; + gte r5055 170141183460469231731687303715884105728u128 into r5058; + add.w r5055 r5055 into r5059; + gte r5059 r1539 into r5060; + or r5058 r5060 into r5061; + sub.w r5059 r1539 into r5062; + ternary r5061 r5062 r5059 into r5063; + add r5057 649037107316853453566312041152512u128 into r5064; + ternary r5061 r5064 r5057 into r5065; + gte r5063 170141183460469231731687303715884105728u128 into r5066; + add.w r5063 r5063 into r5067; + gte r5067 r1539 into r5068; + or r5066 r5068 into r5069; + sub.w r5067 r1539 into r5070; + ternary r5069 r5070 r5067 into r5071; + add r5065 324518553658426726783156020576256u128 into r5072; + ternary r5069 r5072 r5065 into r5073; + gte r5071 170141183460469231731687303715884105728u128 into r5074; + add.w r5071 r5071 into r5075; + gte r5075 r1539 into r5076; + or r5074 r5076 into r5077; + sub.w r5075 r1539 into r5078; + ternary r5077 r5078 r5075 into r5079; + add r5073 162259276829213363391578010288128u128 into r5080; + ternary r5077 r5080 r5073 into r5081; + gte r5079 170141183460469231731687303715884105728u128 into r5082; + add.w r5079 r5079 into r5083; + gte r5083 r1539 into r5084; + or r5082 r5084 into r5085; + sub.w r5083 r1539 into r5086; + ternary r5085 r5086 r5083 into r5087; + add r5081 81129638414606681695789005144064u128 into r5088; + ternary r5085 r5088 r5081 into r5089; + gte r5087 170141183460469231731687303715884105728u128 into r5090; + add.w r5087 r5087 into r5091; + gte r5091 r1539 into r5092; + or r5090 r5092 into r5093; + sub.w r5091 r1539 into r5094; + ternary r5093 r5094 r5091 into r5095; + add r5089 40564819207303340847894502572032u128 into r5096; + ternary r5093 r5096 r5089 into r5097; + gte r5095 170141183460469231731687303715884105728u128 into r5098; + add.w r5095 r5095 into r5099; + gte r5099 r1539 into r5100; + or r5098 r5100 into r5101; + sub.w r5099 r1539 into r5102; + ternary r5101 r5102 r5099 into r5103; + add r5097 20282409603651670423947251286016u128 into r5104; + ternary r5101 r5104 r5097 into r5105; + gte r5103 170141183460469231731687303715884105728u128 into r5106; + add.w r5103 r5103 into r5107; + gte r5107 r1539 into r5108; + or r5106 r5108 into r5109; + sub.w r5107 r1539 into r5110; + ternary r5109 r5110 r5107 into r5111; + add r5105 10141204801825835211973625643008u128 into r5112; + ternary r5109 r5112 r5105 into r5113; + gte r5111 170141183460469231731687303715884105728u128 into r5114; + add.w r5111 r5111 into r5115; + gte r5115 r1539 into r5116; + or r5114 r5116 into r5117; + sub.w r5115 r1539 into r5118; + ternary r5117 r5118 r5115 into r5119; + add r5113 5070602400912917605986812821504u128 into r5120; + ternary r5117 r5120 r5113 into r5121; + gte r5119 170141183460469231731687303715884105728u128 into r5122; + add.w r5119 r5119 into r5123; + gte r5123 r1539 into r5124; + or r5122 r5124 into r5125; + sub.w r5123 r1539 into r5126; + ternary r5125 r5126 r5123 into r5127; + add r5121 2535301200456458802993406410752u128 into r5128; + ternary r5125 r5128 r5121 into r5129; + gte r5127 170141183460469231731687303715884105728u128 into r5130; + add.w r5127 r5127 into r5131; + gte r5131 r1539 into r5132; + or r5130 r5132 into r5133; + sub.w r5131 r1539 into r5134; + ternary r5133 r5134 r5131 into r5135; + add r5129 1267650600228229401496703205376u128 into r5136; + ternary r5133 r5136 r5129 into r5137; + gte r5135 170141183460469231731687303715884105728u128 into r5138; + add.w r5135 r5135 into r5139; + gte r5139 r1539 into r5140; + or r5138 r5140 into r5141; + sub.w r5139 r1539 into r5142; + ternary r5141 r5142 r5139 into r5143; + add r5137 633825300114114700748351602688u128 into r5144; + ternary r5141 r5144 r5137 into r5145; + gte r5143 170141183460469231731687303715884105728u128 into r5146; + add.w r5143 r5143 into r5147; + gte r5147 r1539 into r5148; + or r5146 r5148 into r5149; + sub.w r5147 r1539 into r5150; + ternary r5149 r5150 r5147 into r5151; + add r5145 316912650057057350374175801344u128 into r5152; + ternary r5149 r5152 r5145 into r5153; + gte r5151 170141183460469231731687303715884105728u128 into r5154; + add.w r5151 r5151 into r5155; + gte r5155 r1539 into r5156; + or r5154 r5156 into r5157; + sub.w r5155 r1539 into r5158; + ternary r5157 r5158 r5155 into r5159; + add r5153 158456325028528675187087900672u128 into r5160; + ternary r5157 r5160 r5153 into r5161; + gte r5159 170141183460469231731687303715884105728u128 into r5162; + add.w r5159 r5159 into r5163; + gte r5163 r1539 into r5164; + or r5162 r5164 into r5165; + sub.w r5163 r1539 into r5166; + ternary r5165 r5166 r5163 into r5167; + add r5161 79228162514264337593543950336u128 into r5168; + ternary r5165 r5168 r5161 into r5169; + gte r5167 170141183460469231731687303715884105728u128 into r5170; + add.w r5167 r5167 into r5171; + gte r5171 r1539 into r5172; + or r5170 r5172 into r5173; + sub.w r5171 r1539 into r5174; + ternary r5173 r5174 r5171 into r5175; + add r5169 39614081257132168796771975168u128 into r5176; + ternary r5173 r5176 r5169 into r5177; + gte r5175 170141183460469231731687303715884105728u128 into r5178; + add.w r5175 r5175 into r5179; + gte r5179 r1539 into r5180; + or r5178 r5180 into r5181; + sub.w r5179 r1539 into r5182; + ternary r5181 r5182 r5179 into r5183; + add r5177 19807040628566084398385987584u128 into r5184; + ternary r5181 r5184 r5177 into r5185; + gte r5183 170141183460469231731687303715884105728u128 into r5186; + add.w r5183 r5183 into r5187; + gte r5187 r1539 into r5188; + or r5186 r5188 into r5189; + sub.w r5187 r1539 into r5190; + ternary r5189 r5190 r5187 into r5191; + add r5185 9903520314283042199192993792u128 into r5192; + ternary r5189 r5192 r5185 into r5193; + gte r5191 170141183460469231731687303715884105728u128 into r5194; + add.w r5191 r5191 into r5195; + gte r5195 r1539 into r5196; + or r5194 r5196 into r5197; + sub.w r5195 r1539 into r5198; + ternary r5197 r5198 r5195 into r5199; + add r5193 4951760157141521099596496896u128 into r5200; + ternary r5197 r5200 r5193 into r5201; + gte r5199 170141183460469231731687303715884105728u128 into r5202; + add.w r5199 r5199 into r5203; + gte r5203 r1539 into r5204; + or r5202 r5204 into r5205; + sub.w r5203 r1539 into r5206; + ternary r5205 r5206 r5203 into r5207; + add r5201 2475880078570760549798248448u128 into r5208; + ternary r5205 r5208 r5201 into r5209; + gte r5207 170141183460469231731687303715884105728u128 into r5210; + add.w r5207 r5207 into r5211; + gte r5211 r1539 into r5212; + or r5210 r5212 into r5213; + sub.w r5211 r1539 into r5214; + ternary r5213 r5214 r5211 into r5215; + add r5209 1237940039285380274899124224u128 into r5216; + ternary r5213 r5216 r5209 into r5217; + gte r5215 170141183460469231731687303715884105728u128 into r5218; + add.w r5215 r5215 into r5219; + gte r5219 r1539 into r5220; + or r5218 r5220 into r5221; + sub.w r5219 r1539 into r5222; + ternary r5221 r5222 r5219 into r5223; + add r5217 618970019642690137449562112u128 into r5224; + ternary r5221 r5224 r5217 into r5225; + gte r5223 170141183460469231731687303715884105728u128 into r5226; + add.w r5223 r5223 into r5227; + gte r5227 r1539 into r5228; + or r5226 r5228 into r5229; + sub.w r5227 r1539 into r5230; + ternary r5229 r5230 r5227 into r5231; + add r5225 309485009821345068724781056u128 into r5232; + ternary r5229 r5232 r5225 into r5233; + gte r5231 170141183460469231731687303715884105728u128 into r5234; + add.w r5231 r5231 into r5235; + gte r5235 r1539 into r5236; + or r5234 r5236 into r5237; + sub.w r5235 r1539 into r5238; + ternary r5237 r5238 r5235 into r5239; + add r5233 154742504910672534362390528u128 into r5240; + ternary r5237 r5240 r5233 into r5241; + gte r5239 170141183460469231731687303715884105728u128 into r5242; + add.w r5239 r5239 into r5243; + gte r5243 r1539 into r5244; + or r5242 r5244 into r5245; + sub.w r5243 r1539 into r5246; + ternary r5245 r5246 r5243 into r5247; + add r5241 77371252455336267181195264u128 into r5248; + ternary r5245 r5248 r5241 into r5249; + gte r5247 170141183460469231731687303715884105728u128 into r5250; + add.w r5247 r5247 into r5251; + gte r5251 r1539 into r5252; + or r5250 r5252 into r5253; + sub.w r5251 r1539 into r5254; + ternary r5253 r5254 r5251 into r5255; + add r5249 38685626227668133590597632u128 into r5256; + ternary r5253 r5256 r5249 into r5257; + gte r5255 170141183460469231731687303715884105728u128 into r5258; + add.w r5255 r5255 into r5259; + gte r5259 r1539 into r5260; + or r5258 r5260 into r5261; + sub.w r5259 r1539 into r5262; + ternary r5261 r5262 r5259 into r5263; + add r5257 19342813113834066795298816u128 into r5264; + ternary r5261 r5264 r5257 into r5265; + gte r5263 170141183460469231731687303715884105728u128 into r5266; + add.w r5263 r5263 into r5267; + gte r5267 r1539 into r5268; + or r5266 r5268 into r5269; + sub.w r5267 r1539 into r5270; + ternary r5269 r5270 r5267 into r5271; + add r5265 9671406556917033397649408u128 into r5272; + ternary r5269 r5272 r5265 into r5273; + gte r5271 170141183460469231731687303715884105728u128 into r5274; + add.w r5271 r5271 into r5275; + gte r5275 r1539 into r5276; + or r5274 r5276 into r5277; + sub.w r5275 r1539 into r5278; + ternary r5277 r5278 r5275 into r5279; + add r5273 4835703278458516698824704u128 into r5280; + ternary r5277 r5280 r5273 into r5281; + gte r5279 170141183460469231731687303715884105728u128 into r5282; + add.w r5279 r5279 into r5283; + gte r5283 r1539 into r5284; + or r5282 r5284 into r5285; + sub.w r5283 r1539 into r5286; + ternary r5285 r5286 r5283 into r5287; + add r5281 2417851639229258349412352u128 into r5288; + ternary r5285 r5288 r5281 into r5289; + gte r5287 170141183460469231731687303715884105728u128 into r5290; + add.w r5287 r5287 into r5291; + gte r5291 r1539 into r5292; + or r5290 r5292 into r5293; + sub.w r5291 r1539 into r5294; + ternary r5293 r5294 r5291 into r5295; + add r5289 1208925819614629174706176u128 into r5296; + ternary r5293 r5296 r5289 into r5297; + gte r5295 170141183460469231731687303715884105728u128 into r5298; + add.w r5295 r5295 into r5299; + gte r5299 r1539 into r5300; + or r5298 r5300 into r5301; + sub.w r5299 r1539 into r5302; + ternary r5301 r5302 r5299 into r5303; + add r5297 604462909807314587353088u128 into r5304; + ternary r5301 r5304 r5297 into r5305; + gte r5303 170141183460469231731687303715884105728u128 into r5306; + add.w r5303 r5303 into r5307; + gte r5307 r1539 into r5308; + or r5306 r5308 into r5309; + sub.w r5307 r1539 into r5310; + ternary r5309 r5310 r5307 into r5311; + add r5305 302231454903657293676544u128 into r5312; + ternary r5309 r5312 r5305 into r5313; + gte r5311 170141183460469231731687303715884105728u128 into r5314; + add.w r5311 r5311 into r5315; + gte r5315 r1539 into r5316; + or r5314 r5316 into r5317; + sub.w r5315 r1539 into r5318; + ternary r5317 r5318 r5315 into r5319; + add r5313 151115727451828646838272u128 into r5320; + ternary r5317 r5320 r5313 into r5321; + gte r5319 170141183460469231731687303715884105728u128 into r5322; + add.w r5319 r5319 into r5323; + gte r5323 r1539 into r5324; + or r5322 r5324 into r5325; + sub.w r5323 r1539 into r5326; + ternary r5325 r5326 r5323 into r5327; + add r5321 75557863725914323419136u128 into r5328; + ternary r5325 r5328 r5321 into r5329; + gte r5327 170141183460469231731687303715884105728u128 into r5330; + add.w r5327 r5327 into r5331; + gte r5331 r1539 into r5332; + or r5330 r5332 into r5333; + sub.w r5331 r1539 into r5334; + ternary r5333 r5334 r5331 into r5335; + add r5329 37778931862957161709568u128 into r5336; + ternary r5333 r5336 r5329 into r5337; + gte r5335 170141183460469231731687303715884105728u128 into r5338; + add.w r5335 r5335 into r5339; + gte r5339 r1539 into r5340; + or r5338 r5340 into r5341; + sub.w r5339 r1539 into r5342; + ternary r5341 r5342 r5339 into r5343; + add r5337 18889465931478580854784u128 into r5344; + ternary r5341 r5344 r5337 into r5345; + gte r5343 170141183460469231731687303715884105728u128 into r5346; + add.w r5343 r5343 into r5347; + gte r5347 r1539 into r5348; + or r5346 r5348 into r5349; + sub.w r5347 r1539 into r5350; + ternary r5349 r5350 r5347 into r5351; + add r5345 9444732965739290427392u128 into r5352; + ternary r5349 r5352 r5345 into r5353; + gte r5351 170141183460469231731687303715884105728u128 into r5354; + add.w r5351 r5351 into r5355; + gte r5355 r1539 into r5356; + or r5354 r5356 into r5357; + sub.w r5355 r1539 into r5358; + ternary r5357 r5358 r5355 into r5359; + add r5353 4722366482869645213696u128 into r5360; + ternary r5357 r5360 r5353 into r5361; + gte r5359 170141183460469231731687303715884105728u128 into r5362; + add.w r5359 r5359 into r5363; + gte r5363 r1539 into r5364; + or r5362 r5364 into r5365; + sub.w r5363 r1539 into r5366; + ternary r5365 r5366 r5363 into r5367; + add r5361 2361183241434822606848u128 into r5368; + ternary r5365 r5368 r5361 into r5369; + gte r5367 170141183460469231731687303715884105728u128 into r5370; + add.w r5367 r5367 into r5371; + gte r5371 r1539 into r5372; + or r5370 r5372 into r5373; + sub.w r5371 r1539 into r5374; + ternary r5373 r5374 r5371 into r5375; + add r5369 1180591620717411303424u128 into r5376; + ternary r5373 r5376 r5369 into r5377; + gte r5375 170141183460469231731687303715884105728u128 into r5378; + add.w r5375 r5375 into r5379; + gte r5379 r1539 into r5380; + or r5378 r5380 into r5381; + sub.w r5379 r1539 into r5382; + ternary r5381 r5382 r5379 into r5383; + add r5377 590295810358705651712u128 into r5384; + ternary r5381 r5384 r5377 into r5385; + gte r5383 170141183460469231731687303715884105728u128 into r5386; + add.w r5383 r5383 into r5387; + gte r5387 r1539 into r5388; + or r5386 r5388 into r5389; + sub.w r5387 r1539 into r5390; + ternary r5389 r5390 r5387 into r5391; + add r5385 295147905179352825856u128 into r5392; + ternary r5389 r5392 r5385 into r5393; + gte r5391 170141183460469231731687303715884105728u128 into r5394; + add.w r5391 r5391 into r5395; + gte r5395 r1539 into r5396; + or r5394 r5396 into r5397; + sub.w r5395 r1539 into r5398; + ternary r5397 r5398 r5395 into r5399; + add r5393 147573952589676412928u128 into r5400; + ternary r5397 r5400 r5393 into r5401; + gte r5399 170141183460469231731687303715884105728u128 into r5402; + add.w r5399 r5399 into r5403; + gte r5403 r1539 into r5404; + or r5402 r5404 into r5405; + sub.w r5403 r1539 into r5406; + ternary r5405 r5406 r5403 into r5407; + add r5401 73786976294838206464u128 into r5408; + ternary r5405 r5408 r5401 into r5409; + gte r5407 170141183460469231731687303715884105728u128 into r5410; + add.w r5407 r5407 into r5411; + gte r5411 r1539 into r5412; + or r5410 r5412 into r5413; + sub.w r5411 r1539 into r5414; + ternary r5413 r5414 r5411 into r5415; + add r5409 36893488147419103232u128 into r5416; + ternary r5413 r5416 r5409 into r5417; + gte r5415 170141183460469231731687303715884105728u128 into r5418; + add.w r5415 r5415 into r5419; + gte r5419 r1539 into r5420; + or r5418 r5420 into r5421; + sub.w r5419 r1539 into r5422; + ternary r5421 r5422 r5419 into r5423; + add r5417 18446744073709551616u128 into r5424; + ternary r5421 r5424 r5417 into r5425; + gte r5423 170141183460469231731687303715884105728u128 into r5426; + add.w r5423 r5423 into r5427; + gte r5427 r1539 into r5428; + or r5426 r5428 into r5429; + sub.w r5427 r1539 into r5430; + ternary r5429 r5430 r5427 into r5431; + add r5425 9223372036854775808u128 into r5432; + ternary r5429 r5432 r5425 into r5433; + gte r5431 170141183460469231731687303715884105728u128 into r5434; + add.w r5431 r5431 into r5435; + gte r5435 r1539 into r5436; + or r5434 r5436 into r5437; + sub.w r5435 r1539 into r5438; + ternary r5437 r5438 r5435 into r5439; + add r5433 4611686018427387904u128 into r5440; + ternary r5437 r5440 r5433 into r5441; + gte r5439 170141183460469231731687303715884105728u128 into r5442; + add.w r5439 r5439 into r5443; + gte r5443 r1539 into r5444; + or r5442 r5444 into r5445; + sub.w r5443 r1539 into r5446; + ternary r5445 r5446 r5443 into r5447; + add r5441 2305843009213693952u128 into r5448; + ternary r5445 r5448 r5441 into r5449; + gte r5447 170141183460469231731687303715884105728u128 into r5450; + add.w r5447 r5447 into r5451; + gte r5451 r1539 into r5452; + or r5450 r5452 into r5453; + sub.w r5451 r1539 into r5454; + ternary r5453 r5454 r5451 into r5455; + add r5449 1152921504606846976u128 into r5456; + ternary r5453 r5456 r5449 into r5457; + gte r5455 170141183460469231731687303715884105728u128 into r5458; + add.w r5455 r5455 into r5459; + gte r5459 r1539 into r5460; + or r5458 r5460 into r5461; + sub.w r5459 r1539 into r5462; + ternary r5461 r5462 r5459 into r5463; + add r5457 576460752303423488u128 into r5464; + ternary r5461 r5464 r5457 into r5465; + gte r5463 170141183460469231731687303715884105728u128 into r5466; + add.w r5463 r5463 into r5467; + gte r5467 r1539 into r5468; + or r5466 r5468 into r5469; + sub.w r5467 r1539 into r5470; + ternary r5469 r5470 r5467 into r5471; + add r5465 288230376151711744u128 into r5472; + ternary r5469 r5472 r5465 into r5473; + gte r5471 170141183460469231731687303715884105728u128 into r5474; + add.w r5471 r5471 into r5475; + gte r5475 r1539 into r5476; + or r5474 r5476 into r5477; + sub.w r5475 r1539 into r5478; + ternary r5477 r5478 r5475 into r5479; + add r5473 144115188075855872u128 into r5480; + ternary r5477 r5480 r5473 into r5481; + gte r5479 170141183460469231731687303715884105728u128 into r5482; + add.w r5479 r5479 into r5483; + gte r5483 r1539 into r5484; + or r5482 r5484 into r5485; + sub.w r5483 r1539 into r5486; + ternary r5485 r5486 r5483 into r5487; + add r5481 72057594037927936u128 into r5488; + ternary r5485 r5488 r5481 into r5489; + gte r5487 170141183460469231731687303715884105728u128 into r5490; + add.w r5487 r5487 into r5491; + gte r5491 r1539 into r5492; + or r5490 r5492 into r5493; + sub.w r5491 r1539 into r5494; + ternary r5493 r5494 r5491 into r5495; + add r5489 36028797018963968u128 into r5496; + ternary r5493 r5496 r5489 into r5497; + gte r5495 170141183460469231731687303715884105728u128 into r5498; + add.w r5495 r5495 into r5499; + gte r5499 r1539 into r5500; + or r5498 r5500 into r5501; + sub.w r5499 r1539 into r5502; + ternary r5501 r5502 r5499 into r5503; + add r5497 18014398509481984u128 into r5504; + ternary r5501 r5504 r5497 into r5505; + gte r5503 170141183460469231731687303715884105728u128 into r5506; + add.w r5503 r5503 into r5507; + gte r5507 r1539 into r5508; + or r5506 r5508 into r5509; + sub.w r5507 r1539 into r5510; + ternary r5509 r5510 r5507 into r5511; + add r5505 9007199254740992u128 into r5512; + ternary r5509 r5512 r5505 into r5513; + gte r5511 170141183460469231731687303715884105728u128 into r5514; + add.w r5511 r5511 into r5515; + gte r5515 r1539 into r5516; + or r5514 r5516 into r5517; + sub.w r5515 r1539 into r5518; + ternary r5517 r5518 r5515 into r5519; + add r5513 4503599627370496u128 into r5520; + ternary r5517 r5520 r5513 into r5521; + gte r5519 170141183460469231731687303715884105728u128 into r5522; + add.w r5519 r5519 into r5523; + gte r5523 r1539 into r5524; + or r5522 r5524 into r5525; + sub.w r5523 r1539 into r5526; + ternary r5525 r5526 r5523 into r5527; + add r5521 2251799813685248u128 into r5528; + ternary r5525 r5528 r5521 into r5529; + gte r5527 170141183460469231731687303715884105728u128 into r5530; + add.w r5527 r5527 into r5531; + gte r5531 r1539 into r5532; + or r5530 r5532 into r5533; + sub.w r5531 r1539 into r5534; + ternary r5533 r5534 r5531 into r5535; + add r5529 1125899906842624u128 into r5536; + ternary r5533 r5536 r5529 into r5537; + gte r5535 170141183460469231731687303715884105728u128 into r5538; + add.w r5535 r5535 into r5539; + gte r5539 r1539 into r5540; + or r5538 r5540 into r5541; + sub.w r5539 r1539 into r5542; + ternary r5541 r5542 r5539 into r5543; + add r5537 562949953421312u128 into r5544; + ternary r5541 r5544 r5537 into r5545; + gte r5543 170141183460469231731687303715884105728u128 into r5546; + add.w r5543 r5543 into r5547; + gte r5547 r1539 into r5548; + or r5546 r5548 into r5549; + sub.w r5547 r1539 into r5550; + ternary r5549 r5550 r5547 into r5551; + add r5545 281474976710656u128 into r5552; + ternary r5549 r5552 r5545 into r5553; + gte r5551 170141183460469231731687303715884105728u128 into r5554; + add.w r5551 r5551 into r5555; + gte r5555 r1539 into r5556; + or r5554 r5556 into r5557; + sub.w r5555 r1539 into r5558; + ternary r5557 r5558 r5555 into r5559; + add r5553 140737488355328u128 into r5560; + ternary r5557 r5560 r5553 into r5561; + gte r5559 170141183460469231731687303715884105728u128 into r5562; + add.w r5559 r5559 into r5563; + gte r5563 r1539 into r5564; + or r5562 r5564 into r5565; + sub.w r5563 r1539 into r5566; + ternary r5565 r5566 r5563 into r5567; + add r5561 70368744177664u128 into r5568; + ternary r5565 r5568 r5561 into r5569; + gte r5567 170141183460469231731687303715884105728u128 into r5570; + add.w r5567 r5567 into r5571; + gte r5571 r1539 into r5572; + or r5570 r5572 into r5573; + sub.w r5571 r1539 into r5574; + ternary r5573 r5574 r5571 into r5575; + add r5569 35184372088832u128 into r5576; + ternary r5573 r5576 r5569 into r5577; + gte r5575 170141183460469231731687303715884105728u128 into r5578; + add.w r5575 r5575 into r5579; + gte r5579 r1539 into r5580; + or r5578 r5580 into r5581; + sub.w r5579 r1539 into r5582; + ternary r5581 r5582 r5579 into r5583; + add r5577 17592186044416u128 into r5584; + ternary r5581 r5584 r5577 into r5585; + gte r5583 170141183460469231731687303715884105728u128 into r5586; + add.w r5583 r5583 into r5587; + gte r5587 r1539 into r5588; + or r5586 r5588 into r5589; + sub.w r5587 r1539 into r5590; + ternary r5589 r5590 r5587 into r5591; + add r5585 8796093022208u128 into r5592; + ternary r5589 r5592 r5585 into r5593; + gte r5591 170141183460469231731687303715884105728u128 into r5594; + add.w r5591 r5591 into r5595; + gte r5595 r1539 into r5596; + or r5594 r5596 into r5597; + sub.w r5595 r1539 into r5598; + ternary r5597 r5598 r5595 into r5599; + add r5593 4398046511104u128 into r5600; + ternary r5597 r5600 r5593 into r5601; + gte r5599 170141183460469231731687303715884105728u128 into r5602; + add.w r5599 r5599 into r5603; + gte r5603 r1539 into r5604; + or r5602 r5604 into r5605; + sub.w r5603 r1539 into r5606; + ternary r5605 r5606 r5603 into r5607; + add r5601 2199023255552u128 into r5608; + ternary r5605 r5608 r5601 into r5609; + gte r5607 170141183460469231731687303715884105728u128 into r5610; + add.w r5607 r5607 into r5611; + gte r5611 r1539 into r5612; + or r5610 r5612 into r5613; + sub.w r5611 r1539 into r5614; + ternary r5613 r5614 r5611 into r5615; + add r5609 1099511627776u128 into r5616; + ternary r5613 r5616 r5609 into r5617; + gte r5615 170141183460469231731687303715884105728u128 into r5618; + add.w r5615 r5615 into r5619; + gte r5619 r1539 into r5620; + or r5618 r5620 into r5621; + sub.w r5619 r1539 into r5622; + ternary r5621 r5622 r5619 into r5623; + add r5617 549755813888u128 into r5624; + ternary r5621 r5624 r5617 into r5625; + gte r5623 170141183460469231731687303715884105728u128 into r5626; + add.w r5623 r5623 into r5627; + gte r5627 r1539 into r5628; + or r5626 r5628 into r5629; + sub.w r5627 r1539 into r5630; + ternary r5629 r5630 r5627 into r5631; + add r5625 274877906944u128 into r5632; + ternary r5629 r5632 r5625 into r5633; + gte r5631 170141183460469231731687303715884105728u128 into r5634; + add.w r5631 r5631 into r5635; + gte r5635 r1539 into r5636; + or r5634 r5636 into r5637; + sub.w r5635 r1539 into r5638; + ternary r5637 r5638 r5635 into r5639; + add r5633 137438953472u128 into r5640; + ternary r5637 r5640 r5633 into r5641; + gte r5639 170141183460469231731687303715884105728u128 into r5642; + add.w r5639 r5639 into r5643; + gte r5643 r1539 into r5644; + or r5642 r5644 into r5645; + sub.w r5643 r1539 into r5646; + ternary r5645 r5646 r5643 into r5647; + add r5641 68719476736u128 into r5648; + ternary r5645 r5648 r5641 into r5649; + gte r5647 170141183460469231731687303715884105728u128 into r5650; + add.w r5647 r5647 into r5651; + gte r5651 r1539 into r5652; + or r5650 r5652 into r5653; + sub.w r5651 r1539 into r5654; + ternary r5653 r5654 r5651 into r5655; + add r5649 34359738368u128 into r5656; + ternary r5653 r5656 r5649 into r5657; + gte r5655 170141183460469231731687303715884105728u128 into r5658; + add.w r5655 r5655 into r5659; + gte r5659 r1539 into r5660; + or r5658 r5660 into r5661; + sub.w r5659 r1539 into r5662; + ternary r5661 r5662 r5659 into r5663; + add r5657 17179869184u128 into r5664; + ternary r5661 r5664 r5657 into r5665; + gte r5663 170141183460469231731687303715884105728u128 into r5666; + add.w r5663 r5663 into r5667; + gte r5667 r1539 into r5668; + or r5666 r5668 into r5669; + sub.w r5667 r1539 into r5670; + ternary r5669 r5670 r5667 into r5671; + add r5665 8589934592u128 into r5672; + ternary r5669 r5672 r5665 into r5673; + gte r5671 170141183460469231731687303715884105728u128 into r5674; + add.w r5671 r5671 into r5675; + gte r5675 r1539 into r5676; + or r5674 r5676 into r5677; + sub.w r5675 r1539 into r5678; + ternary r5677 r5678 r5675 into r5679; + add r5673 4294967296u128 into r5680; + ternary r5677 r5680 r5673 into r5681; + gte r5679 170141183460469231731687303715884105728u128 into r5682; + add.w r5679 r5679 into r5683; + gte r5683 r1539 into r5684; + or r5682 r5684 into r5685; + sub.w r5683 r1539 into r5686; + ternary r5685 r5686 r5683 into r5687; + add r5681 2147483648u128 into r5688; + ternary r5685 r5688 r5681 into r5689; + gte r5687 170141183460469231731687303715884105728u128 into r5690; + add.w r5687 r5687 into r5691; + gte r5691 r1539 into r5692; + or r5690 r5692 into r5693; + sub.w r5691 r1539 into r5694; + ternary r5693 r5694 r5691 into r5695; + add r5689 1073741824u128 into r5696; + ternary r5693 r5696 r5689 into r5697; + gte r5695 170141183460469231731687303715884105728u128 into r5698; + add.w r5695 r5695 into r5699; + gte r5699 r1539 into r5700; + or r5698 r5700 into r5701; + sub.w r5699 r1539 into r5702; + ternary r5701 r5702 r5699 into r5703; + add r5697 536870912u128 into r5704; + ternary r5701 r5704 r5697 into r5705; + gte r5703 170141183460469231731687303715884105728u128 into r5706; + add.w r5703 r5703 into r5707; + gte r5707 r1539 into r5708; + or r5706 r5708 into r5709; + sub.w r5707 r1539 into r5710; + ternary r5709 r5710 r5707 into r5711; + add r5705 268435456u128 into r5712; + ternary r5709 r5712 r5705 into r5713; + gte r5711 170141183460469231731687303715884105728u128 into r5714; + add.w r5711 r5711 into r5715; + gte r5715 r1539 into r5716; + or r5714 r5716 into r5717; + sub.w r5715 r1539 into r5718; + ternary r5717 r5718 r5715 into r5719; + add r5713 134217728u128 into r5720; + ternary r5717 r5720 r5713 into r5721; + gte r5719 170141183460469231731687303715884105728u128 into r5722; + add.w r5719 r5719 into r5723; + gte r5723 r1539 into r5724; + or r5722 r5724 into r5725; + sub.w r5723 r1539 into r5726; + ternary r5725 r5726 r5723 into r5727; + add r5721 67108864u128 into r5728; + ternary r5725 r5728 r5721 into r5729; + gte r5727 170141183460469231731687303715884105728u128 into r5730; + add.w r5727 r5727 into r5731; + gte r5731 r1539 into r5732; + or r5730 r5732 into r5733; + sub.w r5731 r1539 into r5734; + ternary r5733 r5734 r5731 into r5735; + add r5729 33554432u128 into r5736; + ternary r5733 r5736 r5729 into r5737; + gte r5735 170141183460469231731687303715884105728u128 into r5738; + add.w r5735 r5735 into r5739; + gte r5739 r1539 into r5740; + or r5738 r5740 into r5741; + sub.w r5739 r1539 into r5742; + ternary r5741 r5742 r5739 into r5743; + add r5737 16777216u128 into r5744; + ternary r5741 r5744 r5737 into r5745; + gte r5743 170141183460469231731687303715884105728u128 into r5746; + add.w r5743 r5743 into r5747; + gte r5747 r1539 into r5748; + or r5746 r5748 into r5749; + sub.w r5747 r1539 into r5750; + ternary r5749 r5750 r5747 into r5751; + add r5745 8388608u128 into r5752; + ternary r5749 r5752 r5745 into r5753; + gte r5751 170141183460469231731687303715884105728u128 into r5754; + add.w r5751 r5751 into r5755; + gte r5755 r1539 into r5756; + or r5754 r5756 into r5757; + sub.w r5755 r1539 into r5758; + ternary r5757 r5758 r5755 into r5759; + add r5753 4194304u128 into r5760; + ternary r5757 r5760 r5753 into r5761; + gte r5759 170141183460469231731687303715884105728u128 into r5762; + add.w r5759 r5759 into r5763; + gte r5763 r1539 into r5764; + or r5762 r5764 into r5765; + sub.w r5763 r1539 into r5766; + ternary r5765 r5766 r5763 into r5767; + add r5761 2097152u128 into r5768; + ternary r5765 r5768 r5761 into r5769; + gte r5767 170141183460469231731687303715884105728u128 into r5770; + add.w r5767 r5767 into r5771; + gte r5771 r1539 into r5772; + or r5770 r5772 into r5773; + sub.w r5771 r1539 into r5774; + ternary r5773 r5774 r5771 into r5775; + add r5769 1048576u128 into r5776; + ternary r5773 r5776 r5769 into r5777; + gte r5775 170141183460469231731687303715884105728u128 into r5778; + add.w r5775 r5775 into r5779; + gte r5779 r1539 into r5780; + or r5778 r5780 into r5781; + sub.w r5779 r1539 into r5782; + ternary r5781 r5782 r5779 into r5783; + add r5777 524288u128 into r5784; + ternary r5781 r5784 r5777 into r5785; + gte r5783 170141183460469231731687303715884105728u128 into r5786; + add.w r5783 r5783 into r5787; + gte r5787 r1539 into r5788; + or r5786 r5788 into r5789; + sub.w r5787 r1539 into r5790; + ternary r5789 r5790 r5787 into r5791; + add r5785 262144u128 into r5792; + ternary r5789 r5792 r5785 into r5793; + gte r5791 170141183460469231731687303715884105728u128 into r5794; + add.w r5791 r5791 into r5795; + gte r5795 r1539 into r5796; + or r5794 r5796 into r5797; + sub.w r5795 r1539 into r5798; + ternary r5797 r5798 r5795 into r5799; + add r5793 131072u128 into r5800; + ternary r5797 r5800 r5793 into r5801; + gte r5799 170141183460469231731687303715884105728u128 into r5802; + add.w r5799 r5799 into r5803; + gte r5803 r1539 into r5804; + or r5802 r5804 into r5805; + sub.w r5803 r1539 into r5806; + ternary r5805 r5806 r5803 into r5807; + add r5801 65536u128 into r5808; + ternary r5805 r5808 r5801 into r5809; + gte r5807 170141183460469231731687303715884105728u128 into r5810; + add.w r5807 r5807 into r5811; + gte r5811 r1539 into r5812; + or r5810 r5812 into r5813; + sub.w r5811 r1539 into r5814; + ternary r5813 r5814 r5811 into r5815; + add r5809 32768u128 into r5816; + ternary r5813 r5816 r5809 into r5817; + gte r5815 170141183460469231731687303715884105728u128 into r5818; + add.w r5815 r5815 into r5819; + gte r5819 r1539 into r5820; + or r5818 r5820 into r5821; + sub.w r5819 r1539 into r5822; + ternary r5821 r5822 r5819 into r5823; + add r5817 16384u128 into r5824; + ternary r5821 r5824 r5817 into r5825; + gte r5823 170141183460469231731687303715884105728u128 into r5826; + add.w r5823 r5823 into r5827; + gte r5827 r1539 into r5828; + or r5826 r5828 into r5829; + sub.w r5827 r1539 into r5830; + ternary r5829 r5830 r5827 into r5831; + add r5825 8192u128 into r5832; + ternary r5829 r5832 r5825 into r5833; + gte r5831 170141183460469231731687303715884105728u128 into r5834; + add.w r5831 r5831 into r5835; + gte r5835 r1539 into r5836; + or r5834 r5836 into r5837; + sub.w r5835 r1539 into r5838; + ternary r5837 r5838 r5835 into r5839; + add r5833 4096u128 into r5840; + ternary r5837 r5840 r5833 into r5841; + gte r5839 170141183460469231731687303715884105728u128 into r5842; + add.w r5839 r5839 into r5843; + gte r5843 r1539 into r5844; + or r5842 r5844 into r5845; + sub.w r5843 r1539 into r5846; + ternary r5845 r5846 r5843 into r5847; + add r5841 2048u128 into r5848; + ternary r5845 r5848 r5841 into r5849; + gte r5847 170141183460469231731687303715884105728u128 into r5850; + add.w r5847 r5847 into r5851; + gte r5851 r1539 into r5852; + or r5850 r5852 into r5853; + sub.w r5851 r1539 into r5854; + ternary r5853 r5854 r5851 into r5855; + add r5849 1024u128 into r5856; + ternary r5853 r5856 r5849 into r5857; + gte r5855 170141183460469231731687303715884105728u128 into r5858; + add.w r5855 r5855 into r5859; + gte r5859 r1539 into r5860; + or r5858 r5860 into r5861; + sub.w r5859 r1539 into r5862; + ternary r5861 r5862 r5859 into r5863; + add r5857 512u128 into r5864; + ternary r5861 r5864 r5857 into r5865; + gte r5863 170141183460469231731687303715884105728u128 into r5866; + add.w r5863 r5863 into r5867; + gte r5867 r1539 into r5868; + or r5866 r5868 into r5869; + sub.w r5867 r1539 into r5870; + ternary r5869 r5870 r5867 into r5871; + add r5865 256u128 into r5872; + ternary r5869 r5872 r5865 into r5873; + gte r5871 170141183460469231731687303715884105728u128 into r5874; + add.w r5871 r5871 into r5875; + gte r5875 r1539 into r5876; + or r5874 r5876 into r5877; + sub.w r5875 r1539 into r5878; + ternary r5877 r5878 r5875 into r5879; + add r5873 128u128 into r5880; + ternary r5877 r5880 r5873 into r5881; + gte r5879 170141183460469231731687303715884105728u128 into r5882; + add.w r5879 r5879 into r5883; + gte r5883 r1539 into r5884; + or r5882 r5884 into r5885; + sub.w r5883 r1539 into r5886; + ternary r5885 r5886 r5883 into r5887; + add r5881 64u128 into r5888; + ternary r5885 r5888 r5881 into r5889; + gte r5887 170141183460469231731687303715884105728u128 into r5890; + add.w r5887 r5887 into r5891; + gte r5891 r1539 into r5892; + or r5890 r5892 into r5893; + sub.w r5891 r1539 into r5894; + ternary r5893 r5894 r5891 into r5895; + add r5889 32u128 into r5896; + ternary r5893 r5896 r5889 into r5897; + gte r5895 170141183460469231731687303715884105728u128 into r5898; + add.w r5895 r5895 into r5899; + gte r5899 r1539 into r5900; + or r5898 r5900 into r5901; + sub.w r5899 r1539 into r5902; + ternary r5901 r5902 r5899 into r5903; + add r5897 16u128 into r5904; + ternary r5901 r5904 r5897 into r5905; + gte r5903 170141183460469231731687303715884105728u128 into r5906; + add.w r5903 r5903 into r5907; + gte r5907 r1539 into r5908; + or r5906 r5908 into r5909; + sub.w r5907 r1539 into r5910; + ternary r5909 r5910 r5907 into r5911; + add r5905 8u128 into r5912; + ternary r5909 r5912 r5905 into r5913; + gte r5911 170141183460469231731687303715884105728u128 into r5914; + add.w r5911 r5911 into r5915; + gte r5915 r1539 into r5916; + or r5914 r5916 into r5917; + sub.w r5915 r1539 into r5918; + ternary r5917 r5918 r5915 into r5919; + add r5913 4u128 into r5920; + ternary r5917 r5920 r5913 into r5921; + gte r5919 170141183460469231731687303715884105728u128 into r5922; + add.w r5919 r5919 into r5923; + gte r5923 r1539 into r5924; + or r5922 r5924 into r5925; + sub.w r5923 r1539 into r5926; + ternary r5925 r5926 r5923 into r5927; + add r5921 2u128 into r5928; + ternary r5925 r5928 r5921 into r5929; + gte r5927 170141183460469231731687303715884105728u128 into r5930; + add.w r5927 r5927 into r5931; + gte r5931 r1539 into r5932; + or r5930 r5932 into r5933; + add r5929 1u128 into r5934; + ternary r5933 r5934 r5929 into r5935; + ternary r1538 r4912 0u128 into r5936; + ternary r1538 r5935 0u128 into r5937; + cast r5936 r5937 into r5938 as U256__8JquwLopp8; + add.w r4.lo r5938.lo into r5939; + lt r5939 r4.lo into r5940; + ternary r5940 1u128 0u128 into r5941; + add.w r4.hi r5938.hi into r5942; + add.w r5942 r5941 into r5943; + cast r5943 r5939 into r5944 as U256__8JquwLopp8; + add r3 r4677 into r5945; + ternary r4673 r5944.hi r4.hi into r5946; + ternary r4673 r5944.lo r4.lo into r5947; + cast r5946 r5947 into r5948 as U256__8JquwLopp8; + add r5 r4910 into r5949; + gt r4676.hi 0u128 into r5950; + ternary r5950 r4676.hi r4676.lo into r5951; + ternary r5950 128u32 0u32 into r5952; + gte r5951 18446744073709551616u128 into r5953; + shr r5951 64u8 into r5954; + ternary r5953 r5954 r5951 into r5955; + ternary r5953 64u32 0u32 into r5956; + gte r5955 4294967296u128 into r5957; + shr r5955 32u8 into r5958; + add r5956 32u32 into r5959; + ternary r5957 r5958 r5955 into r5960; + ternary r5957 r5959 r5956 into r5961; + gte r5960 65536u128 into r5962; + shr r5960 16u8 into r5963; + add r5961 16u32 into r5964; + ternary r5962 r5963 r5960 into r5965; + ternary r5962 r5964 r5961 into r5966; + gte r5965 256u128 into r5967; + shr r5965 8u8 into r5968; + add r5966 8u32 into r5969; + ternary r5967 r5968 r5965 into r5970; + ternary r5967 r5969 r5966 into r5971; + gte r5970 16u128 into r5972; + shr r5970 4u8 into r5973; + add r5971 4u32 into r5974; + ternary r5972 r5973 r5970 into r5975; + ternary r5972 r5974 r5971 into r5976; + gte r5975 4u128 into r5977; + shr r5975 2u8 into r5978; + add r5976 2u32 into r5979; + ternary r5977 r5978 r5975 into r5980; + ternary r5977 r5979 r5976 into r5981; + gte r5980 2u128 into r5982; + add r5981 1u32 into r5983; + ternary r5982 r5983 r5981 into r5984; + add r5952 r5984 into r5985; + gte r5985 127u32 into r5986; + ternary r5986 r5985 127u32 into r5987; + ternary r5986 127u32 r5985 into r5988; + sub r5987 r5988 into r5989; + cast r5989 into r5990 as u16; + and r5990 127u16 into r5991; + cast r5991 into r5992 as u8; + is.eq r5992 0u8 into r5993; + sub 128u8 r5992 into r5994; + shl.w r4676.hi r5994 into r5995; + ternary r5993 0u128 r5995 into r5996; + shr r4676.lo r5992 into r5997; + or r5997 r5996 into r5998; + shr r4676.hi r5992 into r5999; + shr r4676.hi r5992 into r6000; + gte r5990 128u16 into r6001; + ternary r6001 0u128 r5999 into r6002; + ternary r6001 r6000 r5998 into r6003; + cast r6002 r6003 into r6004 as U256__8JquwLopp8; + cast r5991 into r6005 as u8; + is.eq r6005 0u8 into r6006; + sub 128u8 r6005 into r6007; + shr.w r4676.lo r6007 into r6008; + ternary r6006 0u128 r6008 into r6009; + shl.w r4676.hi r6005 into r6010; + or r6010 r6009 into r6011; + shl.w r4676.lo r6005 into r6012; + shl.w r4676.lo r6005 into r6013; + ternary r6001 r6013 r6011 into r6014; + ternary r6001 0u128 r6012 into r6015; + cast r6014 r6015 into r6016 as U256__8JquwLopp8; + ternary r5986 r6004.hi r6016.hi into r6017; + ternary r5986 r6004.lo r6016.lo into r6018; + cast r6017 r6018 into r6019 as U256__8JquwLopp8; + shr r6019.lo 64u8 into r6020; + mul r6020 r6020 into r6021; + shr r6021 63u8 into r6022; + shr r6022 64u8 into r6023; + shl r6023 63u8 into r6024; + cast r6023 into r6025 as u8; + shr r6022 r6025 into r6026; + mul r6026 r6026 into r6027; + shr r6027 63u8 into r6028; + shr r6028 64u8 into r6029; + shl r6029 62u8 into r6030; + or r6024 r6030 into r6031; + cast r6029 into r6032 as u8; + shr r6028 r6032 into r6033; + mul r6033 r6033 into r6034; + shr r6034 63u8 into r6035; + shr r6035 64u8 into r6036; + shl r6036 61u8 into r6037; + or r6031 r6037 into r6038; + cast r6036 into r6039 as u8; + shr r6035 r6039 into r6040; + mul r6040 r6040 into r6041; + shr r6041 63u8 into r6042; + shr r6042 64u8 into r6043; + shl r6043 60u8 into r6044; + or r6038 r6044 into r6045; + cast r6043 into r6046 as u8; + shr r6042 r6046 into r6047; + mul r6047 r6047 into r6048; + shr r6048 63u8 into r6049; + shr r6049 64u8 into r6050; + shl r6050 59u8 into r6051; + or r6045 r6051 into r6052; + cast r6050 into r6053 as u8; + shr r6049 r6053 into r6054; + mul r6054 r6054 into r6055; + shr r6055 63u8 into r6056; + shr r6056 64u8 into r6057; + shl r6057 58u8 into r6058; + or r6052 r6058 into r6059; + cast r6057 into r6060 as u8; + shr r6056 r6060 into r6061; + mul r6061 r6061 into r6062; + shr r6062 63u8 into r6063; + shr r6063 64u8 into r6064; + shl r6064 57u8 into r6065; + or r6059 r6065 into r6066; + cast r6064 into r6067 as u8; + shr r6063 r6067 into r6068; + mul r6068 r6068 into r6069; + shr r6069 63u8 into r6070; + shr r6070 64u8 into r6071; + shl r6071 56u8 into r6072; + or r6066 r6072 into r6073; + cast r6071 into r6074 as u8; + shr r6070 r6074 into r6075; + mul r6075 r6075 into r6076; + shr r6076 63u8 into r6077; + shr r6077 64u8 into r6078; + shl r6078 55u8 into r6079; + or r6073 r6079 into r6080; + cast r6078 into r6081 as u8; + shr r6077 r6081 into r6082; + mul r6082 r6082 into r6083; + shr r6083 63u8 into r6084; + shr r6084 64u8 into r6085; + shl r6085 54u8 into r6086; + or r6080 r6086 into r6087; + cast r6085 into r6088 as u8; + shr r6084 r6088 into r6089; + mul r6089 r6089 into r6090; + shr r6090 63u8 into r6091; + shr r6091 64u8 into r6092; + shl r6092 53u8 into r6093; + or r6087 r6093 into r6094; + cast r6092 into r6095 as u8; + shr r6091 r6095 into r6096; + mul r6096 r6096 into r6097; + shr r6097 63u8 into r6098; + shr r6098 64u8 into r6099; + shl r6099 52u8 into r6100; + or r6094 r6100 into r6101; + cast r6099 into r6102 as u8; + shr r6098 r6102 into r6103; + mul r6103 r6103 into r6104; + shr r6104 63u8 into r6105; + shr r6105 64u8 into r6106; + shl r6106 51u8 into r6107; + or r6101 r6107 into r6108; + cast r6106 into r6109 as u8; + shr r6105 r6109 into r6110; + mul r6110 r6110 into r6111; + shr r6111 63u8 into r6112; + shr r6112 64u8 into r6113; + shl r6113 50u8 into r6114; + or r6108 r6114 into r6115; + cast r5985 into r6116 as i128; + sub r6116 128i128 into r6117; + shl r6117 64u8 into r6118; + cast r6115 into r6119 as i128; + add r6118 r6119 into r6120; + div r6120 1330584781654114i128 into r6121; + cast r6121 into r6122 as i32; + output r4676 as U256__8JquwLopp8.public; + output r5945 as u128.public; + output r4906 as u128.public; + output r5948 as U256__8JquwLopp8.public; + output r5949 as u128.public; + output r6122 as i32.public; + +view resolve_stored_tick: + input r0 as U256__8JquwLopp8.public; + input r1 as i32.public; + input r2 as U256__8JquwLopp8.public; + input r3 as i32.public; + input r4 as boolean.public; + add r3 1i32 into r5; + gte r5 -524287i32 into r6; + lte r5 524287i32 into r7; + and r6 r7 into r8; + assert.eq r8 true; + lt r5 0i32 into r9; + sub 0i32 r5 into r10; + ternary r9 r10 r5 into r11; + gte r11 0i32 into r12; + assert.eq r12 true; + cast r11 into r13 as u32; + and r13 3u32 into r14; + is.eq r14 0u32 into r15; + is.eq r14 1u32 into r16; + is.eq r14 2u32 into r17; + ternary r17 0u128 0u128 into r18; + ternary r17 340248342086729790484326174814286782778u128 340231330945450418515964920540021147199u128 into r19; + cast r18 r19 into r20 as U256__8JquwLopp8; + ternary r16 0u128 r20.hi into r21; + ternary r16 340265354078544963557816517032075149313u128 r20.lo into r22; + cast r21 r22 into r23 as U256__8JquwLopp8; + ternary r15 1u128 r23.hi into r24; + ternary r15 0u128 r23.lo into r25; + cast r24 r25 into r26 as U256__8JquwLopp8; + and r13 4u32 into r27; + is.neq r27 0u32 into r28; + and r26.lo 18446744073709551615u128 into r29; + shr r26.lo 64u8 into r30; + mul r29 17226890335427755468u128 into r31; + mul r29 18443055278223354162u128 into r32; + mul r30 17226890335427755468u128 into r33; + mul r30 18443055278223354162u128 into r34; + and r31 18446744073709551615u128 into r35; + shr r31 64u8 into r36; + and r32 18446744073709551615u128 into r37; + add r36 r37 into r38; + and r33 18446744073709551615u128 into r39; + add r38 r39 into r40; + and r40 18446744073709551615u128 into r41; + shr r40 64u8 into r42; + shr r32 64u8 into r43; + shr r33 64u8 into r44; + add r43 r44 into r45; + and r34 18446744073709551615u128 into r46; + add r45 r46 into r47; + add r47 r42 into r48; + and r48 18446744073709551615u128 into r49; + shr r48 64u8 into r50; + shr r34 64u8 into r51; + add r51 r50 into r52; + shl r52 64u8 into r53; + add r53 r49 into r54; + shl r41 64u8 into r55; + add r55 r35 into r56; + and r26.hi 18446744073709551615u128 into r57; + shr r26.hi 64u8 into r58; + mul r57 17226890335427755468u128 into r59; + mul r57 18443055278223354162u128 into r60; + mul r58 17226890335427755468u128 into r61; + mul r58 18443055278223354162u128 into r62; + and r59 18446744073709551615u128 into r63; + shr r59 64u8 into r64; + and r60 18446744073709551615u128 into r65; + add r64 r65 into r66; + and r61 18446744073709551615u128 into r67; + add r66 r67 into r68; + and r68 18446744073709551615u128 into r69; + shr r68 64u8 into r70; + shr r60 64u8 into r71; + shr r61 64u8 into r72; + add r71 r72 into r73; + and r62 18446744073709551615u128 into r74; + add r73 r74 into r75; + add r75 r70 into r76; + and r76 18446744073709551615u128 into r77; + shr r76 64u8 into r78; + shr r62 64u8 into r79; + add r79 r78 into r80; + shl r80 64u8 into r81; + add r81 r77 into r82; + shl r69 64u8 into r83; + add r83 r63 into r84; + add.w r54 r84 into r85; + lt r85 r54 into r86; + ternary r86 1u128 0u128 into r87; + add.w r82 r87 into r88; + cast r88 r85 into r89 as U256__8JquwLopp8; + ternary r28 r89.hi r26.hi into r90; + ternary r28 r89.lo r26.lo into r91; + cast r90 r91 into r92 as U256__8JquwLopp8; + and r13 8u32 into r93; + is.neq r93 0u32 into r94; + and r92.lo 18446744073709551615u128 into r95; + shr r92.lo 64u8 into r96; + mul r95 2032852871939366096u128 into r97; + mul r95 18439367220385604838u128 into r98; + mul r96 2032852871939366096u128 into r99; + mul r96 18439367220385604838u128 into r100; + and r97 18446744073709551615u128 into r101; + shr r97 64u8 into r102; + and r98 18446744073709551615u128 into r103; + add r102 r103 into r104; + and r99 18446744073709551615u128 into r105; + add r104 r105 into r106; + and r106 18446744073709551615u128 into r107; + shr r106 64u8 into r108; + shr r98 64u8 into r109; + shr r99 64u8 into r110; + add r109 r110 into r111; + and r100 18446744073709551615u128 into r112; + add r111 r112 into r113; + add r113 r108 into r114; + and r114 18446744073709551615u128 into r115; + shr r114 64u8 into r116; + shr r100 64u8 into r117; + add r117 r116 into r118; + shl r118 64u8 into r119; + add r119 r115 into r120; + shl r107 64u8 into r121; + add r121 r101 into r122; + and r92.hi 18446744073709551615u128 into r123; + shr r92.hi 64u8 into r124; + mul r123 2032852871939366096u128 into r125; + mul r123 18439367220385604838u128 into r126; + mul r124 2032852871939366096u128 into r127; + mul r124 18439367220385604838u128 into r128; + and r125 18446744073709551615u128 into r129; + shr r125 64u8 into r130; + and r126 18446744073709551615u128 into r131; + add r130 r131 into r132; + and r127 18446744073709551615u128 into r133; + add r132 r133 into r134; + and r134 18446744073709551615u128 into r135; + shr r134 64u8 into r136; + shr r126 64u8 into r137; + shr r127 64u8 into r138; + add r137 r138 into r139; + and r128 18446744073709551615u128 into r140; + add r139 r140 into r141; + add r141 r136 into r142; + and r142 18446744073709551615u128 into r143; + shr r142 64u8 into r144; + shr r128 64u8 into r145; + add r145 r144 into r146; + shl r146 64u8 into r147; + add r147 r143 into r148; + shl r135 64u8 into r149; + add r149 r129 into r150; + add.w r120 r150 into r151; + lt r151 r120 into r152; + ternary r152 1u128 0u128 into r153; + add.w r148 r153 into r154; + cast r154 r151 into r155 as U256__8JquwLopp8; + ternary r94 r155.hi r92.hi into r156; + ternary r94 r155.lo r92.lo into r157; + cast r156 r157 into r158 as U256__8JquwLopp8; + and r13 16u32 into r159; + is.neq r159 0u32 into r160; + and r158.lo 18446744073709551615u128 into r161; + shr r158.lo 64u8 into r162; + mul r161 14545316742740207172u128 into r163; + mul r161 18431993317065449817u128 into r164; + mul r162 14545316742740207172u128 into r165; + mul r162 18431993317065449817u128 into r166; + and r163 18446744073709551615u128 into r167; + shr r163 64u8 into r168; + and r164 18446744073709551615u128 into r169; + add r168 r169 into r170; + and r165 18446744073709551615u128 into r171; + add r170 r171 into r172; + and r172 18446744073709551615u128 into r173; + shr r172 64u8 into r174; + shr r164 64u8 into r175; + shr r165 64u8 into r176; + add r175 r176 into r177; + and r166 18446744073709551615u128 into r178; + add r177 r178 into r179; + add r179 r174 into r180; + and r180 18446744073709551615u128 into r181; + shr r180 64u8 into r182; + shr r166 64u8 into r183; + add r183 r182 into r184; + shl r184 64u8 into r185; + add r185 r181 into r186; + shl r173 64u8 into r187; + add r187 r167 into r188; + and r158.hi 18446744073709551615u128 into r189; + shr r158.hi 64u8 into r190; + mul r189 14545316742740207172u128 into r191; + mul r189 18431993317065449817u128 into r192; + mul r190 14545316742740207172u128 into r193; + mul r190 18431993317065449817u128 into r194; + and r191 18446744073709551615u128 into r195; + shr r191 64u8 into r196; + and r192 18446744073709551615u128 into r197; + add r196 r197 into r198; + and r193 18446744073709551615u128 into r199; + add r198 r199 into r200; + and r200 18446744073709551615u128 into r201; + shr r200 64u8 into r202; + shr r192 64u8 into r203; + shr r193 64u8 into r204; + add r203 r204 into r205; + and r194 18446744073709551615u128 into r206; + add r205 r206 into r207; + add r207 r202 into r208; + and r208 18446744073709551615u128 into r209; + shr r208 64u8 into r210; + shr r194 64u8 into r211; + add r211 r210 into r212; + shl r212 64u8 into r213; + add r213 r209 into r214; + shl r201 64u8 into r215; + add r215 r195 into r216; + add.w r186 r216 into r217; + lt r217 r186 into r218; + ternary r218 1u128 0u128 into r219; + add.w r214 r219 into r220; + cast r220 r217 into r221 as U256__8JquwLopp8; + ternary r160 r221.hi r158.hi into r222; + ternary r160 r221.lo r158.lo into r223; + cast r222 r223 into r224 as U256__8JquwLopp8; + and r13 32u32 into r225; + is.neq r225 0u32 into r226; + and r224.lo 18446744073709551615u128 into r227; + shr r224.lo 64u8 into r228; + mul r227 5129152022828963008u128 into r229; + mul r227 18417254355718160513u128 into r230; + mul r228 5129152022828963008u128 into r231; + mul r228 18417254355718160513u128 into r232; + and r229 18446744073709551615u128 into r233; + shr r229 64u8 into r234; + and r230 18446744073709551615u128 into r235; + add r234 r235 into r236; + and r231 18446744073709551615u128 into r237; + add r236 r237 into r238; + and r238 18446744073709551615u128 into r239; + shr r238 64u8 into r240; + shr r230 64u8 into r241; + shr r231 64u8 into r242; + add r241 r242 into r243; + and r232 18446744073709551615u128 into r244; + add r243 r244 into r245; + add r245 r240 into r246; + and r246 18446744073709551615u128 into r247; + shr r246 64u8 into r248; + shr r232 64u8 into r249; + add r249 r248 into r250; + shl r250 64u8 into r251; + add r251 r247 into r252; + shl r239 64u8 into r253; + add r253 r233 into r254; + and r224.hi 18446744073709551615u128 into r255; + shr r224.hi 64u8 into r256; + mul r255 5129152022828963008u128 into r257; + mul r255 18417254355718160513u128 into r258; + mul r256 5129152022828963008u128 into r259; + mul r256 18417254355718160513u128 into r260; + and r257 18446744073709551615u128 into r261; + shr r257 64u8 into r262; + and r258 18446744073709551615u128 into r263; + add r262 r263 into r264; + and r259 18446744073709551615u128 into r265; + add r264 r265 into r266; + and r266 18446744073709551615u128 into r267; + shr r266 64u8 into r268; + shr r258 64u8 into r269; + shr r259 64u8 into r270; + add r269 r270 into r271; + and r260 18446744073709551615u128 into r272; + add r271 r272 into r273; + add r273 r268 into r274; + and r274 18446744073709551615u128 into r275; + shr r274 64u8 into r276; + shr r260 64u8 into r277; + add r277 r276 into r278; + shl r278 64u8 into r279; + add r279 r275 into r280; + shl r267 64u8 into r281; + add r281 r261 into r282; + add.w r252 r282 into r283; + lt r283 r252 into r284; + ternary r284 1u128 0u128 into r285; + add.w r280 r285 into r286; + cast r286 r283 into r287 as U256__8JquwLopp8; + ternary r226 r287.hi r224.hi into r288; + ternary r226 r287.lo r224.lo into r289; + cast r288 r289 into r290 as U256__8JquwLopp8; + and r13 64u32 into r291; + is.neq r291 0u32 into r292; + and r290.lo 18446744073709551615u128 into r293; + shr r290.lo 64u8 into r294; + mul r293 4894419605888772193u128 into r295; + mul r293 18387811781193591352u128 into r296; + mul r294 4894419605888772193u128 into r297; + mul r294 18387811781193591352u128 into r298; + and r295 18446744073709551615u128 into r299; + shr r295 64u8 into r300; + and r296 18446744073709551615u128 into r301; + add r300 r301 into r302; + and r297 18446744073709551615u128 into r303; + add r302 r303 into r304; + and r304 18446744073709551615u128 into r305; + shr r304 64u8 into r306; + shr r296 64u8 into r307; + shr r297 64u8 into r308; + add r307 r308 into r309; + and r298 18446744073709551615u128 into r310; + add r309 r310 into r311; + add r311 r306 into r312; + and r312 18446744073709551615u128 into r313; + shr r312 64u8 into r314; + shr r298 64u8 into r315; + add r315 r314 into r316; + shl r316 64u8 into r317; + add r317 r313 into r318; + shl r305 64u8 into r319; + add r319 r299 into r320; + and r290.hi 18446744073709551615u128 into r321; + shr r290.hi 64u8 into r322; + mul r321 4894419605888772193u128 into r323; + mul r321 18387811781193591352u128 into r324; + mul r322 4894419605888772193u128 into r325; + mul r322 18387811781193591352u128 into r326; + and r323 18446744073709551615u128 into r327; + shr r323 64u8 into r328; + and r324 18446744073709551615u128 into r329; + add r328 r329 into r330; + and r325 18446744073709551615u128 into r331; + add r330 r331 into r332; + and r332 18446744073709551615u128 into r333; + shr r332 64u8 into r334; + shr r324 64u8 into r335; + shr r325 64u8 into r336; + add r335 r336 into r337; + and r326 18446744073709551615u128 into r338; + add r337 r338 into r339; + add r339 r334 into r340; + and r340 18446744073709551615u128 into r341; + shr r340 64u8 into r342; + shr r326 64u8 into r343; + add r343 r342 into r344; + shl r344 64u8 into r345; + add r345 r341 into r346; + shl r333 64u8 into r347; + add r347 r327 into r348; + add.w r318 r348 into r349; + lt r349 r318 into r350; + ternary r350 1u128 0u128 into r351; + add.w r346 r351 into r352; + cast r352 r349 into r353 as U256__8JquwLopp8; + ternary r292 r353.hi r290.hi into r354; + ternary r292 r353.lo r290.lo into r355; + cast r354 r355 into r356 as U256__8JquwLopp8; + and r13 128u32 into r357; + is.neq r357 0u32 into r358; + and r356.lo 18446744073709551615u128 into r359; + shr r356.lo 64u8 into r360; + mul r359 1280255884321894483u128 into r361; + mul r359 18329067761203520168u128 into r362; + mul r360 1280255884321894483u128 into r363; + mul r360 18329067761203520168u128 into r364; + and r361 18446744073709551615u128 into r365; + shr r361 64u8 into r366; + and r362 18446744073709551615u128 into r367; + add r366 r367 into r368; + and r363 18446744073709551615u128 into r369; + add r368 r369 into r370; + and r370 18446744073709551615u128 into r371; + shr r370 64u8 into r372; + shr r362 64u8 into r373; + shr r363 64u8 into r374; + add r373 r374 into r375; + and r364 18446744073709551615u128 into r376; + add r375 r376 into r377; + add r377 r372 into r378; + and r378 18446744073709551615u128 into r379; + shr r378 64u8 into r380; + shr r364 64u8 into r381; + add r381 r380 into r382; + shl r382 64u8 into r383; + add r383 r379 into r384; + shl r371 64u8 into r385; + add r385 r365 into r386; + and r356.hi 18446744073709551615u128 into r387; + shr r356.hi 64u8 into r388; + mul r387 1280255884321894483u128 into r389; + mul r387 18329067761203520168u128 into r390; + mul r388 1280255884321894483u128 into r391; + mul r388 18329067761203520168u128 into r392; + and r389 18446744073709551615u128 into r393; + shr r389 64u8 into r394; + and r390 18446744073709551615u128 into r395; + add r394 r395 into r396; + and r391 18446744073709551615u128 into r397; + add r396 r397 into r398; + and r398 18446744073709551615u128 into r399; + shr r398 64u8 into r400; + shr r390 64u8 into r401; + shr r391 64u8 into r402; + add r401 r402 into r403; + and r392 18446744073709551615u128 into r404; + add r403 r404 into r405; + add r405 r400 into r406; + and r406 18446744073709551615u128 into r407; + shr r406 64u8 into r408; + shr r392 64u8 into r409; + add r409 r408 into r410; + shl r410 64u8 into r411; + add r411 r407 into r412; + shl r399 64u8 into r413; + add r413 r393 into r414; + add.w r384 r414 into r415; + lt r415 r384 into r416; + ternary r416 1u128 0u128 into r417; + add.w r412 r417 into r418; + cast r418 r415 into r419 as U256__8JquwLopp8; + ternary r358 r419.hi r356.hi into r420; + ternary r358 r419.lo r356.lo into r421; + cast r420 r421 into r422 as U256__8JquwLopp8; + and r13 256u32 into r423; + is.neq r423 0u32 into r424; + and r422.lo 18446744073709551615u128 into r425; + shr r422.lo 64u8 into r426; + mul r425 15924666964335305636u128 into r427; + mul r425 18212142134806087854u128 into r428; + mul r426 15924666964335305636u128 into r429; + mul r426 18212142134806087854u128 into r430; + and r427 18446744073709551615u128 into r431; + shr r427 64u8 into r432; + and r428 18446744073709551615u128 into r433; + add r432 r433 into r434; + and r429 18446744073709551615u128 into r435; + add r434 r435 into r436; + and r436 18446744073709551615u128 into r437; + shr r436 64u8 into r438; + shr r428 64u8 into r439; + shr r429 64u8 into r440; + add r439 r440 into r441; + and r430 18446744073709551615u128 into r442; + add r441 r442 into r443; + add r443 r438 into r444; + and r444 18446744073709551615u128 into r445; + shr r444 64u8 into r446; + shr r430 64u8 into r447; + add r447 r446 into r448; + shl r448 64u8 into r449; + add r449 r445 into r450; + shl r437 64u8 into r451; + add r451 r431 into r452; + and r422.hi 18446744073709551615u128 into r453; + shr r422.hi 64u8 into r454; + mul r453 15924666964335305636u128 into r455; + mul r453 18212142134806087854u128 into r456; + mul r454 15924666964335305636u128 into r457; + mul r454 18212142134806087854u128 into r458; + and r455 18446744073709551615u128 into r459; + shr r455 64u8 into r460; + and r456 18446744073709551615u128 into r461; + add r460 r461 into r462; + and r457 18446744073709551615u128 into r463; + add r462 r463 into r464; + and r464 18446744073709551615u128 into r465; + shr r464 64u8 into r466; + shr r456 64u8 into r467; + shr r457 64u8 into r468; + add r467 r468 into r469; + and r458 18446744073709551615u128 into r470; + add r469 r470 into r471; + add r471 r466 into r472; + and r472 18446744073709551615u128 into r473; + shr r472 64u8 into r474; + shr r458 64u8 into r475; + add r475 r474 into r476; + shl r476 64u8 into r477; + add r477 r473 into r478; + shl r465 64u8 into r479; + add r479 r459 into r480; + add.w r450 r480 into r481; + lt r481 r450 into r482; + ternary r482 1u128 0u128 into r483; + add.w r478 r483 into r484; + cast r484 r481 into r485 as U256__8JquwLopp8; + ternary r424 r485.hi r422.hi into r486; + ternary r424 r485.lo r422.lo into r487; + cast r486 r487 into r488 as U256__8JquwLopp8; + and r13 512u32 into r489; + is.neq r489 0u32 into r490; + and r488.lo 18446744073709551615u128 into r491; + shr r488.lo 64u8 into r492; + mul r491 8010504389359918676u128 into r493; + mul r491 17980523815641551639u128 into r494; + mul r492 8010504389359918676u128 into r495; + mul r492 17980523815641551639u128 into r496; + and r493 18446744073709551615u128 into r497; + shr r493 64u8 into r498; + and r494 18446744073709551615u128 into r499; + add r498 r499 into r500; + and r495 18446744073709551615u128 into r501; + add r500 r501 into r502; + and r502 18446744073709551615u128 into r503; + shr r502 64u8 into r504; + shr r494 64u8 into r505; + shr r495 64u8 into r506; + add r505 r506 into r507; + and r496 18446744073709551615u128 into r508; + add r507 r508 into r509; + add r509 r504 into r510; + and r510 18446744073709551615u128 into r511; + shr r510 64u8 into r512; + shr r496 64u8 into r513; + add r513 r512 into r514; + shl r514 64u8 into r515; + add r515 r511 into r516; + shl r503 64u8 into r517; + add r517 r497 into r518; + and r488.hi 18446744073709551615u128 into r519; + shr r488.hi 64u8 into r520; + mul r519 8010504389359918676u128 into r521; + mul r519 17980523815641551639u128 into r522; + mul r520 8010504389359918676u128 into r523; + mul r520 17980523815641551639u128 into r524; + and r521 18446744073709551615u128 into r525; + shr r521 64u8 into r526; + and r522 18446744073709551615u128 into r527; + add r526 r527 into r528; + and r523 18446744073709551615u128 into r529; + add r528 r529 into r530; + and r530 18446744073709551615u128 into r531; + shr r530 64u8 into r532; + shr r522 64u8 into r533; + shr r523 64u8 into r534; + add r533 r534 into r535; + and r524 18446744073709551615u128 into r536; + add r535 r536 into r537; + add r537 r532 into r538; + and r538 18446744073709551615u128 into r539; + shr r538 64u8 into r540; + shr r524 64u8 into r541; + add r541 r540 into r542; + shl r542 64u8 into r543; + add r543 r539 into r544; + shl r531 64u8 into r545; + add r545 r525 into r546; + add.w r516 r546 into r547; + lt r547 r516 into r548; + ternary r548 1u128 0u128 into r549; + add.w r544 r549 into r550; + cast r550 r547 into r551 as U256__8JquwLopp8; + ternary r490 r551.hi r488.hi into r552; + ternary r490 r551.lo r488.lo into r553; + cast r552 r553 into r554 as U256__8JquwLopp8; + and r13 1024u32 into r555; + is.neq r555 0u32 into r556; + and r554.lo 18446744073709551615u128 into r557; + shr r554.lo 64u8 into r558; + mul r557 10668036004952895731u128 into r559; + mul r557 17526086738831147013u128 into r560; + mul r558 10668036004952895731u128 into r561; + mul r558 17526086738831147013u128 into r562; + and r559 18446744073709551615u128 into r563; + shr r559 64u8 into r564; + and r560 18446744073709551615u128 into r565; + add r564 r565 into r566; + and r561 18446744073709551615u128 into r567; + add r566 r567 into r568; + and r568 18446744073709551615u128 into r569; + shr r568 64u8 into r570; + shr r560 64u8 into r571; + shr r561 64u8 into r572; + add r571 r572 into r573; + and r562 18446744073709551615u128 into r574; + add r573 r574 into r575; + add r575 r570 into r576; + and r576 18446744073709551615u128 into r577; + shr r576 64u8 into r578; + shr r562 64u8 into r579; + add r579 r578 into r580; + shl r580 64u8 into r581; + add r581 r577 into r582; + shl r569 64u8 into r583; + add r583 r563 into r584; + and r554.hi 18446744073709551615u128 into r585; + shr r554.hi 64u8 into r586; + mul r585 10668036004952895731u128 into r587; + mul r585 17526086738831147013u128 into r588; + mul r586 10668036004952895731u128 into r589; + mul r586 17526086738831147013u128 into r590; + and r587 18446744073709551615u128 into r591; + shr r587 64u8 into r592; + and r588 18446744073709551615u128 into r593; + add r592 r593 into r594; + and r589 18446744073709551615u128 into r595; + add r594 r595 into r596; + and r596 18446744073709551615u128 into r597; + shr r596 64u8 into r598; + shr r588 64u8 into r599; + shr r589 64u8 into r600; + add r599 r600 into r601; + and r590 18446744073709551615u128 into r602; + add r601 r602 into r603; + add r603 r598 into r604; + and r604 18446744073709551615u128 into r605; + shr r604 64u8 into r606; + shr r590 64u8 into r607; + add r607 r606 into r608; + shl r608 64u8 into r609; + add r609 r605 into r610; + shl r597 64u8 into r611; + add r611 r591 into r612; + add.w r582 r612 into r613; + lt r613 r582 into r614; + ternary r614 1u128 0u128 into r615; + add.w r610 r615 into r616; + cast r616 r613 into r617 as U256__8JquwLopp8; + ternary r556 r617.hi r554.hi into r618; + ternary r556 r617.lo r554.lo into r619; + cast r618 r619 into r620 as U256__8JquwLopp8; + and r13 2048u32 into r621; + is.neq r621 0u32 into r622; + and r620.lo 18446744073709551615u128 into r623; + shr r620.lo 64u8 into r624; + mul r623 4878133418470705625u128 into r625; + mul r623 16651378430235024244u128 into r626; + mul r624 4878133418470705625u128 into r627; + mul r624 16651378430235024244u128 into r628; + and r625 18446744073709551615u128 into r629; + shr r625 64u8 into r630; + and r626 18446744073709551615u128 into r631; + add r630 r631 into r632; + and r627 18446744073709551615u128 into r633; + add r632 r633 into r634; + and r634 18446744073709551615u128 into r635; + shr r634 64u8 into r636; + shr r626 64u8 into r637; + shr r627 64u8 into r638; + add r637 r638 into r639; + and r628 18446744073709551615u128 into r640; + add r639 r640 into r641; + add r641 r636 into r642; + and r642 18446744073709551615u128 into r643; + shr r642 64u8 into r644; + shr r628 64u8 into r645; + add r645 r644 into r646; + shl r646 64u8 into r647; + add r647 r643 into r648; + shl r635 64u8 into r649; + add r649 r629 into r650; + and r620.hi 18446744073709551615u128 into r651; + shr r620.hi 64u8 into r652; + mul r651 4878133418470705625u128 into r653; + mul r651 16651378430235024244u128 into r654; + mul r652 4878133418470705625u128 into r655; + mul r652 16651378430235024244u128 into r656; + and r653 18446744073709551615u128 into r657; + shr r653 64u8 into r658; + and r654 18446744073709551615u128 into r659; + add r658 r659 into r660; + and r655 18446744073709551615u128 into r661; + add r660 r661 into r662; + and r662 18446744073709551615u128 into r663; + shr r662 64u8 into r664; + shr r654 64u8 into r665; + shr r655 64u8 into r666; + add r665 r666 into r667; + and r656 18446744073709551615u128 into r668; + add r667 r668 into r669; + add r669 r664 into r670; + and r670 18446744073709551615u128 into r671; + shr r670 64u8 into r672; + shr r656 64u8 into r673; + add r673 r672 into r674; + shl r674 64u8 into r675; + add r675 r671 into r676; + shl r663 64u8 into r677; + add r677 r657 into r678; + add.w r648 r678 into r679; + lt r679 r648 into r680; + ternary r680 1u128 0u128 into r681; + add.w r676 r681 into r682; + cast r682 r679 into r683 as U256__8JquwLopp8; + ternary r622 r683.hi r620.hi into r684; + ternary r622 r683.lo r620.lo into r685; + cast r684 r685 into r686 as U256__8JquwLopp8; + and r13 4096u32 into r687; + is.neq r687 0u32 into r688; + and r686.lo 18446744073709551615u128 into r689; + shr r686.lo 64u8 into r690; + mul r689 9537173718739605541u128 into r691; + mul r689 15030750278693429944u128 into r692; + mul r690 9537173718739605541u128 into r693; + mul r690 15030750278693429944u128 into r694; + and r691 18446744073709551615u128 into r695; + shr r691 64u8 into r696; + and r692 18446744073709551615u128 into r697; + add r696 r697 into r698; + and r693 18446744073709551615u128 into r699; + add r698 r699 into r700; + and r700 18446744073709551615u128 into r701; + shr r700 64u8 into r702; + shr r692 64u8 into r703; + shr r693 64u8 into r704; + add r703 r704 into r705; + and r694 18446744073709551615u128 into r706; + add r705 r706 into r707; + add r707 r702 into r708; + and r708 18446744073709551615u128 into r709; + shr r708 64u8 into r710; + shr r694 64u8 into r711; + add r711 r710 into r712; + shl r712 64u8 into r713; + add r713 r709 into r714; + shl r701 64u8 into r715; + add r715 r695 into r716; + and r686.hi 18446744073709551615u128 into r717; + shr r686.hi 64u8 into r718; + mul r717 9537173718739605541u128 into r719; + mul r717 15030750278693429944u128 into r720; + mul r718 9537173718739605541u128 into r721; + mul r718 15030750278693429944u128 into r722; + and r719 18446744073709551615u128 into r723; + shr r719 64u8 into r724; + and r720 18446744073709551615u128 into r725; + add r724 r725 into r726; + and r721 18446744073709551615u128 into r727; + add r726 r727 into r728; + and r728 18446744073709551615u128 into r729; + shr r728 64u8 into r730; + shr r720 64u8 into r731; + shr r721 64u8 into r732; + add r731 r732 into r733; + and r722 18446744073709551615u128 into r734; + add r733 r734 into r735; + add r735 r730 into r736; + and r736 18446744073709551615u128 into r737; + shr r736 64u8 into r738; + shr r722 64u8 into r739; + add r739 r738 into r740; + shl r740 64u8 into r741; + add r741 r737 into r742; + shl r729 64u8 into r743; + add r743 r723 into r744; + add.w r714 r744 into r745; + lt r745 r714 into r746; + ternary r746 1u128 0u128 into r747; + add.w r742 r747 into r748; + cast r748 r745 into r749 as U256__8JquwLopp8; + ternary r688 r749.hi r686.hi into r750; + ternary r688 r749.lo r686.lo into r751; + cast r750 r751 into r752 as U256__8JquwLopp8; + and r13 8192u32 into r753; + is.neq r753 0u32 into r754; + and r752.lo 18446744073709551615u128 into r755; + shr r752.lo 64u8 into r756; + mul r755 9972618978014552549u128 into r757; + mul r755 12247334978882834399u128 into r758; + mul r756 9972618978014552549u128 into r759; + mul r756 12247334978882834399u128 into r760; + and r757 18446744073709551615u128 into r761; + shr r757 64u8 into r762; + and r758 18446744073709551615u128 into r763; + add r762 r763 into r764; + and r759 18446744073709551615u128 into r765; + add r764 r765 into r766; + and r766 18446744073709551615u128 into r767; + shr r766 64u8 into r768; + shr r758 64u8 into r769; + shr r759 64u8 into r770; + add r769 r770 into r771; + and r760 18446744073709551615u128 into r772; + add r771 r772 into r773; + add r773 r768 into r774; + and r774 18446744073709551615u128 into r775; + shr r774 64u8 into r776; + shr r760 64u8 into r777; + add r777 r776 into r778; + shl r778 64u8 into r779; + add r779 r775 into r780; + shl r767 64u8 into r781; + add r781 r761 into r782; + and r752.hi 18446744073709551615u128 into r783; + shr r752.hi 64u8 into r784; + mul r783 9972618978014552549u128 into r785; + mul r783 12247334978882834399u128 into r786; + mul r784 9972618978014552549u128 into r787; + mul r784 12247334978882834399u128 into r788; + and r785 18446744073709551615u128 into r789; + shr r785 64u8 into r790; + and r786 18446744073709551615u128 into r791; + add r790 r791 into r792; + and r787 18446744073709551615u128 into r793; + add r792 r793 into r794; + and r794 18446744073709551615u128 into r795; + shr r794 64u8 into r796; + shr r786 64u8 into r797; + shr r787 64u8 into r798; + add r797 r798 into r799; + and r788 18446744073709551615u128 into r800; + add r799 r800 into r801; + add r801 r796 into r802; + and r802 18446744073709551615u128 into r803; + shr r802 64u8 into r804; + shr r788 64u8 into r805; + add r805 r804 into r806; + shl r806 64u8 into r807; + add r807 r803 into r808; + shl r795 64u8 into r809; + add r809 r789 into r810; + add.w r780 r810 into r811; + lt r811 r780 into r812; + ternary r812 1u128 0u128 into r813; + add.w r808 r813 into r814; + cast r814 r811 into r815 as U256__8JquwLopp8; + ternary r754 r815.hi r752.hi into r816; + ternary r754 r815.lo r752.lo into r817; + cast r816 r817 into r818 as U256__8JquwLopp8; + and r13 16384u32 into r819; + is.neq r819 0u32 into r820; + and r818.lo 18446744073709551615u128 into r821; + shr r818.lo 64u8 into r822; + mul r821 10428997489610666743u128 into r823; + mul r821 8131365268884726200u128 into r824; + mul r822 10428997489610666743u128 into r825; + mul r822 8131365268884726200u128 into r826; + and r823 18446744073709551615u128 into r827; + shr r823 64u8 into r828; + and r824 18446744073709551615u128 into r829; + add r828 r829 into r830; + and r825 18446744073709551615u128 into r831; + add r830 r831 into r832; + and r832 18446744073709551615u128 into r833; + shr r832 64u8 into r834; + shr r824 64u8 into r835; + shr r825 64u8 into r836; + add r835 r836 into r837; + and r826 18446744073709551615u128 into r838; + add r837 r838 into r839; + add r839 r834 into r840; + and r840 18446744073709551615u128 into r841; + shr r840 64u8 into r842; + shr r826 64u8 into r843; + add r843 r842 into r844; + shl r844 64u8 into r845; + add r845 r841 into r846; + shl r833 64u8 into r847; + add r847 r827 into r848; + and r818.hi 18446744073709551615u128 into r849; + shr r818.hi 64u8 into r850; + mul r849 10428997489610666743u128 into r851; + mul r849 8131365268884726200u128 into r852; + mul r850 10428997489610666743u128 into r853; + mul r850 8131365268884726200u128 into r854; + and r851 18446744073709551615u128 into r855; + shr r851 64u8 into r856; + and r852 18446744073709551615u128 into r857; + add r856 r857 into r858; + and r853 18446744073709551615u128 into r859; + add r858 r859 into r860; + and r860 18446744073709551615u128 into r861; + shr r860 64u8 into r862; + shr r852 64u8 into r863; + shr r853 64u8 into r864; + add r863 r864 into r865; + and r854 18446744073709551615u128 into r866; + add r865 r866 into r867; + add r867 r862 into r868; + and r868 18446744073709551615u128 into r869; + shr r868 64u8 into r870; + shr r854 64u8 into r871; + add r871 r870 into r872; + shl r872 64u8 into r873; + add r873 r869 into r874; + shl r861 64u8 into r875; + add r875 r855 into r876; + add.w r846 r876 into r877; + lt r877 r846 into r878; + ternary r878 1u128 0u128 into r879; + add.w r874 r879 into r880; + cast r880 r877 into r881 as U256__8JquwLopp8; + ternary r820 r881.hi r818.hi into r882; + ternary r820 r881.lo r818.lo into r883; + cast r882 r883 into r884 as U256__8JquwLopp8; + and r13 32768u32 into r885; + is.neq r885 0u32 into r886; + and r884.lo 18446744073709551615u128 into r887; + shr r884.lo 64u8 into r888; + mul r887 9305304367709015974u128 into r889; + mul r887 3584323654723342297u128 into r890; + mul r888 9305304367709015974u128 into r891; + mul r888 3584323654723342297u128 into r892; + and r889 18446744073709551615u128 into r893; + shr r889 64u8 into r894; + and r890 18446744073709551615u128 into r895; + add r894 r895 into r896; + and r891 18446744073709551615u128 into r897; + add r896 r897 into r898; + and r898 18446744073709551615u128 into r899; + shr r898 64u8 into r900; + shr r890 64u8 into r901; + shr r891 64u8 into r902; + add r901 r902 into r903; + and r892 18446744073709551615u128 into r904; + add r903 r904 into r905; + add r905 r900 into r906; + and r906 18446744073709551615u128 into r907; + shr r906 64u8 into r908; + shr r892 64u8 into r909; + add r909 r908 into r910; + shl r910 64u8 into r911; + add r911 r907 into r912; + shl r899 64u8 into r913; + add r913 r893 into r914; + and r884.hi 18446744073709551615u128 into r915; + shr r884.hi 64u8 into r916; + mul r915 9305304367709015974u128 into r917; + mul r915 3584323654723342297u128 into r918; + mul r916 9305304367709015974u128 into r919; + mul r916 3584323654723342297u128 into r920; + and r917 18446744073709551615u128 into r921; + shr r917 64u8 into r922; + and r918 18446744073709551615u128 into r923; + add r922 r923 into r924; + and r919 18446744073709551615u128 into r925; + add r924 r925 into r926; + and r926 18446744073709551615u128 into r927; + shr r926 64u8 into r928; + shr r918 64u8 into r929; + shr r919 64u8 into r930; + add r929 r930 into r931; + and r920 18446744073709551615u128 into r932; + add r931 r932 into r933; + add r933 r928 into r934; + and r934 18446744073709551615u128 into r935; + shr r934 64u8 into r936; + shr r920 64u8 into r937; + add r937 r936 into r938; + shl r938 64u8 into r939; + add r939 r935 into r940; + shl r927 64u8 into r941; + add r941 r921 into r942; + add.w r912 r942 into r943; + lt r943 r912 into r944; + ternary r944 1u128 0u128 into r945; + add.w r940 r945 into r946; + cast r946 r943 into r947 as U256__8JquwLopp8; + ternary r886 r947.hi r884.hi into r948; + ternary r886 r947.lo r884.lo into r949; + cast r948 r949 into r950 as U256__8JquwLopp8; + and r13 65536u32 into r951; + is.neq r951 0u32 into r952; + and r950.lo 18446744073709551615u128 into r953; + shr r950.lo 64u8 into r954; + mul r953 14301143598189091785u128 into r955; + mul r953 696457651847595233u128 into r956; + mul r954 14301143598189091785u128 into r957; + mul r954 696457651847595233u128 into r958; + and r955 18446744073709551615u128 into r959; + shr r955 64u8 into r960; + and r956 18446744073709551615u128 into r961; + add r960 r961 into r962; + and r957 18446744073709551615u128 into r963; + add r962 r963 into r964; + and r964 18446744073709551615u128 into r965; + shr r964 64u8 into r966; + shr r956 64u8 into r967; + shr r957 64u8 into r968; + add r967 r968 into r969; + and r958 18446744073709551615u128 into r970; + add r969 r970 into r971; + add r971 r966 into r972; + and r972 18446744073709551615u128 into r973; + shr r972 64u8 into r974; + shr r958 64u8 into r975; + add r975 r974 into r976; + shl r976 64u8 into r977; + add r977 r973 into r978; + shl r965 64u8 into r979; + add r979 r959 into r980; + and r950.hi 18446744073709551615u128 into r981; + shr r950.hi 64u8 into r982; + mul r981 14301143598189091785u128 into r983; + mul r981 696457651847595233u128 into r984; + mul r982 14301143598189091785u128 into r985; + mul r982 696457651847595233u128 into r986; + and r983 18446744073709551615u128 into r987; + shr r983 64u8 into r988; + and r984 18446744073709551615u128 into r989; + add r988 r989 into r990; + and r985 18446744073709551615u128 into r991; + add r990 r991 into r992; + and r992 18446744073709551615u128 into r993; + shr r992 64u8 into r994; + shr r984 64u8 into r995; + shr r985 64u8 into r996; + add r995 r996 into r997; + and r986 18446744073709551615u128 into r998; + add r997 r998 into r999; + add r999 r994 into r1000; + and r1000 18446744073709551615u128 into r1001; + shr r1000 64u8 into r1002; + shr r986 64u8 into r1003; + add r1003 r1002 into r1004; + shl r1004 64u8 into r1005; + add r1005 r1001 into r1006; + shl r993 64u8 into r1007; + add r1007 r987 into r1008; + add.w r978 r1008 into r1009; + lt r1009 r978 into r1010; + ternary r1010 1u128 0u128 into r1011; + add.w r1006 r1011 into r1012; + cast r1012 r1009 into r1013 as U256__8JquwLopp8; + ternary r952 r1013.hi r950.hi into r1014; + ternary r952 r1013.lo r950.lo into r1015; + cast r1014 r1015 into r1016 as U256__8JquwLopp8; + and r13 131072u32 into r1017; + is.neq r1017 0u32 into r1018; + and r1016.lo 18446744073709551615u128 into r1019; + shr r1016.lo 64u8 into r1020; + mul r1019 7393154844743099908u128 into r1021; + mul r1019 26294789957452057u128 into r1022; + mul r1020 7393154844743099908u128 into r1023; + mul r1020 26294789957452057u128 into r1024; + and r1021 18446744073709551615u128 into r1025; + shr r1021 64u8 into r1026; + and r1022 18446744073709551615u128 into r1027; + add r1026 r1027 into r1028; + and r1023 18446744073709551615u128 into r1029; + add r1028 r1029 into r1030; + and r1030 18446744073709551615u128 into r1031; + shr r1030 64u8 into r1032; + shr r1022 64u8 into r1033; + shr r1023 64u8 into r1034; + add r1033 r1034 into r1035; + and r1024 18446744073709551615u128 into r1036; + add r1035 r1036 into r1037; + add r1037 r1032 into r1038; + and r1038 18446744073709551615u128 into r1039; + shr r1038 64u8 into r1040; + shr r1024 64u8 into r1041; + add r1041 r1040 into r1042; + shl r1042 64u8 into r1043; + add r1043 r1039 into r1044; + shl r1031 64u8 into r1045; + add r1045 r1025 into r1046; + and r1016.hi 18446744073709551615u128 into r1047; + shr r1016.hi 64u8 into r1048; + mul r1047 7393154844743099908u128 into r1049; + mul r1047 26294789957452057u128 into r1050; + mul r1048 7393154844743099908u128 into r1051; + mul r1048 26294789957452057u128 into r1052; + and r1049 18446744073709551615u128 into r1053; + shr r1049 64u8 into r1054; + and r1050 18446744073709551615u128 into r1055; + add r1054 r1055 into r1056; + and r1051 18446744073709551615u128 into r1057; + add r1056 r1057 into r1058; + and r1058 18446744073709551615u128 into r1059; + shr r1058 64u8 into r1060; + shr r1050 64u8 into r1061; + shr r1051 64u8 into r1062; + add r1061 r1062 into r1063; + and r1052 18446744073709551615u128 into r1064; + add r1063 r1064 into r1065; + add r1065 r1060 into r1066; + and r1066 18446744073709551615u128 into r1067; + shr r1066 64u8 into r1068; + shr r1052 64u8 into r1069; + add r1069 r1068 into r1070; + shl r1070 64u8 into r1071; + add r1071 r1067 into r1072; + shl r1059 64u8 into r1073; + add r1073 r1053 into r1074; + add.w r1044 r1074 into r1075; + lt r1075 r1044 into r1076; + ternary r1076 1u128 0u128 into r1077; + add.w r1072 r1077 into r1078; + cast r1078 r1075 into r1079 as U256__8JquwLopp8; + ternary r1018 r1079.hi r1016.hi into r1080; + ternary r1018 r1079.lo r1016.lo into r1081; + cast r1080 r1081 into r1082 as U256__8JquwLopp8; + and r13 262144u32 into r1083; + is.neq r1083 0u32 into r1084; + and r1082.lo 18446744073709551615u128 into r1085; + shr r1082.lo 64u8 into r1086; + mul r1085 2209338891292245656u128 into r1087; + mul r1085 37481735321082u128 into r1088; + mul r1086 2209338891292245656u128 into r1089; + mul r1086 37481735321082u128 into r1090; + and r1087 18446744073709551615u128 into r1091; + shr r1087 64u8 into r1092; + and r1088 18446744073709551615u128 into r1093; + add r1092 r1093 into r1094; + and r1089 18446744073709551615u128 into r1095; + add r1094 r1095 into r1096; + and r1096 18446744073709551615u128 into r1097; + shr r1096 64u8 into r1098; + shr r1088 64u8 into r1099; + shr r1089 64u8 into r1100; + add r1099 r1100 into r1101; + and r1090 18446744073709551615u128 into r1102; + add r1101 r1102 into r1103; + add r1103 r1098 into r1104; + and r1104 18446744073709551615u128 into r1105; + shr r1104 64u8 into r1106; + shr r1090 64u8 into r1107; + add r1107 r1106 into r1108; + shl r1108 64u8 into r1109; + add r1109 r1105 into r1110; + shl r1097 64u8 into r1111; + add r1111 r1091 into r1112; + and r1082.hi 18446744073709551615u128 into r1113; + shr r1082.hi 64u8 into r1114; + mul r1113 2209338891292245656u128 into r1115; + mul r1113 37481735321082u128 into r1116; + mul r1114 2209338891292245656u128 into r1117; + mul r1114 37481735321082u128 into r1118; + and r1115 18446744073709551615u128 into r1119; + shr r1115 64u8 into r1120; + and r1116 18446744073709551615u128 into r1121; + add r1120 r1121 into r1122; + and r1117 18446744073709551615u128 into r1123; + add r1122 r1123 into r1124; + and r1124 18446744073709551615u128 into r1125; + shr r1124 64u8 into r1126; + shr r1116 64u8 into r1127; + shr r1117 64u8 into r1128; + add r1127 r1128 into r1129; + and r1118 18446744073709551615u128 into r1130; + add r1129 r1130 into r1131; + add r1131 r1126 into r1132; + and r1132 18446744073709551615u128 into r1133; + shr r1132 64u8 into r1134; + shr r1118 64u8 into r1135; + add r1135 r1134 into r1136; + shl r1136 64u8 into r1137; + add r1137 r1133 into r1138; + shl r1125 64u8 into r1139; + add r1139 r1119 into r1140; + add.w r1110 r1140 into r1141; + lt r1141 r1110 into r1142; + ternary r1142 1u128 0u128 into r1143; + add.w r1138 r1143 into r1144; + cast r1144 r1141 into r1145 as U256__8JquwLopp8; + ternary r1084 r1145.hi r1082.hi into r1146; + ternary r1084 r1145.lo r1082.lo into r1147; + cast r1146 r1147 into r1148 as U256__8JquwLopp8; + gt r5 0i32 into r1149; + is.eq r1148.lo 0u128 into r1150; + ternary r1150 1u128 r1148.lo into r1151; + div 340282366920938463463374607431768211455u128 r1151 into r1152; + rem 340282366920938463463374607431768211455u128 r1151 into r1153; + lt r1153 r1151 into r1154; + assert.eq r1154 true; + gte r1153 170141183460469231731687303715884105728u128 into r1155; + add.w r1153 r1153 into r1156; + add r1156 1u128 into r1157; + gte r1157 r1151 into r1158; + or r1155 r1158 into r1159; + sub.w r1157 r1151 into r1160; + ternary r1159 r1160 r1157 into r1161; + ternary r1159 170141183460469231731687303715884105728u128 0u128 into r1162; + gte r1161 170141183460469231731687303715884105728u128 into r1163; + add.w r1161 r1161 into r1164; + add r1164 1u128 into r1165; + gte r1165 r1151 into r1166; + or r1163 r1166 into r1167; + sub.w r1165 r1151 into r1168; + ternary r1167 r1168 r1165 into r1169; + add r1162 85070591730234615865843651857942052864u128 into r1170; + ternary r1167 r1170 r1162 into r1171; + gte r1169 170141183460469231731687303715884105728u128 into r1172; + add.w r1169 r1169 into r1173; + add r1173 1u128 into r1174; + gte r1174 r1151 into r1175; + or r1172 r1175 into r1176; + sub.w r1174 r1151 into r1177; + ternary r1176 r1177 r1174 into r1178; + add r1171 42535295865117307932921825928971026432u128 into r1179; + ternary r1176 r1179 r1171 into r1180; + gte r1178 170141183460469231731687303715884105728u128 into r1181; + add.w r1178 r1178 into r1182; + add r1182 1u128 into r1183; + gte r1183 r1151 into r1184; + or r1181 r1184 into r1185; + sub.w r1183 r1151 into r1186; + ternary r1185 r1186 r1183 into r1187; + add r1180 21267647932558653966460912964485513216u128 into r1188; + ternary r1185 r1188 r1180 into r1189; + gte r1187 170141183460469231731687303715884105728u128 into r1190; + add.w r1187 r1187 into r1191; + add r1191 1u128 into r1192; + gte r1192 r1151 into r1193; + or r1190 r1193 into r1194; + sub.w r1192 r1151 into r1195; + ternary r1194 r1195 r1192 into r1196; + add r1189 10633823966279326983230456482242756608u128 into r1197; + ternary r1194 r1197 r1189 into r1198; + gte r1196 170141183460469231731687303715884105728u128 into r1199; + add.w r1196 r1196 into r1200; + add r1200 1u128 into r1201; + gte r1201 r1151 into r1202; + or r1199 r1202 into r1203; + sub.w r1201 r1151 into r1204; + ternary r1203 r1204 r1201 into r1205; + add r1198 5316911983139663491615228241121378304u128 into r1206; + ternary r1203 r1206 r1198 into r1207; + gte r1205 170141183460469231731687303715884105728u128 into r1208; + add.w r1205 r1205 into r1209; + add r1209 1u128 into r1210; + gte r1210 r1151 into r1211; + or r1208 r1211 into r1212; + sub.w r1210 r1151 into r1213; + ternary r1212 r1213 r1210 into r1214; + add r1207 2658455991569831745807614120560689152u128 into r1215; + ternary r1212 r1215 r1207 into r1216; + gte r1214 170141183460469231731687303715884105728u128 into r1217; + add.w r1214 r1214 into r1218; + add r1218 1u128 into r1219; + gte r1219 r1151 into r1220; + or r1217 r1220 into r1221; + sub.w r1219 r1151 into r1222; + ternary r1221 r1222 r1219 into r1223; + add r1216 1329227995784915872903807060280344576u128 into r1224; + ternary r1221 r1224 r1216 into r1225; + gte r1223 170141183460469231731687303715884105728u128 into r1226; + add.w r1223 r1223 into r1227; + add r1227 1u128 into r1228; + gte r1228 r1151 into r1229; + or r1226 r1229 into r1230; + sub.w r1228 r1151 into r1231; + ternary r1230 r1231 r1228 into r1232; + add r1225 664613997892457936451903530140172288u128 into r1233; + ternary r1230 r1233 r1225 into r1234; + gte r1232 170141183460469231731687303715884105728u128 into r1235; + add.w r1232 r1232 into r1236; + add r1236 1u128 into r1237; + gte r1237 r1151 into r1238; + or r1235 r1238 into r1239; + sub.w r1237 r1151 into r1240; + ternary r1239 r1240 r1237 into r1241; + add r1234 332306998946228968225951765070086144u128 into r1242; + ternary r1239 r1242 r1234 into r1243; + gte r1241 170141183460469231731687303715884105728u128 into r1244; + add.w r1241 r1241 into r1245; + add r1245 1u128 into r1246; + gte r1246 r1151 into r1247; + or r1244 r1247 into r1248; + sub.w r1246 r1151 into r1249; + ternary r1248 r1249 r1246 into r1250; + add r1243 166153499473114484112975882535043072u128 into r1251; + ternary r1248 r1251 r1243 into r1252; + gte r1250 170141183460469231731687303715884105728u128 into r1253; + add.w r1250 r1250 into r1254; + add r1254 1u128 into r1255; + gte r1255 r1151 into r1256; + or r1253 r1256 into r1257; + sub.w r1255 r1151 into r1258; + ternary r1257 r1258 r1255 into r1259; + add r1252 83076749736557242056487941267521536u128 into r1260; + ternary r1257 r1260 r1252 into r1261; + gte r1259 170141183460469231731687303715884105728u128 into r1262; + add.w r1259 r1259 into r1263; + add r1263 1u128 into r1264; + gte r1264 r1151 into r1265; + or r1262 r1265 into r1266; + sub.w r1264 r1151 into r1267; + ternary r1266 r1267 r1264 into r1268; + add r1261 41538374868278621028243970633760768u128 into r1269; + ternary r1266 r1269 r1261 into r1270; + gte r1268 170141183460469231731687303715884105728u128 into r1271; + add.w r1268 r1268 into r1272; + add r1272 1u128 into r1273; + gte r1273 r1151 into r1274; + or r1271 r1274 into r1275; + sub.w r1273 r1151 into r1276; + ternary r1275 r1276 r1273 into r1277; + add r1270 20769187434139310514121985316880384u128 into r1278; + ternary r1275 r1278 r1270 into r1279; + gte r1277 170141183460469231731687303715884105728u128 into r1280; + add.w r1277 r1277 into r1281; + add r1281 1u128 into r1282; + gte r1282 r1151 into r1283; + or r1280 r1283 into r1284; + sub.w r1282 r1151 into r1285; + ternary r1284 r1285 r1282 into r1286; + add r1279 10384593717069655257060992658440192u128 into r1287; + ternary r1284 r1287 r1279 into r1288; + gte r1286 170141183460469231731687303715884105728u128 into r1289; + add.w r1286 r1286 into r1290; + add r1290 1u128 into r1291; + gte r1291 r1151 into r1292; + or r1289 r1292 into r1293; + sub.w r1291 r1151 into r1294; + ternary r1293 r1294 r1291 into r1295; + add r1288 5192296858534827628530496329220096u128 into r1296; + ternary r1293 r1296 r1288 into r1297; + gte r1295 170141183460469231731687303715884105728u128 into r1298; + add.w r1295 r1295 into r1299; + add r1299 1u128 into r1300; + gte r1300 r1151 into r1301; + or r1298 r1301 into r1302; + sub.w r1300 r1151 into r1303; + ternary r1302 r1303 r1300 into r1304; + add r1297 2596148429267413814265248164610048u128 into r1305; + ternary r1302 r1305 r1297 into r1306; + gte r1304 170141183460469231731687303715884105728u128 into r1307; + add.w r1304 r1304 into r1308; + add r1308 1u128 into r1309; + gte r1309 r1151 into r1310; + or r1307 r1310 into r1311; + sub.w r1309 r1151 into r1312; + ternary r1311 r1312 r1309 into r1313; + add r1306 1298074214633706907132624082305024u128 into r1314; + ternary r1311 r1314 r1306 into r1315; + gte r1313 170141183460469231731687303715884105728u128 into r1316; + add.w r1313 r1313 into r1317; + add r1317 1u128 into r1318; + gte r1318 r1151 into r1319; + or r1316 r1319 into r1320; + sub.w r1318 r1151 into r1321; + ternary r1320 r1321 r1318 into r1322; + add r1315 649037107316853453566312041152512u128 into r1323; + ternary r1320 r1323 r1315 into r1324; + gte r1322 170141183460469231731687303715884105728u128 into r1325; + add.w r1322 r1322 into r1326; + add r1326 1u128 into r1327; + gte r1327 r1151 into r1328; + or r1325 r1328 into r1329; + sub.w r1327 r1151 into r1330; + ternary r1329 r1330 r1327 into r1331; + add r1324 324518553658426726783156020576256u128 into r1332; + ternary r1329 r1332 r1324 into r1333; + gte r1331 170141183460469231731687303715884105728u128 into r1334; + add.w r1331 r1331 into r1335; + add r1335 1u128 into r1336; + gte r1336 r1151 into r1337; + or r1334 r1337 into r1338; + sub.w r1336 r1151 into r1339; + ternary r1338 r1339 r1336 into r1340; + add r1333 162259276829213363391578010288128u128 into r1341; + ternary r1338 r1341 r1333 into r1342; + gte r1340 170141183460469231731687303715884105728u128 into r1343; + add.w r1340 r1340 into r1344; + add r1344 1u128 into r1345; + gte r1345 r1151 into r1346; + or r1343 r1346 into r1347; + sub.w r1345 r1151 into r1348; + ternary r1347 r1348 r1345 into r1349; + add r1342 81129638414606681695789005144064u128 into r1350; + ternary r1347 r1350 r1342 into r1351; + gte r1349 170141183460469231731687303715884105728u128 into r1352; + add.w r1349 r1349 into r1353; + add r1353 1u128 into r1354; + gte r1354 r1151 into r1355; + or r1352 r1355 into r1356; + sub.w r1354 r1151 into r1357; + ternary r1356 r1357 r1354 into r1358; + add r1351 40564819207303340847894502572032u128 into r1359; + ternary r1356 r1359 r1351 into r1360; + gte r1358 170141183460469231731687303715884105728u128 into r1361; + add.w r1358 r1358 into r1362; + add r1362 1u128 into r1363; + gte r1363 r1151 into r1364; + or r1361 r1364 into r1365; + sub.w r1363 r1151 into r1366; + ternary r1365 r1366 r1363 into r1367; + add r1360 20282409603651670423947251286016u128 into r1368; + ternary r1365 r1368 r1360 into r1369; + gte r1367 170141183460469231731687303715884105728u128 into r1370; + add.w r1367 r1367 into r1371; + add r1371 1u128 into r1372; + gte r1372 r1151 into r1373; + or r1370 r1373 into r1374; + sub.w r1372 r1151 into r1375; + ternary r1374 r1375 r1372 into r1376; + add r1369 10141204801825835211973625643008u128 into r1377; + ternary r1374 r1377 r1369 into r1378; + gte r1376 170141183460469231731687303715884105728u128 into r1379; + add.w r1376 r1376 into r1380; + add r1380 1u128 into r1381; + gte r1381 r1151 into r1382; + or r1379 r1382 into r1383; + sub.w r1381 r1151 into r1384; + ternary r1383 r1384 r1381 into r1385; + add r1378 5070602400912917605986812821504u128 into r1386; + ternary r1383 r1386 r1378 into r1387; + gte r1385 170141183460469231731687303715884105728u128 into r1388; + add.w r1385 r1385 into r1389; + add r1389 1u128 into r1390; + gte r1390 r1151 into r1391; + or r1388 r1391 into r1392; + sub.w r1390 r1151 into r1393; + ternary r1392 r1393 r1390 into r1394; + add r1387 2535301200456458802993406410752u128 into r1395; + ternary r1392 r1395 r1387 into r1396; + gte r1394 170141183460469231731687303715884105728u128 into r1397; + add.w r1394 r1394 into r1398; + add r1398 1u128 into r1399; + gte r1399 r1151 into r1400; + or r1397 r1400 into r1401; + sub.w r1399 r1151 into r1402; + ternary r1401 r1402 r1399 into r1403; + add r1396 1267650600228229401496703205376u128 into r1404; + ternary r1401 r1404 r1396 into r1405; + gte r1403 170141183460469231731687303715884105728u128 into r1406; + add.w r1403 r1403 into r1407; + add r1407 1u128 into r1408; + gte r1408 r1151 into r1409; + or r1406 r1409 into r1410; + sub.w r1408 r1151 into r1411; + ternary r1410 r1411 r1408 into r1412; + add r1405 633825300114114700748351602688u128 into r1413; + ternary r1410 r1413 r1405 into r1414; + gte r1412 170141183460469231731687303715884105728u128 into r1415; + add.w r1412 r1412 into r1416; + add r1416 1u128 into r1417; + gte r1417 r1151 into r1418; + or r1415 r1418 into r1419; + sub.w r1417 r1151 into r1420; + ternary r1419 r1420 r1417 into r1421; + add r1414 316912650057057350374175801344u128 into r1422; + ternary r1419 r1422 r1414 into r1423; + gte r1421 170141183460469231731687303715884105728u128 into r1424; + add.w r1421 r1421 into r1425; + add r1425 1u128 into r1426; + gte r1426 r1151 into r1427; + or r1424 r1427 into r1428; + sub.w r1426 r1151 into r1429; + ternary r1428 r1429 r1426 into r1430; + add r1423 158456325028528675187087900672u128 into r1431; + ternary r1428 r1431 r1423 into r1432; + gte r1430 170141183460469231731687303715884105728u128 into r1433; + add.w r1430 r1430 into r1434; + add r1434 1u128 into r1435; + gte r1435 r1151 into r1436; + or r1433 r1436 into r1437; + sub.w r1435 r1151 into r1438; + ternary r1437 r1438 r1435 into r1439; + add r1432 79228162514264337593543950336u128 into r1440; + ternary r1437 r1440 r1432 into r1441; + gte r1439 170141183460469231731687303715884105728u128 into r1442; + add.w r1439 r1439 into r1443; + add r1443 1u128 into r1444; + gte r1444 r1151 into r1445; + or r1442 r1445 into r1446; + sub.w r1444 r1151 into r1447; + ternary r1446 r1447 r1444 into r1448; + add r1441 39614081257132168796771975168u128 into r1449; + ternary r1446 r1449 r1441 into r1450; + gte r1448 170141183460469231731687303715884105728u128 into r1451; + add.w r1448 r1448 into r1452; + add r1452 1u128 into r1453; + gte r1453 r1151 into r1454; + or r1451 r1454 into r1455; + sub.w r1453 r1151 into r1456; + ternary r1455 r1456 r1453 into r1457; + add r1450 19807040628566084398385987584u128 into r1458; + ternary r1455 r1458 r1450 into r1459; + gte r1457 170141183460469231731687303715884105728u128 into r1460; + add.w r1457 r1457 into r1461; + add r1461 1u128 into r1462; + gte r1462 r1151 into r1463; + or r1460 r1463 into r1464; + sub.w r1462 r1151 into r1465; + ternary r1464 r1465 r1462 into r1466; + add r1459 9903520314283042199192993792u128 into r1467; + ternary r1464 r1467 r1459 into r1468; + gte r1466 170141183460469231731687303715884105728u128 into r1469; + add.w r1466 r1466 into r1470; + add r1470 1u128 into r1471; + gte r1471 r1151 into r1472; + or r1469 r1472 into r1473; + sub.w r1471 r1151 into r1474; + ternary r1473 r1474 r1471 into r1475; + add r1468 4951760157141521099596496896u128 into r1476; + ternary r1473 r1476 r1468 into r1477; + gte r1475 170141183460469231731687303715884105728u128 into r1478; + add.w r1475 r1475 into r1479; + add r1479 1u128 into r1480; + gte r1480 r1151 into r1481; + or r1478 r1481 into r1482; + sub.w r1480 r1151 into r1483; + ternary r1482 r1483 r1480 into r1484; + add r1477 2475880078570760549798248448u128 into r1485; + ternary r1482 r1485 r1477 into r1486; + gte r1484 170141183460469231731687303715884105728u128 into r1487; + add.w r1484 r1484 into r1488; + add r1488 1u128 into r1489; + gte r1489 r1151 into r1490; + or r1487 r1490 into r1491; + sub.w r1489 r1151 into r1492; + ternary r1491 r1492 r1489 into r1493; + add r1486 1237940039285380274899124224u128 into r1494; + ternary r1491 r1494 r1486 into r1495; + gte r1493 170141183460469231731687303715884105728u128 into r1496; + add.w r1493 r1493 into r1497; + add r1497 1u128 into r1498; + gte r1498 r1151 into r1499; + or r1496 r1499 into r1500; + sub.w r1498 r1151 into r1501; + ternary r1500 r1501 r1498 into r1502; + add r1495 618970019642690137449562112u128 into r1503; + ternary r1500 r1503 r1495 into r1504; + gte r1502 170141183460469231731687303715884105728u128 into r1505; + add.w r1502 r1502 into r1506; + add r1506 1u128 into r1507; + gte r1507 r1151 into r1508; + or r1505 r1508 into r1509; + sub.w r1507 r1151 into r1510; + ternary r1509 r1510 r1507 into r1511; + add r1504 309485009821345068724781056u128 into r1512; + ternary r1509 r1512 r1504 into r1513; + gte r1511 170141183460469231731687303715884105728u128 into r1514; + add.w r1511 r1511 into r1515; + add r1515 1u128 into r1516; + gte r1516 r1151 into r1517; + or r1514 r1517 into r1518; + sub.w r1516 r1151 into r1519; + ternary r1518 r1519 r1516 into r1520; + add r1513 154742504910672534362390528u128 into r1521; + ternary r1518 r1521 r1513 into r1522; + gte r1520 170141183460469231731687303715884105728u128 into r1523; + add.w r1520 r1520 into r1524; + add r1524 1u128 into r1525; + gte r1525 r1151 into r1526; + or r1523 r1526 into r1527; + sub.w r1525 r1151 into r1528; + ternary r1527 r1528 r1525 into r1529; + add r1522 77371252455336267181195264u128 into r1530; + ternary r1527 r1530 r1522 into r1531; + gte r1529 170141183460469231731687303715884105728u128 into r1532; + add.w r1529 r1529 into r1533; + add r1533 1u128 into r1534; + gte r1534 r1151 into r1535; + or r1532 r1535 into r1536; + sub.w r1534 r1151 into r1537; + ternary r1536 r1537 r1534 into r1538; + add r1531 38685626227668133590597632u128 into r1539; + ternary r1536 r1539 r1531 into r1540; + gte r1538 170141183460469231731687303715884105728u128 into r1541; + add.w r1538 r1538 into r1542; + add r1542 1u128 into r1543; + gte r1543 r1151 into r1544; + or r1541 r1544 into r1545; + sub.w r1543 r1151 into r1546; + ternary r1545 r1546 r1543 into r1547; + add r1540 19342813113834066795298816u128 into r1548; + ternary r1545 r1548 r1540 into r1549; + gte r1547 170141183460469231731687303715884105728u128 into r1550; + add.w r1547 r1547 into r1551; + add r1551 1u128 into r1552; + gte r1552 r1151 into r1553; + or r1550 r1553 into r1554; + sub.w r1552 r1151 into r1555; + ternary r1554 r1555 r1552 into r1556; + add r1549 9671406556917033397649408u128 into r1557; + ternary r1554 r1557 r1549 into r1558; + gte r1556 170141183460469231731687303715884105728u128 into r1559; + add.w r1556 r1556 into r1560; + add r1560 1u128 into r1561; + gte r1561 r1151 into r1562; + or r1559 r1562 into r1563; + sub.w r1561 r1151 into r1564; + ternary r1563 r1564 r1561 into r1565; + add r1558 4835703278458516698824704u128 into r1566; + ternary r1563 r1566 r1558 into r1567; + gte r1565 170141183460469231731687303715884105728u128 into r1568; + add.w r1565 r1565 into r1569; + add r1569 1u128 into r1570; + gte r1570 r1151 into r1571; + or r1568 r1571 into r1572; + sub.w r1570 r1151 into r1573; + ternary r1572 r1573 r1570 into r1574; + add r1567 2417851639229258349412352u128 into r1575; + ternary r1572 r1575 r1567 into r1576; + gte r1574 170141183460469231731687303715884105728u128 into r1577; + add.w r1574 r1574 into r1578; + add r1578 1u128 into r1579; + gte r1579 r1151 into r1580; + or r1577 r1580 into r1581; + sub.w r1579 r1151 into r1582; + ternary r1581 r1582 r1579 into r1583; + add r1576 1208925819614629174706176u128 into r1584; + ternary r1581 r1584 r1576 into r1585; + gte r1583 170141183460469231731687303715884105728u128 into r1586; + add.w r1583 r1583 into r1587; + add r1587 1u128 into r1588; + gte r1588 r1151 into r1589; + or r1586 r1589 into r1590; + sub.w r1588 r1151 into r1591; + ternary r1590 r1591 r1588 into r1592; + add r1585 604462909807314587353088u128 into r1593; + ternary r1590 r1593 r1585 into r1594; + gte r1592 170141183460469231731687303715884105728u128 into r1595; + add.w r1592 r1592 into r1596; + add r1596 1u128 into r1597; + gte r1597 r1151 into r1598; + or r1595 r1598 into r1599; + sub.w r1597 r1151 into r1600; + ternary r1599 r1600 r1597 into r1601; + add r1594 302231454903657293676544u128 into r1602; + ternary r1599 r1602 r1594 into r1603; + gte r1601 170141183460469231731687303715884105728u128 into r1604; + add.w r1601 r1601 into r1605; + add r1605 1u128 into r1606; + gte r1606 r1151 into r1607; + or r1604 r1607 into r1608; + sub.w r1606 r1151 into r1609; + ternary r1608 r1609 r1606 into r1610; + add r1603 151115727451828646838272u128 into r1611; + ternary r1608 r1611 r1603 into r1612; + gte r1610 170141183460469231731687303715884105728u128 into r1613; + add.w r1610 r1610 into r1614; + add r1614 1u128 into r1615; + gte r1615 r1151 into r1616; + or r1613 r1616 into r1617; + sub.w r1615 r1151 into r1618; + ternary r1617 r1618 r1615 into r1619; + add r1612 75557863725914323419136u128 into r1620; + ternary r1617 r1620 r1612 into r1621; + gte r1619 170141183460469231731687303715884105728u128 into r1622; + add.w r1619 r1619 into r1623; + add r1623 1u128 into r1624; + gte r1624 r1151 into r1625; + or r1622 r1625 into r1626; + sub.w r1624 r1151 into r1627; + ternary r1626 r1627 r1624 into r1628; + add r1621 37778931862957161709568u128 into r1629; + ternary r1626 r1629 r1621 into r1630; + gte r1628 170141183460469231731687303715884105728u128 into r1631; + add.w r1628 r1628 into r1632; + add r1632 1u128 into r1633; + gte r1633 r1151 into r1634; + or r1631 r1634 into r1635; + sub.w r1633 r1151 into r1636; + ternary r1635 r1636 r1633 into r1637; + add r1630 18889465931478580854784u128 into r1638; + ternary r1635 r1638 r1630 into r1639; + gte r1637 170141183460469231731687303715884105728u128 into r1640; + add.w r1637 r1637 into r1641; + add r1641 1u128 into r1642; + gte r1642 r1151 into r1643; + or r1640 r1643 into r1644; + sub.w r1642 r1151 into r1645; + ternary r1644 r1645 r1642 into r1646; + add r1639 9444732965739290427392u128 into r1647; + ternary r1644 r1647 r1639 into r1648; + gte r1646 170141183460469231731687303715884105728u128 into r1649; + add.w r1646 r1646 into r1650; + add r1650 1u128 into r1651; + gte r1651 r1151 into r1652; + or r1649 r1652 into r1653; + sub.w r1651 r1151 into r1654; + ternary r1653 r1654 r1651 into r1655; + add r1648 4722366482869645213696u128 into r1656; + ternary r1653 r1656 r1648 into r1657; + gte r1655 170141183460469231731687303715884105728u128 into r1658; + add.w r1655 r1655 into r1659; + add r1659 1u128 into r1660; + gte r1660 r1151 into r1661; + or r1658 r1661 into r1662; + sub.w r1660 r1151 into r1663; + ternary r1662 r1663 r1660 into r1664; + add r1657 2361183241434822606848u128 into r1665; + ternary r1662 r1665 r1657 into r1666; + gte r1664 170141183460469231731687303715884105728u128 into r1667; + add.w r1664 r1664 into r1668; + add r1668 1u128 into r1669; + gte r1669 r1151 into r1670; + or r1667 r1670 into r1671; + sub.w r1669 r1151 into r1672; + ternary r1671 r1672 r1669 into r1673; + add r1666 1180591620717411303424u128 into r1674; + ternary r1671 r1674 r1666 into r1675; + gte r1673 170141183460469231731687303715884105728u128 into r1676; + add.w r1673 r1673 into r1677; + add r1677 1u128 into r1678; + gte r1678 r1151 into r1679; + or r1676 r1679 into r1680; + sub.w r1678 r1151 into r1681; + ternary r1680 r1681 r1678 into r1682; + add r1675 590295810358705651712u128 into r1683; + ternary r1680 r1683 r1675 into r1684; + gte r1682 170141183460469231731687303715884105728u128 into r1685; + add.w r1682 r1682 into r1686; + add r1686 1u128 into r1687; + gte r1687 r1151 into r1688; + or r1685 r1688 into r1689; + sub.w r1687 r1151 into r1690; + ternary r1689 r1690 r1687 into r1691; + add r1684 295147905179352825856u128 into r1692; + ternary r1689 r1692 r1684 into r1693; + gte r1691 170141183460469231731687303715884105728u128 into r1694; + add.w r1691 r1691 into r1695; + add r1695 1u128 into r1696; + gte r1696 r1151 into r1697; + or r1694 r1697 into r1698; + sub.w r1696 r1151 into r1699; + ternary r1698 r1699 r1696 into r1700; + add r1693 147573952589676412928u128 into r1701; + ternary r1698 r1701 r1693 into r1702; + gte r1700 170141183460469231731687303715884105728u128 into r1703; + add.w r1700 r1700 into r1704; + add r1704 1u128 into r1705; + gte r1705 r1151 into r1706; + or r1703 r1706 into r1707; + sub.w r1705 r1151 into r1708; + ternary r1707 r1708 r1705 into r1709; + add r1702 73786976294838206464u128 into r1710; + ternary r1707 r1710 r1702 into r1711; + gte r1709 170141183460469231731687303715884105728u128 into r1712; + add.w r1709 r1709 into r1713; + add r1713 1u128 into r1714; + gte r1714 r1151 into r1715; + or r1712 r1715 into r1716; + sub.w r1714 r1151 into r1717; + ternary r1716 r1717 r1714 into r1718; + add r1711 36893488147419103232u128 into r1719; + ternary r1716 r1719 r1711 into r1720; + gte r1718 170141183460469231731687303715884105728u128 into r1721; + add.w r1718 r1718 into r1722; + add r1722 1u128 into r1723; + gte r1723 r1151 into r1724; + or r1721 r1724 into r1725; + sub.w r1723 r1151 into r1726; + ternary r1725 r1726 r1723 into r1727; + add r1720 18446744073709551616u128 into r1728; + ternary r1725 r1728 r1720 into r1729; + gte r1727 170141183460469231731687303715884105728u128 into r1730; + add.w r1727 r1727 into r1731; + add r1731 1u128 into r1732; + gte r1732 r1151 into r1733; + or r1730 r1733 into r1734; + sub.w r1732 r1151 into r1735; + ternary r1734 r1735 r1732 into r1736; + add r1729 9223372036854775808u128 into r1737; + ternary r1734 r1737 r1729 into r1738; + gte r1736 170141183460469231731687303715884105728u128 into r1739; + add.w r1736 r1736 into r1740; + add r1740 1u128 into r1741; + gte r1741 r1151 into r1742; + or r1739 r1742 into r1743; + sub.w r1741 r1151 into r1744; + ternary r1743 r1744 r1741 into r1745; + add r1738 4611686018427387904u128 into r1746; + ternary r1743 r1746 r1738 into r1747; + gte r1745 170141183460469231731687303715884105728u128 into r1748; + add.w r1745 r1745 into r1749; + add r1749 1u128 into r1750; + gte r1750 r1151 into r1751; + or r1748 r1751 into r1752; + sub.w r1750 r1151 into r1753; + ternary r1752 r1753 r1750 into r1754; + add r1747 2305843009213693952u128 into r1755; + ternary r1752 r1755 r1747 into r1756; + gte r1754 170141183460469231731687303715884105728u128 into r1757; + add.w r1754 r1754 into r1758; + add r1758 1u128 into r1759; + gte r1759 r1151 into r1760; + or r1757 r1760 into r1761; + sub.w r1759 r1151 into r1762; + ternary r1761 r1762 r1759 into r1763; + add r1756 1152921504606846976u128 into r1764; + ternary r1761 r1764 r1756 into r1765; + gte r1763 170141183460469231731687303715884105728u128 into r1766; + add.w r1763 r1763 into r1767; + add r1767 1u128 into r1768; + gte r1768 r1151 into r1769; + or r1766 r1769 into r1770; + sub.w r1768 r1151 into r1771; + ternary r1770 r1771 r1768 into r1772; + add r1765 576460752303423488u128 into r1773; + ternary r1770 r1773 r1765 into r1774; + gte r1772 170141183460469231731687303715884105728u128 into r1775; + add.w r1772 r1772 into r1776; + add r1776 1u128 into r1777; + gte r1777 r1151 into r1778; + or r1775 r1778 into r1779; + sub.w r1777 r1151 into r1780; + ternary r1779 r1780 r1777 into r1781; + add r1774 288230376151711744u128 into r1782; + ternary r1779 r1782 r1774 into r1783; + gte r1781 170141183460469231731687303715884105728u128 into r1784; + add.w r1781 r1781 into r1785; + add r1785 1u128 into r1786; + gte r1786 r1151 into r1787; + or r1784 r1787 into r1788; + sub.w r1786 r1151 into r1789; + ternary r1788 r1789 r1786 into r1790; + add r1783 144115188075855872u128 into r1791; + ternary r1788 r1791 r1783 into r1792; + gte r1790 170141183460469231731687303715884105728u128 into r1793; + add.w r1790 r1790 into r1794; + add r1794 1u128 into r1795; + gte r1795 r1151 into r1796; + or r1793 r1796 into r1797; + sub.w r1795 r1151 into r1798; + ternary r1797 r1798 r1795 into r1799; + add r1792 72057594037927936u128 into r1800; + ternary r1797 r1800 r1792 into r1801; + gte r1799 170141183460469231731687303715884105728u128 into r1802; + add.w r1799 r1799 into r1803; + add r1803 1u128 into r1804; + gte r1804 r1151 into r1805; + or r1802 r1805 into r1806; + sub.w r1804 r1151 into r1807; + ternary r1806 r1807 r1804 into r1808; + add r1801 36028797018963968u128 into r1809; + ternary r1806 r1809 r1801 into r1810; + gte r1808 170141183460469231731687303715884105728u128 into r1811; + add.w r1808 r1808 into r1812; + add r1812 1u128 into r1813; + gte r1813 r1151 into r1814; + or r1811 r1814 into r1815; + sub.w r1813 r1151 into r1816; + ternary r1815 r1816 r1813 into r1817; + add r1810 18014398509481984u128 into r1818; + ternary r1815 r1818 r1810 into r1819; + gte r1817 170141183460469231731687303715884105728u128 into r1820; + add.w r1817 r1817 into r1821; + add r1821 1u128 into r1822; + gte r1822 r1151 into r1823; + or r1820 r1823 into r1824; + sub.w r1822 r1151 into r1825; + ternary r1824 r1825 r1822 into r1826; + add r1819 9007199254740992u128 into r1827; + ternary r1824 r1827 r1819 into r1828; + gte r1826 170141183460469231731687303715884105728u128 into r1829; + add.w r1826 r1826 into r1830; + add r1830 1u128 into r1831; + gte r1831 r1151 into r1832; + or r1829 r1832 into r1833; + sub.w r1831 r1151 into r1834; + ternary r1833 r1834 r1831 into r1835; + add r1828 4503599627370496u128 into r1836; + ternary r1833 r1836 r1828 into r1837; + gte r1835 170141183460469231731687303715884105728u128 into r1838; + add.w r1835 r1835 into r1839; + add r1839 1u128 into r1840; + gte r1840 r1151 into r1841; + or r1838 r1841 into r1842; + sub.w r1840 r1151 into r1843; + ternary r1842 r1843 r1840 into r1844; + add r1837 2251799813685248u128 into r1845; + ternary r1842 r1845 r1837 into r1846; + gte r1844 170141183460469231731687303715884105728u128 into r1847; + add.w r1844 r1844 into r1848; + add r1848 1u128 into r1849; + gte r1849 r1151 into r1850; + or r1847 r1850 into r1851; + sub.w r1849 r1151 into r1852; + ternary r1851 r1852 r1849 into r1853; + add r1846 1125899906842624u128 into r1854; + ternary r1851 r1854 r1846 into r1855; + gte r1853 170141183460469231731687303715884105728u128 into r1856; + add.w r1853 r1853 into r1857; + add r1857 1u128 into r1858; + gte r1858 r1151 into r1859; + or r1856 r1859 into r1860; + sub.w r1858 r1151 into r1861; + ternary r1860 r1861 r1858 into r1862; + add r1855 562949953421312u128 into r1863; + ternary r1860 r1863 r1855 into r1864; + gte r1862 170141183460469231731687303715884105728u128 into r1865; + add.w r1862 r1862 into r1866; + add r1866 1u128 into r1867; + gte r1867 r1151 into r1868; + or r1865 r1868 into r1869; + sub.w r1867 r1151 into r1870; + ternary r1869 r1870 r1867 into r1871; + add r1864 281474976710656u128 into r1872; + ternary r1869 r1872 r1864 into r1873; + gte r1871 170141183460469231731687303715884105728u128 into r1874; + add.w r1871 r1871 into r1875; + add r1875 1u128 into r1876; + gte r1876 r1151 into r1877; + or r1874 r1877 into r1878; + sub.w r1876 r1151 into r1879; + ternary r1878 r1879 r1876 into r1880; + add r1873 140737488355328u128 into r1881; + ternary r1878 r1881 r1873 into r1882; + gte r1880 170141183460469231731687303715884105728u128 into r1883; + add.w r1880 r1880 into r1884; + add r1884 1u128 into r1885; + gte r1885 r1151 into r1886; + or r1883 r1886 into r1887; + sub.w r1885 r1151 into r1888; + ternary r1887 r1888 r1885 into r1889; + add r1882 70368744177664u128 into r1890; + ternary r1887 r1890 r1882 into r1891; + gte r1889 170141183460469231731687303715884105728u128 into r1892; + add.w r1889 r1889 into r1893; + add r1893 1u128 into r1894; + gte r1894 r1151 into r1895; + or r1892 r1895 into r1896; + sub.w r1894 r1151 into r1897; + ternary r1896 r1897 r1894 into r1898; + add r1891 35184372088832u128 into r1899; + ternary r1896 r1899 r1891 into r1900; + gte r1898 170141183460469231731687303715884105728u128 into r1901; + add.w r1898 r1898 into r1902; + add r1902 1u128 into r1903; + gte r1903 r1151 into r1904; + or r1901 r1904 into r1905; + sub.w r1903 r1151 into r1906; + ternary r1905 r1906 r1903 into r1907; + add r1900 17592186044416u128 into r1908; + ternary r1905 r1908 r1900 into r1909; + gte r1907 170141183460469231731687303715884105728u128 into r1910; + add.w r1907 r1907 into r1911; + add r1911 1u128 into r1912; + gte r1912 r1151 into r1913; + or r1910 r1913 into r1914; + sub.w r1912 r1151 into r1915; + ternary r1914 r1915 r1912 into r1916; + add r1909 8796093022208u128 into r1917; + ternary r1914 r1917 r1909 into r1918; + gte r1916 170141183460469231731687303715884105728u128 into r1919; + add.w r1916 r1916 into r1920; + add r1920 1u128 into r1921; + gte r1921 r1151 into r1922; + or r1919 r1922 into r1923; + sub.w r1921 r1151 into r1924; + ternary r1923 r1924 r1921 into r1925; + add r1918 4398046511104u128 into r1926; + ternary r1923 r1926 r1918 into r1927; + gte r1925 170141183460469231731687303715884105728u128 into r1928; + add.w r1925 r1925 into r1929; + add r1929 1u128 into r1930; + gte r1930 r1151 into r1931; + or r1928 r1931 into r1932; + sub.w r1930 r1151 into r1933; + ternary r1932 r1933 r1930 into r1934; + add r1927 2199023255552u128 into r1935; + ternary r1932 r1935 r1927 into r1936; + gte r1934 170141183460469231731687303715884105728u128 into r1937; + add.w r1934 r1934 into r1938; + add r1938 1u128 into r1939; + gte r1939 r1151 into r1940; + or r1937 r1940 into r1941; + sub.w r1939 r1151 into r1942; + ternary r1941 r1942 r1939 into r1943; + add r1936 1099511627776u128 into r1944; + ternary r1941 r1944 r1936 into r1945; + gte r1943 170141183460469231731687303715884105728u128 into r1946; + add.w r1943 r1943 into r1947; + add r1947 1u128 into r1948; + gte r1948 r1151 into r1949; + or r1946 r1949 into r1950; + sub.w r1948 r1151 into r1951; + ternary r1950 r1951 r1948 into r1952; + add r1945 549755813888u128 into r1953; + ternary r1950 r1953 r1945 into r1954; + gte r1952 170141183460469231731687303715884105728u128 into r1955; + add.w r1952 r1952 into r1956; + add r1956 1u128 into r1957; + gte r1957 r1151 into r1958; + or r1955 r1958 into r1959; + sub.w r1957 r1151 into r1960; + ternary r1959 r1960 r1957 into r1961; + add r1954 274877906944u128 into r1962; + ternary r1959 r1962 r1954 into r1963; + gte r1961 170141183460469231731687303715884105728u128 into r1964; + add.w r1961 r1961 into r1965; + add r1965 1u128 into r1966; + gte r1966 r1151 into r1967; + or r1964 r1967 into r1968; + sub.w r1966 r1151 into r1969; + ternary r1968 r1969 r1966 into r1970; + add r1963 137438953472u128 into r1971; + ternary r1968 r1971 r1963 into r1972; + gte r1970 170141183460469231731687303715884105728u128 into r1973; + add.w r1970 r1970 into r1974; + add r1974 1u128 into r1975; + gte r1975 r1151 into r1976; + or r1973 r1976 into r1977; + sub.w r1975 r1151 into r1978; + ternary r1977 r1978 r1975 into r1979; + add r1972 68719476736u128 into r1980; + ternary r1977 r1980 r1972 into r1981; + gte r1979 170141183460469231731687303715884105728u128 into r1982; + add.w r1979 r1979 into r1983; + add r1983 1u128 into r1984; + gte r1984 r1151 into r1985; + or r1982 r1985 into r1986; + sub.w r1984 r1151 into r1987; + ternary r1986 r1987 r1984 into r1988; + add r1981 34359738368u128 into r1989; + ternary r1986 r1989 r1981 into r1990; + gte r1988 170141183460469231731687303715884105728u128 into r1991; + add.w r1988 r1988 into r1992; + add r1992 1u128 into r1993; + gte r1993 r1151 into r1994; + or r1991 r1994 into r1995; + sub.w r1993 r1151 into r1996; + ternary r1995 r1996 r1993 into r1997; + add r1990 17179869184u128 into r1998; + ternary r1995 r1998 r1990 into r1999; + gte r1997 170141183460469231731687303715884105728u128 into r2000; + add.w r1997 r1997 into r2001; + add r2001 1u128 into r2002; + gte r2002 r1151 into r2003; + or r2000 r2003 into r2004; + sub.w r2002 r1151 into r2005; + ternary r2004 r2005 r2002 into r2006; + add r1999 8589934592u128 into r2007; + ternary r2004 r2007 r1999 into r2008; + gte r2006 170141183460469231731687303715884105728u128 into r2009; + add.w r2006 r2006 into r2010; + add r2010 1u128 into r2011; + gte r2011 r1151 into r2012; + or r2009 r2012 into r2013; + sub.w r2011 r1151 into r2014; + ternary r2013 r2014 r2011 into r2015; + add r2008 4294967296u128 into r2016; + ternary r2013 r2016 r2008 into r2017; + gte r2015 170141183460469231731687303715884105728u128 into r2018; + add.w r2015 r2015 into r2019; + add r2019 1u128 into r2020; + gte r2020 r1151 into r2021; + or r2018 r2021 into r2022; + sub.w r2020 r1151 into r2023; + ternary r2022 r2023 r2020 into r2024; + add r2017 2147483648u128 into r2025; + ternary r2022 r2025 r2017 into r2026; + gte r2024 170141183460469231731687303715884105728u128 into r2027; + add.w r2024 r2024 into r2028; + add r2028 1u128 into r2029; + gte r2029 r1151 into r2030; + or r2027 r2030 into r2031; + sub.w r2029 r1151 into r2032; + ternary r2031 r2032 r2029 into r2033; + add r2026 1073741824u128 into r2034; + ternary r2031 r2034 r2026 into r2035; + gte r2033 170141183460469231731687303715884105728u128 into r2036; + add.w r2033 r2033 into r2037; + add r2037 1u128 into r2038; + gte r2038 r1151 into r2039; + or r2036 r2039 into r2040; + sub.w r2038 r1151 into r2041; + ternary r2040 r2041 r2038 into r2042; + add r2035 536870912u128 into r2043; + ternary r2040 r2043 r2035 into r2044; + gte r2042 170141183460469231731687303715884105728u128 into r2045; + add.w r2042 r2042 into r2046; + add r2046 1u128 into r2047; + gte r2047 r1151 into r2048; + or r2045 r2048 into r2049; + sub.w r2047 r1151 into r2050; + ternary r2049 r2050 r2047 into r2051; + add r2044 268435456u128 into r2052; + ternary r2049 r2052 r2044 into r2053; + gte r2051 170141183460469231731687303715884105728u128 into r2054; + add.w r2051 r2051 into r2055; + add r2055 1u128 into r2056; + gte r2056 r1151 into r2057; + or r2054 r2057 into r2058; + sub.w r2056 r1151 into r2059; + ternary r2058 r2059 r2056 into r2060; + add r2053 134217728u128 into r2061; + ternary r2058 r2061 r2053 into r2062; + gte r2060 170141183460469231731687303715884105728u128 into r2063; + add.w r2060 r2060 into r2064; + add r2064 1u128 into r2065; + gte r2065 r1151 into r2066; + or r2063 r2066 into r2067; + sub.w r2065 r1151 into r2068; + ternary r2067 r2068 r2065 into r2069; + add r2062 67108864u128 into r2070; + ternary r2067 r2070 r2062 into r2071; + gte r2069 170141183460469231731687303715884105728u128 into r2072; + add.w r2069 r2069 into r2073; + add r2073 1u128 into r2074; + gte r2074 r1151 into r2075; + or r2072 r2075 into r2076; + sub.w r2074 r1151 into r2077; + ternary r2076 r2077 r2074 into r2078; + add r2071 33554432u128 into r2079; + ternary r2076 r2079 r2071 into r2080; + gte r2078 170141183460469231731687303715884105728u128 into r2081; + add.w r2078 r2078 into r2082; + add r2082 1u128 into r2083; + gte r2083 r1151 into r2084; + or r2081 r2084 into r2085; + sub.w r2083 r1151 into r2086; + ternary r2085 r2086 r2083 into r2087; + add r2080 16777216u128 into r2088; + ternary r2085 r2088 r2080 into r2089; + gte r2087 170141183460469231731687303715884105728u128 into r2090; + add.w r2087 r2087 into r2091; + add r2091 1u128 into r2092; + gte r2092 r1151 into r2093; + or r2090 r2093 into r2094; + sub.w r2092 r1151 into r2095; + ternary r2094 r2095 r2092 into r2096; + add r2089 8388608u128 into r2097; + ternary r2094 r2097 r2089 into r2098; + gte r2096 170141183460469231731687303715884105728u128 into r2099; + add.w r2096 r2096 into r2100; + add r2100 1u128 into r2101; + gte r2101 r1151 into r2102; + or r2099 r2102 into r2103; + sub.w r2101 r1151 into r2104; + ternary r2103 r2104 r2101 into r2105; + add r2098 4194304u128 into r2106; + ternary r2103 r2106 r2098 into r2107; + gte r2105 170141183460469231731687303715884105728u128 into r2108; + add.w r2105 r2105 into r2109; + add r2109 1u128 into r2110; + gte r2110 r1151 into r2111; + or r2108 r2111 into r2112; + sub.w r2110 r1151 into r2113; + ternary r2112 r2113 r2110 into r2114; + add r2107 2097152u128 into r2115; + ternary r2112 r2115 r2107 into r2116; + gte r2114 170141183460469231731687303715884105728u128 into r2117; + add.w r2114 r2114 into r2118; + add r2118 1u128 into r2119; + gte r2119 r1151 into r2120; + or r2117 r2120 into r2121; + sub.w r2119 r1151 into r2122; + ternary r2121 r2122 r2119 into r2123; + add r2116 1048576u128 into r2124; + ternary r2121 r2124 r2116 into r2125; + gte r2123 170141183460469231731687303715884105728u128 into r2126; + add.w r2123 r2123 into r2127; + add r2127 1u128 into r2128; + gte r2128 r1151 into r2129; + or r2126 r2129 into r2130; + sub.w r2128 r1151 into r2131; + ternary r2130 r2131 r2128 into r2132; + add r2125 524288u128 into r2133; + ternary r2130 r2133 r2125 into r2134; + gte r2132 170141183460469231731687303715884105728u128 into r2135; + add.w r2132 r2132 into r2136; + add r2136 1u128 into r2137; + gte r2137 r1151 into r2138; + or r2135 r2138 into r2139; + sub.w r2137 r1151 into r2140; + ternary r2139 r2140 r2137 into r2141; + add r2134 262144u128 into r2142; + ternary r2139 r2142 r2134 into r2143; + gte r2141 170141183460469231731687303715884105728u128 into r2144; + add.w r2141 r2141 into r2145; + add r2145 1u128 into r2146; + gte r2146 r1151 into r2147; + or r2144 r2147 into r2148; + sub.w r2146 r1151 into r2149; + ternary r2148 r2149 r2146 into r2150; + add r2143 131072u128 into r2151; + ternary r2148 r2151 r2143 into r2152; + gte r2150 170141183460469231731687303715884105728u128 into r2153; + add.w r2150 r2150 into r2154; + add r2154 1u128 into r2155; + gte r2155 r1151 into r2156; + or r2153 r2156 into r2157; + sub.w r2155 r1151 into r2158; + ternary r2157 r2158 r2155 into r2159; + add r2152 65536u128 into r2160; + ternary r2157 r2160 r2152 into r2161; + gte r2159 170141183460469231731687303715884105728u128 into r2162; + add.w r2159 r2159 into r2163; + add r2163 1u128 into r2164; + gte r2164 r1151 into r2165; + or r2162 r2165 into r2166; + sub.w r2164 r1151 into r2167; + ternary r2166 r2167 r2164 into r2168; + add r2161 32768u128 into r2169; + ternary r2166 r2169 r2161 into r2170; + gte r2168 170141183460469231731687303715884105728u128 into r2171; + add.w r2168 r2168 into r2172; + add r2172 1u128 into r2173; + gte r2173 r1151 into r2174; + or r2171 r2174 into r2175; + sub.w r2173 r1151 into r2176; + ternary r2175 r2176 r2173 into r2177; + add r2170 16384u128 into r2178; + ternary r2175 r2178 r2170 into r2179; + gte r2177 170141183460469231731687303715884105728u128 into r2180; + add.w r2177 r2177 into r2181; + add r2181 1u128 into r2182; + gte r2182 r1151 into r2183; + or r2180 r2183 into r2184; + sub.w r2182 r1151 into r2185; + ternary r2184 r2185 r2182 into r2186; + add r2179 8192u128 into r2187; + ternary r2184 r2187 r2179 into r2188; + gte r2186 170141183460469231731687303715884105728u128 into r2189; + add.w r2186 r2186 into r2190; + add r2190 1u128 into r2191; + gte r2191 r1151 into r2192; + or r2189 r2192 into r2193; + sub.w r2191 r1151 into r2194; + ternary r2193 r2194 r2191 into r2195; + add r2188 4096u128 into r2196; + ternary r2193 r2196 r2188 into r2197; + gte r2195 170141183460469231731687303715884105728u128 into r2198; + add.w r2195 r2195 into r2199; + add r2199 1u128 into r2200; + gte r2200 r1151 into r2201; + or r2198 r2201 into r2202; + sub.w r2200 r1151 into r2203; + ternary r2202 r2203 r2200 into r2204; + add r2197 2048u128 into r2205; + ternary r2202 r2205 r2197 into r2206; + gte r2204 170141183460469231731687303715884105728u128 into r2207; + add.w r2204 r2204 into r2208; + add r2208 1u128 into r2209; + gte r2209 r1151 into r2210; + or r2207 r2210 into r2211; + sub.w r2209 r1151 into r2212; + ternary r2211 r2212 r2209 into r2213; + add r2206 1024u128 into r2214; + ternary r2211 r2214 r2206 into r2215; + gte r2213 170141183460469231731687303715884105728u128 into r2216; + add.w r2213 r2213 into r2217; + add r2217 1u128 into r2218; + gte r2218 r1151 into r2219; + or r2216 r2219 into r2220; + sub.w r2218 r1151 into r2221; + ternary r2220 r2221 r2218 into r2222; + add r2215 512u128 into r2223; + ternary r2220 r2223 r2215 into r2224; + gte r2222 170141183460469231731687303715884105728u128 into r2225; + add.w r2222 r2222 into r2226; + add r2226 1u128 into r2227; + gte r2227 r1151 into r2228; + or r2225 r2228 into r2229; + sub.w r2227 r1151 into r2230; + ternary r2229 r2230 r2227 into r2231; + add r2224 256u128 into r2232; + ternary r2229 r2232 r2224 into r2233; + gte r2231 170141183460469231731687303715884105728u128 into r2234; + add.w r2231 r2231 into r2235; + add r2235 1u128 into r2236; + gte r2236 r1151 into r2237; + or r2234 r2237 into r2238; + sub.w r2236 r1151 into r2239; + ternary r2238 r2239 r2236 into r2240; + add r2233 128u128 into r2241; + ternary r2238 r2241 r2233 into r2242; + gte r2240 170141183460469231731687303715884105728u128 into r2243; + add.w r2240 r2240 into r2244; + add r2244 1u128 into r2245; + gte r2245 r1151 into r2246; + or r2243 r2246 into r2247; + sub.w r2245 r1151 into r2248; + ternary r2247 r2248 r2245 into r2249; + add r2242 64u128 into r2250; + ternary r2247 r2250 r2242 into r2251; + gte r2249 170141183460469231731687303715884105728u128 into r2252; + add.w r2249 r2249 into r2253; + add r2253 1u128 into r2254; + gte r2254 r1151 into r2255; + or r2252 r2255 into r2256; + sub.w r2254 r1151 into r2257; + ternary r2256 r2257 r2254 into r2258; + add r2251 32u128 into r2259; + ternary r2256 r2259 r2251 into r2260; + gte r2258 170141183460469231731687303715884105728u128 into r2261; + add.w r2258 r2258 into r2262; + add r2262 1u128 into r2263; + gte r2263 r1151 into r2264; + or r2261 r2264 into r2265; + sub.w r2263 r1151 into r2266; + ternary r2265 r2266 r2263 into r2267; + add r2260 16u128 into r2268; + ternary r2265 r2268 r2260 into r2269; + gte r2267 170141183460469231731687303715884105728u128 into r2270; + add.w r2267 r2267 into r2271; + add r2271 1u128 into r2272; + gte r2272 r1151 into r2273; + or r2270 r2273 into r2274; + sub.w r2272 r1151 into r2275; + ternary r2274 r2275 r2272 into r2276; + add r2269 8u128 into r2277; + ternary r2274 r2277 r2269 into r2278; + gte r2276 170141183460469231731687303715884105728u128 into r2279; + add.w r2276 r2276 into r2280; + add r2280 1u128 into r2281; + gte r2281 r1151 into r2282; + or r2279 r2282 into r2283; + sub.w r2281 r1151 into r2284; + ternary r2283 r2284 r2281 into r2285; + add r2278 4u128 into r2286; + ternary r2283 r2286 r2278 into r2287; + gte r2285 170141183460469231731687303715884105728u128 into r2288; + add.w r2285 r2285 into r2289; + add r2289 1u128 into r2290; + gte r2290 r1151 into r2291; + or r2288 r2291 into r2292; + sub.w r2290 r1151 into r2293; + ternary r2292 r2293 r2290 into r2294; + add r2287 2u128 into r2295; + ternary r2292 r2295 r2287 into r2296; + gte r2294 170141183460469231731687303715884105728u128 into r2297; + add.w r2294 r2294 into r2298; + add r2298 1u128 into r2299; + gte r2299 r1151 into r2300; + or r2297 r2300 into r2301; + add r2296 1u128 into r2302; + ternary r2301 r2302 r2296 into r2303; + cast r1152 r2303 into r2304 as U256__8JquwLopp8; + ternary r1149 r2304.hi r1148.hi into r2305; + ternary r1149 r2304.lo r1148.lo into r2306; + cast r2305 r2306 into r2307 as U256__8JquwLopp8; + lt r2.hi r2307.hi into r2308; + gt r2.hi r2307.hi into r2309; + lt r2.lo r2307.lo into r2310; + ternary r2309 false r2310 into r2311; + ternary r2308 true r2311 into r2312; + not r2312 into r2313; + ternary r2313 r5 r3 into r2314; + gte r2314 -524287i32 into r2315; + lte r2314 524287i32 into r2316; + and r2315 r2316 into r2317; + assert.eq r2317 true; + lt r2314 0i32 into r2318; + sub 0i32 r2314 into r2319; + ternary r2318 r2319 r2314 into r2320; + gte r2320 0i32 into r2321; + assert.eq r2321 true; + cast r2320 into r2322 as u32; + and r2322 3u32 into r2323; + is.eq r2323 0u32 into r2324; + is.eq r2323 1u32 into r2325; + is.eq r2323 2u32 into r2326; + ternary r2326 0u128 0u128 into r2327; + ternary r2326 340248342086729790484326174814286782778u128 340231330945450418515964920540021147199u128 into r2328; + cast r2327 r2328 into r2329 as U256__8JquwLopp8; + ternary r2325 0u128 r2329.hi into r2330; + ternary r2325 340265354078544963557816517032075149313u128 r2329.lo into r2331; + cast r2330 r2331 into r2332 as U256__8JquwLopp8; + ternary r2324 1u128 r2332.hi into r2333; + ternary r2324 0u128 r2332.lo into r2334; + cast r2333 r2334 into r2335 as U256__8JquwLopp8; + and r2322 4u32 into r2336; + is.neq r2336 0u32 into r2337; + and r2335.lo 18446744073709551615u128 into r2338; + shr r2335.lo 64u8 into r2339; + mul r2338 17226890335427755468u128 into r2340; + mul r2338 18443055278223354162u128 into r2341; + mul r2339 17226890335427755468u128 into r2342; + mul r2339 18443055278223354162u128 into r2343; + and r2340 18446744073709551615u128 into r2344; + shr r2340 64u8 into r2345; + and r2341 18446744073709551615u128 into r2346; + add r2345 r2346 into r2347; + and r2342 18446744073709551615u128 into r2348; + add r2347 r2348 into r2349; + and r2349 18446744073709551615u128 into r2350; + shr r2349 64u8 into r2351; + shr r2341 64u8 into r2352; + shr r2342 64u8 into r2353; + add r2352 r2353 into r2354; + and r2343 18446744073709551615u128 into r2355; + add r2354 r2355 into r2356; + add r2356 r2351 into r2357; + and r2357 18446744073709551615u128 into r2358; + shr r2357 64u8 into r2359; + shr r2343 64u8 into r2360; + add r2360 r2359 into r2361; + shl r2361 64u8 into r2362; + add r2362 r2358 into r2363; + shl r2350 64u8 into r2364; + add r2364 r2344 into r2365; + and r2335.hi 18446744073709551615u128 into r2366; + shr r2335.hi 64u8 into r2367; + mul r2366 17226890335427755468u128 into r2368; + mul r2366 18443055278223354162u128 into r2369; + mul r2367 17226890335427755468u128 into r2370; + mul r2367 18443055278223354162u128 into r2371; + and r2368 18446744073709551615u128 into r2372; + shr r2368 64u8 into r2373; + and r2369 18446744073709551615u128 into r2374; + add r2373 r2374 into r2375; + and r2370 18446744073709551615u128 into r2376; + add r2375 r2376 into r2377; + and r2377 18446744073709551615u128 into r2378; + shr r2377 64u8 into r2379; + shr r2369 64u8 into r2380; + shr r2370 64u8 into r2381; + add r2380 r2381 into r2382; + and r2371 18446744073709551615u128 into r2383; + add r2382 r2383 into r2384; + add r2384 r2379 into r2385; + and r2385 18446744073709551615u128 into r2386; + shr r2385 64u8 into r2387; + shr r2371 64u8 into r2388; + add r2388 r2387 into r2389; + shl r2389 64u8 into r2390; + add r2390 r2386 into r2391; + shl r2378 64u8 into r2392; + add r2392 r2372 into r2393; + add.w r2363 r2393 into r2394; + lt r2394 r2363 into r2395; + ternary r2395 1u128 0u128 into r2396; + add.w r2391 r2396 into r2397; + cast r2397 r2394 into r2398 as U256__8JquwLopp8; + ternary r2337 r2398.hi r2335.hi into r2399; + ternary r2337 r2398.lo r2335.lo into r2400; + cast r2399 r2400 into r2401 as U256__8JquwLopp8; + and r2322 8u32 into r2402; + is.neq r2402 0u32 into r2403; + and r2401.lo 18446744073709551615u128 into r2404; + shr r2401.lo 64u8 into r2405; + mul r2404 2032852871939366096u128 into r2406; + mul r2404 18439367220385604838u128 into r2407; + mul r2405 2032852871939366096u128 into r2408; + mul r2405 18439367220385604838u128 into r2409; + and r2406 18446744073709551615u128 into r2410; + shr r2406 64u8 into r2411; + and r2407 18446744073709551615u128 into r2412; + add r2411 r2412 into r2413; + and r2408 18446744073709551615u128 into r2414; + add r2413 r2414 into r2415; + and r2415 18446744073709551615u128 into r2416; + shr r2415 64u8 into r2417; + shr r2407 64u8 into r2418; + shr r2408 64u8 into r2419; + add r2418 r2419 into r2420; + and r2409 18446744073709551615u128 into r2421; + add r2420 r2421 into r2422; + add r2422 r2417 into r2423; + and r2423 18446744073709551615u128 into r2424; + shr r2423 64u8 into r2425; + shr r2409 64u8 into r2426; + add r2426 r2425 into r2427; + shl r2427 64u8 into r2428; + add r2428 r2424 into r2429; + shl r2416 64u8 into r2430; + add r2430 r2410 into r2431; + and r2401.hi 18446744073709551615u128 into r2432; + shr r2401.hi 64u8 into r2433; + mul r2432 2032852871939366096u128 into r2434; + mul r2432 18439367220385604838u128 into r2435; + mul r2433 2032852871939366096u128 into r2436; + mul r2433 18439367220385604838u128 into r2437; + and r2434 18446744073709551615u128 into r2438; + shr r2434 64u8 into r2439; + and r2435 18446744073709551615u128 into r2440; + add r2439 r2440 into r2441; + and r2436 18446744073709551615u128 into r2442; + add r2441 r2442 into r2443; + and r2443 18446744073709551615u128 into r2444; + shr r2443 64u8 into r2445; + shr r2435 64u8 into r2446; + shr r2436 64u8 into r2447; + add r2446 r2447 into r2448; + and r2437 18446744073709551615u128 into r2449; + add r2448 r2449 into r2450; + add r2450 r2445 into r2451; + and r2451 18446744073709551615u128 into r2452; + shr r2451 64u8 into r2453; + shr r2437 64u8 into r2454; + add r2454 r2453 into r2455; + shl r2455 64u8 into r2456; + add r2456 r2452 into r2457; + shl r2444 64u8 into r2458; + add r2458 r2438 into r2459; + add.w r2429 r2459 into r2460; + lt r2460 r2429 into r2461; + ternary r2461 1u128 0u128 into r2462; + add.w r2457 r2462 into r2463; + cast r2463 r2460 into r2464 as U256__8JquwLopp8; + ternary r2403 r2464.hi r2401.hi into r2465; + ternary r2403 r2464.lo r2401.lo into r2466; + cast r2465 r2466 into r2467 as U256__8JquwLopp8; + and r2322 16u32 into r2468; + is.neq r2468 0u32 into r2469; + and r2467.lo 18446744073709551615u128 into r2470; + shr r2467.lo 64u8 into r2471; + mul r2470 14545316742740207172u128 into r2472; + mul r2470 18431993317065449817u128 into r2473; + mul r2471 14545316742740207172u128 into r2474; + mul r2471 18431993317065449817u128 into r2475; + and r2472 18446744073709551615u128 into r2476; + shr r2472 64u8 into r2477; + and r2473 18446744073709551615u128 into r2478; + add r2477 r2478 into r2479; + and r2474 18446744073709551615u128 into r2480; + add r2479 r2480 into r2481; + and r2481 18446744073709551615u128 into r2482; + shr r2481 64u8 into r2483; + shr r2473 64u8 into r2484; + shr r2474 64u8 into r2485; + add r2484 r2485 into r2486; + and r2475 18446744073709551615u128 into r2487; + add r2486 r2487 into r2488; + add r2488 r2483 into r2489; + and r2489 18446744073709551615u128 into r2490; + shr r2489 64u8 into r2491; + shr r2475 64u8 into r2492; + add r2492 r2491 into r2493; + shl r2493 64u8 into r2494; + add r2494 r2490 into r2495; + shl r2482 64u8 into r2496; + add r2496 r2476 into r2497; + and r2467.hi 18446744073709551615u128 into r2498; + shr r2467.hi 64u8 into r2499; + mul r2498 14545316742740207172u128 into r2500; + mul r2498 18431993317065449817u128 into r2501; + mul r2499 14545316742740207172u128 into r2502; + mul r2499 18431993317065449817u128 into r2503; + and r2500 18446744073709551615u128 into r2504; + shr r2500 64u8 into r2505; + and r2501 18446744073709551615u128 into r2506; + add r2505 r2506 into r2507; + and r2502 18446744073709551615u128 into r2508; + add r2507 r2508 into r2509; + and r2509 18446744073709551615u128 into r2510; + shr r2509 64u8 into r2511; + shr r2501 64u8 into r2512; + shr r2502 64u8 into r2513; + add r2512 r2513 into r2514; + and r2503 18446744073709551615u128 into r2515; + add r2514 r2515 into r2516; + add r2516 r2511 into r2517; + and r2517 18446744073709551615u128 into r2518; + shr r2517 64u8 into r2519; + shr r2503 64u8 into r2520; + add r2520 r2519 into r2521; + shl r2521 64u8 into r2522; + add r2522 r2518 into r2523; + shl r2510 64u8 into r2524; + add r2524 r2504 into r2525; + add.w r2495 r2525 into r2526; + lt r2526 r2495 into r2527; + ternary r2527 1u128 0u128 into r2528; + add.w r2523 r2528 into r2529; + cast r2529 r2526 into r2530 as U256__8JquwLopp8; + ternary r2469 r2530.hi r2467.hi into r2531; + ternary r2469 r2530.lo r2467.lo into r2532; + cast r2531 r2532 into r2533 as U256__8JquwLopp8; + and r2322 32u32 into r2534; + is.neq r2534 0u32 into r2535; + and r2533.lo 18446744073709551615u128 into r2536; + shr r2533.lo 64u8 into r2537; + mul r2536 5129152022828963008u128 into r2538; + mul r2536 18417254355718160513u128 into r2539; + mul r2537 5129152022828963008u128 into r2540; + mul r2537 18417254355718160513u128 into r2541; + and r2538 18446744073709551615u128 into r2542; + shr r2538 64u8 into r2543; + and r2539 18446744073709551615u128 into r2544; + add r2543 r2544 into r2545; + and r2540 18446744073709551615u128 into r2546; + add r2545 r2546 into r2547; + and r2547 18446744073709551615u128 into r2548; + shr r2547 64u8 into r2549; + shr r2539 64u8 into r2550; + shr r2540 64u8 into r2551; + add r2550 r2551 into r2552; + and r2541 18446744073709551615u128 into r2553; + add r2552 r2553 into r2554; + add r2554 r2549 into r2555; + and r2555 18446744073709551615u128 into r2556; + shr r2555 64u8 into r2557; + shr r2541 64u8 into r2558; + add r2558 r2557 into r2559; + shl r2559 64u8 into r2560; + add r2560 r2556 into r2561; + shl r2548 64u8 into r2562; + add r2562 r2542 into r2563; + and r2533.hi 18446744073709551615u128 into r2564; + shr r2533.hi 64u8 into r2565; + mul r2564 5129152022828963008u128 into r2566; + mul r2564 18417254355718160513u128 into r2567; + mul r2565 5129152022828963008u128 into r2568; + mul r2565 18417254355718160513u128 into r2569; + and r2566 18446744073709551615u128 into r2570; + shr r2566 64u8 into r2571; + and r2567 18446744073709551615u128 into r2572; + add r2571 r2572 into r2573; + and r2568 18446744073709551615u128 into r2574; + add r2573 r2574 into r2575; + and r2575 18446744073709551615u128 into r2576; + shr r2575 64u8 into r2577; + shr r2567 64u8 into r2578; + shr r2568 64u8 into r2579; + add r2578 r2579 into r2580; + and r2569 18446744073709551615u128 into r2581; + add r2580 r2581 into r2582; + add r2582 r2577 into r2583; + and r2583 18446744073709551615u128 into r2584; + shr r2583 64u8 into r2585; + shr r2569 64u8 into r2586; + add r2586 r2585 into r2587; + shl r2587 64u8 into r2588; + add r2588 r2584 into r2589; + shl r2576 64u8 into r2590; + add r2590 r2570 into r2591; + add.w r2561 r2591 into r2592; + lt r2592 r2561 into r2593; + ternary r2593 1u128 0u128 into r2594; + add.w r2589 r2594 into r2595; + cast r2595 r2592 into r2596 as U256__8JquwLopp8; + ternary r2535 r2596.hi r2533.hi into r2597; + ternary r2535 r2596.lo r2533.lo into r2598; + cast r2597 r2598 into r2599 as U256__8JquwLopp8; + and r2322 64u32 into r2600; + is.neq r2600 0u32 into r2601; + and r2599.lo 18446744073709551615u128 into r2602; + shr r2599.lo 64u8 into r2603; + mul r2602 4894419605888772193u128 into r2604; + mul r2602 18387811781193591352u128 into r2605; + mul r2603 4894419605888772193u128 into r2606; + mul r2603 18387811781193591352u128 into r2607; + and r2604 18446744073709551615u128 into r2608; + shr r2604 64u8 into r2609; + and r2605 18446744073709551615u128 into r2610; + add r2609 r2610 into r2611; + and r2606 18446744073709551615u128 into r2612; + add r2611 r2612 into r2613; + and r2613 18446744073709551615u128 into r2614; + shr r2613 64u8 into r2615; + shr r2605 64u8 into r2616; + shr r2606 64u8 into r2617; + add r2616 r2617 into r2618; + and r2607 18446744073709551615u128 into r2619; + add r2618 r2619 into r2620; + add r2620 r2615 into r2621; + and r2621 18446744073709551615u128 into r2622; + shr r2621 64u8 into r2623; + shr r2607 64u8 into r2624; + add r2624 r2623 into r2625; + shl r2625 64u8 into r2626; + add r2626 r2622 into r2627; + shl r2614 64u8 into r2628; + add r2628 r2608 into r2629; + and r2599.hi 18446744073709551615u128 into r2630; + shr r2599.hi 64u8 into r2631; + mul r2630 4894419605888772193u128 into r2632; + mul r2630 18387811781193591352u128 into r2633; + mul r2631 4894419605888772193u128 into r2634; + mul r2631 18387811781193591352u128 into r2635; + and r2632 18446744073709551615u128 into r2636; + shr r2632 64u8 into r2637; + and r2633 18446744073709551615u128 into r2638; + add r2637 r2638 into r2639; + and r2634 18446744073709551615u128 into r2640; + add r2639 r2640 into r2641; + and r2641 18446744073709551615u128 into r2642; + shr r2641 64u8 into r2643; + shr r2633 64u8 into r2644; + shr r2634 64u8 into r2645; + add r2644 r2645 into r2646; + and r2635 18446744073709551615u128 into r2647; + add r2646 r2647 into r2648; + add r2648 r2643 into r2649; + and r2649 18446744073709551615u128 into r2650; + shr r2649 64u8 into r2651; + shr r2635 64u8 into r2652; + add r2652 r2651 into r2653; + shl r2653 64u8 into r2654; + add r2654 r2650 into r2655; + shl r2642 64u8 into r2656; + add r2656 r2636 into r2657; + add.w r2627 r2657 into r2658; + lt r2658 r2627 into r2659; + ternary r2659 1u128 0u128 into r2660; + add.w r2655 r2660 into r2661; + cast r2661 r2658 into r2662 as U256__8JquwLopp8; + ternary r2601 r2662.hi r2599.hi into r2663; + ternary r2601 r2662.lo r2599.lo into r2664; + cast r2663 r2664 into r2665 as U256__8JquwLopp8; + and r2322 128u32 into r2666; + is.neq r2666 0u32 into r2667; + and r2665.lo 18446744073709551615u128 into r2668; + shr r2665.lo 64u8 into r2669; + mul r2668 1280255884321894483u128 into r2670; + mul r2668 18329067761203520168u128 into r2671; + mul r2669 1280255884321894483u128 into r2672; + mul r2669 18329067761203520168u128 into r2673; + and r2670 18446744073709551615u128 into r2674; + shr r2670 64u8 into r2675; + and r2671 18446744073709551615u128 into r2676; + add r2675 r2676 into r2677; + and r2672 18446744073709551615u128 into r2678; + add r2677 r2678 into r2679; + and r2679 18446744073709551615u128 into r2680; + shr r2679 64u8 into r2681; + shr r2671 64u8 into r2682; + shr r2672 64u8 into r2683; + add r2682 r2683 into r2684; + and r2673 18446744073709551615u128 into r2685; + add r2684 r2685 into r2686; + add r2686 r2681 into r2687; + and r2687 18446744073709551615u128 into r2688; + shr r2687 64u8 into r2689; + shr r2673 64u8 into r2690; + add r2690 r2689 into r2691; + shl r2691 64u8 into r2692; + add r2692 r2688 into r2693; + shl r2680 64u8 into r2694; + add r2694 r2674 into r2695; + and r2665.hi 18446744073709551615u128 into r2696; + shr r2665.hi 64u8 into r2697; + mul r2696 1280255884321894483u128 into r2698; + mul r2696 18329067761203520168u128 into r2699; + mul r2697 1280255884321894483u128 into r2700; + mul r2697 18329067761203520168u128 into r2701; + and r2698 18446744073709551615u128 into r2702; + shr r2698 64u8 into r2703; + and r2699 18446744073709551615u128 into r2704; + add r2703 r2704 into r2705; + and r2700 18446744073709551615u128 into r2706; + add r2705 r2706 into r2707; + and r2707 18446744073709551615u128 into r2708; + shr r2707 64u8 into r2709; + shr r2699 64u8 into r2710; + shr r2700 64u8 into r2711; + add r2710 r2711 into r2712; + and r2701 18446744073709551615u128 into r2713; + add r2712 r2713 into r2714; + add r2714 r2709 into r2715; + and r2715 18446744073709551615u128 into r2716; + shr r2715 64u8 into r2717; + shr r2701 64u8 into r2718; + add r2718 r2717 into r2719; + shl r2719 64u8 into r2720; + add r2720 r2716 into r2721; + shl r2708 64u8 into r2722; + add r2722 r2702 into r2723; + add.w r2693 r2723 into r2724; + lt r2724 r2693 into r2725; + ternary r2725 1u128 0u128 into r2726; + add.w r2721 r2726 into r2727; + cast r2727 r2724 into r2728 as U256__8JquwLopp8; + ternary r2667 r2728.hi r2665.hi into r2729; + ternary r2667 r2728.lo r2665.lo into r2730; + cast r2729 r2730 into r2731 as U256__8JquwLopp8; + and r2322 256u32 into r2732; + is.neq r2732 0u32 into r2733; + and r2731.lo 18446744073709551615u128 into r2734; + shr r2731.lo 64u8 into r2735; + mul r2734 15924666964335305636u128 into r2736; + mul r2734 18212142134806087854u128 into r2737; + mul r2735 15924666964335305636u128 into r2738; + mul r2735 18212142134806087854u128 into r2739; + and r2736 18446744073709551615u128 into r2740; + shr r2736 64u8 into r2741; + and r2737 18446744073709551615u128 into r2742; + add r2741 r2742 into r2743; + and r2738 18446744073709551615u128 into r2744; + add r2743 r2744 into r2745; + and r2745 18446744073709551615u128 into r2746; + shr r2745 64u8 into r2747; + shr r2737 64u8 into r2748; + shr r2738 64u8 into r2749; + add r2748 r2749 into r2750; + and r2739 18446744073709551615u128 into r2751; + add r2750 r2751 into r2752; + add r2752 r2747 into r2753; + and r2753 18446744073709551615u128 into r2754; + shr r2753 64u8 into r2755; + shr r2739 64u8 into r2756; + add r2756 r2755 into r2757; + shl r2757 64u8 into r2758; + add r2758 r2754 into r2759; + shl r2746 64u8 into r2760; + add r2760 r2740 into r2761; + and r2731.hi 18446744073709551615u128 into r2762; + shr r2731.hi 64u8 into r2763; + mul r2762 15924666964335305636u128 into r2764; + mul r2762 18212142134806087854u128 into r2765; + mul r2763 15924666964335305636u128 into r2766; + mul r2763 18212142134806087854u128 into r2767; + and r2764 18446744073709551615u128 into r2768; + shr r2764 64u8 into r2769; + and r2765 18446744073709551615u128 into r2770; + add r2769 r2770 into r2771; + and r2766 18446744073709551615u128 into r2772; + add r2771 r2772 into r2773; + and r2773 18446744073709551615u128 into r2774; + shr r2773 64u8 into r2775; + shr r2765 64u8 into r2776; + shr r2766 64u8 into r2777; + add r2776 r2777 into r2778; + and r2767 18446744073709551615u128 into r2779; + add r2778 r2779 into r2780; + add r2780 r2775 into r2781; + and r2781 18446744073709551615u128 into r2782; + shr r2781 64u8 into r2783; + shr r2767 64u8 into r2784; + add r2784 r2783 into r2785; + shl r2785 64u8 into r2786; + add r2786 r2782 into r2787; + shl r2774 64u8 into r2788; + add r2788 r2768 into r2789; + add.w r2759 r2789 into r2790; + lt r2790 r2759 into r2791; + ternary r2791 1u128 0u128 into r2792; + add.w r2787 r2792 into r2793; + cast r2793 r2790 into r2794 as U256__8JquwLopp8; + ternary r2733 r2794.hi r2731.hi into r2795; + ternary r2733 r2794.lo r2731.lo into r2796; + cast r2795 r2796 into r2797 as U256__8JquwLopp8; + and r2322 512u32 into r2798; + is.neq r2798 0u32 into r2799; + and r2797.lo 18446744073709551615u128 into r2800; + shr r2797.lo 64u8 into r2801; + mul r2800 8010504389359918676u128 into r2802; + mul r2800 17980523815641551639u128 into r2803; + mul r2801 8010504389359918676u128 into r2804; + mul r2801 17980523815641551639u128 into r2805; + and r2802 18446744073709551615u128 into r2806; + shr r2802 64u8 into r2807; + and r2803 18446744073709551615u128 into r2808; + add r2807 r2808 into r2809; + and r2804 18446744073709551615u128 into r2810; + add r2809 r2810 into r2811; + and r2811 18446744073709551615u128 into r2812; + shr r2811 64u8 into r2813; + shr r2803 64u8 into r2814; + shr r2804 64u8 into r2815; + add r2814 r2815 into r2816; + and r2805 18446744073709551615u128 into r2817; + add r2816 r2817 into r2818; + add r2818 r2813 into r2819; + and r2819 18446744073709551615u128 into r2820; + shr r2819 64u8 into r2821; + shr r2805 64u8 into r2822; + add r2822 r2821 into r2823; + shl r2823 64u8 into r2824; + add r2824 r2820 into r2825; + shl r2812 64u8 into r2826; + add r2826 r2806 into r2827; + and r2797.hi 18446744073709551615u128 into r2828; + shr r2797.hi 64u8 into r2829; + mul r2828 8010504389359918676u128 into r2830; + mul r2828 17980523815641551639u128 into r2831; + mul r2829 8010504389359918676u128 into r2832; + mul r2829 17980523815641551639u128 into r2833; + and r2830 18446744073709551615u128 into r2834; + shr r2830 64u8 into r2835; + and r2831 18446744073709551615u128 into r2836; + add r2835 r2836 into r2837; + and r2832 18446744073709551615u128 into r2838; + add r2837 r2838 into r2839; + and r2839 18446744073709551615u128 into r2840; + shr r2839 64u8 into r2841; + shr r2831 64u8 into r2842; + shr r2832 64u8 into r2843; + add r2842 r2843 into r2844; + and r2833 18446744073709551615u128 into r2845; + add r2844 r2845 into r2846; + add r2846 r2841 into r2847; + and r2847 18446744073709551615u128 into r2848; + shr r2847 64u8 into r2849; + shr r2833 64u8 into r2850; + add r2850 r2849 into r2851; + shl r2851 64u8 into r2852; + add r2852 r2848 into r2853; + shl r2840 64u8 into r2854; + add r2854 r2834 into r2855; + add.w r2825 r2855 into r2856; + lt r2856 r2825 into r2857; + ternary r2857 1u128 0u128 into r2858; + add.w r2853 r2858 into r2859; + cast r2859 r2856 into r2860 as U256__8JquwLopp8; + ternary r2799 r2860.hi r2797.hi into r2861; + ternary r2799 r2860.lo r2797.lo into r2862; + cast r2861 r2862 into r2863 as U256__8JquwLopp8; + and r2322 1024u32 into r2864; + is.neq r2864 0u32 into r2865; + and r2863.lo 18446744073709551615u128 into r2866; + shr r2863.lo 64u8 into r2867; + mul r2866 10668036004952895731u128 into r2868; + mul r2866 17526086738831147013u128 into r2869; + mul r2867 10668036004952895731u128 into r2870; + mul r2867 17526086738831147013u128 into r2871; + and r2868 18446744073709551615u128 into r2872; + shr r2868 64u8 into r2873; + and r2869 18446744073709551615u128 into r2874; + add r2873 r2874 into r2875; + and r2870 18446744073709551615u128 into r2876; + add r2875 r2876 into r2877; + and r2877 18446744073709551615u128 into r2878; + shr r2877 64u8 into r2879; + shr r2869 64u8 into r2880; + shr r2870 64u8 into r2881; + add r2880 r2881 into r2882; + and r2871 18446744073709551615u128 into r2883; + add r2882 r2883 into r2884; + add r2884 r2879 into r2885; + and r2885 18446744073709551615u128 into r2886; + shr r2885 64u8 into r2887; + shr r2871 64u8 into r2888; + add r2888 r2887 into r2889; + shl r2889 64u8 into r2890; + add r2890 r2886 into r2891; + shl r2878 64u8 into r2892; + add r2892 r2872 into r2893; + and r2863.hi 18446744073709551615u128 into r2894; + shr r2863.hi 64u8 into r2895; + mul r2894 10668036004952895731u128 into r2896; + mul r2894 17526086738831147013u128 into r2897; + mul r2895 10668036004952895731u128 into r2898; + mul r2895 17526086738831147013u128 into r2899; + and r2896 18446744073709551615u128 into r2900; + shr r2896 64u8 into r2901; + and r2897 18446744073709551615u128 into r2902; + add r2901 r2902 into r2903; + and r2898 18446744073709551615u128 into r2904; + add r2903 r2904 into r2905; + and r2905 18446744073709551615u128 into r2906; + shr r2905 64u8 into r2907; + shr r2897 64u8 into r2908; + shr r2898 64u8 into r2909; + add r2908 r2909 into r2910; + and r2899 18446744073709551615u128 into r2911; + add r2910 r2911 into r2912; + add r2912 r2907 into r2913; + and r2913 18446744073709551615u128 into r2914; + shr r2913 64u8 into r2915; + shr r2899 64u8 into r2916; + add r2916 r2915 into r2917; + shl r2917 64u8 into r2918; + add r2918 r2914 into r2919; + shl r2906 64u8 into r2920; + add r2920 r2900 into r2921; + add.w r2891 r2921 into r2922; + lt r2922 r2891 into r2923; + ternary r2923 1u128 0u128 into r2924; + add.w r2919 r2924 into r2925; + cast r2925 r2922 into r2926 as U256__8JquwLopp8; + ternary r2865 r2926.hi r2863.hi into r2927; + ternary r2865 r2926.lo r2863.lo into r2928; + cast r2927 r2928 into r2929 as U256__8JquwLopp8; + and r2322 2048u32 into r2930; + is.neq r2930 0u32 into r2931; + and r2929.lo 18446744073709551615u128 into r2932; + shr r2929.lo 64u8 into r2933; + mul r2932 4878133418470705625u128 into r2934; + mul r2932 16651378430235024244u128 into r2935; + mul r2933 4878133418470705625u128 into r2936; + mul r2933 16651378430235024244u128 into r2937; + and r2934 18446744073709551615u128 into r2938; + shr r2934 64u8 into r2939; + and r2935 18446744073709551615u128 into r2940; + add r2939 r2940 into r2941; + and r2936 18446744073709551615u128 into r2942; + add r2941 r2942 into r2943; + and r2943 18446744073709551615u128 into r2944; + shr r2943 64u8 into r2945; + shr r2935 64u8 into r2946; + shr r2936 64u8 into r2947; + add r2946 r2947 into r2948; + and r2937 18446744073709551615u128 into r2949; + add r2948 r2949 into r2950; + add r2950 r2945 into r2951; + and r2951 18446744073709551615u128 into r2952; + shr r2951 64u8 into r2953; + shr r2937 64u8 into r2954; + add r2954 r2953 into r2955; + shl r2955 64u8 into r2956; + add r2956 r2952 into r2957; + shl r2944 64u8 into r2958; + add r2958 r2938 into r2959; + and r2929.hi 18446744073709551615u128 into r2960; + shr r2929.hi 64u8 into r2961; + mul r2960 4878133418470705625u128 into r2962; + mul r2960 16651378430235024244u128 into r2963; + mul r2961 4878133418470705625u128 into r2964; + mul r2961 16651378430235024244u128 into r2965; + and r2962 18446744073709551615u128 into r2966; + shr r2962 64u8 into r2967; + and r2963 18446744073709551615u128 into r2968; + add r2967 r2968 into r2969; + and r2964 18446744073709551615u128 into r2970; + add r2969 r2970 into r2971; + and r2971 18446744073709551615u128 into r2972; + shr r2971 64u8 into r2973; + shr r2963 64u8 into r2974; + shr r2964 64u8 into r2975; + add r2974 r2975 into r2976; + and r2965 18446744073709551615u128 into r2977; + add r2976 r2977 into r2978; + add r2978 r2973 into r2979; + and r2979 18446744073709551615u128 into r2980; + shr r2979 64u8 into r2981; + shr r2965 64u8 into r2982; + add r2982 r2981 into r2983; + shl r2983 64u8 into r2984; + add r2984 r2980 into r2985; + shl r2972 64u8 into r2986; + add r2986 r2966 into r2987; + add.w r2957 r2987 into r2988; + lt r2988 r2957 into r2989; + ternary r2989 1u128 0u128 into r2990; + add.w r2985 r2990 into r2991; + cast r2991 r2988 into r2992 as U256__8JquwLopp8; + ternary r2931 r2992.hi r2929.hi into r2993; + ternary r2931 r2992.lo r2929.lo into r2994; + cast r2993 r2994 into r2995 as U256__8JquwLopp8; + and r2322 4096u32 into r2996; + is.neq r2996 0u32 into r2997; + and r2995.lo 18446744073709551615u128 into r2998; + shr r2995.lo 64u8 into r2999; + mul r2998 9537173718739605541u128 into r3000; + mul r2998 15030750278693429944u128 into r3001; + mul r2999 9537173718739605541u128 into r3002; + mul r2999 15030750278693429944u128 into r3003; + and r3000 18446744073709551615u128 into r3004; + shr r3000 64u8 into r3005; + and r3001 18446744073709551615u128 into r3006; + add r3005 r3006 into r3007; + and r3002 18446744073709551615u128 into r3008; + add r3007 r3008 into r3009; + and r3009 18446744073709551615u128 into r3010; + shr r3009 64u8 into r3011; + shr r3001 64u8 into r3012; + shr r3002 64u8 into r3013; + add r3012 r3013 into r3014; + and r3003 18446744073709551615u128 into r3015; + add r3014 r3015 into r3016; + add r3016 r3011 into r3017; + and r3017 18446744073709551615u128 into r3018; + shr r3017 64u8 into r3019; + shr r3003 64u8 into r3020; + add r3020 r3019 into r3021; + shl r3021 64u8 into r3022; + add r3022 r3018 into r3023; + shl r3010 64u8 into r3024; + add r3024 r3004 into r3025; + and r2995.hi 18446744073709551615u128 into r3026; + shr r2995.hi 64u8 into r3027; + mul r3026 9537173718739605541u128 into r3028; + mul r3026 15030750278693429944u128 into r3029; + mul r3027 9537173718739605541u128 into r3030; + mul r3027 15030750278693429944u128 into r3031; + and r3028 18446744073709551615u128 into r3032; + shr r3028 64u8 into r3033; + and r3029 18446744073709551615u128 into r3034; + add r3033 r3034 into r3035; + and r3030 18446744073709551615u128 into r3036; + add r3035 r3036 into r3037; + and r3037 18446744073709551615u128 into r3038; + shr r3037 64u8 into r3039; + shr r3029 64u8 into r3040; + shr r3030 64u8 into r3041; + add r3040 r3041 into r3042; + and r3031 18446744073709551615u128 into r3043; + add r3042 r3043 into r3044; + add r3044 r3039 into r3045; + and r3045 18446744073709551615u128 into r3046; + shr r3045 64u8 into r3047; + shr r3031 64u8 into r3048; + add r3048 r3047 into r3049; + shl r3049 64u8 into r3050; + add r3050 r3046 into r3051; + shl r3038 64u8 into r3052; + add r3052 r3032 into r3053; + add.w r3023 r3053 into r3054; + lt r3054 r3023 into r3055; + ternary r3055 1u128 0u128 into r3056; + add.w r3051 r3056 into r3057; + cast r3057 r3054 into r3058 as U256__8JquwLopp8; + ternary r2997 r3058.hi r2995.hi into r3059; + ternary r2997 r3058.lo r2995.lo into r3060; + cast r3059 r3060 into r3061 as U256__8JquwLopp8; + and r2322 8192u32 into r3062; + is.neq r3062 0u32 into r3063; + and r3061.lo 18446744073709551615u128 into r3064; + shr r3061.lo 64u8 into r3065; + mul r3064 9972618978014552549u128 into r3066; + mul r3064 12247334978882834399u128 into r3067; + mul r3065 9972618978014552549u128 into r3068; + mul r3065 12247334978882834399u128 into r3069; + and r3066 18446744073709551615u128 into r3070; + shr r3066 64u8 into r3071; + and r3067 18446744073709551615u128 into r3072; + add r3071 r3072 into r3073; + and r3068 18446744073709551615u128 into r3074; + add r3073 r3074 into r3075; + and r3075 18446744073709551615u128 into r3076; + shr r3075 64u8 into r3077; + shr r3067 64u8 into r3078; + shr r3068 64u8 into r3079; + add r3078 r3079 into r3080; + and r3069 18446744073709551615u128 into r3081; + add r3080 r3081 into r3082; + add r3082 r3077 into r3083; + and r3083 18446744073709551615u128 into r3084; + shr r3083 64u8 into r3085; + shr r3069 64u8 into r3086; + add r3086 r3085 into r3087; + shl r3087 64u8 into r3088; + add r3088 r3084 into r3089; + shl r3076 64u8 into r3090; + add r3090 r3070 into r3091; + and r3061.hi 18446744073709551615u128 into r3092; + shr r3061.hi 64u8 into r3093; + mul r3092 9972618978014552549u128 into r3094; + mul r3092 12247334978882834399u128 into r3095; + mul r3093 9972618978014552549u128 into r3096; + mul r3093 12247334978882834399u128 into r3097; + and r3094 18446744073709551615u128 into r3098; + shr r3094 64u8 into r3099; + and r3095 18446744073709551615u128 into r3100; + add r3099 r3100 into r3101; + and r3096 18446744073709551615u128 into r3102; + add r3101 r3102 into r3103; + and r3103 18446744073709551615u128 into r3104; + shr r3103 64u8 into r3105; + shr r3095 64u8 into r3106; + shr r3096 64u8 into r3107; + add r3106 r3107 into r3108; + and r3097 18446744073709551615u128 into r3109; + add r3108 r3109 into r3110; + add r3110 r3105 into r3111; + and r3111 18446744073709551615u128 into r3112; + shr r3111 64u8 into r3113; + shr r3097 64u8 into r3114; + add r3114 r3113 into r3115; + shl r3115 64u8 into r3116; + add r3116 r3112 into r3117; + shl r3104 64u8 into r3118; + add r3118 r3098 into r3119; + add.w r3089 r3119 into r3120; + lt r3120 r3089 into r3121; + ternary r3121 1u128 0u128 into r3122; + add.w r3117 r3122 into r3123; + cast r3123 r3120 into r3124 as U256__8JquwLopp8; + ternary r3063 r3124.hi r3061.hi into r3125; + ternary r3063 r3124.lo r3061.lo into r3126; + cast r3125 r3126 into r3127 as U256__8JquwLopp8; + and r2322 16384u32 into r3128; + is.neq r3128 0u32 into r3129; + and r3127.lo 18446744073709551615u128 into r3130; + shr r3127.lo 64u8 into r3131; + mul r3130 10428997489610666743u128 into r3132; + mul r3130 8131365268884726200u128 into r3133; + mul r3131 10428997489610666743u128 into r3134; + mul r3131 8131365268884726200u128 into r3135; + and r3132 18446744073709551615u128 into r3136; + shr r3132 64u8 into r3137; + and r3133 18446744073709551615u128 into r3138; + add r3137 r3138 into r3139; + and r3134 18446744073709551615u128 into r3140; + add r3139 r3140 into r3141; + and r3141 18446744073709551615u128 into r3142; + shr r3141 64u8 into r3143; + shr r3133 64u8 into r3144; + shr r3134 64u8 into r3145; + add r3144 r3145 into r3146; + and r3135 18446744073709551615u128 into r3147; + add r3146 r3147 into r3148; + add r3148 r3143 into r3149; + and r3149 18446744073709551615u128 into r3150; + shr r3149 64u8 into r3151; + shr r3135 64u8 into r3152; + add r3152 r3151 into r3153; + shl r3153 64u8 into r3154; + add r3154 r3150 into r3155; + shl r3142 64u8 into r3156; + add r3156 r3136 into r3157; + and r3127.hi 18446744073709551615u128 into r3158; + shr r3127.hi 64u8 into r3159; + mul r3158 10428997489610666743u128 into r3160; + mul r3158 8131365268884726200u128 into r3161; + mul r3159 10428997489610666743u128 into r3162; + mul r3159 8131365268884726200u128 into r3163; + and r3160 18446744073709551615u128 into r3164; + shr r3160 64u8 into r3165; + and r3161 18446744073709551615u128 into r3166; + add r3165 r3166 into r3167; + and r3162 18446744073709551615u128 into r3168; + add r3167 r3168 into r3169; + and r3169 18446744073709551615u128 into r3170; + shr r3169 64u8 into r3171; + shr r3161 64u8 into r3172; + shr r3162 64u8 into r3173; + add r3172 r3173 into r3174; + and r3163 18446744073709551615u128 into r3175; + add r3174 r3175 into r3176; + add r3176 r3171 into r3177; + and r3177 18446744073709551615u128 into r3178; + shr r3177 64u8 into r3179; + shr r3163 64u8 into r3180; + add r3180 r3179 into r3181; + shl r3181 64u8 into r3182; + add r3182 r3178 into r3183; + shl r3170 64u8 into r3184; + add r3184 r3164 into r3185; + add.w r3155 r3185 into r3186; + lt r3186 r3155 into r3187; + ternary r3187 1u128 0u128 into r3188; + add.w r3183 r3188 into r3189; + cast r3189 r3186 into r3190 as U256__8JquwLopp8; + ternary r3129 r3190.hi r3127.hi into r3191; + ternary r3129 r3190.lo r3127.lo into r3192; + cast r3191 r3192 into r3193 as U256__8JquwLopp8; + and r2322 32768u32 into r3194; + is.neq r3194 0u32 into r3195; + and r3193.lo 18446744073709551615u128 into r3196; + shr r3193.lo 64u8 into r3197; + mul r3196 9305304367709015974u128 into r3198; + mul r3196 3584323654723342297u128 into r3199; + mul r3197 9305304367709015974u128 into r3200; + mul r3197 3584323654723342297u128 into r3201; + and r3198 18446744073709551615u128 into r3202; + shr r3198 64u8 into r3203; + and r3199 18446744073709551615u128 into r3204; + add r3203 r3204 into r3205; + and r3200 18446744073709551615u128 into r3206; + add r3205 r3206 into r3207; + and r3207 18446744073709551615u128 into r3208; + shr r3207 64u8 into r3209; + shr r3199 64u8 into r3210; + shr r3200 64u8 into r3211; + add r3210 r3211 into r3212; + and r3201 18446744073709551615u128 into r3213; + add r3212 r3213 into r3214; + add r3214 r3209 into r3215; + and r3215 18446744073709551615u128 into r3216; + shr r3215 64u8 into r3217; + shr r3201 64u8 into r3218; + add r3218 r3217 into r3219; + shl r3219 64u8 into r3220; + add r3220 r3216 into r3221; + shl r3208 64u8 into r3222; + add r3222 r3202 into r3223; + and r3193.hi 18446744073709551615u128 into r3224; + shr r3193.hi 64u8 into r3225; + mul r3224 9305304367709015974u128 into r3226; + mul r3224 3584323654723342297u128 into r3227; + mul r3225 9305304367709015974u128 into r3228; + mul r3225 3584323654723342297u128 into r3229; + and r3226 18446744073709551615u128 into r3230; + shr r3226 64u8 into r3231; + and r3227 18446744073709551615u128 into r3232; + add r3231 r3232 into r3233; + and r3228 18446744073709551615u128 into r3234; + add r3233 r3234 into r3235; + and r3235 18446744073709551615u128 into r3236; + shr r3235 64u8 into r3237; + shr r3227 64u8 into r3238; + shr r3228 64u8 into r3239; + add r3238 r3239 into r3240; + and r3229 18446744073709551615u128 into r3241; + add r3240 r3241 into r3242; + add r3242 r3237 into r3243; + and r3243 18446744073709551615u128 into r3244; + shr r3243 64u8 into r3245; + shr r3229 64u8 into r3246; + add r3246 r3245 into r3247; + shl r3247 64u8 into r3248; + add r3248 r3244 into r3249; + shl r3236 64u8 into r3250; + add r3250 r3230 into r3251; + add.w r3221 r3251 into r3252; + lt r3252 r3221 into r3253; + ternary r3253 1u128 0u128 into r3254; + add.w r3249 r3254 into r3255; + cast r3255 r3252 into r3256 as U256__8JquwLopp8; + ternary r3195 r3256.hi r3193.hi into r3257; + ternary r3195 r3256.lo r3193.lo into r3258; + cast r3257 r3258 into r3259 as U256__8JquwLopp8; + and r2322 65536u32 into r3260; + is.neq r3260 0u32 into r3261; + and r3259.lo 18446744073709551615u128 into r3262; + shr r3259.lo 64u8 into r3263; + mul r3262 14301143598189091785u128 into r3264; + mul r3262 696457651847595233u128 into r3265; + mul r3263 14301143598189091785u128 into r3266; + mul r3263 696457651847595233u128 into r3267; + and r3264 18446744073709551615u128 into r3268; + shr r3264 64u8 into r3269; + and r3265 18446744073709551615u128 into r3270; + add r3269 r3270 into r3271; + and r3266 18446744073709551615u128 into r3272; + add r3271 r3272 into r3273; + and r3273 18446744073709551615u128 into r3274; + shr r3273 64u8 into r3275; + shr r3265 64u8 into r3276; + shr r3266 64u8 into r3277; + add r3276 r3277 into r3278; + and r3267 18446744073709551615u128 into r3279; + add r3278 r3279 into r3280; + add r3280 r3275 into r3281; + and r3281 18446744073709551615u128 into r3282; + shr r3281 64u8 into r3283; + shr r3267 64u8 into r3284; + add r3284 r3283 into r3285; + shl r3285 64u8 into r3286; + add r3286 r3282 into r3287; + shl r3274 64u8 into r3288; + add r3288 r3268 into r3289; + and r3259.hi 18446744073709551615u128 into r3290; + shr r3259.hi 64u8 into r3291; + mul r3290 14301143598189091785u128 into r3292; + mul r3290 696457651847595233u128 into r3293; + mul r3291 14301143598189091785u128 into r3294; + mul r3291 696457651847595233u128 into r3295; + and r3292 18446744073709551615u128 into r3296; + shr r3292 64u8 into r3297; + and r3293 18446744073709551615u128 into r3298; + add r3297 r3298 into r3299; + and r3294 18446744073709551615u128 into r3300; + add r3299 r3300 into r3301; + and r3301 18446744073709551615u128 into r3302; + shr r3301 64u8 into r3303; + shr r3293 64u8 into r3304; + shr r3294 64u8 into r3305; + add r3304 r3305 into r3306; + and r3295 18446744073709551615u128 into r3307; + add r3306 r3307 into r3308; + add r3308 r3303 into r3309; + and r3309 18446744073709551615u128 into r3310; + shr r3309 64u8 into r3311; + shr r3295 64u8 into r3312; + add r3312 r3311 into r3313; + shl r3313 64u8 into r3314; + add r3314 r3310 into r3315; + shl r3302 64u8 into r3316; + add r3316 r3296 into r3317; + add.w r3287 r3317 into r3318; + lt r3318 r3287 into r3319; + ternary r3319 1u128 0u128 into r3320; + add.w r3315 r3320 into r3321; + cast r3321 r3318 into r3322 as U256__8JquwLopp8; + ternary r3261 r3322.hi r3259.hi into r3323; + ternary r3261 r3322.lo r3259.lo into r3324; + cast r3323 r3324 into r3325 as U256__8JquwLopp8; + and r2322 131072u32 into r3326; + is.neq r3326 0u32 into r3327; + and r3325.lo 18446744073709551615u128 into r3328; + shr r3325.lo 64u8 into r3329; + mul r3328 7393154844743099908u128 into r3330; + mul r3328 26294789957452057u128 into r3331; + mul r3329 7393154844743099908u128 into r3332; + mul r3329 26294789957452057u128 into r3333; + and r3330 18446744073709551615u128 into r3334; + shr r3330 64u8 into r3335; + and r3331 18446744073709551615u128 into r3336; + add r3335 r3336 into r3337; + and r3332 18446744073709551615u128 into r3338; + add r3337 r3338 into r3339; + and r3339 18446744073709551615u128 into r3340; + shr r3339 64u8 into r3341; + shr r3331 64u8 into r3342; + shr r3332 64u8 into r3343; + add r3342 r3343 into r3344; + and r3333 18446744073709551615u128 into r3345; + add r3344 r3345 into r3346; + add r3346 r3341 into r3347; + and r3347 18446744073709551615u128 into r3348; + shr r3347 64u8 into r3349; + shr r3333 64u8 into r3350; + add r3350 r3349 into r3351; + shl r3351 64u8 into r3352; + add r3352 r3348 into r3353; + shl r3340 64u8 into r3354; + add r3354 r3334 into r3355; + and r3325.hi 18446744073709551615u128 into r3356; + shr r3325.hi 64u8 into r3357; + mul r3356 7393154844743099908u128 into r3358; + mul r3356 26294789957452057u128 into r3359; + mul r3357 7393154844743099908u128 into r3360; + mul r3357 26294789957452057u128 into r3361; + and r3358 18446744073709551615u128 into r3362; + shr r3358 64u8 into r3363; + and r3359 18446744073709551615u128 into r3364; + add r3363 r3364 into r3365; + and r3360 18446744073709551615u128 into r3366; + add r3365 r3366 into r3367; + and r3367 18446744073709551615u128 into r3368; + shr r3367 64u8 into r3369; + shr r3359 64u8 into r3370; + shr r3360 64u8 into r3371; + add r3370 r3371 into r3372; + and r3361 18446744073709551615u128 into r3373; + add r3372 r3373 into r3374; + add r3374 r3369 into r3375; + and r3375 18446744073709551615u128 into r3376; + shr r3375 64u8 into r3377; + shr r3361 64u8 into r3378; + add r3378 r3377 into r3379; + shl r3379 64u8 into r3380; + add r3380 r3376 into r3381; + shl r3368 64u8 into r3382; + add r3382 r3362 into r3383; + add.w r3353 r3383 into r3384; + lt r3384 r3353 into r3385; + ternary r3385 1u128 0u128 into r3386; + add.w r3381 r3386 into r3387; + cast r3387 r3384 into r3388 as U256__8JquwLopp8; + ternary r3327 r3388.hi r3325.hi into r3389; + ternary r3327 r3388.lo r3325.lo into r3390; + cast r3389 r3390 into r3391 as U256__8JquwLopp8; + and r2322 262144u32 into r3392; + is.neq r3392 0u32 into r3393; + and r3391.lo 18446744073709551615u128 into r3394; + shr r3391.lo 64u8 into r3395; + mul r3394 2209338891292245656u128 into r3396; + mul r3394 37481735321082u128 into r3397; + mul r3395 2209338891292245656u128 into r3398; + mul r3395 37481735321082u128 into r3399; + and r3396 18446744073709551615u128 into r3400; + shr r3396 64u8 into r3401; + and r3397 18446744073709551615u128 into r3402; + add r3401 r3402 into r3403; + and r3398 18446744073709551615u128 into r3404; + add r3403 r3404 into r3405; + and r3405 18446744073709551615u128 into r3406; + shr r3405 64u8 into r3407; + shr r3397 64u8 into r3408; + shr r3398 64u8 into r3409; + add r3408 r3409 into r3410; + and r3399 18446744073709551615u128 into r3411; + add r3410 r3411 into r3412; + add r3412 r3407 into r3413; + and r3413 18446744073709551615u128 into r3414; + shr r3413 64u8 into r3415; + shr r3399 64u8 into r3416; + add r3416 r3415 into r3417; + shl r3417 64u8 into r3418; + add r3418 r3414 into r3419; + shl r3406 64u8 into r3420; + add r3420 r3400 into r3421; + and r3391.hi 18446744073709551615u128 into r3422; + shr r3391.hi 64u8 into r3423; + mul r3422 2209338891292245656u128 into r3424; + mul r3422 37481735321082u128 into r3425; + mul r3423 2209338891292245656u128 into r3426; + mul r3423 37481735321082u128 into r3427; + and r3424 18446744073709551615u128 into r3428; + shr r3424 64u8 into r3429; + and r3425 18446744073709551615u128 into r3430; + add r3429 r3430 into r3431; + and r3426 18446744073709551615u128 into r3432; + add r3431 r3432 into r3433; + and r3433 18446744073709551615u128 into r3434; + shr r3433 64u8 into r3435; + shr r3425 64u8 into r3436; + shr r3426 64u8 into r3437; + add r3436 r3437 into r3438; + and r3427 18446744073709551615u128 into r3439; + add r3438 r3439 into r3440; + add r3440 r3435 into r3441; + and r3441 18446744073709551615u128 into r3442; + shr r3441 64u8 into r3443; + shr r3427 64u8 into r3444; + add r3444 r3443 into r3445; + shl r3445 64u8 into r3446; + add r3446 r3442 into r3447; + shl r3434 64u8 into r3448; + add r3448 r3428 into r3449; + add.w r3419 r3449 into r3450; + lt r3450 r3419 into r3451; + ternary r3451 1u128 0u128 into r3452; + add.w r3447 r3452 into r3453; + cast r3453 r3450 into r3454 as U256__8JquwLopp8; + ternary r3393 r3454.hi r3391.hi into r3455; + ternary r3393 r3454.lo r3391.lo into r3456; + cast r3455 r3456 into r3457 as U256__8JquwLopp8; + gt r2314 0i32 into r3458; + is.eq r3457.lo 0u128 into r3459; + ternary r3459 1u128 r3457.lo into r3460; + div 340282366920938463463374607431768211455u128 r3460 into r3461; + rem 340282366920938463463374607431768211455u128 r3460 into r3462; + lt r3462 r3460 into r3463; + assert.eq r3463 true; + gte r3462 170141183460469231731687303715884105728u128 into r3464; + add.w r3462 r3462 into r3465; + add r3465 1u128 into r3466; + gte r3466 r3460 into r3467; + or r3464 r3467 into r3468; + sub.w r3466 r3460 into r3469; + ternary r3468 r3469 r3466 into r3470; + ternary r3468 170141183460469231731687303715884105728u128 0u128 into r3471; + gte r3470 170141183460469231731687303715884105728u128 into r3472; + add.w r3470 r3470 into r3473; + add r3473 1u128 into r3474; + gte r3474 r3460 into r3475; + or r3472 r3475 into r3476; + sub.w r3474 r3460 into r3477; + ternary r3476 r3477 r3474 into r3478; + add r3471 85070591730234615865843651857942052864u128 into r3479; + ternary r3476 r3479 r3471 into r3480; + gte r3478 170141183460469231731687303715884105728u128 into r3481; + add.w r3478 r3478 into r3482; + add r3482 1u128 into r3483; + gte r3483 r3460 into r3484; + or r3481 r3484 into r3485; + sub.w r3483 r3460 into r3486; + ternary r3485 r3486 r3483 into r3487; + add r3480 42535295865117307932921825928971026432u128 into r3488; + ternary r3485 r3488 r3480 into r3489; + gte r3487 170141183460469231731687303715884105728u128 into r3490; + add.w r3487 r3487 into r3491; + add r3491 1u128 into r3492; + gte r3492 r3460 into r3493; + or r3490 r3493 into r3494; + sub.w r3492 r3460 into r3495; + ternary r3494 r3495 r3492 into r3496; + add r3489 21267647932558653966460912964485513216u128 into r3497; + ternary r3494 r3497 r3489 into r3498; + gte r3496 170141183460469231731687303715884105728u128 into r3499; + add.w r3496 r3496 into r3500; + add r3500 1u128 into r3501; + gte r3501 r3460 into r3502; + or r3499 r3502 into r3503; + sub.w r3501 r3460 into r3504; + ternary r3503 r3504 r3501 into r3505; + add r3498 10633823966279326983230456482242756608u128 into r3506; + ternary r3503 r3506 r3498 into r3507; + gte r3505 170141183460469231731687303715884105728u128 into r3508; + add.w r3505 r3505 into r3509; + add r3509 1u128 into r3510; + gte r3510 r3460 into r3511; + or r3508 r3511 into r3512; + sub.w r3510 r3460 into r3513; + ternary r3512 r3513 r3510 into r3514; + add r3507 5316911983139663491615228241121378304u128 into r3515; + ternary r3512 r3515 r3507 into r3516; + gte r3514 170141183460469231731687303715884105728u128 into r3517; + add.w r3514 r3514 into r3518; + add r3518 1u128 into r3519; + gte r3519 r3460 into r3520; + or r3517 r3520 into r3521; + sub.w r3519 r3460 into r3522; + ternary r3521 r3522 r3519 into r3523; + add r3516 2658455991569831745807614120560689152u128 into r3524; + ternary r3521 r3524 r3516 into r3525; + gte r3523 170141183460469231731687303715884105728u128 into r3526; + add.w r3523 r3523 into r3527; + add r3527 1u128 into r3528; + gte r3528 r3460 into r3529; + or r3526 r3529 into r3530; + sub.w r3528 r3460 into r3531; + ternary r3530 r3531 r3528 into r3532; + add r3525 1329227995784915872903807060280344576u128 into r3533; + ternary r3530 r3533 r3525 into r3534; + gte r3532 170141183460469231731687303715884105728u128 into r3535; + add.w r3532 r3532 into r3536; + add r3536 1u128 into r3537; + gte r3537 r3460 into r3538; + or r3535 r3538 into r3539; + sub.w r3537 r3460 into r3540; + ternary r3539 r3540 r3537 into r3541; + add r3534 664613997892457936451903530140172288u128 into r3542; + ternary r3539 r3542 r3534 into r3543; + gte r3541 170141183460469231731687303715884105728u128 into r3544; + add.w r3541 r3541 into r3545; + add r3545 1u128 into r3546; + gte r3546 r3460 into r3547; + or r3544 r3547 into r3548; + sub.w r3546 r3460 into r3549; + ternary r3548 r3549 r3546 into r3550; + add r3543 332306998946228968225951765070086144u128 into r3551; + ternary r3548 r3551 r3543 into r3552; + gte r3550 170141183460469231731687303715884105728u128 into r3553; + add.w r3550 r3550 into r3554; + add r3554 1u128 into r3555; + gte r3555 r3460 into r3556; + or r3553 r3556 into r3557; + sub.w r3555 r3460 into r3558; + ternary r3557 r3558 r3555 into r3559; + add r3552 166153499473114484112975882535043072u128 into r3560; + ternary r3557 r3560 r3552 into r3561; + gte r3559 170141183460469231731687303715884105728u128 into r3562; + add.w r3559 r3559 into r3563; + add r3563 1u128 into r3564; + gte r3564 r3460 into r3565; + or r3562 r3565 into r3566; + sub.w r3564 r3460 into r3567; + ternary r3566 r3567 r3564 into r3568; + add r3561 83076749736557242056487941267521536u128 into r3569; + ternary r3566 r3569 r3561 into r3570; + gte r3568 170141183460469231731687303715884105728u128 into r3571; + add.w r3568 r3568 into r3572; + add r3572 1u128 into r3573; + gte r3573 r3460 into r3574; + or r3571 r3574 into r3575; + sub.w r3573 r3460 into r3576; + ternary r3575 r3576 r3573 into r3577; + add r3570 41538374868278621028243970633760768u128 into r3578; + ternary r3575 r3578 r3570 into r3579; + gte r3577 170141183460469231731687303715884105728u128 into r3580; + add.w r3577 r3577 into r3581; + add r3581 1u128 into r3582; + gte r3582 r3460 into r3583; + or r3580 r3583 into r3584; + sub.w r3582 r3460 into r3585; + ternary r3584 r3585 r3582 into r3586; + add r3579 20769187434139310514121985316880384u128 into r3587; + ternary r3584 r3587 r3579 into r3588; + gte r3586 170141183460469231731687303715884105728u128 into r3589; + add.w r3586 r3586 into r3590; + add r3590 1u128 into r3591; + gte r3591 r3460 into r3592; + or r3589 r3592 into r3593; + sub.w r3591 r3460 into r3594; + ternary r3593 r3594 r3591 into r3595; + add r3588 10384593717069655257060992658440192u128 into r3596; + ternary r3593 r3596 r3588 into r3597; + gte r3595 170141183460469231731687303715884105728u128 into r3598; + add.w r3595 r3595 into r3599; + add r3599 1u128 into r3600; + gte r3600 r3460 into r3601; + or r3598 r3601 into r3602; + sub.w r3600 r3460 into r3603; + ternary r3602 r3603 r3600 into r3604; + add r3597 5192296858534827628530496329220096u128 into r3605; + ternary r3602 r3605 r3597 into r3606; + gte r3604 170141183460469231731687303715884105728u128 into r3607; + add.w r3604 r3604 into r3608; + add r3608 1u128 into r3609; + gte r3609 r3460 into r3610; + or r3607 r3610 into r3611; + sub.w r3609 r3460 into r3612; + ternary r3611 r3612 r3609 into r3613; + add r3606 2596148429267413814265248164610048u128 into r3614; + ternary r3611 r3614 r3606 into r3615; + gte r3613 170141183460469231731687303715884105728u128 into r3616; + add.w r3613 r3613 into r3617; + add r3617 1u128 into r3618; + gte r3618 r3460 into r3619; + or r3616 r3619 into r3620; + sub.w r3618 r3460 into r3621; + ternary r3620 r3621 r3618 into r3622; + add r3615 1298074214633706907132624082305024u128 into r3623; + ternary r3620 r3623 r3615 into r3624; + gte r3622 170141183460469231731687303715884105728u128 into r3625; + add.w r3622 r3622 into r3626; + add r3626 1u128 into r3627; + gte r3627 r3460 into r3628; + or r3625 r3628 into r3629; + sub.w r3627 r3460 into r3630; + ternary r3629 r3630 r3627 into r3631; + add r3624 649037107316853453566312041152512u128 into r3632; + ternary r3629 r3632 r3624 into r3633; + gte r3631 170141183460469231731687303715884105728u128 into r3634; + add.w r3631 r3631 into r3635; + add r3635 1u128 into r3636; + gte r3636 r3460 into r3637; + or r3634 r3637 into r3638; + sub.w r3636 r3460 into r3639; + ternary r3638 r3639 r3636 into r3640; + add r3633 324518553658426726783156020576256u128 into r3641; + ternary r3638 r3641 r3633 into r3642; + gte r3640 170141183460469231731687303715884105728u128 into r3643; + add.w r3640 r3640 into r3644; + add r3644 1u128 into r3645; + gte r3645 r3460 into r3646; + or r3643 r3646 into r3647; + sub.w r3645 r3460 into r3648; + ternary r3647 r3648 r3645 into r3649; + add r3642 162259276829213363391578010288128u128 into r3650; + ternary r3647 r3650 r3642 into r3651; + gte r3649 170141183460469231731687303715884105728u128 into r3652; + add.w r3649 r3649 into r3653; + add r3653 1u128 into r3654; + gte r3654 r3460 into r3655; + or r3652 r3655 into r3656; + sub.w r3654 r3460 into r3657; + ternary r3656 r3657 r3654 into r3658; + add r3651 81129638414606681695789005144064u128 into r3659; + ternary r3656 r3659 r3651 into r3660; + gte r3658 170141183460469231731687303715884105728u128 into r3661; + add.w r3658 r3658 into r3662; + add r3662 1u128 into r3663; + gte r3663 r3460 into r3664; + or r3661 r3664 into r3665; + sub.w r3663 r3460 into r3666; + ternary r3665 r3666 r3663 into r3667; + add r3660 40564819207303340847894502572032u128 into r3668; + ternary r3665 r3668 r3660 into r3669; + gte r3667 170141183460469231731687303715884105728u128 into r3670; + add.w r3667 r3667 into r3671; + add r3671 1u128 into r3672; + gte r3672 r3460 into r3673; + or r3670 r3673 into r3674; + sub.w r3672 r3460 into r3675; + ternary r3674 r3675 r3672 into r3676; + add r3669 20282409603651670423947251286016u128 into r3677; + ternary r3674 r3677 r3669 into r3678; + gte r3676 170141183460469231731687303715884105728u128 into r3679; + add.w r3676 r3676 into r3680; + add r3680 1u128 into r3681; + gte r3681 r3460 into r3682; + or r3679 r3682 into r3683; + sub.w r3681 r3460 into r3684; + ternary r3683 r3684 r3681 into r3685; + add r3678 10141204801825835211973625643008u128 into r3686; + ternary r3683 r3686 r3678 into r3687; + gte r3685 170141183460469231731687303715884105728u128 into r3688; + add.w r3685 r3685 into r3689; + add r3689 1u128 into r3690; + gte r3690 r3460 into r3691; + or r3688 r3691 into r3692; + sub.w r3690 r3460 into r3693; + ternary r3692 r3693 r3690 into r3694; + add r3687 5070602400912917605986812821504u128 into r3695; + ternary r3692 r3695 r3687 into r3696; + gte r3694 170141183460469231731687303715884105728u128 into r3697; + add.w r3694 r3694 into r3698; + add r3698 1u128 into r3699; + gte r3699 r3460 into r3700; + or r3697 r3700 into r3701; + sub.w r3699 r3460 into r3702; + ternary r3701 r3702 r3699 into r3703; + add r3696 2535301200456458802993406410752u128 into r3704; + ternary r3701 r3704 r3696 into r3705; + gte r3703 170141183460469231731687303715884105728u128 into r3706; + add.w r3703 r3703 into r3707; + add r3707 1u128 into r3708; + gte r3708 r3460 into r3709; + or r3706 r3709 into r3710; + sub.w r3708 r3460 into r3711; + ternary r3710 r3711 r3708 into r3712; + add r3705 1267650600228229401496703205376u128 into r3713; + ternary r3710 r3713 r3705 into r3714; + gte r3712 170141183460469231731687303715884105728u128 into r3715; + add.w r3712 r3712 into r3716; + add r3716 1u128 into r3717; + gte r3717 r3460 into r3718; + or r3715 r3718 into r3719; + sub.w r3717 r3460 into r3720; + ternary r3719 r3720 r3717 into r3721; + add r3714 633825300114114700748351602688u128 into r3722; + ternary r3719 r3722 r3714 into r3723; + gte r3721 170141183460469231731687303715884105728u128 into r3724; + add.w r3721 r3721 into r3725; + add r3725 1u128 into r3726; + gte r3726 r3460 into r3727; + or r3724 r3727 into r3728; + sub.w r3726 r3460 into r3729; + ternary r3728 r3729 r3726 into r3730; + add r3723 316912650057057350374175801344u128 into r3731; + ternary r3728 r3731 r3723 into r3732; + gte r3730 170141183460469231731687303715884105728u128 into r3733; + add.w r3730 r3730 into r3734; + add r3734 1u128 into r3735; + gte r3735 r3460 into r3736; + or r3733 r3736 into r3737; + sub.w r3735 r3460 into r3738; + ternary r3737 r3738 r3735 into r3739; + add r3732 158456325028528675187087900672u128 into r3740; + ternary r3737 r3740 r3732 into r3741; + gte r3739 170141183460469231731687303715884105728u128 into r3742; + add.w r3739 r3739 into r3743; + add r3743 1u128 into r3744; + gte r3744 r3460 into r3745; + or r3742 r3745 into r3746; + sub.w r3744 r3460 into r3747; + ternary r3746 r3747 r3744 into r3748; + add r3741 79228162514264337593543950336u128 into r3749; + ternary r3746 r3749 r3741 into r3750; + gte r3748 170141183460469231731687303715884105728u128 into r3751; + add.w r3748 r3748 into r3752; + add r3752 1u128 into r3753; + gte r3753 r3460 into r3754; + or r3751 r3754 into r3755; + sub.w r3753 r3460 into r3756; + ternary r3755 r3756 r3753 into r3757; + add r3750 39614081257132168796771975168u128 into r3758; + ternary r3755 r3758 r3750 into r3759; + gte r3757 170141183460469231731687303715884105728u128 into r3760; + add.w r3757 r3757 into r3761; + add r3761 1u128 into r3762; + gte r3762 r3460 into r3763; + or r3760 r3763 into r3764; + sub.w r3762 r3460 into r3765; + ternary r3764 r3765 r3762 into r3766; + add r3759 19807040628566084398385987584u128 into r3767; + ternary r3764 r3767 r3759 into r3768; + gte r3766 170141183460469231731687303715884105728u128 into r3769; + add.w r3766 r3766 into r3770; + add r3770 1u128 into r3771; + gte r3771 r3460 into r3772; + or r3769 r3772 into r3773; + sub.w r3771 r3460 into r3774; + ternary r3773 r3774 r3771 into r3775; + add r3768 9903520314283042199192993792u128 into r3776; + ternary r3773 r3776 r3768 into r3777; + gte r3775 170141183460469231731687303715884105728u128 into r3778; + add.w r3775 r3775 into r3779; + add r3779 1u128 into r3780; + gte r3780 r3460 into r3781; + or r3778 r3781 into r3782; + sub.w r3780 r3460 into r3783; + ternary r3782 r3783 r3780 into r3784; + add r3777 4951760157141521099596496896u128 into r3785; + ternary r3782 r3785 r3777 into r3786; + gte r3784 170141183460469231731687303715884105728u128 into r3787; + add.w r3784 r3784 into r3788; + add r3788 1u128 into r3789; + gte r3789 r3460 into r3790; + or r3787 r3790 into r3791; + sub.w r3789 r3460 into r3792; + ternary r3791 r3792 r3789 into r3793; + add r3786 2475880078570760549798248448u128 into r3794; + ternary r3791 r3794 r3786 into r3795; + gte r3793 170141183460469231731687303715884105728u128 into r3796; + add.w r3793 r3793 into r3797; + add r3797 1u128 into r3798; + gte r3798 r3460 into r3799; + or r3796 r3799 into r3800; + sub.w r3798 r3460 into r3801; + ternary r3800 r3801 r3798 into r3802; + add r3795 1237940039285380274899124224u128 into r3803; + ternary r3800 r3803 r3795 into r3804; + gte r3802 170141183460469231731687303715884105728u128 into r3805; + add.w r3802 r3802 into r3806; + add r3806 1u128 into r3807; + gte r3807 r3460 into r3808; + or r3805 r3808 into r3809; + sub.w r3807 r3460 into r3810; + ternary r3809 r3810 r3807 into r3811; + add r3804 618970019642690137449562112u128 into r3812; + ternary r3809 r3812 r3804 into r3813; + gte r3811 170141183460469231731687303715884105728u128 into r3814; + add.w r3811 r3811 into r3815; + add r3815 1u128 into r3816; + gte r3816 r3460 into r3817; + or r3814 r3817 into r3818; + sub.w r3816 r3460 into r3819; + ternary r3818 r3819 r3816 into r3820; + add r3813 309485009821345068724781056u128 into r3821; + ternary r3818 r3821 r3813 into r3822; + gte r3820 170141183460469231731687303715884105728u128 into r3823; + add.w r3820 r3820 into r3824; + add r3824 1u128 into r3825; + gte r3825 r3460 into r3826; + or r3823 r3826 into r3827; + sub.w r3825 r3460 into r3828; + ternary r3827 r3828 r3825 into r3829; + add r3822 154742504910672534362390528u128 into r3830; + ternary r3827 r3830 r3822 into r3831; + gte r3829 170141183460469231731687303715884105728u128 into r3832; + add.w r3829 r3829 into r3833; + add r3833 1u128 into r3834; + gte r3834 r3460 into r3835; + or r3832 r3835 into r3836; + sub.w r3834 r3460 into r3837; + ternary r3836 r3837 r3834 into r3838; + add r3831 77371252455336267181195264u128 into r3839; + ternary r3836 r3839 r3831 into r3840; + gte r3838 170141183460469231731687303715884105728u128 into r3841; + add.w r3838 r3838 into r3842; + add r3842 1u128 into r3843; + gte r3843 r3460 into r3844; + or r3841 r3844 into r3845; + sub.w r3843 r3460 into r3846; + ternary r3845 r3846 r3843 into r3847; + add r3840 38685626227668133590597632u128 into r3848; + ternary r3845 r3848 r3840 into r3849; + gte r3847 170141183460469231731687303715884105728u128 into r3850; + add.w r3847 r3847 into r3851; + add r3851 1u128 into r3852; + gte r3852 r3460 into r3853; + or r3850 r3853 into r3854; + sub.w r3852 r3460 into r3855; + ternary r3854 r3855 r3852 into r3856; + add r3849 19342813113834066795298816u128 into r3857; + ternary r3854 r3857 r3849 into r3858; + gte r3856 170141183460469231731687303715884105728u128 into r3859; + add.w r3856 r3856 into r3860; + add r3860 1u128 into r3861; + gte r3861 r3460 into r3862; + or r3859 r3862 into r3863; + sub.w r3861 r3460 into r3864; + ternary r3863 r3864 r3861 into r3865; + add r3858 9671406556917033397649408u128 into r3866; + ternary r3863 r3866 r3858 into r3867; + gte r3865 170141183460469231731687303715884105728u128 into r3868; + add.w r3865 r3865 into r3869; + add r3869 1u128 into r3870; + gte r3870 r3460 into r3871; + or r3868 r3871 into r3872; + sub.w r3870 r3460 into r3873; + ternary r3872 r3873 r3870 into r3874; + add r3867 4835703278458516698824704u128 into r3875; + ternary r3872 r3875 r3867 into r3876; + gte r3874 170141183460469231731687303715884105728u128 into r3877; + add.w r3874 r3874 into r3878; + add r3878 1u128 into r3879; + gte r3879 r3460 into r3880; + or r3877 r3880 into r3881; + sub.w r3879 r3460 into r3882; + ternary r3881 r3882 r3879 into r3883; + add r3876 2417851639229258349412352u128 into r3884; + ternary r3881 r3884 r3876 into r3885; + gte r3883 170141183460469231731687303715884105728u128 into r3886; + add.w r3883 r3883 into r3887; + add r3887 1u128 into r3888; + gte r3888 r3460 into r3889; + or r3886 r3889 into r3890; + sub.w r3888 r3460 into r3891; + ternary r3890 r3891 r3888 into r3892; + add r3885 1208925819614629174706176u128 into r3893; + ternary r3890 r3893 r3885 into r3894; + gte r3892 170141183460469231731687303715884105728u128 into r3895; + add.w r3892 r3892 into r3896; + add r3896 1u128 into r3897; + gte r3897 r3460 into r3898; + or r3895 r3898 into r3899; + sub.w r3897 r3460 into r3900; + ternary r3899 r3900 r3897 into r3901; + add r3894 604462909807314587353088u128 into r3902; + ternary r3899 r3902 r3894 into r3903; + gte r3901 170141183460469231731687303715884105728u128 into r3904; + add.w r3901 r3901 into r3905; + add r3905 1u128 into r3906; + gte r3906 r3460 into r3907; + or r3904 r3907 into r3908; + sub.w r3906 r3460 into r3909; + ternary r3908 r3909 r3906 into r3910; + add r3903 302231454903657293676544u128 into r3911; + ternary r3908 r3911 r3903 into r3912; + gte r3910 170141183460469231731687303715884105728u128 into r3913; + add.w r3910 r3910 into r3914; + add r3914 1u128 into r3915; + gte r3915 r3460 into r3916; + or r3913 r3916 into r3917; + sub.w r3915 r3460 into r3918; + ternary r3917 r3918 r3915 into r3919; + add r3912 151115727451828646838272u128 into r3920; + ternary r3917 r3920 r3912 into r3921; + gte r3919 170141183460469231731687303715884105728u128 into r3922; + add.w r3919 r3919 into r3923; + add r3923 1u128 into r3924; + gte r3924 r3460 into r3925; + or r3922 r3925 into r3926; + sub.w r3924 r3460 into r3927; + ternary r3926 r3927 r3924 into r3928; + add r3921 75557863725914323419136u128 into r3929; + ternary r3926 r3929 r3921 into r3930; + gte r3928 170141183460469231731687303715884105728u128 into r3931; + add.w r3928 r3928 into r3932; + add r3932 1u128 into r3933; + gte r3933 r3460 into r3934; + or r3931 r3934 into r3935; + sub.w r3933 r3460 into r3936; + ternary r3935 r3936 r3933 into r3937; + add r3930 37778931862957161709568u128 into r3938; + ternary r3935 r3938 r3930 into r3939; + gte r3937 170141183460469231731687303715884105728u128 into r3940; + add.w r3937 r3937 into r3941; + add r3941 1u128 into r3942; + gte r3942 r3460 into r3943; + or r3940 r3943 into r3944; + sub.w r3942 r3460 into r3945; + ternary r3944 r3945 r3942 into r3946; + add r3939 18889465931478580854784u128 into r3947; + ternary r3944 r3947 r3939 into r3948; + gte r3946 170141183460469231731687303715884105728u128 into r3949; + add.w r3946 r3946 into r3950; + add r3950 1u128 into r3951; + gte r3951 r3460 into r3952; + or r3949 r3952 into r3953; + sub.w r3951 r3460 into r3954; + ternary r3953 r3954 r3951 into r3955; + add r3948 9444732965739290427392u128 into r3956; + ternary r3953 r3956 r3948 into r3957; + gte r3955 170141183460469231731687303715884105728u128 into r3958; + add.w r3955 r3955 into r3959; + add r3959 1u128 into r3960; + gte r3960 r3460 into r3961; + or r3958 r3961 into r3962; + sub.w r3960 r3460 into r3963; + ternary r3962 r3963 r3960 into r3964; + add r3957 4722366482869645213696u128 into r3965; + ternary r3962 r3965 r3957 into r3966; + gte r3964 170141183460469231731687303715884105728u128 into r3967; + add.w r3964 r3964 into r3968; + add r3968 1u128 into r3969; + gte r3969 r3460 into r3970; + or r3967 r3970 into r3971; + sub.w r3969 r3460 into r3972; + ternary r3971 r3972 r3969 into r3973; + add r3966 2361183241434822606848u128 into r3974; + ternary r3971 r3974 r3966 into r3975; + gte r3973 170141183460469231731687303715884105728u128 into r3976; + add.w r3973 r3973 into r3977; + add r3977 1u128 into r3978; + gte r3978 r3460 into r3979; + or r3976 r3979 into r3980; + sub.w r3978 r3460 into r3981; + ternary r3980 r3981 r3978 into r3982; + add r3975 1180591620717411303424u128 into r3983; + ternary r3980 r3983 r3975 into r3984; + gte r3982 170141183460469231731687303715884105728u128 into r3985; + add.w r3982 r3982 into r3986; + add r3986 1u128 into r3987; + gte r3987 r3460 into r3988; + or r3985 r3988 into r3989; + sub.w r3987 r3460 into r3990; + ternary r3989 r3990 r3987 into r3991; + add r3984 590295810358705651712u128 into r3992; + ternary r3989 r3992 r3984 into r3993; + gte r3991 170141183460469231731687303715884105728u128 into r3994; + add.w r3991 r3991 into r3995; + add r3995 1u128 into r3996; + gte r3996 r3460 into r3997; + or r3994 r3997 into r3998; + sub.w r3996 r3460 into r3999; + ternary r3998 r3999 r3996 into r4000; + add r3993 295147905179352825856u128 into r4001; + ternary r3998 r4001 r3993 into r4002; + gte r4000 170141183460469231731687303715884105728u128 into r4003; + add.w r4000 r4000 into r4004; + add r4004 1u128 into r4005; + gte r4005 r3460 into r4006; + or r4003 r4006 into r4007; + sub.w r4005 r3460 into r4008; + ternary r4007 r4008 r4005 into r4009; + add r4002 147573952589676412928u128 into r4010; + ternary r4007 r4010 r4002 into r4011; + gte r4009 170141183460469231731687303715884105728u128 into r4012; + add.w r4009 r4009 into r4013; + add r4013 1u128 into r4014; + gte r4014 r3460 into r4015; + or r4012 r4015 into r4016; + sub.w r4014 r3460 into r4017; + ternary r4016 r4017 r4014 into r4018; + add r4011 73786976294838206464u128 into r4019; + ternary r4016 r4019 r4011 into r4020; + gte r4018 170141183460469231731687303715884105728u128 into r4021; + add.w r4018 r4018 into r4022; + add r4022 1u128 into r4023; + gte r4023 r3460 into r4024; + or r4021 r4024 into r4025; + sub.w r4023 r3460 into r4026; + ternary r4025 r4026 r4023 into r4027; + add r4020 36893488147419103232u128 into r4028; + ternary r4025 r4028 r4020 into r4029; + gte r4027 170141183460469231731687303715884105728u128 into r4030; + add.w r4027 r4027 into r4031; + add r4031 1u128 into r4032; + gte r4032 r3460 into r4033; + or r4030 r4033 into r4034; + sub.w r4032 r3460 into r4035; + ternary r4034 r4035 r4032 into r4036; + add r4029 18446744073709551616u128 into r4037; + ternary r4034 r4037 r4029 into r4038; + gte r4036 170141183460469231731687303715884105728u128 into r4039; + add.w r4036 r4036 into r4040; + add r4040 1u128 into r4041; + gte r4041 r3460 into r4042; + or r4039 r4042 into r4043; + sub.w r4041 r3460 into r4044; + ternary r4043 r4044 r4041 into r4045; + add r4038 9223372036854775808u128 into r4046; + ternary r4043 r4046 r4038 into r4047; + gte r4045 170141183460469231731687303715884105728u128 into r4048; + add.w r4045 r4045 into r4049; + add r4049 1u128 into r4050; + gte r4050 r3460 into r4051; + or r4048 r4051 into r4052; + sub.w r4050 r3460 into r4053; + ternary r4052 r4053 r4050 into r4054; + add r4047 4611686018427387904u128 into r4055; + ternary r4052 r4055 r4047 into r4056; + gte r4054 170141183460469231731687303715884105728u128 into r4057; + add.w r4054 r4054 into r4058; + add r4058 1u128 into r4059; + gte r4059 r3460 into r4060; + or r4057 r4060 into r4061; + sub.w r4059 r3460 into r4062; + ternary r4061 r4062 r4059 into r4063; + add r4056 2305843009213693952u128 into r4064; + ternary r4061 r4064 r4056 into r4065; + gte r4063 170141183460469231731687303715884105728u128 into r4066; + add.w r4063 r4063 into r4067; + add r4067 1u128 into r4068; + gte r4068 r3460 into r4069; + or r4066 r4069 into r4070; + sub.w r4068 r3460 into r4071; + ternary r4070 r4071 r4068 into r4072; + add r4065 1152921504606846976u128 into r4073; + ternary r4070 r4073 r4065 into r4074; + gte r4072 170141183460469231731687303715884105728u128 into r4075; + add.w r4072 r4072 into r4076; + add r4076 1u128 into r4077; + gte r4077 r3460 into r4078; + or r4075 r4078 into r4079; + sub.w r4077 r3460 into r4080; + ternary r4079 r4080 r4077 into r4081; + add r4074 576460752303423488u128 into r4082; + ternary r4079 r4082 r4074 into r4083; + gte r4081 170141183460469231731687303715884105728u128 into r4084; + add.w r4081 r4081 into r4085; + add r4085 1u128 into r4086; + gte r4086 r3460 into r4087; + or r4084 r4087 into r4088; + sub.w r4086 r3460 into r4089; + ternary r4088 r4089 r4086 into r4090; + add r4083 288230376151711744u128 into r4091; + ternary r4088 r4091 r4083 into r4092; + gte r4090 170141183460469231731687303715884105728u128 into r4093; + add.w r4090 r4090 into r4094; + add r4094 1u128 into r4095; + gte r4095 r3460 into r4096; + or r4093 r4096 into r4097; + sub.w r4095 r3460 into r4098; + ternary r4097 r4098 r4095 into r4099; + add r4092 144115188075855872u128 into r4100; + ternary r4097 r4100 r4092 into r4101; + gte r4099 170141183460469231731687303715884105728u128 into r4102; + add.w r4099 r4099 into r4103; + add r4103 1u128 into r4104; + gte r4104 r3460 into r4105; + or r4102 r4105 into r4106; + sub.w r4104 r3460 into r4107; + ternary r4106 r4107 r4104 into r4108; + add r4101 72057594037927936u128 into r4109; + ternary r4106 r4109 r4101 into r4110; + gte r4108 170141183460469231731687303715884105728u128 into r4111; + add.w r4108 r4108 into r4112; + add r4112 1u128 into r4113; + gte r4113 r3460 into r4114; + or r4111 r4114 into r4115; + sub.w r4113 r3460 into r4116; + ternary r4115 r4116 r4113 into r4117; + add r4110 36028797018963968u128 into r4118; + ternary r4115 r4118 r4110 into r4119; + gte r4117 170141183460469231731687303715884105728u128 into r4120; + add.w r4117 r4117 into r4121; + add r4121 1u128 into r4122; + gte r4122 r3460 into r4123; + or r4120 r4123 into r4124; + sub.w r4122 r3460 into r4125; + ternary r4124 r4125 r4122 into r4126; + add r4119 18014398509481984u128 into r4127; + ternary r4124 r4127 r4119 into r4128; + gte r4126 170141183460469231731687303715884105728u128 into r4129; + add.w r4126 r4126 into r4130; + add r4130 1u128 into r4131; + gte r4131 r3460 into r4132; + or r4129 r4132 into r4133; + sub.w r4131 r3460 into r4134; + ternary r4133 r4134 r4131 into r4135; + add r4128 9007199254740992u128 into r4136; + ternary r4133 r4136 r4128 into r4137; + gte r4135 170141183460469231731687303715884105728u128 into r4138; + add.w r4135 r4135 into r4139; + add r4139 1u128 into r4140; + gte r4140 r3460 into r4141; + or r4138 r4141 into r4142; + sub.w r4140 r3460 into r4143; + ternary r4142 r4143 r4140 into r4144; + add r4137 4503599627370496u128 into r4145; + ternary r4142 r4145 r4137 into r4146; + gte r4144 170141183460469231731687303715884105728u128 into r4147; + add.w r4144 r4144 into r4148; + add r4148 1u128 into r4149; + gte r4149 r3460 into r4150; + or r4147 r4150 into r4151; + sub.w r4149 r3460 into r4152; + ternary r4151 r4152 r4149 into r4153; + add r4146 2251799813685248u128 into r4154; + ternary r4151 r4154 r4146 into r4155; + gte r4153 170141183460469231731687303715884105728u128 into r4156; + add.w r4153 r4153 into r4157; + add r4157 1u128 into r4158; + gte r4158 r3460 into r4159; + or r4156 r4159 into r4160; + sub.w r4158 r3460 into r4161; + ternary r4160 r4161 r4158 into r4162; + add r4155 1125899906842624u128 into r4163; + ternary r4160 r4163 r4155 into r4164; + gte r4162 170141183460469231731687303715884105728u128 into r4165; + add.w r4162 r4162 into r4166; + add r4166 1u128 into r4167; + gte r4167 r3460 into r4168; + or r4165 r4168 into r4169; + sub.w r4167 r3460 into r4170; + ternary r4169 r4170 r4167 into r4171; + add r4164 562949953421312u128 into r4172; + ternary r4169 r4172 r4164 into r4173; + gte r4171 170141183460469231731687303715884105728u128 into r4174; + add.w r4171 r4171 into r4175; + add r4175 1u128 into r4176; + gte r4176 r3460 into r4177; + or r4174 r4177 into r4178; + sub.w r4176 r3460 into r4179; + ternary r4178 r4179 r4176 into r4180; + add r4173 281474976710656u128 into r4181; + ternary r4178 r4181 r4173 into r4182; + gte r4180 170141183460469231731687303715884105728u128 into r4183; + add.w r4180 r4180 into r4184; + add r4184 1u128 into r4185; + gte r4185 r3460 into r4186; + or r4183 r4186 into r4187; + sub.w r4185 r3460 into r4188; + ternary r4187 r4188 r4185 into r4189; + add r4182 140737488355328u128 into r4190; + ternary r4187 r4190 r4182 into r4191; + gte r4189 170141183460469231731687303715884105728u128 into r4192; + add.w r4189 r4189 into r4193; + add r4193 1u128 into r4194; + gte r4194 r3460 into r4195; + or r4192 r4195 into r4196; + sub.w r4194 r3460 into r4197; + ternary r4196 r4197 r4194 into r4198; + add r4191 70368744177664u128 into r4199; + ternary r4196 r4199 r4191 into r4200; + gte r4198 170141183460469231731687303715884105728u128 into r4201; + add.w r4198 r4198 into r4202; + add r4202 1u128 into r4203; + gte r4203 r3460 into r4204; + or r4201 r4204 into r4205; + sub.w r4203 r3460 into r4206; + ternary r4205 r4206 r4203 into r4207; + add r4200 35184372088832u128 into r4208; + ternary r4205 r4208 r4200 into r4209; + gte r4207 170141183460469231731687303715884105728u128 into r4210; + add.w r4207 r4207 into r4211; + add r4211 1u128 into r4212; + gte r4212 r3460 into r4213; + or r4210 r4213 into r4214; + sub.w r4212 r3460 into r4215; + ternary r4214 r4215 r4212 into r4216; + add r4209 17592186044416u128 into r4217; + ternary r4214 r4217 r4209 into r4218; + gte r4216 170141183460469231731687303715884105728u128 into r4219; + add.w r4216 r4216 into r4220; + add r4220 1u128 into r4221; + gte r4221 r3460 into r4222; + or r4219 r4222 into r4223; + sub.w r4221 r3460 into r4224; + ternary r4223 r4224 r4221 into r4225; + add r4218 8796093022208u128 into r4226; + ternary r4223 r4226 r4218 into r4227; + gte r4225 170141183460469231731687303715884105728u128 into r4228; + add.w r4225 r4225 into r4229; + add r4229 1u128 into r4230; + gte r4230 r3460 into r4231; + or r4228 r4231 into r4232; + sub.w r4230 r3460 into r4233; + ternary r4232 r4233 r4230 into r4234; + add r4227 4398046511104u128 into r4235; + ternary r4232 r4235 r4227 into r4236; + gte r4234 170141183460469231731687303715884105728u128 into r4237; + add.w r4234 r4234 into r4238; + add r4238 1u128 into r4239; + gte r4239 r3460 into r4240; + or r4237 r4240 into r4241; + sub.w r4239 r3460 into r4242; + ternary r4241 r4242 r4239 into r4243; + add r4236 2199023255552u128 into r4244; + ternary r4241 r4244 r4236 into r4245; + gte r4243 170141183460469231731687303715884105728u128 into r4246; + add.w r4243 r4243 into r4247; + add r4247 1u128 into r4248; + gte r4248 r3460 into r4249; + or r4246 r4249 into r4250; + sub.w r4248 r3460 into r4251; + ternary r4250 r4251 r4248 into r4252; + add r4245 1099511627776u128 into r4253; + ternary r4250 r4253 r4245 into r4254; + gte r4252 170141183460469231731687303715884105728u128 into r4255; + add.w r4252 r4252 into r4256; + add r4256 1u128 into r4257; + gte r4257 r3460 into r4258; + or r4255 r4258 into r4259; + sub.w r4257 r3460 into r4260; + ternary r4259 r4260 r4257 into r4261; + add r4254 549755813888u128 into r4262; + ternary r4259 r4262 r4254 into r4263; + gte r4261 170141183460469231731687303715884105728u128 into r4264; + add.w r4261 r4261 into r4265; + add r4265 1u128 into r4266; + gte r4266 r3460 into r4267; + or r4264 r4267 into r4268; + sub.w r4266 r3460 into r4269; + ternary r4268 r4269 r4266 into r4270; + add r4263 274877906944u128 into r4271; + ternary r4268 r4271 r4263 into r4272; + gte r4270 170141183460469231731687303715884105728u128 into r4273; + add.w r4270 r4270 into r4274; + add r4274 1u128 into r4275; + gte r4275 r3460 into r4276; + or r4273 r4276 into r4277; + sub.w r4275 r3460 into r4278; + ternary r4277 r4278 r4275 into r4279; + add r4272 137438953472u128 into r4280; + ternary r4277 r4280 r4272 into r4281; + gte r4279 170141183460469231731687303715884105728u128 into r4282; + add.w r4279 r4279 into r4283; + add r4283 1u128 into r4284; + gte r4284 r3460 into r4285; + or r4282 r4285 into r4286; + sub.w r4284 r3460 into r4287; + ternary r4286 r4287 r4284 into r4288; + add r4281 68719476736u128 into r4289; + ternary r4286 r4289 r4281 into r4290; + gte r4288 170141183460469231731687303715884105728u128 into r4291; + add.w r4288 r4288 into r4292; + add r4292 1u128 into r4293; + gte r4293 r3460 into r4294; + or r4291 r4294 into r4295; + sub.w r4293 r3460 into r4296; + ternary r4295 r4296 r4293 into r4297; + add r4290 34359738368u128 into r4298; + ternary r4295 r4298 r4290 into r4299; + gte r4297 170141183460469231731687303715884105728u128 into r4300; + add.w r4297 r4297 into r4301; + add r4301 1u128 into r4302; + gte r4302 r3460 into r4303; + or r4300 r4303 into r4304; + sub.w r4302 r3460 into r4305; + ternary r4304 r4305 r4302 into r4306; + add r4299 17179869184u128 into r4307; + ternary r4304 r4307 r4299 into r4308; + gte r4306 170141183460469231731687303715884105728u128 into r4309; + add.w r4306 r4306 into r4310; + add r4310 1u128 into r4311; + gte r4311 r3460 into r4312; + or r4309 r4312 into r4313; + sub.w r4311 r3460 into r4314; + ternary r4313 r4314 r4311 into r4315; + add r4308 8589934592u128 into r4316; + ternary r4313 r4316 r4308 into r4317; + gte r4315 170141183460469231731687303715884105728u128 into r4318; + add.w r4315 r4315 into r4319; + add r4319 1u128 into r4320; + gte r4320 r3460 into r4321; + or r4318 r4321 into r4322; + sub.w r4320 r3460 into r4323; + ternary r4322 r4323 r4320 into r4324; + add r4317 4294967296u128 into r4325; + ternary r4322 r4325 r4317 into r4326; + gte r4324 170141183460469231731687303715884105728u128 into r4327; + add.w r4324 r4324 into r4328; + add r4328 1u128 into r4329; + gte r4329 r3460 into r4330; + or r4327 r4330 into r4331; + sub.w r4329 r3460 into r4332; + ternary r4331 r4332 r4329 into r4333; + add r4326 2147483648u128 into r4334; + ternary r4331 r4334 r4326 into r4335; + gte r4333 170141183460469231731687303715884105728u128 into r4336; + add.w r4333 r4333 into r4337; + add r4337 1u128 into r4338; + gte r4338 r3460 into r4339; + or r4336 r4339 into r4340; + sub.w r4338 r3460 into r4341; + ternary r4340 r4341 r4338 into r4342; + add r4335 1073741824u128 into r4343; + ternary r4340 r4343 r4335 into r4344; + gte r4342 170141183460469231731687303715884105728u128 into r4345; + add.w r4342 r4342 into r4346; + add r4346 1u128 into r4347; + gte r4347 r3460 into r4348; + or r4345 r4348 into r4349; + sub.w r4347 r3460 into r4350; + ternary r4349 r4350 r4347 into r4351; + add r4344 536870912u128 into r4352; + ternary r4349 r4352 r4344 into r4353; + gte r4351 170141183460469231731687303715884105728u128 into r4354; + add.w r4351 r4351 into r4355; + add r4355 1u128 into r4356; + gte r4356 r3460 into r4357; + or r4354 r4357 into r4358; + sub.w r4356 r3460 into r4359; + ternary r4358 r4359 r4356 into r4360; + add r4353 268435456u128 into r4361; + ternary r4358 r4361 r4353 into r4362; + gte r4360 170141183460469231731687303715884105728u128 into r4363; + add.w r4360 r4360 into r4364; + add r4364 1u128 into r4365; + gte r4365 r3460 into r4366; + or r4363 r4366 into r4367; + sub.w r4365 r3460 into r4368; + ternary r4367 r4368 r4365 into r4369; + add r4362 134217728u128 into r4370; + ternary r4367 r4370 r4362 into r4371; + gte r4369 170141183460469231731687303715884105728u128 into r4372; + add.w r4369 r4369 into r4373; + add r4373 1u128 into r4374; + gte r4374 r3460 into r4375; + or r4372 r4375 into r4376; + sub.w r4374 r3460 into r4377; + ternary r4376 r4377 r4374 into r4378; + add r4371 67108864u128 into r4379; + ternary r4376 r4379 r4371 into r4380; + gte r4378 170141183460469231731687303715884105728u128 into r4381; + add.w r4378 r4378 into r4382; + add r4382 1u128 into r4383; + gte r4383 r3460 into r4384; + or r4381 r4384 into r4385; + sub.w r4383 r3460 into r4386; + ternary r4385 r4386 r4383 into r4387; + add r4380 33554432u128 into r4388; + ternary r4385 r4388 r4380 into r4389; + gte r4387 170141183460469231731687303715884105728u128 into r4390; + add.w r4387 r4387 into r4391; + add r4391 1u128 into r4392; + gte r4392 r3460 into r4393; + or r4390 r4393 into r4394; + sub.w r4392 r3460 into r4395; + ternary r4394 r4395 r4392 into r4396; + add r4389 16777216u128 into r4397; + ternary r4394 r4397 r4389 into r4398; + gte r4396 170141183460469231731687303715884105728u128 into r4399; + add.w r4396 r4396 into r4400; + add r4400 1u128 into r4401; + gte r4401 r3460 into r4402; + or r4399 r4402 into r4403; + sub.w r4401 r3460 into r4404; + ternary r4403 r4404 r4401 into r4405; + add r4398 8388608u128 into r4406; + ternary r4403 r4406 r4398 into r4407; + gte r4405 170141183460469231731687303715884105728u128 into r4408; + add.w r4405 r4405 into r4409; + add r4409 1u128 into r4410; + gte r4410 r3460 into r4411; + or r4408 r4411 into r4412; + sub.w r4410 r3460 into r4413; + ternary r4412 r4413 r4410 into r4414; + add r4407 4194304u128 into r4415; + ternary r4412 r4415 r4407 into r4416; + gte r4414 170141183460469231731687303715884105728u128 into r4417; + add.w r4414 r4414 into r4418; + add r4418 1u128 into r4419; + gte r4419 r3460 into r4420; + or r4417 r4420 into r4421; + sub.w r4419 r3460 into r4422; + ternary r4421 r4422 r4419 into r4423; + add r4416 2097152u128 into r4424; + ternary r4421 r4424 r4416 into r4425; + gte r4423 170141183460469231731687303715884105728u128 into r4426; + add.w r4423 r4423 into r4427; + add r4427 1u128 into r4428; + gte r4428 r3460 into r4429; + or r4426 r4429 into r4430; + sub.w r4428 r3460 into r4431; + ternary r4430 r4431 r4428 into r4432; + add r4425 1048576u128 into r4433; + ternary r4430 r4433 r4425 into r4434; + gte r4432 170141183460469231731687303715884105728u128 into r4435; + add.w r4432 r4432 into r4436; + add r4436 1u128 into r4437; + gte r4437 r3460 into r4438; + or r4435 r4438 into r4439; + sub.w r4437 r3460 into r4440; + ternary r4439 r4440 r4437 into r4441; + add r4434 524288u128 into r4442; + ternary r4439 r4442 r4434 into r4443; + gte r4441 170141183460469231731687303715884105728u128 into r4444; + add.w r4441 r4441 into r4445; + add r4445 1u128 into r4446; + gte r4446 r3460 into r4447; + or r4444 r4447 into r4448; + sub.w r4446 r3460 into r4449; + ternary r4448 r4449 r4446 into r4450; + add r4443 262144u128 into r4451; + ternary r4448 r4451 r4443 into r4452; + gte r4450 170141183460469231731687303715884105728u128 into r4453; + add.w r4450 r4450 into r4454; + add r4454 1u128 into r4455; + gte r4455 r3460 into r4456; + or r4453 r4456 into r4457; + sub.w r4455 r3460 into r4458; + ternary r4457 r4458 r4455 into r4459; + add r4452 131072u128 into r4460; + ternary r4457 r4460 r4452 into r4461; + gte r4459 170141183460469231731687303715884105728u128 into r4462; + add.w r4459 r4459 into r4463; + add r4463 1u128 into r4464; + gte r4464 r3460 into r4465; + or r4462 r4465 into r4466; + sub.w r4464 r3460 into r4467; + ternary r4466 r4467 r4464 into r4468; + add r4461 65536u128 into r4469; + ternary r4466 r4469 r4461 into r4470; + gte r4468 170141183460469231731687303715884105728u128 into r4471; + add.w r4468 r4468 into r4472; + add r4472 1u128 into r4473; + gte r4473 r3460 into r4474; + or r4471 r4474 into r4475; + sub.w r4473 r3460 into r4476; + ternary r4475 r4476 r4473 into r4477; + add r4470 32768u128 into r4478; + ternary r4475 r4478 r4470 into r4479; + gte r4477 170141183460469231731687303715884105728u128 into r4480; + add.w r4477 r4477 into r4481; + add r4481 1u128 into r4482; + gte r4482 r3460 into r4483; + or r4480 r4483 into r4484; + sub.w r4482 r3460 into r4485; + ternary r4484 r4485 r4482 into r4486; + add r4479 16384u128 into r4487; + ternary r4484 r4487 r4479 into r4488; + gte r4486 170141183460469231731687303715884105728u128 into r4489; + add.w r4486 r4486 into r4490; + add r4490 1u128 into r4491; + gte r4491 r3460 into r4492; + or r4489 r4492 into r4493; + sub.w r4491 r3460 into r4494; + ternary r4493 r4494 r4491 into r4495; + add r4488 8192u128 into r4496; + ternary r4493 r4496 r4488 into r4497; + gte r4495 170141183460469231731687303715884105728u128 into r4498; + add.w r4495 r4495 into r4499; + add r4499 1u128 into r4500; + gte r4500 r3460 into r4501; + or r4498 r4501 into r4502; + sub.w r4500 r3460 into r4503; + ternary r4502 r4503 r4500 into r4504; + add r4497 4096u128 into r4505; + ternary r4502 r4505 r4497 into r4506; + gte r4504 170141183460469231731687303715884105728u128 into r4507; + add.w r4504 r4504 into r4508; + add r4508 1u128 into r4509; + gte r4509 r3460 into r4510; + or r4507 r4510 into r4511; + sub.w r4509 r3460 into r4512; + ternary r4511 r4512 r4509 into r4513; + add r4506 2048u128 into r4514; + ternary r4511 r4514 r4506 into r4515; + gte r4513 170141183460469231731687303715884105728u128 into r4516; + add.w r4513 r4513 into r4517; + add r4517 1u128 into r4518; + gte r4518 r3460 into r4519; + or r4516 r4519 into r4520; + sub.w r4518 r3460 into r4521; + ternary r4520 r4521 r4518 into r4522; + add r4515 1024u128 into r4523; + ternary r4520 r4523 r4515 into r4524; + gte r4522 170141183460469231731687303715884105728u128 into r4525; + add.w r4522 r4522 into r4526; + add r4526 1u128 into r4527; + gte r4527 r3460 into r4528; + or r4525 r4528 into r4529; + sub.w r4527 r3460 into r4530; + ternary r4529 r4530 r4527 into r4531; + add r4524 512u128 into r4532; + ternary r4529 r4532 r4524 into r4533; + gte r4531 170141183460469231731687303715884105728u128 into r4534; + add.w r4531 r4531 into r4535; + add r4535 1u128 into r4536; + gte r4536 r3460 into r4537; + or r4534 r4537 into r4538; + sub.w r4536 r3460 into r4539; + ternary r4538 r4539 r4536 into r4540; + add r4533 256u128 into r4541; + ternary r4538 r4541 r4533 into r4542; + gte r4540 170141183460469231731687303715884105728u128 into r4543; + add.w r4540 r4540 into r4544; + add r4544 1u128 into r4545; + gte r4545 r3460 into r4546; + or r4543 r4546 into r4547; + sub.w r4545 r3460 into r4548; + ternary r4547 r4548 r4545 into r4549; + add r4542 128u128 into r4550; + ternary r4547 r4550 r4542 into r4551; + gte r4549 170141183460469231731687303715884105728u128 into r4552; + add.w r4549 r4549 into r4553; + add r4553 1u128 into r4554; + gte r4554 r3460 into r4555; + or r4552 r4555 into r4556; + sub.w r4554 r3460 into r4557; + ternary r4556 r4557 r4554 into r4558; + add r4551 64u128 into r4559; + ternary r4556 r4559 r4551 into r4560; + gte r4558 170141183460469231731687303715884105728u128 into r4561; + add.w r4558 r4558 into r4562; + add r4562 1u128 into r4563; + gte r4563 r3460 into r4564; + or r4561 r4564 into r4565; + sub.w r4563 r3460 into r4566; + ternary r4565 r4566 r4563 into r4567; + add r4560 32u128 into r4568; + ternary r4565 r4568 r4560 into r4569; + gte r4567 170141183460469231731687303715884105728u128 into r4570; + add.w r4567 r4567 into r4571; + add r4571 1u128 into r4572; + gte r4572 r3460 into r4573; + or r4570 r4573 into r4574; + sub.w r4572 r3460 into r4575; + ternary r4574 r4575 r4572 into r4576; + add r4569 16u128 into r4577; + ternary r4574 r4577 r4569 into r4578; + gte r4576 170141183460469231731687303715884105728u128 into r4579; + add.w r4576 r4576 into r4580; + add r4580 1u128 into r4581; + gte r4581 r3460 into r4582; + or r4579 r4582 into r4583; + sub.w r4581 r3460 into r4584; + ternary r4583 r4584 r4581 into r4585; + add r4578 8u128 into r4586; + ternary r4583 r4586 r4578 into r4587; + gte r4585 170141183460469231731687303715884105728u128 into r4588; + add.w r4585 r4585 into r4589; + add r4589 1u128 into r4590; + gte r4590 r3460 into r4591; + or r4588 r4591 into r4592; + sub.w r4590 r3460 into r4593; + ternary r4592 r4593 r4590 into r4594; + add r4587 4u128 into r4595; + ternary r4592 r4595 r4587 into r4596; + gte r4594 170141183460469231731687303715884105728u128 into r4597; + add.w r4594 r4594 into r4598; + add r4598 1u128 into r4599; + gte r4599 r3460 into r4600; + or r4597 r4600 into r4601; + sub.w r4599 r3460 into r4602; + ternary r4601 r4602 r4599 into r4603; + add r4596 2u128 into r4604; + ternary r4601 r4604 r4596 into r4605; + gte r4603 170141183460469231731687303715884105728u128 into r4606; + add.w r4603 r4603 into r4607; + add r4607 1u128 into r4608; + gte r4608 r3460 into r4609; + or r4606 r4609 into r4610; + add r4605 1u128 into r4611; + ternary r4610 r4611 r4605 into r4612; + cast r3461 r4612 into r4613 as U256__8JquwLopp8; + ternary r3458 r4613.hi r3457.hi into r4614; + ternary r3458 r4613.lo r3457.lo into r4615; + cast r4614 r4615 into r4616 as U256__8JquwLopp8; + lt r2.hi r4616.hi into r4617; + gt r2.hi r4616.hi into r4618; + lt r2.lo r4616.lo into r4619; + ternary r4618 false r4619 into r4620; + ternary r4617 true r4620 into r4621; + sub r2314 1i32 into r4622; + ternary r4621 r4622 r2314 into r4623; + is.eq r2.hi r0.hi into r4624; + is.eq r2.lo r0.lo into r4625; + and r4624 r4625 into r4626; + not r4 into r4627; + and r4626 r4627 into r4628; + ternary r4628 r1 r4623 into r4629; + output r4629 as i32.public; + +function swap: + input r0 as dynamic.record; + input r1 as field.private; + input r2 as address.public; + input r3 as field.public; + input r4 as boolean.public; + input r5 as u128.public; + input r6 as u128.public; + input r7 as U256__8JquwLopp8.public; + input r8 as u64.public; + input r9 as u32.public; + input r10 as field.public; + input r11 as field.public; + is.eq self.caller aleo1waeghjttfvzrmk68ckpp4ftnfh7aq6wcm73qxzy0m754x4cu6yxqf38zsq into r12; + call verify_blinded_address shield_swap.aleo self.signer r1 r2; + cast r3 r4 r5 r6 r7 r2 r8 r9 into r13 as SwapRequest; + cast r3 r4 r5 r7 r2 r8 r2 into r14 as SwapKey; + hash.bhp256 r14 into r15 as field; + ternary r4 r10 r11 into r16; + ternary r4 r11 r10 into r17; + cast aleo1t08epjqqv8h7jpuy2m2cxm80zy2pcy5c4f3m82hnac4sjmdrjyysvx3s2h r15 r16 r17 r13 self.caller self.signer r2 into r18 as SwapComplianceRecord.record; + call.dynamic r16 'aleo' 'transfer_private_to_public' with r0 shield_swap.aleo r5 (as dynamic.record address.public u128.public) into r19 r20 (as dynamic.record dynamic.future); + async swap r20 r13 r10 r11 r15 r16 r17 r2 r12 into r21; + output r15 as field.public; + output r19 as dynamic.record; + output r18 as SwapComplianceRecord.record; + output r21 as shield_swap.aleo/swap.future; + +finalize swap: + input r0 as dynamic.future; + input r1 as SwapRequest.public; + input r2 as field.public; + input r3 as field.public; + input r4 as field.public; + input r5 as field.public; + input r6 as field.public; + input r7 as address.public; + input r8 as boolean.public; + contains from_wrapper_token_id[r5] into r9; + branch.eq r9 false to end_then_0_0; + assert.eq r8 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + await r0; + lte block.height r1.deadline into r10; + assert.eq r10 true; + get.or_use global_paused[true] false into r11; + not r11 into r12; + assert.eq r12 true; + get pools[r1.pool] into r13; + assert.eq r13.enabled true; + get.or_use token_paused[r13.token0] false into r14; + not r14 into r15; + assert.eq r15 true; + get.or_use token_paused[r13.token1] false into r16; + not r16 into r17; + assert.eq r17 true; + cast r13.token0 r13.token1 into r18 as PairKey; + get.or_use pair_paused[r18] false into r19; + not r19 into r20; + assert.eq r20 true; + is.eq r13.token0 r2 into r21; + assert.eq r21 true; + is.eq r13.token1 r3 into r22; + assert.eq r22 true; + get slots[r1.pool] into r23; + cast r13.fee into r24 as u32; + lt r1.sqrt_price_limit.hi 0u128 into r25; + gt r1.sqrt_price_limit.hi 0u128 into r26; + lt r1.sqrt_price_limit.lo 702075911466779181339691826087u128 into r27; + ternary r26 false r27 into r28; + ternary r25 true r28 into r29; + not r29 into r30; + lt 484680305u128 r1.sqrt_price_limit.hi into r31; + gt 484680305u128 r1.sqrt_price_limit.hi into r32; + lt 8756686347225649145659787327114459760u128 r1.sqrt_price_limit.lo into r33; + ternary r32 false r33 into r34; + ternary r31 true r34 into r35; + not r35 into r36; + and r30 r36 into r37; + assert.eq r37 true; + lt r1.sqrt_price_limit.hi r23.sqrt_price.hi into r38; + gt r1.sqrt_price_limit.hi r23.sqrt_price.hi into r39; + lt r1.sqrt_price_limit.lo r23.sqrt_price.lo into r40; + ternary r39 false r40 into r41; + ternary r38 true r41 into r42; + lt r23.sqrt_price.hi r1.sqrt_price_limit.hi into r43; + gt r23.sqrt_price.hi r1.sqrt_price_limit.hi into r44; + lt r23.sqrt_price.lo r1.sqrt_price_limit.lo into r45; + ternary r44 false r45 into r46; + ternary r43 true r46 into r47; + ternary r1.zero_for_one r42 r47 into r48; + assert.eq r48 true; + gt r1.amount_in 0u128 into r49; + assert.eq r49 true; + ternary r1.zero_for_one r23.fee_growth_global0_x_128.hi r23.fee_growth_global1_x_128.hi into r50; + ternary r1.zero_for_one r23.fee_growth_global0_x_128.lo r23.fee_growth_global1_x_128.lo into r51; + cast r50 r51 into r52 as U256__8JquwLopp8; + cast r1.zero_for_one r1.sqrt_price_limit r24 r23.fee_protocol r23.fee_growth_global0_x_128 r23.fee_growth_global1_x_128 into r53 as SwapIterCfg; + ternary r1.zero_for_one r23.next_init_below r23.next_init_above into r54; + cast r1.pool r54 into r55 as TickKey; + hash.bhp256 r55 into r56 as field; + get ticks[r56] into r57; + call view_sqrt_price_at_tick_x128 r54 into r58; + cast r23.sqrt_price r1.amount_in 0u128 r52 r23.liquidity r23.tick true 0u128 r23.next_init_below r23.next_init_above into r59 as SwapIterState; + call view_swap_iteration r53 r54 r58 r57 r59 into r60 r61; + set r61 into ticks[r56]; + not r60.crossed into r62; + is.eq r60.sp.hi r23.sqrt_price.hi into r63; + is.eq r60.sp.lo r23.sqrt_price.lo into r64; + and r63 r64 into r65; + not r65 into r66; + and r62 r66 into r67; + ternary r1.zero_for_one r60.nb r60.na into r68; + cast r1.pool r68 into r69 as TickKey; + hash.bhp256 r69 into r70 as field; + get ticks[r70] into r71; + call view_sqrt_price_at_tick_x128 r68 into r72; + cast r60.sp r60.rem r60.out r60.fg r60.liq r60.tk r60.crossed r60.pf r60.nb r60.na into r73 as SwapIterState; + call view_swap_iteration r53 r68 r72 r71 r73 into r74 r75; + set r75 into ticks[r70]; + not r74.crossed into r76; + is.eq r74.sp.hi r60.sp.hi into r77; + is.eq r74.sp.lo r60.sp.lo into r78; + and r77 r78 into r79; + not r79 into r80; + and r76 r80 into r81; + or r67 r81 into r82; + ternary r1.zero_for_one r74.nb r74.na into r83; + cast r1.pool r83 into r84 as TickKey; + hash.bhp256 r84 into r85 as field; + get ticks[r85] into r86; + call view_sqrt_price_at_tick_x128 r83 into r87; + cast r74.sp r74.rem r74.out r74.fg r74.liq r74.tk r74.crossed r74.pf r74.nb r74.na into r88 as SwapIterState; + call view_swap_iteration r53 r83 r87 r86 r88 into r89 r90; + set r90 into ticks[r85]; + not r89.crossed into r91; + is.eq r89.sp.hi r74.sp.hi into r92; + is.eq r89.sp.lo r74.sp.lo into r93; + and r92 r93 into r94; + not r94 into r95; + and r91 r95 into r96; + or r82 r96 into r97; + ternary r1.zero_for_one r89.nb r89.na into r98; + cast r1.pool r98 into r99 as TickKey; + hash.bhp256 r99 into r100 as field; + get ticks[r100] into r101; + call view_sqrt_price_at_tick_x128 r98 into r102; + cast r89.sp r89.rem r89.out r89.fg r89.liq r89.tk r89.crossed r89.pf r89.nb r89.na into r103 as SwapIterState; + call view_swap_iteration r53 r98 r102 r101 r103 into r104 r105; + set r105 into ticks[r100]; + not r104.crossed into r106; + is.eq r104.sp.hi r89.sp.hi into r107; + is.eq r104.sp.lo r89.sp.lo into r108; + and r107 r108 into r109; + not r109 into r110; + and r106 r110 into r111; + or r97 r111 into r112; + ternary r1.zero_for_one r104.nb r104.na into r113; + cast r1.pool r113 into r114 as TickKey; + hash.bhp256 r114 into r115 as field; + get ticks[r115] into r116; + call view_sqrt_price_at_tick_x128 r113 into r117; + cast r104.sp r104.rem r104.out r104.fg r104.liq r104.tk r104.crossed r104.pf r104.nb r104.na into r118 as SwapIterState; + call view_swap_iteration r53 r113 r117 r116 r118 into r119 r120; + set r120 into ticks[r115]; + not r119.crossed into r121; + is.eq r119.sp.hi r104.sp.hi into r122; + is.eq r119.sp.lo r104.sp.lo into r123; + and r122 r123 into r124; + not r124 into r125; + and r121 r125 into r126; + or r112 r126 into r127; + ternary r1.zero_for_one r119.nb r119.na into r128; + call view_sqrt_price_at_tick_x128 r128 into r129; + call view_bounded_partial r119.sp r119.liq r119.rem r119.out r119.fg r119.pf r129 r1.sqrt_price_limit r24 r23.fee_protocol r1.zero_for_one into r130 r131 r132 r133 r134 r135; + call resolve_stored_tick r119.sp r119.tk r130 r135 r127 into r136; + gte r131 r1.amount_out_min into r137; + assert.eq r137 true; + add r23.protocol_fees0 r134 into r138; + ternary r1.zero_for_one r138 r23.protocol_fees0 into r139; + add r23.protocol_fees1 r134 into r140; + ternary r1.zero_for_one r23.protocol_fees1 r140 into r141; + ternary r1.zero_for_one r133.hi r23.fee_growth_global0_x_128.hi into r142; + ternary r1.zero_for_one r133.lo r23.fee_growth_global0_x_128.lo into r143; + cast r142 r143 into r144 as U256__8JquwLopp8; + ternary r1.zero_for_one r23.fee_growth_global1_x_128.hi r133.hi into r145; + ternary r1.zero_for_one r23.fee_growth_global1_x_128.lo r133.lo into r146; + cast r145 r146 into r147 as U256__8JquwLopp8; + cast r136 r23.tick_spacing r130 r23.fee_protocol r119.liq r144 r147 r23.max_liquidity_per_tick r139 r141 r119.nb r119.na into r148 as Slot; + set r148 into slots[r1.pool]; + contains swap_outputs[r4] into r149; + not r149 into r150; + assert.eq r150 true; + cast r1.recipient r7 r5 r6 r131 r132 into r151 as SwapOutput; + set r151 into swap_outputs[r4]; + contains used_blinded_addresses[r7] into r152; + not r152 into r153; + assert.eq r153 true; + set true into used_blinded_addresses[r7]; + +function claim_swap_output: + input r0 as field.private; + input r1 as address.public; + input r2 as field.public; + input r3 as field.public; + input r4 as field.public; + input r5 as u128.public; + input r6 as u128.public; + input r7 as [MerkleProof; 2u32].private; + is.eq self.caller aleo1waeghjttfvzrmk68ckpp4ftnfh7aq6wcm73qxzy0m754x4cu6yxqf38zsq into r8; + call verify_blinded_address shield_swap.aleo self.signer r0 r1; + rem r7[0u32].leaf_index 2u32 into r9; + is.eq r9 0u32 into r10; + cast 1field r7[0u32].siblings[0u32] r7[0u32].siblings[1u32] into r11 as [field; 3u32]; + cast 1field r7[0u32].siblings[1u32] r7[0u32].siblings[0u32] into r12 as [field; 3u32]; + ternary r10 r11[0u32] r12[0u32] into r13; + ternary r10 r11[1u32] r12[1u32] into r14; + ternary r10 r11[2u32] r12[2u32] into r15; + cast r13 r14 r15 into r16 as [field; 3u32]; + hash.psd4 r16 into r17 as field; + is.eq r7[0u32].siblings[2u32] 0field into r18; + div r7[0u32].leaf_index 2u32 into r19; + rem r19 2u32 into r20; + is.eq r20 0u32 into r21; + cast 0field r17 r7[0u32].siblings[2u32] into r22 as [field; 3u32]; + cast 0field r7[0u32].siblings[2u32] r17 into r23 as [field; 3u32]; + ternary r21 r22[0u32] r23[0u32] into r24; + ternary r21 r22[1u32] r23[1u32] into r25; + ternary r21 r22[2u32] r23[2u32] into r26; + cast r24 r25 r26 into r27 as [field; 3u32]; + hash.psd4 r27 into r28 as field; + is.eq r7[0u32].siblings[3u32] 0field into r29; + div r7[0u32].leaf_index 4u32 into r30; + rem r30 2u32 into r31; + is.eq r31 0u32 into r32; + cast 0field r28 r7[0u32].siblings[3u32] into r33 as [field; 3u32]; + cast 0field r7[0u32].siblings[3u32] r28 into r34 as [field; 3u32]; + ternary r32 r33[0u32] r34[0u32] into r35; + ternary r32 r33[1u32] r34[1u32] into r36; + ternary r32 r33[2u32] r34[2u32] into r37; + cast r35 r36 r37 into r38 as [field; 3u32]; + hash.psd4 r38 into r39 as field; + is.eq r7[0u32].siblings[4u32] 0field into r40; + div r7[0u32].leaf_index 8u32 into r41; + rem r41 2u32 into r42; + is.eq r42 0u32 into r43; + cast 0field r39 r7[0u32].siblings[4u32] into r44 as [field; 3u32]; + cast 0field r7[0u32].siblings[4u32] r39 into r45 as [field; 3u32]; + ternary r43 r44[0u32] r45[0u32] into r46; + ternary r43 r44[1u32] r45[1u32] into r47; + ternary r43 r44[2u32] r45[2u32] into r48; + cast r46 r47 r48 into r49 as [field; 3u32]; + hash.psd4 r49 into r50 as field; + is.eq r7[0u32].siblings[5u32] 0field into r51; + div r7[0u32].leaf_index 16u32 into r52; + rem r52 2u32 into r53; + is.eq r53 0u32 into r54; + cast 0field r50 r7[0u32].siblings[5u32] into r55 as [field; 3u32]; + cast 0field r7[0u32].siblings[5u32] r50 into r56 as [field; 3u32]; + ternary r54 r55[0u32] r56[0u32] into r57; + ternary r54 r55[1u32] r56[1u32] into r58; + ternary r54 r55[2u32] r56[2u32] into r59; + cast r57 r58 r59 into r60 as [field; 3u32]; + hash.psd4 r60 into r61 as field; + is.eq r7[0u32].siblings[6u32] 0field into r62; + div r7[0u32].leaf_index 32u32 into r63; + rem r63 2u32 into r64; + is.eq r64 0u32 into r65; + cast 0field r61 r7[0u32].siblings[6u32] into r66 as [field; 3u32]; + cast 0field r7[0u32].siblings[6u32] r61 into r67 as [field; 3u32]; + ternary r65 r66[0u32] r67[0u32] into r68; + ternary r65 r66[1u32] r67[1u32] into r69; + ternary r65 r66[2u32] r67[2u32] into r70; + cast r68 r69 r70 into r71 as [field; 3u32]; + hash.psd4 r71 into r72 as field; + is.eq r7[0u32].siblings[7u32] 0field into r73; + div r7[0u32].leaf_index 64u32 into r74; + rem r74 2u32 into r75; + is.eq r75 0u32 into r76; + cast 0field r72 r7[0u32].siblings[7u32] into r77 as [field; 3u32]; + cast 0field r7[0u32].siblings[7u32] r72 into r78 as [field; 3u32]; + ternary r76 r77[0u32] r78[0u32] into r79; + ternary r76 r77[1u32] r78[1u32] into r80; + ternary r76 r77[2u32] r78[2u32] into r81; + cast r79 r80 r81 into r82 as [field; 3u32]; + hash.psd4 r82 into r83 as field; + is.eq r7[0u32].siblings[8u32] 0field into r84; + div r7[0u32].leaf_index 128u32 into r85; + rem r85 2u32 into r86; + is.eq r86 0u32 into r87; + cast 0field r83 r7[0u32].siblings[8u32] into r88 as [field; 3u32]; + cast 0field r7[0u32].siblings[8u32] r83 into r89 as [field; 3u32]; + ternary r87 r88[0u32] r89[0u32] into r90; + ternary r87 r88[1u32] r89[1u32] into r91; + ternary r87 r88[2u32] r89[2u32] into r92; + cast r90 r91 r92 into r93 as [field; 3u32]; + hash.psd4 r93 into r94 as field; + is.eq r7[0u32].siblings[9u32] 0field into r95; + div r7[0u32].leaf_index 256u32 into r96; + rem r96 2u32 into r97; + is.eq r97 0u32 into r98; + cast 0field r94 r7[0u32].siblings[9u32] into r99 as [field; 3u32]; + cast 0field r7[0u32].siblings[9u32] r94 into r100 as [field; 3u32]; + ternary r98 r99[0u32] r100[0u32] into r101; + ternary r98 r99[1u32] r100[1u32] into r102; + ternary r98 r99[2u32] r100[2u32] into r103; + cast r101 r102 r103 into r104 as [field; 3u32]; + hash.psd4 r104 into r105 as field; + is.eq r7[0u32].siblings[10u32] 0field into r106; + div r7[0u32].leaf_index 512u32 into r107; + rem r107 2u32 into r108; + is.eq r108 0u32 into r109; + cast 0field r105 r7[0u32].siblings[10u32] into r110 as [field; 3u32]; + cast 0field r7[0u32].siblings[10u32] r105 into r111 as [field; 3u32]; + ternary r109 r110[0u32] r111[0u32] into r112; + ternary r109 r110[1u32] r111[1u32] into r113; + ternary r109 r110[2u32] r111[2u32] into r114; + cast r112 r113 r114 into r115 as [field; 3u32]; + hash.psd4 r115 into r116 as field; + is.eq r7[0u32].siblings[11u32] 0field into r117; + div r7[0u32].leaf_index 1024u32 into r118; + rem r118 2u32 into r119; + is.eq r119 0u32 into r120; + cast 0field r116 r7[0u32].siblings[11u32] into r121 as [field; 3u32]; + cast 0field r7[0u32].siblings[11u32] r116 into r122 as [field; 3u32]; + ternary r120 r121[0u32] r122[0u32] into r123; + ternary r120 r121[1u32] r122[1u32] into r124; + ternary r120 r121[2u32] r122[2u32] into r125; + cast r123 r124 r125 into r126 as [field; 3u32]; + hash.psd4 r126 into r127 as field; + is.eq r7[0u32].siblings[12u32] 0field into r128; + div r7[0u32].leaf_index 2048u32 into r129; + rem r129 2u32 into r130; + is.eq r130 0u32 into r131; + cast 0field r127 r7[0u32].siblings[12u32] into r132 as [field; 3u32]; + cast 0field r7[0u32].siblings[12u32] r127 into r133 as [field; 3u32]; + ternary r131 r132[0u32] r133[0u32] into r134; + ternary r131 r132[1u32] r133[1u32] into r135; + ternary r131 r132[2u32] r133[2u32] into r136; + cast r134 r135 r136 into r137 as [field; 3u32]; + hash.psd4 r137 into r138 as field; + is.eq r7[0u32].siblings[13u32] 0field into r139; + div r7[0u32].leaf_index 4096u32 into r140; + rem r140 2u32 into r141; + is.eq r141 0u32 into r142; + cast 0field r138 r7[0u32].siblings[13u32] into r143 as [field; 3u32]; + cast 0field r7[0u32].siblings[13u32] r138 into r144 as [field; 3u32]; + ternary r142 r143[0u32] r144[0u32] into r145; + ternary r142 r143[1u32] r144[1u32] into r146; + ternary r142 r143[2u32] r144[2u32] into r147; + cast r145 r146 r147 into r148 as [field; 3u32]; + hash.psd4 r148 into r149 as field; + is.eq r7[0u32].siblings[14u32] 0field into r150; + div r7[0u32].leaf_index 8192u32 into r151; + rem r151 2u32 into r152; + is.eq r152 0u32 into r153; + cast 0field r149 r7[0u32].siblings[14u32] into r154 as [field; 3u32]; + cast 0field r7[0u32].siblings[14u32] r149 into r155 as [field; 3u32]; + ternary r153 r154[0u32] r155[0u32] into r156; + ternary r153 r154[1u32] r155[1u32] into r157; + ternary r153 r154[2u32] r155[2u32] into r158; + cast r156 r157 r158 into r159 as [field; 3u32]; + hash.psd4 r159 into r160 as field; + is.eq r7[0u32].siblings[15u32] 0field into r161; + div r7[0u32].leaf_index 16384u32 into r162; + rem r162 2u32 into r163; + is.eq r163 0u32 into r164; + cast 0field r160 r7[0u32].siblings[15u32] into r165 as [field; 3u32]; + cast 0field r7[0u32].siblings[15u32] r160 into r166 as [field; 3u32]; + ternary r164 r165[0u32] r166[0u32] into r167; + ternary r164 r165[1u32] r166[1u32] into r168; + ternary r164 r165[2u32] r166[2u32] into r169; + cast r167 r168 r169 into r170 as [field; 3u32]; + hash.psd4 r170 into r171 as field; + ternary r161 r160 r171 into r172; + ternary r161 14u32 15u32 into r173; + ternary r150 r149 r172 into r174; + ternary r150 13u32 r173 into r175; + ternary r139 r138 r174 into r176; + ternary r139 12u32 r175 into r177; + ternary r128 r127 r176 into r178; + ternary r128 11u32 r177 into r179; + ternary r117 r116 r178 into r180; + ternary r117 10u32 r179 into r181; + ternary r106 r105 r180 into r182; + ternary r106 9u32 r181 into r183; + ternary r95 r94 r182 into r184; + ternary r95 8u32 r183 into r185; + ternary r84 r83 r184 into r186; + ternary r84 7u32 r185 into r187; + ternary r73 r72 r186 into r188; + ternary r73 6u32 r187 into r189; + ternary r62 r61 r188 into r190; + ternary r62 5u32 r189 into r191; + ternary r51 r50 r190 into r192; + ternary r51 4u32 r191 into r193; + ternary r40 r39 r192 into r194; + ternary r40 3u32 r193 into r195; + ternary r29 r28 r194 into r196; + ternary r29 2u32 r195 into r197; + ternary r18 r17 r196 into r198; + ternary r18 1u32 r197 into r199; + rem r7[1u32].leaf_index 2u32 into r200; + is.eq r200 0u32 into r201; + cast 1field r7[1u32].siblings[0u32] r7[1u32].siblings[1u32] into r202 as [field; 3u32]; + cast 1field r7[1u32].siblings[1u32] r7[1u32].siblings[0u32] into r203 as [field; 3u32]; + ternary r201 r202[0u32] r203[0u32] into r204; + ternary r201 r202[1u32] r203[1u32] into r205; + ternary r201 r202[2u32] r203[2u32] into r206; + cast r204 r205 r206 into r207 as [field; 3u32]; + hash.psd4 r207 into r208 as field; + is.eq r7[1u32].siblings[2u32] 0field into r209; + div r7[1u32].leaf_index 2u32 into r210; + rem r210 2u32 into r211; + is.eq r211 0u32 into r212; + cast 0field r208 r7[1u32].siblings[2u32] into r213 as [field; 3u32]; + cast 0field r7[1u32].siblings[2u32] r208 into r214 as [field; 3u32]; + ternary r212 r213[0u32] r214[0u32] into r215; + ternary r212 r213[1u32] r214[1u32] into r216; + ternary r212 r213[2u32] r214[2u32] into r217; + cast r215 r216 r217 into r218 as [field; 3u32]; + hash.psd4 r218 into r219 as field; + is.eq r7[1u32].siblings[3u32] 0field into r220; + div r7[1u32].leaf_index 4u32 into r221; + rem r221 2u32 into r222; + is.eq r222 0u32 into r223; + cast 0field r219 r7[1u32].siblings[3u32] into r224 as [field; 3u32]; + cast 0field r7[1u32].siblings[3u32] r219 into r225 as [field; 3u32]; + ternary r223 r224[0u32] r225[0u32] into r226; + ternary r223 r224[1u32] r225[1u32] into r227; + ternary r223 r224[2u32] r225[2u32] into r228; + cast r226 r227 r228 into r229 as [field; 3u32]; + hash.psd4 r229 into r230 as field; + is.eq r7[1u32].siblings[4u32] 0field into r231; + div r7[1u32].leaf_index 8u32 into r232; + rem r232 2u32 into r233; + is.eq r233 0u32 into r234; + cast 0field r230 r7[1u32].siblings[4u32] into r235 as [field; 3u32]; + cast 0field r7[1u32].siblings[4u32] r230 into r236 as [field; 3u32]; + ternary r234 r235[0u32] r236[0u32] into r237; + ternary r234 r235[1u32] r236[1u32] into r238; + ternary r234 r235[2u32] r236[2u32] into r239; + cast r237 r238 r239 into r240 as [field; 3u32]; + hash.psd4 r240 into r241 as field; + is.eq r7[1u32].siblings[5u32] 0field into r242; + div r7[1u32].leaf_index 16u32 into r243; + rem r243 2u32 into r244; + is.eq r244 0u32 into r245; + cast 0field r241 r7[1u32].siblings[5u32] into r246 as [field; 3u32]; + cast 0field r7[1u32].siblings[5u32] r241 into r247 as [field; 3u32]; + ternary r245 r246[0u32] r247[0u32] into r248; + ternary r245 r246[1u32] r247[1u32] into r249; + ternary r245 r246[2u32] r247[2u32] into r250; + cast r248 r249 r250 into r251 as [field; 3u32]; + hash.psd4 r251 into r252 as field; + is.eq r7[1u32].siblings[6u32] 0field into r253; + div r7[1u32].leaf_index 32u32 into r254; + rem r254 2u32 into r255; + is.eq r255 0u32 into r256; + cast 0field r252 r7[1u32].siblings[6u32] into r257 as [field; 3u32]; + cast 0field r7[1u32].siblings[6u32] r252 into r258 as [field; 3u32]; + ternary r256 r257[0u32] r258[0u32] into r259; + ternary r256 r257[1u32] r258[1u32] into r260; + ternary r256 r257[2u32] r258[2u32] into r261; + cast r259 r260 r261 into r262 as [field; 3u32]; + hash.psd4 r262 into r263 as field; + is.eq r7[1u32].siblings[7u32] 0field into r264; + div r7[1u32].leaf_index 64u32 into r265; + rem r265 2u32 into r266; + is.eq r266 0u32 into r267; + cast 0field r263 r7[1u32].siblings[7u32] into r268 as [field; 3u32]; + cast 0field r7[1u32].siblings[7u32] r263 into r269 as [field; 3u32]; + ternary r267 r268[0u32] r269[0u32] into r270; + ternary r267 r268[1u32] r269[1u32] into r271; + ternary r267 r268[2u32] r269[2u32] into r272; + cast r270 r271 r272 into r273 as [field; 3u32]; + hash.psd4 r273 into r274 as field; + is.eq r7[1u32].siblings[8u32] 0field into r275; + div r7[1u32].leaf_index 128u32 into r276; + rem r276 2u32 into r277; + is.eq r277 0u32 into r278; + cast 0field r274 r7[1u32].siblings[8u32] into r279 as [field; 3u32]; + cast 0field r7[1u32].siblings[8u32] r274 into r280 as [field; 3u32]; + ternary r278 r279[0u32] r280[0u32] into r281; + ternary r278 r279[1u32] r280[1u32] into r282; + ternary r278 r279[2u32] r280[2u32] into r283; + cast r281 r282 r283 into r284 as [field; 3u32]; + hash.psd4 r284 into r285 as field; + is.eq r7[1u32].siblings[9u32] 0field into r286; + div r7[1u32].leaf_index 256u32 into r287; + rem r287 2u32 into r288; + is.eq r288 0u32 into r289; + cast 0field r285 r7[1u32].siblings[9u32] into r290 as [field; 3u32]; + cast 0field r7[1u32].siblings[9u32] r285 into r291 as [field; 3u32]; + ternary r289 r290[0u32] r291[0u32] into r292; + ternary r289 r290[1u32] r291[1u32] into r293; + ternary r289 r290[2u32] r291[2u32] into r294; + cast r292 r293 r294 into r295 as [field; 3u32]; + hash.psd4 r295 into r296 as field; + is.eq r7[1u32].siblings[10u32] 0field into r297; + div r7[1u32].leaf_index 512u32 into r298; + rem r298 2u32 into r299; + is.eq r299 0u32 into r300; + cast 0field r296 r7[1u32].siblings[10u32] into r301 as [field; 3u32]; + cast 0field r7[1u32].siblings[10u32] r296 into r302 as [field; 3u32]; + ternary r300 r301[0u32] r302[0u32] into r303; + ternary r300 r301[1u32] r302[1u32] into r304; + ternary r300 r301[2u32] r302[2u32] into r305; + cast r303 r304 r305 into r306 as [field; 3u32]; + hash.psd4 r306 into r307 as field; + is.eq r7[1u32].siblings[11u32] 0field into r308; + div r7[1u32].leaf_index 1024u32 into r309; + rem r309 2u32 into r310; + is.eq r310 0u32 into r311; + cast 0field r307 r7[1u32].siblings[11u32] into r312 as [field; 3u32]; + cast 0field r7[1u32].siblings[11u32] r307 into r313 as [field; 3u32]; + ternary r311 r312[0u32] r313[0u32] into r314; + ternary r311 r312[1u32] r313[1u32] into r315; + ternary r311 r312[2u32] r313[2u32] into r316; + cast r314 r315 r316 into r317 as [field; 3u32]; + hash.psd4 r317 into r318 as field; + is.eq r7[1u32].siblings[12u32] 0field into r319; + div r7[1u32].leaf_index 2048u32 into r320; + rem r320 2u32 into r321; + is.eq r321 0u32 into r322; + cast 0field r318 r7[1u32].siblings[12u32] into r323 as [field; 3u32]; + cast 0field r7[1u32].siblings[12u32] r318 into r324 as [field; 3u32]; + ternary r322 r323[0u32] r324[0u32] into r325; + ternary r322 r323[1u32] r324[1u32] into r326; + ternary r322 r323[2u32] r324[2u32] into r327; + cast r325 r326 r327 into r328 as [field; 3u32]; + hash.psd4 r328 into r329 as field; + is.eq r7[1u32].siblings[13u32] 0field into r330; + div r7[1u32].leaf_index 4096u32 into r331; + rem r331 2u32 into r332; + is.eq r332 0u32 into r333; + cast 0field r329 r7[1u32].siblings[13u32] into r334 as [field; 3u32]; + cast 0field r7[1u32].siblings[13u32] r329 into r335 as [field; 3u32]; + ternary r333 r334[0u32] r335[0u32] into r336; + ternary r333 r334[1u32] r335[1u32] into r337; + ternary r333 r334[2u32] r335[2u32] into r338; + cast r336 r337 r338 into r339 as [field; 3u32]; + hash.psd4 r339 into r340 as field; + is.eq r7[1u32].siblings[14u32] 0field into r341; + div r7[1u32].leaf_index 8192u32 into r342; + rem r342 2u32 into r343; + is.eq r343 0u32 into r344; + cast 0field r340 r7[1u32].siblings[14u32] into r345 as [field; 3u32]; + cast 0field r7[1u32].siblings[14u32] r340 into r346 as [field; 3u32]; + ternary r344 r345[0u32] r346[0u32] into r347; + ternary r344 r345[1u32] r346[1u32] into r348; + ternary r344 r345[2u32] r346[2u32] into r349; + cast r347 r348 r349 into r350 as [field; 3u32]; + hash.psd4 r350 into r351 as field; + is.eq r7[1u32].siblings[15u32] 0field into r352; + div r7[1u32].leaf_index 16384u32 into r353; + rem r353 2u32 into r354; + is.eq r354 0u32 into r355; + cast 0field r351 r7[1u32].siblings[15u32] into r356 as [field; 3u32]; + cast 0field r7[1u32].siblings[15u32] r351 into r357 as [field; 3u32]; + ternary r355 r356[0u32] r357[0u32] into r358; + ternary r355 r356[1u32] r357[1u32] into r359; + ternary r355 r356[2u32] r357[2u32] into r360; + cast r358 r359 r360 into r361 as [field; 3u32]; + hash.psd4 r361 into r362 as field; + ternary r352 r351 r362 into r363; + ternary r352 14u32 15u32 into r364; + ternary r341 r340 r363 into r365; + ternary r341 13u32 r364 into r366; + ternary r330 r329 r365 into r367; + ternary r330 12u32 r366 into r368; + ternary r319 r318 r367 into r369; + ternary r319 11u32 r368 into r370; + ternary r308 r307 r369 into r371; + ternary r308 10u32 r370 into r372; + ternary r297 r296 r371 into r373; + ternary r297 9u32 r372 into r374; + ternary r286 r285 r373 into r375; + ternary r286 8u32 r374 into r376; + ternary r275 r274 r375 into r377; + ternary r275 7u32 r376 into r378; + ternary r264 r263 r377 into r379; + ternary r264 6u32 r378 into r380; + ternary r253 r252 r379 into r381; + ternary r253 5u32 r380 into r382; + ternary r242 r241 r381 into r383; + ternary r242 4u32 r382 into r384; + ternary r231 r230 r383 into r385; + ternary r231 3u32 r384 into r386; + ternary r220 r219 r385 into r387; + ternary r220 2u32 r386 into r388; + ternary r209 r208 r387 into r389; + ternary r209 1u32 r388 into r390; + assert.eq r198 r389; + assert.eq r199 r390; + cast self.signer into r391 as field; + is.eq r7[0u32].leaf_index r7[1u32].leaf_index into r392; + is.eq r7[0u32].leaf_index 0u32 into r393; + lt r391 r7[0u32].siblings[0u32] into r394; + and r392 r393 into r395; + not r395 into r396; + or r394 r396 into r397; + assert.eq r397 true; + not r393 into r398; + pow 2u32 r199 into r399; + sub r399 1u32 into r400; + and r392 r398 into r401; + not r401 into r402; + is.eq r7[0u32].leaf_index r400 into r403; + or r403 r402 into r404; + assert.eq r404 true; + gt r391 r7[0u32].siblings[0u32] into r405; + or r405 r402 into r406; + assert.eq r406 true; + not r392 into r407; + gt r391 r7[0u32].siblings[0u32] into r408; + not r407 into r409; + or r408 r409 into r410; + assert.eq r410 true; + lt r391 r7[1u32].siblings[0u32] into r411; + or r411 r409 into r412; + assert.eq r412 true; + lte r7[1u32].leaf_index r400 into r413; + or r413 r409 into r414; + assert.eq r414 true; + add r7[0u32].leaf_index 1u32 into r415; + is.eq r415 r7[1u32].leaf_index into r416; + or r416 r409 into r417; + assert.eq r417 true; + call.dynamic r4 'aleo' 'transfer_public_to_private' with self.signer r5 (as address.private u128.public) into r418 r419 (as dynamic.record dynamic.future); + call.dynamic r3 'aleo' 'transfer_public_to_private' with self.signer r6 (as address.private u128.public) into r420 r421 (as dynamic.record dynamic.future); + async claim_swap_output r419 r421 r2 r3 r4 r5 r6 r1 r198 r8 into r422; + output r418 as dynamic.record; + output r420 as dynamic.record; + output r422 as shield_swap.aleo/claim_swap_output.future; + +finalize claim_swap_output: + input r0 as dynamic.future; + input r1 as dynamic.future; + input r2 as field.public; + input r3 as field.public; + input r4 as field.public; + input r5 as u128.public; + input r6 as u128.public; + input r7 as address.public; + input r8 as field.public; + input r9 as boolean.public; + get shield_swap_freezelist.aleo/freeze_list_root[1u8] into r10; + is.neq r10 r8 into r11; + branch.eq r11 false to end_then_0_0; + get shield_swap_freezelist.aleo/freeze_list_root[2u8] into r12; + get shield_swap_freezelist.aleo/root_updated_height[true] into r13; + get shield_swap_freezelist.aleo/previous_root_window[true] into r14; + is.eq r8 r10 into r15; + is.eq r8 r12 into r16; + sub block.height r13 into r17; + lt r17 r14 into r18; + and r16 r18 into r19; + or r15 r19 into r20; + assert.eq r20 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + get swap_outputs[r2] into r21; + contains from_wrapper_token_id[r21.token_in] into r22; + contains from_wrapper_token_id[r21.token_out] into r23; + or r22 r23 into r24; + branch.eq r24 false to end_then_0_2; + assert.eq r9 true; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + await r0; + await r1; + is.eq r21.caller r7 into r25; + assert.eq r25 true; + is.eq r21.recipient r7 into r26; + assert.eq r26 true; + is.eq r21.token_in r3 into r27; + assert.eq r27 true; + is.eq r21.token_out r4 into r28; + assert.eq r28 true; + is.eq r21.amount_out r5 into r29; + assert.eq r29 true; + is.eq r21.amount_remaining r6 into r30; + assert.eq r30 true; + remove swap_outputs[r2]; + +function swap_multi_hop: + input r0 as field.private; + input r1 as address.public; + input r2 as dynamic.record; + input r3 as field.public; + input r4 as field.public; + input r5 as u128.public; + input r6 as u128.public; + input r7 as SwapHop.public; + input r8 as SwapHop.public; + input r9 as SwapHop.public; + input r10 as u8.public; + input r11 as u64.public; + input r12 as u32.public; + is.eq self.caller aleo1waeghjttfvzrmk68ckpp4ftnfh7aq6wcm73qxzy0m754x4cu6yxqf38zsq into r13; + call verify_blinded_address shield_swap.aleo self.signer r0 r1; + cast r3 r4 r5 r6 r1 r7 r8 r9 r10 r11 r12 r1 into r14 as SwapMultiHopRequest; + hash.bhp256 r14 into r15 as field; + cast aleo1t08epjqqv8h7jpuy2m2cxm80zy2pcy5c4f3m82hnac4sjmdrjyysvx3s2h r15 r14 self.caller self.signer r1 into r16 as MultiHopSwapComplianceRecord.record; + call.dynamic r3 'aleo' 'transfer_private_to_public' with r2 shield_swap.aleo r5 (as dynamic.record address.public u128.public) into r17 r18 (as dynamic.record dynamic.future); + async swap_multi_hop r18 r14 r15 r13 into r19; + output r15 as field.public; + output r17 as dynamic.record; + output r16 as MultiHopSwapComplianceRecord.record; + output r19 as shield_swap.aleo/swap_multi_hop.future; + +finalize swap_multi_hop: + input r0 as dynamic.future; + input r1 as SwapMultiHopRequest.public; + input r2 as field.public; + input r3 as boolean.public; + contains from_wrapper_token_id[r1.token_in] into r4; + branch.eq r4 false to end_then_0_0; + assert.eq r3 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + await r0; + lte block.height r1.deadline into r5; + assert.eq r5 true; + gte r1.hop_count 2u8 into r6; + lte r1.hop_count 3u8 into r7; + and r6 r7 into r8; + assert.eq r8 true; + gt r1.amount_in 0u128 into r9; + assert.eq r9 true; + get.or_use global_paused[true] false into r10; + not r10 into r11; + assert.eq r11 true; + get pools[r1.hop0.pool] into r12; + assert.eq r12.enabled true; + get.or_use token_paused[r12.token0] false into r13; + not r13 into r14; + assert.eq r14 true; + get.or_use token_paused[r12.token1] false into r15; + not r15 into r16; + assert.eq r16 true; + cast r12.token0 r12.token1 into r17 as PairKey; + get.or_use pair_paused[r17] false into r18; + not r18 into r19; + assert.eq r19 true; + ternary r1.hop0.zero_for_one r12.token0 r12.token1 into r20; + ternary r1.hop0.zero_for_one r12.token1 r12.token0 into r21; + is.eq r20 r1.token_in into r22; + assert.eq r22 true; + get slots[r1.hop0.pool] into r23; + cast r12.fee into r24 as u32; + lt r1.hop0.sqrt_price_limit.hi 0u128 into r25; + gt r1.hop0.sqrt_price_limit.hi 0u128 into r26; + lt r1.hop0.sqrt_price_limit.lo 702075911466779181339691826087u128 into r27; + ternary r26 false r27 into r28; + ternary r25 true r28 into r29; + not r29 into r30; + lt 484680305u128 r1.hop0.sqrt_price_limit.hi into r31; + gt 484680305u128 r1.hop0.sqrt_price_limit.hi into r32; + lt 8756686347225649145659787327114459760u128 r1.hop0.sqrt_price_limit.lo into r33; + ternary r32 false r33 into r34; + ternary r31 true r34 into r35; + not r35 into r36; + and r30 r36 into r37; + assert.eq r37 true; + lt r1.hop0.sqrt_price_limit.hi r23.sqrt_price.hi into r38; + gt r1.hop0.sqrt_price_limit.hi r23.sqrt_price.hi into r39; + lt r1.hop0.sqrt_price_limit.lo r23.sqrt_price.lo into r40; + ternary r39 false r40 into r41; + ternary r38 true r41 into r42; + lt r23.sqrt_price.hi r1.hop0.sqrt_price_limit.hi into r43; + gt r23.sqrt_price.hi r1.hop0.sqrt_price_limit.hi into r44; + lt r23.sqrt_price.lo r1.hop0.sqrt_price_limit.lo into r45; + ternary r44 false r45 into r46; + ternary r43 true r46 into r47; + ternary r1.hop0.zero_for_one r42 r47 into r48; + assert.eq r48 true; + ternary r1.hop0.zero_for_one r23.fee_growth_global0_x_128.hi r23.fee_growth_global1_x_128.hi into r49; + ternary r1.hop0.zero_for_one r23.fee_growth_global0_x_128.lo r23.fee_growth_global1_x_128.lo into r50; + cast r49 r50 into r51 as U256__8JquwLopp8; + cast r1.hop0.zero_for_one r1.hop0.sqrt_price_limit r24 r23.fee_protocol r23.fee_growth_global0_x_128 r23.fee_growth_global1_x_128 into r52 as SwapIterCfg; + ternary r1.hop0.zero_for_one r23.next_init_below r23.next_init_above into r53; + cast r1.hop0.pool r53 into r54 as TickKey; + hash.bhp256 r54 into r55 as field; + get ticks[r55] into r56; + call view_sqrt_price_at_tick_x128 r53 into r57; + cast r23.sqrt_price r1.amount_in 0u128 r51 r23.liquidity r23.tick true 0u128 r23.next_init_below r23.next_init_above into r58 as SwapIterState; + call view_swap_iteration r52 r53 r57 r56 r58 into r59 r60; + set r60 into ticks[r55]; + not r59.crossed into r61; + is.eq r59.sp.hi r23.sqrt_price.hi into r62; + is.eq r59.sp.lo r23.sqrt_price.lo into r63; + and r62 r63 into r64; + not r64 into r65; + and r61 r65 into r66; + ternary r1.hop0.zero_for_one r59.nb r59.na into r67; + cast r1.hop0.pool r67 into r68 as TickKey; + hash.bhp256 r68 into r69 as field; + get ticks[r69] into r70; + call view_sqrt_price_at_tick_x128 r67 into r71; + cast r59.sp r59.rem r59.out r59.fg r59.liq r59.tk r59.crossed r59.pf r59.nb r59.na into r72 as SwapIterState; + call view_swap_iteration r52 r67 r71 r70 r72 into r73 r74; + set r74 into ticks[r69]; + not r73.crossed into r75; + is.eq r73.sp.hi r59.sp.hi into r76; + is.eq r73.sp.lo r59.sp.lo into r77; + and r76 r77 into r78; + not r78 into r79; + and r75 r79 into r80; + or r66 r80 into r81; + ternary r1.hop0.zero_for_one r73.nb r73.na into r82; + cast r1.hop0.pool r82 into r83 as TickKey; + hash.bhp256 r83 into r84 as field; + get ticks[r84] into r85; + call view_sqrt_price_at_tick_x128 r82 into r86; + cast r73.sp r73.rem r73.out r73.fg r73.liq r73.tk r73.crossed r73.pf r73.nb r73.na into r87 as SwapIterState; + call view_swap_iteration r52 r82 r86 r85 r87 into r88 r89; + set r89 into ticks[r84]; + not r88.crossed into r90; + is.eq r88.sp.hi r73.sp.hi into r91; + is.eq r88.sp.lo r73.sp.lo into r92; + and r91 r92 into r93; + not r93 into r94; + and r90 r94 into r95; + or r81 r95 into r96; + ternary r1.hop0.zero_for_one r88.nb r88.na into r97; + call view_sqrt_price_at_tick_x128 r97 into r98; + call view_bounded_partial r88.sp r88.liq r88.rem r88.out r88.fg r88.pf r98 r1.hop0.sqrt_price_limit r24 r23.fee_protocol r1.hop0.zero_for_one into r99 r100 r101 r102 r103 r104; + call resolve_stored_tick r88.sp r88.tk r99 r104 r96 into r105; + add r23.protocol_fees0 r103 into r106; + ternary r1.hop0.zero_for_one r106 r23.protocol_fees0 into r107; + add r23.protocol_fees1 r103 into r108; + ternary r1.hop0.zero_for_one r23.protocol_fees1 r108 into r109; + ternary r1.hop0.zero_for_one r102.hi r23.fee_growth_global0_x_128.hi into r110; + ternary r1.hop0.zero_for_one r102.lo r23.fee_growth_global0_x_128.lo into r111; + cast r110 r111 into r112 as U256__8JquwLopp8; + ternary r1.hop0.zero_for_one r23.fee_growth_global1_x_128.hi r102.hi into r113; + ternary r1.hop0.zero_for_one r23.fee_growth_global1_x_128.lo r102.lo into r114; + cast r113 r114 into r115 as U256__8JquwLopp8; + cast r105 r23.tick_spacing r99 r23.fee_protocol r88.liq r112 r115 r23.max_liquidity_per_tick r107 r109 r88.nb r88.na into r116 as Slot; + set r116 into slots[r1.hop0.pool]; + get pools[r1.hop1.pool] into r117; + assert.eq r117.enabled true; + get.or_use token_paused[r117.token0] false into r118; + not r118 into r119; + assert.eq r119 true; + get.or_use token_paused[r117.token1] false into r120; + not r120 into r121; + assert.eq r121 true; + cast r117.token0 r117.token1 into r122 as PairKey; + get.or_use pair_paused[r122] false into r123; + not r123 into r124; + assert.eq r124 true; + ternary r1.hop1.zero_for_one r117.token0 r117.token1 into r125; + ternary r1.hop1.zero_for_one r117.token1 r117.token0 into r126; + is.eq r125 r21 into r127; + assert.eq r127 true; + get slots[r1.hop1.pool] into r128; + cast r117.fee into r129 as u32; + lt r1.hop1.sqrt_price_limit.hi 0u128 into r130; + gt r1.hop1.sqrt_price_limit.hi 0u128 into r131; + lt r1.hop1.sqrt_price_limit.lo 702075911466779181339691826087u128 into r132; + ternary r131 false r132 into r133; + ternary r130 true r133 into r134; + not r134 into r135; + lt 484680305u128 r1.hop1.sqrt_price_limit.hi into r136; + gt 484680305u128 r1.hop1.sqrt_price_limit.hi into r137; + lt 8756686347225649145659787327114459760u128 r1.hop1.sqrt_price_limit.lo into r138; + ternary r137 false r138 into r139; + ternary r136 true r139 into r140; + not r140 into r141; + and r135 r141 into r142; + assert.eq r142 true; + lt r1.hop1.sqrt_price_limit.hi r128.sqrt_price.hi into r143; + gt r1.hop1.sqrt_price_limit.hi r128.sqrt_price.hi into r144; + lt r1.hop1.sqrt_price_limit.lo r128.sqrt_price.lo into r145; + ternary r144 false r145 into r146; + ternary r143 true r146 into r147; + lt r128.sqrt_price.hi r1.hop1.sqrt_price_limit.hi into r148; + gt r128.sqrt_price.hi r1.hop1.sqrt_price_limit.hi into r149; + lt r128.sqrt_price.lo r1.hop1.sqrt_price_limit.lo into r150; + ternary r149 false r150 into r151; + ternary r148 true r151 into r152; + ternary r1.hop1.zero_for_one r147 r152 into r153; + assert.eq r153 true; + ternary r1.hop1.zero_for_one r128.fee_growth_global0_x_128.hi r128.fee_growth_global1_x_128.hi into r154; + ternary r1.hop1.zero_for_one r128.fee_growth_global0_x_128.lo r128.fee_growth_global1_x_128.lo into r155; + cast r154 r155 into r156 as U256__8JquwLopp8; + cast r1.hop1.zero_for_one r1.hop1.sqrt_price_limit r129 r128.fee_protocol r128.fee_growth_global0_x_128 r128.fee_growth_global1_x_128 into r157 as SwapIterCfg; + ternary r1.hop1.zero_for_one r128.next_init_below r128.next_init_above into r158; + cast r1.hop1.pool r158 into r159 as TickKey; + hash.bhp256 r159 into r160 as field; + get ticks[r160] into r161; + call view_sqrt_price_at_tick_x128 r158 into r162; + cast r128.sqrt_price r100 0u128 r156 r128.liquidity r128.tick true 0u128 r128.next_init_below r128.next_init_above into r163 as SwapIterState; + call view_swap_iteration r157 r158 r162 r161 r163 into r164 r165; + set r165 into ticks[r160]; + not r164.crossed into r166; + is.eq r164.sp.hi r128.sqrt_price.hi into r167; + is.eq r164.sp.lo r128.sqrt_price.lo into r168; + and r167 r168 into r169; + not r169 into r170; + and r166 r170 into r171; + ternary r1.hop1.zero_for_one r164.nb r164.na into r172; + cast r1.hop1.pool r172 into r173 as TickKey; + hash.bhp256 r173 into r174 as field; + get ticks[r174] into r175; + call view_sqrt_price_at_tick_x128 r172 into r176; + cast r164.sp r164.rem r164.out r164.fg r164.liq r164.tk r164.crossed r164.pf r164.nb r164.na into r177 as SwapIterState; + call view_swap_iteration r157 r172 r176 r175 r177 into r178 r179; + set r179 into ticks[r174]; + not r178.crossed into r180; + is.eq r178.sp.hi r164.sp.hi into r181; + is.eq r178.sp.lo r164.sp.lo into r182; + and r181 r182 into r183; + not r183 into r184; + and r180 r184 into r185; + or r171 r185 into r186; + ternary r1.hop1.zero_for_one r178.nb r178.na into r187; + cast r1.hop1.pool r187 into r188 as TickKey; + hash.bhp256 r188 into r189 as field; + get ticks[r189] into r190; + call view_sqrt_price_at_tick_x128 r187 into r191; + cast r178.sp r178.rem r178.out r178.fg r178.liq r178.tk r178.crossed r178.pf r178.nb r178.na into r192 as SwapIterState; + call view_swap_iteration r157 r187 r191 r190 r192 into r193 r194; + set r194 into ticks[r189]; + not r193.crossed into r195; + is.eq r193.sp.hi r178.sp.hi into r196; + is.eq r193.sp.lo r178.sp.lo into r197; + and r196 r197 into r198; + not r198 into r199; + and r195 r199 into r200; + or r186 r200 into r201; + ternary r1.hop1.zero_for_one r193.nb r193.na into r202; + call view_sqrt_price_at_tick_x128 r202 into r203; + call view_bounded_partial r193.sp r193.liq r193.rem r193.out r193.fg r193.pf r203 r1.hop1.sqrt_price_limit r129 r128.fee_protocol r1.hop1.zero_for_one into r204 r205 r206 r207 r208 r209; + call resolve_stored_tick r193.sp r193.tk r204 r209 r201 into r210; + is.eq r206 0u128 into r211; + assert.eq r211 true; + add r128.protocol_fees0 r208 into r212; + ternary r1.hop1.zero_for_one r212 r128.protocol_fees0 into r213; + add r128.protocol_fees1 r208 into r214; + ternary r1.hop1.zero_for_one r128.protocol_fees1 r214 into r215; + ternary r1.hop1.zero_for_one r207.hi r128.fee_growth_global0_x_128.hi into r216; + ternary r1.hop1.zero_for_one r207.lo r128.fee_growth_global0_x_128.lo into r217; + cast r216 r217 into r218 as U256__8JquwLopp8; + ternary r1.hop1.zero_for_one r128.fee_growth_global1_x_128.hi r207.hi into r219; + ternary r1.hop1.zero_for_one r128.fee_growth_global1_x_128.lo r207.lo into r220; + cast r219 r220 into r221 as U256__8JquwLopp8; + cast r210 r128.tick_spacing r204 r128.fee_protocol r193.liq r218 r221 r128.max_liquidity_per_tick r213 r215 r193.nb r193.na into r222 as Slot; + set r222 into slots[r1.hop1.pool]; + is.eq r1.hop_count 3u8 into r223; + cast 0field 0field 0u16 false into r224 as PoolState; + get.or_use pools[r1.hop2.pool] r224 into r225; + branch.eq r223 false to end_then_0_2; + assert.eq r225.enabled true; + get.or_use token_paused[r225.token0] false into r226; + not r226 into r227; + assert.eq r227 true; + get.or_use token_paused[r225.token1] false into r228; + not r228 into r229; + assert.eq r229 true; + cast r225.token0 r225.token1 into r230 as PairKey; + get.or_use pair_paused[r230] false into r231; + not r231 into r232; + assert.eq r232 true; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + ternary r1.hop2.zero_for_one r225.token0 r225.token1 into r233; + ternary r1.hop2.zero_for_one r225.token1 r225.token0 into r234; + not r223 into r235; + is.eq r233 r126 into r236; + or r235 r236 into r237; + assert.eq r237 true; + ternary r223 r234 r126 into r238; + is.eq r238 r1.token_out into r239; + assert.eq r239 true; + cast 1u128 0u128 into r240 as U256__8JquwLopp8; + cast 0u128 0u128 into r241 as U256__8JquwLopp8; + cast 0u128 0u128 into r242 as U256__8JquwLopp8; + cast 0i32 1u32 r240 0u8 0u128 r241 r242 0u128 0u128 0u128 0i32 0i32 into r243 as Slot; + get.or_use slots[r1.hop2.pool] r243 into r244; + cast r225.fee into r245 as u32; + ternary r223 r1.hop2.sqrt_price_limit.hi r244.sqrt_price.hi into r246; + ternary r223 r1.hop2.sqrt_price_limit.lo r244.sqrt_price.lo into r247; + cast r246 r247 into r248 as U256__8JquwLopp8; + lt r248.hi 0u128 into r249; + gt r248.hi 0u128 into r250; + lt r248.lo 702075911466779181339691826087u128 into r251; + ternary r250 false r251 into r252; + ternary r249 true r252 into r253; + not r253 into r254; + lt 484680305u128 r248.hi into r255; + gt 484680305u128 r248.hi into r256; + lt 8756686347225649145659787327114459760u128 r248.lo into r257; + ternary r256 false r257 into r258; + ternary r255 true r258 into r259; + not r259 into r260; + and r254 r260 into r261; + or r235 r261 into r262; + assert.eq r262 true; + lt r248.hi r244.sqrt_price.hi into r263; + gt r248.hi r244.sqrt_price.hi into r264; + lt r248.lo r244.sqrt_price.lo into r265; + ternary r264 false r265 into r266; + ternary r263 true r266 into r267; + lt r244.sqrt_price.hi r248.hi into r268; + gt r244.sqrt_price.hi r248.hi into r269; + lt r244.sqrt_price.lo r248.lo into r270; + ternary r269 false r270 into r271; + ternary r268 true r271 into r272; + ternary r1.hop2.zero_for_one r267 r272 into r273; + or r235 r273 into r274; + assert.eq r274 true; + ternary r1.hop2.zero_for_one r244.fee_growth_global0_x_128.hi r244.fee_growth_global1_x_128.hi into r275; + ternary r1.hop2.zero_for_one r244.fee_growth_global0_x_128.lo r244.fee_growth_global1_x_128.lo into r276; + cast r275 r276 into r277 as U256__8JquwLopp8; + cast r1.hop2.zero_for_one r248 r245 r244.fee_protocol r244.fee_growth_global0_x_128 r244.fee_growth_global1_x_128 into r278 as SwapIterCfg; + ternary r1.hop2.zero_for_one r244.next_init_below r244.next_init_above into r279; + cast r1.hop2.pool r279 into r280 as TickKey; + hash.bhp256 r280 into r281 as field; + cast 0u128 0u128 into r282 as U256__8JquwLopp8; + cast 0u128 0u128 into r283 as U256__8JquwLopp8; + cast r1.hop2.pool 0i128 0u128 r279 r282 r283 r279 r279 into r284 as Tick; + get.or_use ticks[r281] r284 into r285; + call view_sqrt_price_at_tick_x128 r279 into r286; + cast r244.sqrt_price r205 0u128 r277 r244.liquidity r244.tick r223 0u128 r244.next_init_below r244.next_init_above into r287 as SwapIterState; + call view_swap_iteration r278 r279 r286 r285 r287 into r288 r289; + branch.eq r223 false to end_then_0_4; + set r289 into ticks[r281]; + branch.eq true true to end_otherwise_0_5; + position end_then_0_4; + position end_otherwise_0_5; + not r288.crossed into r290; + is.eq r288.sp.hi r244.sqrt_price.hi into r291; + is.eq r288.sp.lo r244.sqrt_price.lo into r292; + and r291 r292 into r293; + not r293 into r294; + and r290 r294 into r295; + ternary r1.hop2.zero_for_one r288.nb r288.na into r296; + cast r1.hop2.pool r296 into r297 as TickKey; + hash.bhp256 r297 into r298 as field; + cast 0u128 0u128 into r299 as U256__8JquwLopp8; + cast 0u128 0u128 into r300 as U256__8JquwLopp8; + cast r1.hop2.pool 0i128 0u128 r296 r299 r300 r296 r296 into r301 as Tick; + get.or_use ticks[r298] r301 into r302; + call view_sqrt_price_at_tick_x128 r296 into r303; + cast r288.sp r288.rem r288.out r288.fg r288.liq r288.tk r288.crossed r288.pf r288.nb r288.na into r304 as SwapIterState; + call view_swap_iteration r278 r296 r303 r302 r304 into r305 r306; + branch.eq r223 false to end_then_0_6; + set r306 into ticks[r298]; + branch.eq true true to end_otherwise_0_7; + position end_then_0_6; + position end_otherwise_0_7; + not r305.crossed into r307; + is.eq r305.sp.hi r288.sp.hi into r308; + is.eq r305.sp.lo r288.sp.lo into r309; + and r308 r309 into r310; + not r310 into r311; + and r307 r311 into r312; + or r295 r312 into r313; + ternary r1.hop2.zero_for_one r305.nb r305.na into r314; + cast r1.hop2.pool r314 into r315 as TickKey; + hash.bhp256 r315 into r316 as field; + cast 0u128 0u128 into r317 as U256__8JquwLopp8; + cast 0u128 0u128 into r318 as U256__8JquwLopp8; + cast r1.hop2.pool 0i128 0u128 r314 r317 r318 r314 r314 into r319 as Tick; + get.or_use ticks[r316] r319 into r320; + call view_sqrt_price_at_tick_x128 r314 into r321; + cast r305.sp r305.rem r305.out r305.fg r305.liq r305.tk r305.crossed r305.pf r305.nb r305.na into r322 as SwapIterState; + call view_swap_iteration r278 r314 r321 r320 r322 into r323 r324; + branch.eq r223 false to end_then_0_8; + set r324 into ticks[r316]; + branch.eq true true to end_otherwise_0_9; + position end_then_0_8; + position end_otherwise_0_9; + not r323.crossed into r325; + is.eq r323.sp.hi r305.sp.hi into r326; + is.eq r323.sp.lo r305.sp.lo into r327; + and r326 r327 into r328; + not r328 into r329; + and r325 r329 into r330; + or r313 r330 into r331; + ternary r1.hop2.zero_for_one r323.nb r323.na into r332; + call view_sqrt_price_at_tick_x128 r332 into r333; + call view_bounded_partial r323.sp r323.liq r323.rem r323.out r323.fg r323.pf r333 r248 r245 r244.fee_protocol r1.hop2.zero_for_one into r334 r335 r336 r337 r338 r339; + call resolve_stored_tick r323.sp r323.tk r334 r339 r331 into r340; + not r223 into r341; + is.eq r336 0u128 into r342; + or r341 r342 into r343; + assert.eq r343 true; + add r244.protocol_fees0 r338 into r344; + ternary r1.hop2.zero_for_one r344 r244.protocol_fees0 into r345; + add r244.protocol_fees1 r338 into r346; + ternary r1.hop2.zero_for_one r244.protocol_fees1 r346 into r347; + branch.eq r223 false to end_then_0_10; + ternary r1.hop2.zero_for_one r337.hi r244.fee_growth_global0_x_128.hi into r348; + ternary r1.hop2.zero_for_one r337.lo r244.fee_growth_global0_x_128.lo into r349; + cast r348 r349 into r350 as U256__8JquwLopp8; + ternary r1.hop2.zero_for_one r244.fee_growth_global1_x_128.hi r337.hi into r351; + ternary r1.hop2.zero_for_one r244.fee_growth_global1_x_128.lo r337.lo into r352; + cast r351 r352 into r353 as U256__8JquwLopp8; + cast r340 r244.tick_spacing r334 r244.fee_protocol r323.liq r350 r353 r244.max_liquidity_per_tick r345 r347 r323.nb r323.na into r354 as Slot; + set r354 into slots[r1.hop2.pool]; + branch.eq true true to end_otherwise_0_11; + position end_then_0_10; + position end_otherwise_0_11; + ternary r223 r335 r205 into r355; + gte r355 r1.amount_out_min into r356; + assert.eq r356 true; + contains swap_outputs[r2] into r357; + not r357 into r358; + assert.eq r358 true; + cast r1.recipient r1.caller r20 r1.token_out r355 r101 into r359 as SwapOutput; + set r359 into swap_outputs[r2]; + contains used_blinded_addresses[r1.caller] into r360; + not r360 into r361; + assert.eq r361 true; + set true into used_blinded_addresses[r1.caller]; + +constructor: + is.eq edition 0u16 into r0; + branch.eq r0 false to end_then_0_0; + contains admin[true] into r1; + not r1 into r2; + assert.eq r2 true; + set aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc into admin[true]; + set false into pool_creation_is_open[true]; + set false into global_paused[true]; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + gt edition 0u16 into r3; + branch.eq r3 false to end_then_0_2; + cast checksum edition into r4 as ChecksumEdition; + hash.bhp256 r4 into r5 as field; + cast shield_swap.aleo r5 into r6 as shield_swap_multisig_core.aleo/WalletSigningOpId; + hash.bhp256 r6 into r7 as field; + contains shield_swap_multisig_core.aleo/completed_signing_ops[r7] into r8; + assert.eq r8 true; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + diff --git a/shield-swap-sdk/tests/fixtures/programs/shield_swap_freezelist.aleo b/shield-swap-sdk/tests/fixtures/programs/shield_swap_freezelist.aleo new file mode 100644 index 00000000..aeef5e4c --- /dev/null +++ b/shield-swap-sdk/tests/fixtures/programs/shield_swap_freezelist.aleo @@ -0,0 +1,173 @@ +import shield_swap_multisig_core.aleo; + +program shield_swap_freezelist.aleo; + +struct ChecksumEdition: + checksum as [u8; 32u32]; + edition as u16; + +mapping freeze_list: + key as address.public; + value as boolean.public; + +mapping freeze_list_index: + key as u32.public; + value as address.public; + +mapping freeze_list_last_index: + key as boolean.public; + value as u32.public; + +mapping freeze_list_root: + key as u8.public; + value as field.public; + +mapping root_updated_height: + key as boolean.public; + value as u32.public; + +mapping block_height_window: + key as boolean.public; + value as u32.public; + +mapping previous_root_window: + key as boolean.public; + value as u32.public; + +mapping address_to_role: + key as address.public; + value as u16.public; + +function initialize: + input r0 as address.public; + input r1 as u32.public; + async initialize r0 self.caller r1 into r2; + output r2 as shield_swap_freezelist.aleo/initialize.future; + +finalize initialize: + input r0 as address.public; + input r1 as address.public; + input r2 as u32.public; + contains freeze_list_root[1u8] into r3; + not r3 into r4; + assert.eq r4 true; + assert.eq r1 aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc; + set 8u16 into address_to_role[r0]; + set r2 into block_height_window[true]; + set 0u32 into freeze_list_last_index[true]; + set 3642222252059314292809609689035560016959342421640560347114299934615987159853field into freeze_list_root[1u8]; + set false into freeze_list[aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc]; + set aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into freeze_list_index[0u32]; + +function update_role: + input r0 as address.public; + input r1 as u16.public; + async update_role r0 self.caller r1 into r2; + output r2 as shield_swap_freezelist.aleo/update_role.future; + +finalize update_role: + input r0 as address.public; + input r1 as address.public; + input r2 as u16.public; + get address_to_role[r1] into r3; + and r3 8u16 into r4; + is.eq r4 8u16 into r5; + assert.eq r5 true; + is.eq r1 r0 into r6; + branch.eq r6 false to end_then_0_0; + and r2 8u16 into r7; + is.eq r7 8u16 into r8; + assert.eq r8 true; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + set r2 into address_to_role[r0]; + +function update_block_height_window: + input r0 as u32.public; + async update_block_height_window r0 self.caller into r1; + output r1 as shield_swap_freezelist.aleo/update_block_height_window.future; + +finalize update_block_height_window: + input r0 as u32.public; + input r1 as address.public; + get address_to_role[r1] into r2; + and r2 16u16 into r3; + is.eq r3 16u16 into r4; + assert.eq r4 true; + set r0 into block_height_window[true]; + +function update_freeze_list: + input r0 as address.public; + input r1 as boolean.public; + input r2 as u32.public; + input r3 as field.public; + input r4 as field.public; + async update_freeze_list r0 r1 r2 self.caller r3 r4 into r5; + output r5 as shield_swap_freezelist.aleo/update_freeze_list.future; + +finalize update_freeze_list: + input r0 as address.public; + input r1 as boolean.public; + input r2 as u32.public; + input r3 as address.public; + input r4 as field.public; + input r5 as field.public; + get address_to_role[r3] into r6; + and r6 16u16 into r7; + is.eq r7 16u16 into r8; + assert.eq r8 true; + assert.neq r2 0u32; + assert.neq r0 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc; + get freeze_list_root[1u8] into r9; + assert.eq r4 r9; + assert.neq r5 r9; + set r9 into freeze_list_root[2u8]; + set r5 into freeze_list_root[1u8]; + get.or_use freeze_list[r0] false into r10; + assert.neq r1 r10; + set r1 into freeze_list[r0]; + get.or_use freeze_list_index[r2] aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into r11; + branch.eq r1 false to end_then_0_0; + assert.eq r11 aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc; + get freeze_list_last_index[true] into r12; + add r12 1u32 into r13; + gte r13 r2 into r14; + assert.eq r14 true; + lt r12 r2 into r15; + branch.eq r15 false to end_then_1_2; + lt r12 32768u32 into r16; + assert.eq r16 true; + set r2 into freeze_list_last_index[true]; + branch.eq true true to end_otherwise_1_3; + position end_then_1_2; + position end_otherwise_1_3; + set r0 into freeze_list_index[r2]; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + assert.eq r11 r0; + set aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc into freeze_list_index[r2]; + position end_otherwise_0_1; + get block_height_window[true] into r17; + set r17 into previous_root_window[true]; + set block.height into root_updated_height[true]; + +constructor: + is.eq edition 0u16 into r0; + branch.eq r0 false to end_then_0_0; + assert.eq program_owner aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc; + branch.eq true true to end_otherwise_0_1; + position end_then_0_0; + position end_otherwise_0_1; + gt edition 0u16 into r1; + branch.eq r1 false to end_then_0_2; + cast checksum edition into r2 as ChecksumEdition; + hash.bhp256 r2 into r3 as field; + cast shield_swap_freezelist.aleo r3 into r4 as shield_swap_multisig_core.aleo/WalletSigningOpId; + hash.bhp256 r4 into r5 as field; + contains shield_swap_multisig_core.aleo/completed_signing_ops[r5] into r6; + assert.eq r6 true; + branch.eq true true to end_otherwise_0_3; + position end_then_0_2; + position end_otherwise_0_3; + diff --git a/shield-swap-sdk/tests/fixtures/programs/test_shield_swap_multisig_core.aleo b/shield-swap-sdk/tests/fixtures/programs/shield_swap_multisig_core.aleo similarity index 96% rename from shield-swap-sdk/tests/fixtures/programs/test_shield_swap_multisig_core.aleo rename to shield-swap-sdk/tests/fixtures/programs/shield_swap_multisig_core.aleo index 34a2570b..6209b76c 100644 --- a/shield-swap-sdk/tests/fixtures/programs/test_shield_swap_multisig_core.aleo +++ b/shield-swap-sdk/tests/fixtures/programs/shield_swap_multisig_core.aleo @@ -1,5 +1,4 @@ -// _source: aleo-viem@4a63636 packages/shield-swap/test/fixtures/programs/test_shield_swap_multisig_core.aleo -program test_shield_swap_multisig_core.aleo; +program shield_swap_multisig_core.aleo; struct AdminOp: op as u8; @@ -85,7 +84,7 @@ function init: input r0 as address.private; input r1 as boolean.private; async init self.caller r0 r1 into r2; - output r2 as test_shield_swap_multisig_core.aleo/init.future; + output r2 as shield_swap_multisig_core.aleo/init.future; finalize init: input r0 as address.public; @@ -100,7 +99,7 @@ finalize init: function disallow_upgrades: async disallow_upgrades self.caller into r0; - output r0 as test_shield_swap_multisig_core.aleo/disallow_upgrades.future; + output r0 as shield_swap_multisig_core.aleo/disallow_upgrades.future; finalize disallow_upgrades: input r0 as address.public; @@ -114,7 +113,7 @@ finalize disallow_upgrades: function set_upgrader_address: input r0 as address.private; async set_upgrader_address self.caller r0 into r1; - output r1 as test_shield_swap_multisig_core.aleo/set_upgrader_address.future; + output r1 as shield_swap_multisig_core.aleo/set_upgrader_address.future; finalize set_upgrader_address: input r0 as address.public; @@ -155,7 +154,7 @@ function create_wallet: hash.bhp256 r22 into r23 as field; cast r17 r19 r21 r23 into r24 as [field; 4u32]; async create_wallet r0 r1 r2 r3 self.caller r15 r24 into r25; - output r25 as test_shield_swap_multisig_core.aleo/create_wallet.future; + output r25 as shield_swap_multisig_core.aleo/create_wallet.future; finalize create_wallet: input r0 as address.public; @@ -168,18 +167,18 @@ finalize create_wallet: contains program_settings_map[true] into r7; assert.eq r7 true; get program_settings_map[true] into r8; - is.neq r0 test_shield_swap_multisig_core.aleo into r9; + is.neq r0 shield_swap_multisig_core.aleo into r9; and r8.guard_create_wallet r9 into r10; branch.eq r10 false to end_then_0_0; cast r0 r1 r2 r3 into r11 as GuardedCreateWalletOp; hash.bhp256 r11 into r12 as field; - cast test_shield_swap_multisig_core.aleo r12 into r13 as WalletSigningOpId; + cast shield_swap_multisig_core.aleo r12 into r13 as WalletSigningOpId; hash.bhp256 r13 into r14 as field; contains completed_signing_ops[r14] into r15; assert.eq r15 true; branch.eq true true to end_otherwise_0_1; position end_then_0_0; - is.eq r0 test_shield_swap_multisig_core.aleo into r16; + is.eq r0 shield_swap_multisig_core.aleo into r16; branch.eq r16 false to end_then_1_2; assert.eq r4 aleo1sa2gyw566v8k7ezjljs8hg4y6ja3vf0sm0kwzfvw5hvredjq3gys6wvfys; branch.eq true true to end_otherwise_1_3; @@ -298,7 +297,7 @@ function initiate_signing_op: hash.bhp256 r6 into r7 as field; async initiate_signing_op r0 r5 r7 r2 into r8; output r5 as field.private; - output r8 as test_shield_swap_multisig_core.aleo/initiate_signing_op.future; + output r8 as shield_swap_multisig_core.aleo/initiate_signing_op.future; finalize initiate_signing_op: input r0 as address.public; @@ -365,7 +364,7 @@ function sign: cast r0 self.signer into r2 as WalletAleoSigner; hash.bhp256 r2 into r3 as field; async sign r0 r1 r3 into r4; - output r4 as test_shield_swap_multisig_core.aleo/sign.future; + output r4 as shield_swap_multisig_core.aleo/sign.future; finalize sign: input r0 as address.public; @@ -407,7 +406,7 @@ function sign_for_round: cast r0 self.signer into r3 as WalletAleoSigner; hash.bhp256 r3 into r4 as field; async sign_for_round r0 r1 r4 r2 into r5; - output r5 as test_shield_swap_multisig_core.aleo/sign_for_round.future; + output r5 as shield_swap_multisig_core.aleo/sign_for_round.future; finalize sign_for_round: input r0 as address.public; @@ -455,7 +454,7 @@ function sign_ecdsa: input r4 as u64.public; cast r0 r2 into r5 as WalletEcdsaSigner; async sign_ecdsa r0 r1 r5 r3 r4 into r6; - output r6 as test_shield_swap_multisig_core.aleo/sign_ecdsa.future; + output r6 as shield_swap_multisig_core.aleo/sign_ecdsa.future; finalize sign_ecdsa: input r0 as address.public; @@ -517,7 +516,7 @@ function sign_ecdsa_for_round: input r5 as u32.public; cast r0 r2 into r6 as WalletEcdsaSigner; async sign_ecdsa_for_round r0 r1 r6 r3 r4 r5 into r7; - output r7 as test_shield_swap_multisig_core.aleo/sign_ecdsa_for_round.future; + output r7 as shield_swap_multisig_core.aleo/sign_ecdsa_for_round.future; finalize sign_ecdsa_for_round: input r0 as address.public; @@ -628,7 +627,7 @@ function init_admin_op: hash.bhp256 r6 into r7 as field; async init_admin_op r0 r5 r7 r2 r3 into r8; output r5 as field.private; - output r8 as test_shield_swap_multisig_core.aleo/init_admin_op.future; + output r8 as shield_swap_multisig_core.aleo/init_admin_op.future; finalize init_admin_op: input r0 as address.public; @@ -696,7 +695,7 @@ function exec_admin_op: cast r0 r1 into r3 as WalletSigningOpId; hash.bhp256 r3 into r4 as field; async exec_admin_op r0 r4 r2 into r5; - output r5 as test_shield_swap_multisig_core.aleo/exec_admin_op.future; + output r5 as shield_swap_multisig_core.aleo/exec_admin_op.future; finalize exec_admin_op: input r0 as address.public; @@ -803,7 +802,7 @@ function assert_signing_completed: input r0 as address.public; input r1 as field.public; async assert_signing_completed r0 r1 into r2; - output r2 as test_shield_swap_multisig_core.aleo/assert_signing_completed.future; + output r2 as shield_swap_multisig_core.aleo/assert_signing_completed.future; finalize assert_signing_completed: input r0 as address.public; diff --git a/shield-swap-sdk/tests/fixtures/programs/shield_swap_v3.aleo b/shield-swap-sdk/tests/fixtures/programs/shield_swap_v3.aleo deleted file mode 100644 index b9340846..00000000 --- a/shield-swap-sdk/tests/fixtures/programs/shield_swap_v3.aleo +++ /dev/null @@ -1,6439 +0,0 @@ -// _source: aleo-viem@4a63636 packages/shield-swap/test/fixtures/programs/shield_swap_v3.aleo -import test_shield_swap_multisig_core.aleo; - -program shield_swap_v3.aleo; - -record PositionNFT: - owner as address.private; - token_id as field.private; - token0_id as field.private; - token1_id as field.private; - pool as field.private; - tick_lower as i32.private; - tick_upper as i32.private; - -struct SwapRequest: - pool as field; - zero_for_one as boolean; - amount_in as u128; - amount_out_min as u128; - sqrt_price_limit as u128; - recipient as address; - nonce as u64; - deadline as u32; - -record SwapComplianceRecord: - owner as address.private; - swap_id as field.private; - token_in as field.private; - token_out as field.private; - request as SwapRequest.private; - caller as address.private; - blinded_address as address.private; - -struct SwapHop: - pool as field; - zero_for_one as boolean; - sqrt_price_limit as u128; - -struct SwapMultiHopRequest: - token_in as field; - token_out as field; - amount_in as u128; - amount_out_min as u128; - recipient as address; - hop0 as SwapHop; - hop1 as SwapHop; - hop2 as SwapHop; - hop_count as u8; - nonce as u64; - deadline as u32; - caller as address; - -record MultiHopSwapComplianceRecord: - owner as address.private; - swap_id as field.private; - request as SwapMultiHopRequest.private; - caller as address.private; - blinded_address as address.private; - -struct MintPositionRequest: - pool as field; - tick_lower as i32; - tick_upper as i32; - amount0_desired as u128; - amount1_desired as u128; - amount0_min as u128; - amount1_min as u128; - tick_lower_hint as i32; - tick_upper_hint as i32; - -record MintComplianceRecord: - owner as address.private; - token_id as field.private; - token0_id as field.private; - token1_id as field.private; - request as MintPositionRequest.private; - caller as address.private; - recipient as address.private; - -struct ChecksumEdition: - checksum as [u8; 32u32]; - edition as u16; - -struct PoolState: - token0 as field; - token1 as field; - fee as u16; - enabled as boolean; - scale0 as u128; - scale1 as u128; - -struct Slot: - tick as i32; - tick_spacing as u32; - sqrt_price as u128; - fee_protocol as u8; - liquidity as u128; - fee_growth_global0_x_64 as u128; - fee_growth_global1_x_64 as u128; - fee_residual0_x_64 as u128; - fee_residual1_x_64 as u128; - max_liquidity_per_tick as u128; - protocol_fees0 as u128; - protocol_fees1 as u128; - next_init_below as i32; - next_init_above as i32; - -struct Tick: - pool as field; - liquidity_net as i128; - liquidity_gross as u128; - tick as i32; - fee_growth_outside0_64 as u128; - fee_growth_outside1_64 as u128; - prev as i32; - next as i32; - -struct Position: - token_id as field; - pool as field; - tick_lower as i32; - tick_upper as i32; - liquidity as u128; - fee_growth_inside0_last_64 as u128; - fee_growth_inside1_last_64 as u128; - tokens_owed0 as u128; - tokens_owed1 as u128; - -struct PoolKey: - token0 as field; - token1 as field; - fee as u16; - -struct PairKey: - token0 as field; - token1 as field; - -struct TickKey: - pool as field; - tick as i32; - -struct SwapKey: - pool as field; - zero_for_one as boolean; - amount_in as u128; - sqrt_price_limit as u128; - recipient as address; - nonce as u64; - caller as address; - -struct TokenIDPreimage: - request as MintPositionRequest; - recipient as address; - nonce as field; - -struct SwapIterCfg: - z as boolean; - lim as u128; - fee_pips as u32; - fee_protocol as u8; - slot_fg0 as u128; - slot_fg1 as u128; - -struct SwapIterState: - sp as u128; - rem as u128; - out as u128; - fg as u128; - liq as u128; - tk as i32; - crossed as boolean; - pf as u128; - nb as i32; - na as i32; - resid as u128; - -struct SwapOutput: - recipient as address; - caller as address; - token_in as field; - token_out as field; - amount_out as u128; - amount_remaining as u128; - token_in_1 as field; - amount_remaining_1 as u128; - token_in_2 as field; - amount_remaining_2 as u128; - -mapping pools: - key as field.public; - value as PoolState.public; - -mapping slots: - key as field.public; - value as Slot.public; - -mapping ticks: - key as field.public; - value as Tick.public; - -mapping initialized_pools: - key as field.public; - value as boolean.public; - -mapping tick_spacings: - key as u32.public; - value as boolean.public; - -mapping fee_tiers: - key as u16.public; - value as boolean.public; - -mapping fee_to_tick_spacing: - key as u16.public; - value as u32.public; - -mapping positions: - key as field.public; - value as Position.public; - -mapping swap_outputs: - key as field.public; - value as SwapOutput.public; - -mapping admin: - key as boolean.public; - value as address.public; - -mapping pending_admin: - key as boolean.public; - value as address.public; - -mapping used_blinded_addresses: - key as address.public; - value as boolean.public; - -mapping token_decimals: - key as field.public; - value as u8.public; - -mapping pool_creation_is_open: - key as boolean.public; - value as boolean.public; - -mapping global_paused: - key as boolean.public; - value as boolean.public; - -mapping token_allowed: - key as field.public; - value as boolean.public; - -mapping token_paused: - key as field.public; - value as boolean.public; - -mapping pair_paused: - key as PairKey.public; - value as boolean.public; - -mapping frozen_position: - key as field.public; - value as u32.public; - -function transfer_admin: - input r0 as address.public; - async transfer_admin self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/transfer_admin.future; - -finalize transfer_admin: - input r0 as address.public; - input r1 as address.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - set r1 into pending_admin[true]; - -function accept_admin: - async accept_admin self.caller into r0; - output r0 as shield_swap_v3.aleo/accept_admin.future; - -finalize accept_admin: - input r0 as address.public; - get pending_admin[true] into r1; - is.eq r0 r1 into r2; - assert.eq r2 true; - set r0 into admin[true]; - remove pending_admin[true]; - -function add_tick_spacing: - input r0 as u32.public; - async add_tick_spacing self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/add_tick_spacing.future; - -finalize add_tick_spacing: - input r0 as address.public; - input r1 as u32.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - gt r1 0u32 into r4; - assert.eq r4 true; - lte r1 400000u32 into r5; - assert.eq r5 true; - set true into tick_spacings[r1]; - -function add_fee_tier: - input r0 as u16.public; - async add_fee_tier self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/add_fee_tier.future; - -finalize add_fee_tier: - input r0 as address.public; - input r1 as u16.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - set true into fee_tiers[r1]; - -function bind_fee_to_tick_spacing: - input r0 as u16.public; - input r1 as u32.public; - async bind_fee_to_tick_spacing self.caller r0 r1 into r2; - output r2 as shield_swap_v3.aleo/bind_fee_to_tick_spacing.future; - -finalize bind_fee_to_tick_spacing: - input r0 as address.public; - input r1 as u16.public; - input r2 as u32.public; - get admin[true] into r3; - is.eq r0 r3 into r4; - assert.eq r4 true; - get.or_use fee_tiers[r1] false into r5; - assert.eq r5 true; - get.or_use tick_spacings[r2] false into r6; - assert.eq r6 true; - set r2 into fee_to_tick_spacing[r1]; - -function set_token_decimals: - input r0 as field.public; - input r1 as u8.public; - async set_token_decimals self.caller r1 r0 into r2; - output r2 as shield_swap_v3.aleo/set_token_decimals.future; - -finalize set_token_decimals: - input r0 as address.public; - input r1 as u8.public; - input r2 as field.public; - get admin[true] into r3; - is.eq r0 r3 into r4; - assert.eq r4 true; - lte r1 18u8 into r5; - assert.eq r5 true; - contains token_decimals[r2] into r6; - not r6 into r7; - assert.eq r7 true; - set r1 into token_decimals[r2]; - -function set_pool_enabled: - input r0 as field.public; - input r1 as boolean.public; - async set_pool_enabled self.caller r0 r1 into r2; - output r2 as shield_swap_v3.aleo/set_pool_enabled.future; - -finalize set_pool_enabled: - input r0 as address.public; - input r1 as field.public; - input r2 as boolean.public; - get admin[true] into r3; - is.eq r0 r3 into r4; - assert.eq r4 true; - get pools[r1] into r5; - cast r5.token0 r5.token1 r5.fee r2 r5.scale0 r5.scale1 into r6 as PoolState; - set r6 into pools[r1]; - -function set_pool_creation_is_open: - input r0 as boolean.public; - async set_pool_creation_is_open self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/set_pool_creation_is_open.future; - -finalize set_pool_creation_is_open: - input r0 as address.public; - input r1 as boolean.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - set r1 into pool_creation_is_open[true]; - -function set_global_paused: - input r0 as boolean.public; - async set_global_paused self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/set_global_paused.future; - -finalize set_global_paused: - input r0 as address.public; - input r1 as boolean.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - set r1 into global_paused[true]; - -function allow_token: - input r0 as field.public; - async allow_token self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/allow_token.future; - -finalize allow_token: - input r0 as address.public; - input r1 as field.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - set true into token_allowed[r1]; - -function set_token_paused: - input r0 as field.public; - input r1 as boolean.public; - async set_token_paused self.caller r0 r1 into r2; - output r2 as shield_swap_v3.aleo/set_token_paused.future; - -finalize set_token_paused: - input r0 as address.public; - input r1 as field.public; - input r2 as boolean.public; - get admin[true] into r3; - is.eq r0 r3 into r4; - assert.eq r4 true; - set r2 into token_paused[r1]; - -function set_pair_paused: - input r0 as field.public; - input r1 as field.public; - input r2 as boolean.public; - lt r0 r1 into r3; - ternary r3 r0 r1 into r4; - ternary r3 r1 r0 into r5; - cast r4 r5 into r6 as PairKey; - async set_pair_paused self.caller r6 r2 into r7; - output r7 as shield_swap_v3.aleo/set_pair_paused.future; - -finalize set_pair_paused: - input r0 as address.public; - input r1 as PairKey.public; - input r2 as boolean.public; - get admin[true] into r3; - is.eq r0 r3 into r4; - assert.eq r4 true; - set r2 into pair_paused[r1]; - -view view_sqrt_price_at_tick: - input r0 as i32.public; - gte r0 -873409i32 into r1; - lte r0 873409i32 into r2; - and r1 r2 into r3; - assert.eq r3 true; - lt r0 0i32 into r4; - sub 0i32 r0 into r5; - ternary r4 r5 r0 into r6; - gte r6 0i32 into r7; - assert.eq r7 true; - cast r6 into r8 as u32; - and r8 3u32 into r9; - is.eq r9 0u32 into r10; - is.eq r9 1u32 into r11; - is.eq r9 2u32 into r12; - ternary r12 9222449791875588096u128 9221988703967300608u128 into r13; - ternary r11 9222910902837697536u128 r13 into r14; - ternary r10 9223372036854775808u128 r14 into r15; - and r8 4u32 into r16; - is.neq r16 0u32 into r17; - mul r15 9221527639111677952u128 into r18; - shr r18 63u8 into r19; - ternary r17 r19 r15 into r20; - and r8 8u32 into r21; - is.neq r21 0u32 into r22; - mul r20 9219683610192801792u128 into r23; - shr r23 63u8 into r24; - ternary r22 r24 r20 into r25; - and r8 16u32 into r26; - is.neq r26 0u32 into r27; - mul r25 9215996658532725760u128 into r28; - shr r28 63u8 into r29; - ternary r27 r29 r25 into r30; - and r8 32u32 into r31; - is.neq r31 0u32 into r32; - mul r30 9208627177859081216u128 into r33; - shr r33 63u8 into r34; - ternary r32 r34 r30 into r35; - and r8 64u32 into r36; - is.neq r36 0u32 into r37; - mul r35 9193905890596798464u128 into r38; - shr r38 63u8 into r39; - ternary r37 r39 r35 into r40; - and r8 128u32 into r41; - is.neq r41 0u32 into r42; - mul r40 9164533880601766912u128 into r43; - shr r43 63u8 into r44; - ternary r42 r44 r40 into r45; - and r8 256u32 into r46; - is.neq r46 0u32 into r47; - mul r45 9106071067403056128u128 into r48; - shr r48 63u8 into r49; - ternary r47 r49 r45 into r50; - and r8 512u32 into r51; - is.neq r51 0u32 into r52; - mul r50 8990261907820801024u128 into r53; - shr r53 63u8 into r54; - ternary r52 r54 r50 into r55; - and r8 1024u32 into r56; - is.neq r56 0u32 into r57; - mul r55 8763043369415622656u128 into r58; - shr r58 63u8 into r59; - ternary r57 r59 r55 into r60; - and r8 2048u32 into r61; - is.neq r61 0u32 into r62; - mul r60 8325689215117605888u128 into r63; - shr r63 63u8 into r64; - ternary r62 r64 r60 into r65; - and r8 4096u32 into r66; - is.neq r66 0u32 into r67; - mul r65 7515375139346884608u128 into r68; - shr r68 63u8 into r69; - ternary r67 r69 r65 into r70; - and r8 8192u32 into r71; - is.neq r71 0u32 into r72; - mul r70 6123667489441693696u128 into r73; - shr r73 63u8 into r74; - ternary r72 r74 r70 into r75; - and r8 16384u32 into r76; - is.neq r76 0u32 into r77; - mul r75 4065682634442729984u128 into r78; - shr r78 63u8 into r79; - ternary r77 r79 r75 into r80; - and r8 32768u32 into r81; - is.neq r81 0u32 into r82; - mul r80 1792161827361994496u128 into r83; - shr r83 63u8 into r84; - ternary r82 r84 r80 into r85; - and r8 65536u32 into r86; - is.neq r86 0u32 into r87; - mul r85 348228825923923264u128 into r88; - shr r88 63u8 into r89; - ternary r87 r89 r85 into r90; - and r8 131072u32 into r91; - is.neq r91 0u32 into r92; - mul r90 13147394978735516u128 into r93; - shr r93 63u8 into r94; - ternary r92 r94 r90 into r95; - and r8 262144u32 into r96; - is.neq r96 0u32 into r97; - mul r95 18740867660568u128 into r98; - shr r98 63u8 into r99; - ternary r97 r99 r95 into r100; - and r8 524288u32 into r101; - is.neq r101 0u32 into r102; - mul r100 38079361u128 into r103; - shr r103 63u8 into r104; - ternary r102 r104 r100 into r105; - gt r0 0i32 into r106; - div 85070591730234615865843651857942052864u128 r105 into r107; - ternary r106 r107 r105 into r108; - output r108 as u128.public; - -view view_amounts_for_liquidity: - input r0 as u128.public; - input r1 as u128.public; - input r2 as u128.public; - input r3 as u128.public; - input r4 as boolean.public; - gt r1 r2 into r5; - ternary r5 r2 r1 into r6; - ternary r5 r1 r2 into r7; - lte r0 r6 into r8; - gt r6 r7 into r9; - ternary r9 r7 r6 into r10; - ternary r9 r6 r7 into r11; - and r3 18446744073709551615u128 into r12; - shr r3 64u8 into r13; - mul r12 9223372036854775808u128 into r14; - mul r13 9223372036854775808u128 into r15; - and r14 18446744073709551615u128 into r16; - shr r14 64u8 into r17; - and r15 18446744073709551615u128 into r18; - add r17 r18 into r19; - and r19 18446744073709551615u128 into r20; - shr r19 64u8 into r21; - shr r15 64u8 into r22; - add r22 r21 into r23; - and r23 18446744073709551615u128 into r24; - shr r23 64u8 into r25; - shl r20 64u8 into r26; - add r26 r16 into r27; - shl r25 64u8 into r28; - add r28 r24 into r29; - lt r29 r10 into r30; - assert.eq r30 true; - shr r27 96u8 into r31; - and r31 4294967295u128 into r32; - shl r29 32u8 into r33; - add r33 r32 into r34; - div r34 r10 into r35; - rem r34 r10 into r36; - shr r27 64u8 into r37; - and r37 4294967295u128 into r38; - shl r36 32u8 into r39; - add r39 r38 into r40; - shl r35 32u8 into r41; - div r40 r10 into r42; - add r41 r42 into r43; - rem r40 r10 into r44; - shr r27 32u8 into r45; - and r45 4294967295u128 into r46; - shl r44 32u8 into r47; - add r47 r46 into r48; - shl r43 32u8 into r49; - div r48 r10 into r50; - add r49 r50 into r51; - rem r48 r10 into r52; - shr r27 0u8 into r53; - and r53 4294967295u128 into r54; - shl r52 32u8 into r55; - add r55 r54 into r56; - shl r51 32u8 into r57; - div r56 r10 into r58; - add r57 r58 into r59; - rem r56 r10 into r60; - gt r60 0u128 into r61; - and r4 r61 into r62; - add r59 1u128 into r63; - ternary r62 r63 r59 into r64; - not r4 into r65; - add r17 r18 into r66; - and r66 18446744073709551615u128 into r67; - shr r66 64u8 into r68; - add r22 r68 into r69; - and r69 18446744073709551615u128 into r70; - shr r69 64u8 into r71; - shl r67 64u8 into r72; - add r72 r16 into r73; - shl r71 64u8 into r74; - add r74 r70 into r75; - lt r75 r11 into r76; - assert.eq r76 true; - shr r73 96u8 into r77; - and r77 4294967295u128 into r78; - shl r75 32u8 into r79; - add r79 r78 into r80; - div r80 r11 into r81; - rem r80 r11 into r82; - shr r73 64u8 into r83; - and r83 4294967295u128 into r84; - shl r82 32u8 into r85; - add r85 r84 into r86; - shl r81 32u8 into r87; - div r86 r11 into r88; - add r87 r88 into r89; - rem r86 r11 into r90; - shr r73 32u8 into r91; - and r91 4294967295u128 into r92; - shl r90 32u8 into r93; - add r93 r92 into r94; - shl r89 32u8 into r95; - div r94 r11 into r96; - add r95 r96 into r97; - rem r94 r11 into r98; - shr r73 0u8 into r99; - and r99 4294967295u128 into r100; - shl r98 32u8 into r101; - add r101 r100 into r102; - shl r97 32u8 into r103; - div r102 r11 into r104; - add r103 r104 into r105; - rem r102 r11 into r106; - gt r106 0u128 into r107; - and r65 r107 into r108; - add r105 1u128 into r109; - ternary r108 r109 r105 into r110; - gte r64 r110 into r111; - ternary r111 r64 r110 into r112; - ternary r111 r110 r64 into r113; - sub r112 r113 into r114; - ternary r111 r114 0u128 into r115; - lt r0 r7 into r116; - gt r0 r7 into r117; - ternary r117 r7 r0 into r118; - ternary r117 r0 r7 into r119; - shl r71 64u8 into r120; - add r120 r70 into r121; - lt r121 r118 into r122; - assert.eq r122 true; - shl r121 32u8 into r123; - add r123 r78 into r124; - div r124 r118 into r125; - rem r124 r118 into r126; - shl r126 32u8 into r127; - add r127 r84 into r128; - shl r125 32u8 into r129; - div r128 r118 into r130; - add r129 r130 into r131; - rem r128 r118 into r132; - shl r132 32u8 into r133; - add r133 r92 into r134; - shl r131 32u8 into r135; - div r134 r118 into r136; - add r135 r136 into r137; - rem r134 r118 into r138; - shl r138 32u8 into r139; - add r139 r100 into r140; - shl r137 32u8 into r141; - div r140 r118 into r142; - add r141 r142 into r143; - rem r140 r118 into r144; - gt r144 0u128 into r145; - and r4 r145 into r146; - add r143 1u128 into r147; - ternary r146 r147 r143 into r148; - lt r121 r119 into r149; - assert.eq r149 true; - shl r121 32u8 into r150; - add r150 r78 into r151; - div r151 r119 into r152; - rem r151 r119 into r153; - shl r153 32u8 into r154; - add r154 r84 into r155; - shl r152 32u8 into r156; - div r155 r119 into r157; - add r156 r157 into r158; - rem r155 r119 into r159; - shl r159 32u8 into r160; - add r160 r92 into r161; - shl r158 32u8 into r162; - div r161 r119 into r163; - add r162 r163 into r164; - rem r161 r119 into r165; - shl r165 32u8 into r166; - add r166 r100 into r167; - shl r164 32u8 into r168; - div r167 r119 into r169; - add r168 r169 into r170; - rem r167 r119 into r171; - gt r171 0u128 into r172; - and r65 r172 into r173; - add r170 1u128 into r174; - ternary r173 r174 r170 into r175; - gte r148 r175 into r176; - ternary r176 r148 r175 into r177; - ternary r176 r175 r148 into r178; - sub r177 r178 into r179; - ternary r176 r179 0u128 into r180; - gt r6 r0 into r181; - ternary r181 r0 r6 into r182; - ternary r181 r6 r0 into r183; - sub r183 r182 into r184; - and r184 18446744073709551615u128 into r185; - shr r184 64u8 into r186; - mul r12 r185 into r187; - mul r12 r186 into r188; - mul r13 r185 into r189; - mul r13 r186 into r190; - and r187 18446744073709551615u128 into r191; - shr r187 64u8 into r192; - and r188 18446744073709551615u128 into r193; - add r192 r193 into r194; - and r189 18446744073709551615u128 into r195; - add r194 r195 into r196; - and r196 18446744073709551615u128 into r197; - shr r196 64u8 into r198; - shr r188 64u8 into r199; - shr r189 64u8 into r200; - add r199 r200 into r201; - and r190 18446744073709551615u128 into r202; - add r201 r202 into r203; - add r203 r198 into r204; - and r204 18446744073709551615u128 into r205; - shr r204 64u8 into r206; - shr r190 64u8 into r207; - add r207 r206 into r208; - shl r197 64u8 into r209; - add r209 r191 into r210; - shl r208 64u8 into r211; - add r211 r205 into r212; - shl r212 65u8 into r213; - shr r210 63u8 into r214; - add r213 r214 into r215; - and r210 9223372036854775807u128 into r216; - gt r216 0u128 into r217; - and r4 r217 into r218; - add r215 1u128 into r219; - ternary r218 r219 r215 into r220; - gt r6 r7 into r221; - ternary r221 r7 r6 into r222; - ternary r221 r6 r7 into r223; - sub r223 r222 into r224; - and r224 18446744073709551615u128 into r225; - shr r224 64u8 into r226; - mul r12 r225 into r227; - mul r12 r226 into r228; - mul r13 r225 into r229; - mul r13 r226 into r230; - and r227 18446744073709551615u128 into r231; - shr r227 64u8 into r232; - and r228 18446744073709551615u128 into r233; - add r232 r233 into r234; - and r229 18446744073709551615u128 into r235; - add r234 r235 into r236; - and r236 18446744073709551615u128 into r237; - shr r236 64u8 into r238; - shr r228 64u8 into r239; - shr r229 64u8 into r240; - add r239 r240 into r241; - and r230 18446744073709551615u128 into r242; - add r241 r242 into r243; - add r243 r238 into r244; - and r244 18446744073709551615u128 into r245; - shr r244 64u8 into r246; - shr r230 64u8 into r247; - add r247 r246 into r248; - shl r237 64u8 into r249; - add r249 r231 into r250; - shl r248 64u8 into r251; - add r251 r245 into r252; - shl r252 65u8 into r253; - shr r250 63u8 into r254; - add r253 r254 into r255; - and r250 9223372036854775807u128 into r256; - gt r256 0u128 into r257; - and r4 r257 into r258; - add r255 1u128 into r259; - ternary r258 r259 r255 into r260; - ternary r116 r180 0u128 into r261; - ternary r116 r220 r260 into r262; - ternary r8 r115 r261 into r263; - ternary r8 0u128 r262 into r264; - output r263 as u128.public; - output r264 as u128.public; - -function freeze_position: - input r0 as field.public; - async freeze_position self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/freeze_position.future; - -finalize freeze_position: - input r0 as address.public; - input r1 as field.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - contains positions[r1] into r4; - assert.eq r4 true; - contains frozen_position[r1] into r5; - not r5 into r6; - assert.eq r6 true; - get positions[r1] into r7; - gt r7.liquidity 0u128 into r8; - branch.eq r8 false to end_then_0_0; - get positions[r1] into r9; - get slots[r9.pool] into r10; - call view_sqrt_price_at_tick r9.tick_lower into r11; - call view_sqrt_price_at_tick r9.tick_upper into r12; - call view_amounts_for_liquidity r10.sqrt_price r11 r12 r7.liquidity false into r13 r14; - cast r9.pool r9.tick_lower into r15 as TickKey; - hash.bhp256 r15 into r16 as field; - cast r9.pool r9.tick_upper into r17 as TickKey; - hash.bhp256 r17 into r18 as field; - get ticks[r16] into r19; - get ticks[r18] into r20; - gt r19.liquidity_gross 0u128 into r21; - gt r20.liquidity_gross 0u128 into r22; - sub r19.liquidity_gross r7.liquidity into r23; - sub r20.liquidity_gross r7.liquidity into r24; - is.eq r23 0u128 into r25; - and r21 r25 into r26; - is.eq r24 0u128 into r27; - and r22 r27 into r28; - cast r7.liquidity into r29 as i128; - sub r19.liquidity_net r29 into r30; - cast r19.pool r30 r23 r19.tick r19.fee_growth_outside0_64 r19.fee_growth_outside1_64 r19.prev r19.next into r31 as Tick; - set r31 into ticks[r16]; - branch.eq r26 false to end_then_1_2; - cast r9.pool r19.prev into r32 as TickKey; - hash.bhp256 r32 into r33 as field; - get ticks[r33] into r34; - cast r34.pool r34.liquidity_net r34.liquidity_gross r34.tick r34.fee_growth_outside0_64 r34.fee_growth_outside1_64 r34.prev r19.next into r35 as Tick; - set r35 into ticks[r33]; - cast r9.pool r19.next into r36 as TickKey; - hash.bhp256 r36 into r37 as field; - get ticks[r37] into r38; - cast r38.pool r38.liquidity_net r38.liquidity_gross r38.tick r38.fee_growth_outside0_64 r38.fee_growth_outside1_64 r19.prev r38.next into r39 as Tick; - set r39 into ticks[r37]; - branch.eq true true to end_otherwise_1_3; - position end_then_1_2; - position end_otherwise_1_3; - get ticks[r18] into r40; - cast r7.liquidity into r41 as i128; - add r40.liquidity_net r41 into r42; - cast r40.pool r42 r24 r40.tick r40.fee_growth_outside0_64 r40.fee_growth_outside1_64 r40.prev r40.next into r43 as Tick; - set r43 into ticks[r18]; - branch.eq r28 false to end_then_1_4; - cast r9.pool r40.prev into r44 as TickKey; - hash.bhp256 r44 into r45 as field; - get ticks[r45] into r46; - cast r46.pool r46.liquidity_net r46.liquidity_gross r46.tick r46.fee_growth_outside0_64 r46.fee_growth_outside1_64 r46.prev r40.next into r47 as Tick; - set r47 into ticks[r45]; - cast r9.pool r40.next into r48 as TickKey; - hash.bhp256 r48 into r49 as field; - get ticks[r49] into r50; - cast r50.pool r50.liquidity_net r50.liquidity_gross r50.tick r50.fee_growth_outside0_64 r50.fee_growth_outside1_64 r40.prev r50.next into r51 as Tick; - set r51 into ticks[r49]; - branch.eq true true to end_otherwise_1_5; - position end_then_1_4; - position end_otherwise_1_5; - get ticks[r16] into r52; - get ticks[r18] into r53; - gte r10.tick r52.tick into r54; - gte r10.fee_growth_global0_x_64 r52.fee_growth_outside0_64 into r55; - ternary r55 r10.fee_growth_global0_x_64 r52.fee_growth_outside0_64 into r56; - ternary r55 r52.fee_growth_outside0_64 r10.fee_growth_global0_x_64 into r57; - sub r56 r57 into r58; - gt r58 0u128 into r59; - ternary r59 r58 1u128 into r60; - sub 340282366920938463463374607431768211455u128 r60 into r61; - add r61 1u128 into r62; - ternary r55 r58 r62 into r63; - gte r10.fee_growth_global1_x_64 r52.fee_growth_outside1_64 into r64; - ternary r64 r10.fee_growth_global1_x_64 r52.fee_growth_outside1_64 into r65; - ternary r64 r52.fee_growth_outside1_64 r10.fee_growth_global1_x_64 into r66; - sub r65 r66 into r67; - gt r67 0u128 into r68; - ternary r68 r67 1u128 into r69; - sub 340282366920938463463374607431768211455u128 r69 into r70; - add r70 1u128 into r71; - ternary r64 r67 r71 into r72; - ternary r54 r52.fee_growth_outside0_64 r63 into r73; - ternary r54 r52.fee_growth_outside1_64 r72 into r74; - lt r10.tick r53.tick into r75; - gte r10.fee_growth_global0_x_64 r53.fee_growth_outside0_64 into r76; - ternary r76 r10.fee_growth_global0_x_64 r53.fee_growth_outside0_64 into r77; - ternary r76 r53.fee_growth_outside0_64 r10.fee_growth_global0_x_64 into r78; - sub r77 r78 into r79; - gt r79 0u128 into r80; - ternary r80 r79 1u128 into r81; - sub 340282366920938463463374607431768211455u128 r81 into r82; - add r82 1u128 into r83; - ternary r76 r79 r83 into r84; - gte r10.fee_growth_global1_x_64 r53.fee_growth_outside1_64 into r85; - ternary r85 r10.fee_growth_global1_x_64 r53.fee_growth_outside1_64 into r86; - ternary r85 r53.fee_growth_outside1_64 r10.fee_growth_global1_x_64 into r87; - sub r86 r87 into r88; - gt r88 0u128 into r89; - ternary r89 r88 1u128 into r90; - sub 340282366920938463463374607431768211455u128 r90 into r91; - add r91 1u128 into r92; - ternary r85 r88 r92 into r93; - ternary r75 r53.fee_growth_outside0_64 r84 into r94; - ternary r75 r53.fee_growth_outside1_64 r93 into r95; - gte r10.fee_growth_global0_x_64 r73 into r96; - ternary r96 r10.fee_growth_global0_x_64 r73 into r97; - ternary r96 r73 r10.fee_growth_global0_x_64 into r98; - sub r97 r98 into r99; - gt r99 0u128 into r100; - ternary r100 r99 1u128 into r101; - sub 340282366920938463463374607431768211455u128 r101 into r102; - add r102 1u128 into r103; - ternary r96 r99 r103 into r104; - gte r104 r94 into r105; - ternary r105 r104 r94 into r106; - ternary r105 r94 r104 into r107; - sub r106 r107 into r108; - gt r108 0u128 into r109; - ternary r109 r108 1u128 into r110; - sub 340282366920938463463374607431768211455u128 r110 into r111; - add r111 1u128 into r112; - ternary r105 r108 r112 into r113; - gte r10.fee_growth_global1_x_64 r74 into r114; - ternary r114 r10.fee_growth_global1_x_64 r74 into r115; - ternary r114 r74 r10.fee_growth_global1_x_64 into r116; - sub r115 r116 into r117; - gt r117 0u128 into r118; - ternary r118 r117 1u128 into r119; - sub 340282366920938463463374607431768211455u128 r119 into r120; - add r120 1u128 into r121; - ternary r114 r117 r121 into r122; - gte r122 r95 into r123; - ternary r123 r122 r95 into r124; - ternary r123 r95 r122 into r125; - sub r124 r125 into r126; - gt r126 0u128 into r127; - ternary r127 r126 1u128 into r128; - sub 340282366920938463463374607431768211455u128 r128 into r129; - add r129 1u128 into r130; - ternary r123 r126 r130 into r131; - gte r113 r9.fee_growth_inside0_last_64 into r132; - ternary r132 r113 r9.fee_growth_inside0_last_64 into r133; - ternary r132 r9.fee_growth_inside0_last_64 r113 into r134; - sub r133 r134 into r135; - gt r135 0u128 into r136; - ternary r136 r135 1u128 into r137; - sub 340282366920938463463374607431768211455u128 r137 into r138; - add r138 1u128 into r139; - ternary r132 r135 r139 into r140; - and r140 18446744073709551615u128 into r141; - shr r140 64u8 into r142; - and r9.liquidity 18446744073709551615u128 into r143; - shr r9.liquidity 64u8 into r144; - mul r141 r143 into r145; - mul r141 r144 into r146; - mul r142 r143 into r147; - mul r142 r144 into r148; - and r145 18446744073709551615u128 into r149; - shr r145 64u8 into r150; - and r146 18446744073709551615u128 into r151; - add r150 r151 into r152; - and r147 18446744073709551615u128 into r153; - add r152 r153 into r154; - and r154 18446744073709551615u128 into r155; - shr r154 64u8 into r156; - shr r146 64u8 into r157; - shr r147 64u8 into r158; - add r157 r158 into r159; - and r148 18446744073709551615u128 into r160; - add r159 r160 into r161; - add r161 r156 into r162; - and r162 18446744073709551615u128 into r163; - shr r162 64u8 into r164; - shr r148 64u8 into r165; - add r165 r164 into r166; - shl r155 64u8 into r167; - add r167 r149 into r168; - shl r166 64u8 into r169; - add r169 r163 into r170; - shl r170 65u8 into r171; - shr r168 63u8 into r172; - add r171 r172 into r173; - add r9.tokens_owed0 r173 into r174; - add r174 r13 into r175; - gte r131 r9.fee_growth_inside1_last_64 into r176; - ternary r176 r131 r9.fee_growth_inside1_last_64 into r177; - ternary r176 r9.fee_growth_inside1_last_64 r131 into r178; - sub r177 r178 into r179; - gt r179 0u128 into r180; - ternary r180 r179 1u128 into r181; - sub 340282366920938463463374607431768211455u128 r181 into r182; - add r182 1u128 into r183; - ternary r176 r179 r183 into r184; - and r184 18446744073709551615u128 into r185; - shr r184 64u8 into r186; - and r9.liquidity 18446744073709551615u128 into r187; - shr r9.liquidity 64u8 into r188; - mul r185 r187 into r189; - mul r185 r188 into r190; - mul r186 r187 into r191; - mul r186 r188 into r192; - and r189 18446744073709551615u128 into r193; - shr r189 64u8 into r194; - and r190 18446744073709551615u128 into r195; - add r194 r195 into r196; - and r191 18446744073709551615u128 into r197; - add r196 r197 into r198; - and r198 18446744073709551615u128 into r199; - shr r198 64u8 into r200; - shr r190 64u8 into r201; - shr r191 64u8 into r202; - add r201 r202 into r203; - and r192 18446744073709551615u128 into r204; - add r203 r204 into r205; - add r205 r200 into r206; - and r206 18446744073709551615u128 into r207; - shr r206 64u8 into r208; - shr r192 64u8 into r209; - add r209 r208 into r210; - shl r199 64u8 into r211; - add r211 r193 into r212; - shl r210 64u8 into r213; - add r213 r207 into r214; - shl r214 65u8 into r215; - shr r212 63u8 into r216; - add r215 r216 into r217; - add r9.tokens_owed1 r217 into r218; - add r218 r14 into r219; - sub r9.liquidity r7.liquidity into r220; - cast r1 r9.pool r9.tick_lower r9.tick_upper r220 r113 r131 r175 r219 into r221 as Position; - set r221 into positions[r1]; - is.eq r10.next_init_below r9.tick_lower into r222; - and r26 r222 into r223; - ternary r223 r19.prev r10.next_init_below into r224; - is.eq r10.next_init_above r9.tick_lower into r225; - and r26 r225 into r226; - ternary r226 r19.next r10.next_init_above into r227; - is.eq r224 r9.tick_upper into r228; - and r28 r228 into r229; - ternary r229 r40.prev r224 into r230; - is.eq r227 r9.tick_upper into r231; - and r28 r231 into r232; - ternary r232 r40.next r227 into r233; - gte r10.tick r9.tick_lower into r234; - lt r10.tick r9.tick_upper into r235; - and r234 r235 into r236; - ternary r236 r7.liquidity 0u128 into r237; - sub r10.liquidity r237 into r238; - cast r10.tick r10.tick_spacing r10.sqrt_price r10.fee_protocol r238 r10.fee_growth_global0_x_64 r10.fee_growth_global1_x_64 r10.fee_residual0_x_64 r10.fee_residual1_x_64 r10.max_liquidity_per_tick r10.protocol_fees0 r10.protocol_fees1 r230 r233 into r239 as Slot; - set r239 into slots[r9.pool]; - branch.eq r26 false to end_then_1_6; - remove ticks[r16]; - branch.eq true true to end_otherwise_1_7; - position end_then_1_6; - position end_otherwise_1_7; - branch.eq r28 false to end_then_1_8; - remove ticks[r18]; - branch.eq true true to end_otherwise_1_9; - position end_then_1_8; - position end_otherwise_1_9; - branch.eq true true to end_otherwise_0_1; - position end_then_0_0; - position end_otherwise_0_1; - set block.height into frozen_position[r1]; - -function unfreeze_position: - input r0 as field.public; - async unfreeze_position self.caller r0 into r1; - output r1 as shield_swap_v3.aleo/unfreeze_position.future; - -finalize unfreeze_position: - input r0 as address.public; - input r1 as field.public; - get admin[true] into r2; - is.eq r0 r2 into r3; - assert.eq r3 true; - contains frozen_position[r1] into r4; - assert.eq r4 true; - remove frozen_position[r1]; - -function set_fee_protocol: - input r0 as field.public; - input r1 as u8.public; - async set_fee_protocol self.caller r0 r1 into r2; - output r2 as shield_swap_v3.aleo/set_fee_protocol.future; - -finalize set_fee_protocol: - input r0 as address.public; - input r1 as field.public; - input r2 as u8.public; - get admin[true] into r3; - is.eq r0 r3 into r4; - assert.eq r4 true; - is.eq r2 0u8 into r5; - gte r2 4u8 into r6; - lte r2 10u8 into r7; - and r6 r7 into r8; - or r5 r8 into r9; - assert.eq r9 true; - get slots[r1] into r10; - cast r10.tick r10.tick_spacing r10.sqrt_price r2 r10.liquidity r10.fee_growth_global0_x_64 r10.fee_growth_global1_x_64 r10.fee_residual0_x_64 r10.fee_residual1_x_64 r10.max_liquidity_per_tick r10.protocol_fees0 r10.protocol_fees1 r10.next_init_below r10.next_init_above into r11 as Slot; - set r11 into slots[r1]; - -function collect_protocol: - input r0 as field.public; - input r1 as u128.public; - input r2 as u128.public; - input r3 as field.public; - input r4 as field.public; - input r5 as address.public; - assert.neq r5 shield_swap_v3.aleo; - call.dynamic r3 'aleo' 'transfer_public' with r5 r1 (as address.public u128.public) into r6 (as dynamic.future); - call.dynamic r4 'aleo' 'transfer_public' with r5 r2 (as address.public u128.public) into r7 (as dynamic.future); - async collect_protocol r6 r7 self.caller r0 r1 r2 r3 r4 into r8; - output r8 as shield_swap_v3.aleo/collect_protocol.future; - -finalize collect_protocol: - input r0 as dynamic.future; - input r1 as dynamic.future; - input r2 as address.public; - input r3 as field.public; - input r4 as u128.public; - input r5 as u128.public; - input r6 as field.public; - input r7 as field.public; - get admin[true] into r8; - is.eq r2 r8 into r9; - assert.eq r9 true; - get pools[r3] into r10; - is.eq r10.token0 r6 into r11; - is.eq r10.token1 r7 into r12; - and r11 r12 into r13; - assert.eq r13 true; - get slots[r3] into r14; - rem r4 r10.scale0 into r15; - is.eq r15 0u128 into r16; - rem r5 r10.scale1 into r17; - is.eq r17 0u128 into r18; - and r16 r18 into r19; - assert.eq r19 true; - div r4 r10.scale0 into r20; - div r5 r10.scale1 into r21; - lte r20 r14.protocol_fees0 into r22; - assert.eq r22 true; - lte r21 r14.protocol_fees1 into r23; - assert.eq r23 true; - await r0; - await r1; - sub r14.protocol_fees0 r20 into r24; - sub r14.protocol_fees1 r21 into r25; - cast r14.tick r14.tick_spacing r14.sqrt_price r14.fee_protocol r14.liquidity r14.fee_growth_global0_x_64 r14.fee_growth_global1_x_64 r14.fee_residual0_x_64 r14.fee_residual1_x_64 r14.max_liquidity_per_tick r24 r25 r14.next_init_below r14.next_init_above into r26 as Slot; - set r26 into slots[r3]; - -function create_pool: - input r0 as field.public; - input r1 as field.public; - input r2 as u16.public; - input r3 as u128.public; - input r4 as u32.public; - input r5 as i32.public; - lt r0 r1 into r6; - ternary r6 r0 r1 into r7; - ternary r6 r1 r0 into r8; - cast r7 r8 r2 into r9 as PoolKey; - hash.bhp256 r9 into r10 as field; - async create_pool self.caller r0 r1 r2 r3 r4 r5 into r11; - output r10 as field.public; - output self.signer as address.public; - output r11 as shield_swap_v3.aleo/create_pool.future; - -finalize create_pool: - input r0 as address.public; - input r1 as field.public; - input r2 as field.public; - input r3 as u16.public; - input r4 as u128.public; - input r5 as u32.public; - input r6 as i32.public; - get.or_use pool_creation_is_open[true] false into r7; - get admin[true] into r8; - is.eq r0 r8 into r9; - or r7 r9 into r10; - assert.eq r10 true; - get.or_use token_allowed[r1] false into r11; - assert.eq r11 true; - get.or_use token_allowed[r2] false into r12; - assert.eq r12 true; - get.or_use global_paused[true] false into r13; - not r13 into r14; - assert.eq r14 true; - get token_decimals[r1] into r15; - get token_decimals[r2] into r16; - lt r1 r2 into r17; - ternary r17 r1 r2 into r18; - ternary r17 r2 r1 into r19; - lt r1 r2 into r20; - ternary r20 r15 r16 into r21; - ternary r20 r16 r15 into r22; - gt r21 9u8 into r23; - ternary r23 r21 9u8 into r24; - sub r24 9u8 into r25; - lte r25 29u8 into r26; - assert.eq r26 true; - lt 0u8 r25 into r27; - ternary r27 10u128 1u128 into r28; - lt 1u8 r25 into r29; - mul r28 10u128 into r30; - ternary r29 r30 r28 into r31; - lt 2u8 r25 into r32; - mul r31 10u128 into r33; - ternary r32 r33 r31 into r34; - lt 3u8 r25 into r35; - mul r34 10u128 into r36; - ternary r35 r36 r34 into r37; - lt 4u8 r25 into r38; - mul r37 10u128 into r39; - ternary r38 r39 r37 into r40; - lt 5u8 r25 into r41; - mul r40 10u128 into r42; - ternary r41 r42 r40 into r43; - lt 6u8 r25 into r44; - mul r43 10u128 into r45; - ternary r44 r45 r43 into r46; - lt 7u8 r25 into r47; - mul r46 10u128 into r48; - ternary r47 r48 r46 into r49; - lt 8u8 r25 into r50; - mul r49 10u128 into r51; - ternary r50 r51 r49 into r52; - lt 9u8 r25 into r53; - mul r52 10u128 into r54; - ternary r53 r54 r52 into r55; - lt 10u8 r25 into r56; - mul r55 10u128 into r57; - ternary r56 r57 r55 into r58; - lt 11u8 r25 into r59; - mul r58 10u128 into r60; - ternary r59 r60 r58 into r61; - lt 12u8 r25 into r62; - mul r61 10u128 into r63; - ternary r62 r63 r61 into r64; - lt 13u8 r25 into r65; - mul r64 10u128 into r66; - ternary r65 r66 r64 into r67; - lt 14u8 r25 into r68; - mul r67 10u128 into r69; - ternary r68 r69 r67 into r70; - lt 15u8 r25 into r71; - mul r70 10u128 into r72; - ternary r71 r72 r70 into r73; - lt 16u8 r25 into r74; - mul r73 10u128 into r75; - ternary r74 r75 r73 into r76; - lt 17u8 r25 into r77; - mul r76 10u128 into r78; - ternary r77 r78 r76 into r79; - lt 18u8 r25 into r80; - mul r79 10u128 into r81; - ternary r80 r81 r79 into r82; - lt 19u8 r25 into r83; - mul r82 10u128 into r84; - ternary r83 r84 r82 into r85; - lt 20u8 r25 into r86; - mul r85 10u128 into r87; - ternary r86 r87 r85 into r88; - lt 21u8 r25 into r89; - mul r88 10u128 into r90; - ternary r89 r90 r88 into r91; - lt 22u8 r25 into r92; - mul r91 10u128 into r93; - ternary r92 r93 r91 into r94; - lt 23u8 r25 into r95; - mul r94 10u128 into r96; - ternary r95 r96 r94 into r97; - lt 24u8 r25 into r98; - mul r97 10u128 into r99; - ternary r98 r99 r97 into r100; - lt 25u8 r25 into r101; - mul r100 10u128 into r102; - ternary r101 r102 r100 into r103; - lt 26u8 r25 into r104; - mul r103 10u128 into r105; - ternary r104 r105 r103 into r106; - lt 27u8 r25 into r107; - mul r106 10u128 into r108; - ternary r107 r108 r106 into r109; - lt 28u8 r25 into r110; - mul r109 10u128 into r111; - ternary r110 r111 r109 into r112; - gt r22 9u8 into r113; - ternary r113 r22 9u8 into r114; - sub r114 9u8 into r115; - lte r115 29u8 into r116; - assert.eq r116 true; - lt 0u8 r115 into r117; - ternary r117 10u128 1u128 into r118; - lt 1u8 r115 into r119; - mul r118 10u128 into r120; - ternary r119 r120 r118 into r121; - lt 2u8 r115 into r122; - mul r121 10u128 into r123; - ternary r122 r123 r121 into r124; - lt 3u8 r115 into r125; - mul r124 10u128 into r126; - ternary r125 r126 r124 into r127; - lt 4u8 r115 into r128; - mul r127 10u128 into r129; - ternary r128 r129 r127 into r130; - lt 5u8 r115 into r131; - mul r130 10u128 into r132; - ternary r131 r132 r130 into r133; - lt 6u8 r115 into r134; - mul r133 10u128 into r135; - ternary r134 r135 r133 into r136; - lt 7u8 r115 into r137; - mul r136 10u128 into r138; - ternary r137 r138 r136 into r139; - lt 8u8 r115 into r140; - mul r139 10u128 into r141; - ternary r140 r141 r139 into r142; - lt 9u8 r115 into r143; - mul r142 10u128 into r144; - ternary r143 r144 r142 into r145; - lt 10u8 r115 into r146; - mul r145 10u128 into r147; - ternary r146 r147 r145 into r148; - lt 11u8 r115 into r149; - mul r148 10u128 into r150; - ternary r149 r150 r148 into r151; - lt 12u8 r115 into r152; - mul r151 10u128 into r153; - ternary r152 r153 r151 into r154; - lt 13u8 r115 into r155; - mul r154 10u128 into r156; - ternary r155 r156 r154 into r157; - lt 14u8 r115 into r158; - mul r157 10u128 into r159; - ternary r158 r159 r157 into r160; - lt 15u8 r115 into r161; - mul r160 10u128 into r162; - ternary r161 r162 r160 into r163; - lt 16u8 r115 into r164; - mul r163 10u128 into r165; - ternary r164 r165 r163 into r166; - lt 17u8 r115 into r167; - mul r166 10u128 into r168; - ternary r167 r168 r166 into r169; - lt 18u8 r115 into r170; - mul r169 10u128 into r171; - ternary r170 r171 r169 into r172; - lt 19u8 r115 into r173; - mul r172 10u128 into r174; - ternary r173 r174 r172 into r175; - lt 20u8 r115 into r176; - mul r175 10u128 into r177; - ternary r176 r177 r175 into r178; - lt 21u8 r115 into r179; - mul r178 10u128 into r180; - ternary r179 r180 r178 into r181; - lt 22u8 r115 into r182; - mul r181 10u128 into r183; - ternary r182 r183 r181 into r184; - lt 23u8 r115 into r185; - mul r184 10u128 into r186; - ternary r185 r186 r184 into r187; - lt 24u8 r115 into r188; - mul r187 10u128 into r189; - ternary r188 r189 r187 into r190; - lt 25u8 r115 into r191; - mul r190 10u128 into r192; - ternary r191 r192 r190 into r193; - lt 26u8 r115 into r194; - mul r193 10u128 into r195; - ternary r194 r195 r193 into r196; - lt 27u8 r115 into r197; - mul r196 10u128 into r198; - ternary r197 r198 r196 into r199; - lt 28u8 r115 into r200; - mul r199 10u128 into r201; - ternary r200 r201 r199 into r202; - cast r18 r19 r3 into r203 as PoolKey; - hash.bhp256 r203 into r204 as field; - cast r18 r19 r3 true r112 r202 into r205 as PoolState; - get.or_use token_paused[r18] false into r206; - not r206 into r207; - assert.eq r207 true; - get.or_use token_paused[r19] false into r208; - not r208 into r209; - assert.eq r209 true; - cast r18 r19 into r210 as PairKey; - get.or_use pair_paused[r210] false into r211; - not r211 into r212; - assert.eq r212 true; - assert.neq r1 r2; - get.or_use initialized_pools[r204] false into r213; - not r213 into r214; - assert.eq r214 true; - get.or_use tick_spacings[r5] false into r215; - assert.eq r215 true; - get.or_use fee_tiers[r3] false into r216; - assert.eq r216 true; - get fee_to_tick_spacing[r3] into r217; - is.eq r217 r5 into r218; - assert.eq r218 true; - cast r5 into r219 as i32; - rem r6 r219 into r220; - is.eq r220 0i32 into r221; - assert.eq r221 true; - gte r6 -400000i32 into r222; - lt r6 400000i32 into r223; - and r222 r223 into r224; - assert.eq r224 true; - call view_sqrt_price_at_tick r6 into r225; - add r6 1i32 into r226; - call view_sqrt_price_at_tick r226 into r227; - gte r4 r225 into r228; - lt r4 r227 into r229; - and r228 r229 into r230; - assert.eq r230 true; - cast r5 into r231 as u128; - div 800000u128 r231 into r232; - div 340282366920938463463374607431768211455u128 r232 into r233; - lt r233 9223372036854775808u128 into r234; - ternary r234 r233 9223372036854775808u128 into r235; - set true into initialized_pools[r204]; - set r205 into pools[r204]; - cast r204 -400001i32 into r236 as TickKey; - hash.bhp256 r236 into r237 as field; - cast r204 400001i32 into r238 as TickKey; - hash.bhp256 r238 into r239 as field; - cast r204 0i128 0u128 -400001i32 0u128 0u128 -400001i32 400001i32 into r240 as Tick; - set r240 into ticks[r237]; - cast r204 0i128 0u128 400001i32 0u128 0u128 -400001i32 400001i32 into r241 as Tick; - set r241 into ticks[r239]; - cast r6 r5 r4 0u8 0u128 0u128 0u128 0u128 0u128 r235 0u128 0u128 -400001i32 400001i32 into r242 as Slot; - set r242 into slots[r204]; - -view view_liquidity_for_amounts: - input r0 as u128.public; - input r1 as u128.public; - input r2 as u128.public; - input r3 as u128.public; - input r4 as u128.public; - gt r1 r2 into r5; - ternary r5 r2 r1 into r6; - ternary r5 r1 r2 into r7; - lte r0 r6 into r8; - gt r6 r7 into r9; - ternary r9 r7 r6 into r10; - ternary r9 r6 r7 into r11; - and r10 18446744073709551615u128 into r12; - shr r10 64u8 into r13; - and r11 18446744073709551615u128 into r14; - shr r11 64u8 into r15; - mul r12 r14 into r16; - mul r12 r15 into r17; - mul r13 r14 into r18; - mul r13 r15 into r19; - and r16 18446744073709551615u128 into r20; - shr r16 64u8 into r21; - and r17 18446744073709551615u128 into r22; - add r21 r22 into r23; - and r18 18446744073709551615u128 into r24; - add r23 r24 into r25; - and r25 18446744073709551615u128 into r26; - shr r25 64u8 into r27; - shr r17 64u8 into r28; - shr r18 64u8 into r29; - add r28 r29 into r30; - and r19 18446744073709551615u128 into r31; - add r30 r31 into r32; - add r32 r27 into r33; - and r33 18446744073709551615u128 into r34; - shr r33 64u8 into r35; - shr r19 64u8 into r36; - add r36 r35 into r37; - shl r26 64u8 into r38; - add r38 r20 into r39; - shl r37 64u8 into r40; - add r40 r34 into r41; - shl r41 65u8 into r42; - shr r39 63u8 into r43; - add r42 r43 into r44; - sub r11 r10 into r45; - gt r45 0u128 into r46; - ternary r46 r45 1u128 into r47; - ternary r46 r3 0u128 into r48; - and r48 18446744073709551615u128 into r49; - shr r48 64u8 into r50; - and r44 18446744073709551615u128 into r51; - shr r44 64u8 into r52; - mul r49 r51 into r53; - mul r49 r52 into r54; - mul r50 r51 into r55; - mul r50 r52 into r56; - and r53 18446744073709551615u128 into r57; - shr r53 64u8 into r58; - and r54 18446744073709551615u128 into r59; - add r58 r59 into r60; - and r55 18446744073709551615u128 into r61; - add r60 r61 into r62; - and r62 18446744073709551615u128 into r63; - shr r62 64u8 into r64; - shr r54 64u8 into r65; - shr r55 64u8 into r66; - add r65 r66 into r67; - and r56 18446744073709551615u128 into r68; - add r67 r68 into r69; - add r69 r64 into r70; - and r70 18446744073709551615u128 into r71; - shr r70 64u8 into r72; - shr r56 64u8 into r73; - add r73 r72 into r74; - shl r63 64u8 into r75; - add r75 r57 into r76; - shl r74 64u8 into r77; - add r77 r71 into r78; - lt r78 r47 into r79; - assert.eq r79 true; - shr r76 96u8 into r80; - and r80 4294967295u128 into r81; - shl r78 32u8 into r82; - add r82 r81 into r83; - div r83 r47 into r84; - rem r83 r47 into r85; - shr r76 64u8 into r86; - and r86 4294967295u128 into r87; - shl r85 32u8 into r88; - add r88 r87 into r89; - shl r84 32u8 into r90; - div r89 r47 into r91; - add r90 r91 into r92; - rem r89 r47 into r93; - shr r76 32u8 into r94; - and r94 4294967295u128 into r95; - shl r93 32u8 into r96; - add r96 r95 into r97; - shl r92 32u8 into r98; - div r97 r47 into r99; - add r98 r99 into r100; - rem r97 r47 into r101; - shr r76 0u8 into r102; - and r102 4294967295u128 into r103; - shl r101 32u8 into r104; - add r104 r103 into r105; - shl r100 32u8 into r106; - div r105 r47 into r107; - add r106 r107 into r108; - rem r105 r47 into r109; - add r108 1u128 into r110; - lt r0 r7 into r111; - gt r0 r7 into r112; - ternary r112 r7 r0 into r113; - ternary r112 r0 r7 into r114; - and r113 18446744073709551615u128 into r115; - shr r113 64u8 into r116; - and r114 18446744073709551615u128 into r117; - shr r114 64u8 into r118; - mul r115 r117 into r119; - mul r115 r118 into r120; - mul r116 r117 into r121; - mul r116 r118 into r122; - and r119 18446744073709551615u128 into r123; - shr r119 64u8 into r124; - and r120 18446744073709551615u128 into r125; - add r124 r125 into r126; - and r121 18446744073709551615u128 into r127; - add r126 r127 into r128; - and r128 18446744073709551615u128 into r129; - shr r128 64u8 into r130; - shr r120 64u8 into r131; - shr r121 64u8 into r132; - add r131 r132 into r133; - and r122 18446744073709551615u128 into r134; - add r133 r134 into r135; - add r135 r130 into r136; - and r136 18446744073709551615u128 into r137; - shr r136 64u8 into r138; - shr r122 64u8 into r139; - add r139 r138 into r140; - shl r129 64u8 into r141; - add r141 r123 into r142; - shl r140 64u8 into r143; - add r143 r137 into r144; - shl r144 65u8 into r145; - shr r142 63u8 into r146; - add r145 r146 into r147; - sub r114 r113 into r148; - gt r148 0u128 into r149; - ternary r149 r148 1u128 into r150; - ternary r149 r3 0u128 into r151; - and r151 18446744073709551615u128 into r152; - shr r151 64u8 into r153; - and r147 18446744073709551615u128 into r154; - shr r147 64u8 into r155; - mul r152 r154 into r156; - mul r152 r155 into r157; - mul r153 r154 into r158; - mul r153 r155 into r159; - and r156 18446744073709551615u128 into r160; - shr r156 64u8 into r161; - and r157 18446744073709551615u128 into r162; - add r161 r162 into r163; - and r158 18446744073709551615u128 into r164; - add r163 r164 into r165; - and r165 18446744073709551615u128 into r166; - shr r165 64u8 into r167; - shr r157 64u8 into r168; - shr r158 64u8 into r169; - add r168 r169 into r170; - and r159 18446744073709551615u128 into r171; - add r170 r171 into r172; - add r172 r167 into r173; - and r173 18446744073709551615u128 into r174; - shr r173 64u8 into r175; - shr r159 64u8 into r176; - add r176 r175 into r177; - shl r166 64u8 into r178; - add r178 r160 into r179; - shl r177 64u8 into r180; - add r180 r174 into r181; - lt r181 r150 into r182; - assert.eq r182 true; - shr r179 96u8 into r183; - and r183 4294967295u128 into r184; - shl r181 32u8 into r185; - add r185 r184 into r186; - div r186 r150 into r187; - rem r186 r150 into r188; - shr r179 64u8 into r189; - and r189 4294967295u128 into r190; - shl r188 32u8 into r191; - add r191 r190 into r192; - shl r187 32u8 into r193; - div r192 r150 into r194; - add r193 r194 into r195; - rem r192 r150 into r196; - shr r179 32u8 into r197; - and r197 4294967295u128 into r198; - shl r196 32u8 into r199; - add r199 r198 into r200; - shl r195 32u8 into r201; - div r200 r150 into r202; - add r201 r202 into r203; - rem r200 r150 into r204; - shr r179 0u8 into r205; - and r205 4294967295u128 into r206; - shl r204 32u8 into r207; - add r207 r206 into r208; - shl r203 32u8 into r209; - div r208 r150 into r210; - add r209 r210 into r211; - rem r208 r150 into r212; - add r211 1u128 into r213; - gt r6 r0 into r214; - ternary r214 r0 r6 into r215; - ternary r214 r6 r0 into r216; - sub r216 r215 into r217; - gt r217 0u128 into r218; - ternary r218 r217 1u128 into r219; - ternary r218 r4 0u128 into r220; - and r220 18446744073709551615u128 into r221; - shr r220 64u8 into r222; - mul r221 9223372036854775808u128 into r223; - mul r222 9223372036854775808u128 into r224; - and r223 18446744073709551615u128 into r225; - shr r223 64u8 into r226; - and r224 18446744073709551615u128 into r227; - add r226 r227 into r228; - and r228 18446744073709551615u128 into r229; - shr r228 64u8 into r230; - shr r224 64u8 into r231; - add r231 r230 into r232; - and r232 18446744073709551615u128 into r233; - shr r232 64u8 into r234; - shl r229 64u8 into r235; - add r235 r225 into r236; - shl r234 64u8 into r237; - add r237 r233 into r238; - lt r238 r219 into r239; - assert.eq r239 true; - shr r236 96u8 into r240; - and r240 4294967295u128 into r241; - shl r238 32u8 into r242; - add r242 r241 into r243; - div r243 r219 into r244; - rem r243 r219 into r245; - shr r236 64u8 into r246; - and r246 4294967295u128 into r247; - shl r245 32u8 into r248; - add r248 r247 into r249; - shl r244 32u8 into r250; - div r249 r219 into r251; - add r250 r251 into r252; - rem r249 r219 into r253; - shr r236 32u8 into r254; - and r254 4294967295u128 into r255; - shl r253 32u8 into r256; - add r256 r255 into r257; - shl r252 32u8 into r258; - div r257 r219 into r259; - add r258 r259 into r260; - rem r257 r219 into r261; - shr r236 0u8 into r262; - and r262 4294967295u128 into r263; - shl r261 32u8 into r264; - add r264 r263 into r265; - shl r260 32u8 into r266; - div r265 r219 into r267; - add r266 r267 into r268; - rem r265 r219 into r269; - add r268 1u128 into r270; - lt r211 r268 into r271; - ternary r271 r211 r268 into r272; - gt r6 r7 into r273; - ternary r273 r7 r6 into r274; - ternary r273 r6 r7 into r275; - sub r275 r274 into r276; - gt r276 0u128 into r277; - ternary r277 r276 1u128 into r278; - ternary r277 r4 0u128 into r279; - and r279 18446744073709551615u128 into r280; - shr r279 64u8 into r281; - mul r280 9223372036854775808u128 into r282; - mul r281 9223372036854775808u128 into r283; - and r282 18446744073709551615u128 into r284; - shr r282 64u8 into r285; - and r283 18446744073709551615u128 into r286; - add r285 r286 into r287; - and r287 18446744073709551615u128 into r288; - shr r287 64u8 into r289; - shr r283 64u8 into r290; - add r290 r289 into r291; - and r291 18446744073709551615u128 into r292; - shr r291 64u8 into r293; - shl r288 64u8 into r294; - add r294 r284 into r295; - shl r293 64u8 into r296; - add r296 r292 into r297; - lt r297 r278 into r298; - assert.eq r298 true; - shr r295 96u8 into r299; - and r299 4294967295u128 into r300; - shl r297 32u8 into r301; - add r301 r300 into r302; - div r302 r278 into r303; - rem r302 r278 into r304; - shr r295 64u8 into r305; - and r305 4294967295u128 into r306; - shl r304 32u8 into r307; - add r307 r306 into r308; - shl r303 32u8 into r309; - div r308 r278 into r310; - add r309 r310 into r311; - rem r308 r278 into r312; - shr r295 32u8 into r313; - and r313 4294967295u128 into r314; - shl r312 32u8 into r315; - add r315 r314 into r316; - shl r311 32u8 into r317; - div r316 r278 into r318; - add r317 r318 into r319; - rem r316 r278 into r320; - shr r295 0u8 into r321; - and r321 4294967295u128 into r322; - shl r320 32u8 into r323; - add r323 r322 into r324; - shl r319 32u8 into r325; - div r324 r278 into r326; - add r325 r326 into r327; - rem r324 r278 into r328; - add r327 1u128 into r329; - ternary r111 r272 r327 into r330; - ternary r8 r108 r330 into r331; - output r331 as u128.public; - -function mint: - input r0 as field.private; - input r1 as dynamic.record; - input r2 as dynamic.record; - input r3 as address.private; - input r4 as MintPositionRequest.public; - input r5 as field.public; - input r6 as field.public; - assert.neq r3 shield_swap_v3.aleo; - cast r4 r3 r0 into r7 as TokenIDPreimage; - hash.bhp256 r7 into r8 as field; - cast aleo1t08epjqqv8h7jpuy2m2cxm80zy2pcy5c4f3m82hnac4sjmdrjyysvx3s2h r8 r5 r6 r4 self.caller r3 into r9 as MintComplianceRecord.record; - cast r3 r8 r5 r6 r4.pool r4.tick_lower r4.tick_upper into r10 as PositionNFT.record; - call.dynamic r5 'aleo' 'transfer_private_to_public' with r1 shield_swap_v3.aleo r4.amount0_desired (as dynamic.record address.public u128.public) into r11 r12 (as dynamic.record dynamic.future); - call.dynamic r6 'aleo' 'transfer_private_to_public' with r2 shield_swap_v3.aleo r4.amount1_desired (as dynamic.record address.public u128.public) into r13 r14 (as dynamic.record dynamic.future); - async mint r12 r14 r4 r8 r5 r6 into r15; - output r8 as field.public; - output r10 as PositionNFT.record; - output r11 as dynamic.record; - output r13 as dynamic.record; - output r9 as MintComplianceRecord.record; - output r15 as shield_swap_v3.aleo/mint.future; - -finalize mint: - input r0 as dynamic.future; - input r1 as dynamic.future; - input r2 as MintPositionRequest.public; - input r3 as field.public; - input r4 as field.public; - input r5 as field.public; - await r0; - await r1; - get.or_use global_paused[true] false into r6; - not r6 into r7; - assert.eq r7 true; - get pools[r2.pool] into r8; - assert.eq r8.enabled true; - get.or_use token_paused[r8.token0] false into r9; - not r9 into r10; - assert.eq r10 true; - get.or_use token_paused[r8.token1] false into r11; - not r11 into r12; - assert.eq r12 true; - cast r8.token0 r8.token1 into r13 as PairKey; - get.or_use pair_paused[r13] false into r14; - not r14 into r15; - assert.eq r15 true; - is.eq r8.token0 r4 into r16; - assert.eq r16 true; - is.eq r8.token1 r5 into r17; - assert.eq r17 true; - get slots[r2.pool] into r18; - cast r18.tick_spacing into r19 as i32; - rem r2.tick_lower r19 into r20; - is.eq r20 0i32 into r21; - assert.eq r21 true; - cast r18.tick_spacing into r22 as i32; - rem r2.tick_upper r22 into r23; - is.eq r23 0i32 into r24; - assert.eq r24 true; - lt r2.tick_lower r2.tick_upper into r25; - assert.eq r25 true; - gte r2.tick_lower -400000i32 into r26; - assert.eq r26 true; - lte r2.tick_upper 400000i32 into r27; - assert.eq r27 true; - call view_sqrt_price_at_tick r2.tick_lower into r28; - call view_sqrt_price_at_tick r2.tick_upper into r29; - rem r2.amount0_desired r8.scale0 into r30; - is.eq r30 0u128 into r31; - assert.eq r31 true; - rem r2.amount1_desired r8.scale1 into r32; - is.eq r32 0u128 into r33; - assert.eq r33 true; - div r2.amount0_desired r8.scale0 into r34; - div r2.amount1_desired r8.scale1 into r35; - call view_liquidity_for_amounts r18.sqrt_price r28 r29 r34 r35 into r36; - gt r36 0u128 into r37; - assert.eq r37 true; - call view_amounts_for_liquidity r18.sqrt_price r28 r29 r36 false into r38 r39; - lte r38 r34 into r40; - lte r39 r35 into r41; - and r40 r41 into r42; - assert.eq r42 true; - mul r38 r8.scale0 into r43; - gte r43 r2.amount0_min into r44; - mul r39 r8.scale1 into r45; - gte r45 r2.amount1_min into r46; - and r44 r46 into r47; - assert.eq r47 true; - lt r18.sqrt_price r29 into r48; - branch.eq r48 false to end_then_0_0; - gt r38 0u128 into r49; - assert.eq r49 true; - branch.eq true true to end_otherwise_0_1; - position end_then_0_0; - position end_otherwise_0_1; - gt r18.sqrt_price r28 into r50; - branch.eq r50 false to end_then_0_2; - gt r39 0u128 into r51; - assert.eq r51 true; - branch.eq true true to end_otherwise_0_3; - position end_then_0_2; - position end_otherwise_0_3; - cast r2.pool r2.tick_lower into r52 as TickKey; - hash.bhp256 r52 into r53 as field; - cast r2.pool r2.tick_upper into r54 as TickKey; - hash.bhp256 r54 into r55 as field; - cast r2.pool 0i128 0u128 r2.tick_lower 0u128 0u128 0i32 0i32 into r56 as Tick; - cast r2.pool 0i128 0u128 r2.tick_upper 0u128 0u128 0i32 0i32 into r57 as Tick; - get.or_use ticks[r53] r56 into r58; - get.or_use ticks[r55] r57 into r59; - gt r58.liquidity_gross 0u128 into r60; - gt r59.liquidity_gross 0u128 into r61; - not r60 into r62; - lte r2.tick_lower r18.tick into r63; - and r62 r63 into r64; - ternary r64 r18.fee_growth_global0_x_64 r58.fee_growth_outside0_64 into r65; - lte r2.tick_lower r18.tick into r66; - and r62 r66 into r67; - ternary r67 r18.fee_growth_global1_x_64 r58.fee_growth_outside1_64 into r68; - not r61 into r69; - lte r2.tick_upper r18.tick into r70; - and r69 r70 into r71; - ternary r71 r18.fee_growth_global0_x_64 r59.fee_growth_outside0_64 into r72; - lte r2.tick_upper r18.tick into r73; - and r69 r73 into r74; - ternary r74 r18.fee_growth_global1_x_64 r59.fee_growth_outside1_64 into r75; - add r58.liquidity_gross r36 into r76; - add r59.liquidity_gross r36 into r77; - lte r76 r18.max_liquidity_per_tick into r78; - assert.eq r78 true; - lte r77 r18.max_liquidity_per_tick into r79; - assert.eq r79 true; - ternary r60 -400001i32 r2.tick_lower_hint into r80; - cast r2.pool r80 into r81 as TickKey; - hash.bhp256 r81 into r82 as field; - get ticks[r82] into r83; - branch.eq r62 false to end_then_0_4; - is.eq r83.pool r2.pool into r84; - assert.eq r84 true; - is.eq r83.tick r2.tick_lower_hint into r85; - assert.eq r85 true; - is.eq r2.tick_lower_hint -400001i32 into r86; - gt r83.liquidity_gross 0u128 into r87; - or r86 r87 into r88; - assert.eq r88 true; - lt r83.tick r2.tick_lower into r89; - assert.eq r89 true; - gt r83.next r2.tick_lower into r90; - assert.eq r90 true; - branch.eq true true to end_otherwise_0_5; - position end_then_0_4; - position end_otherwise_0_5; - ternary r60 r58.prev r2.tick_lower_hint into r91; - ternary r60 r58.next r83.next into r92; - cast r36 into r93 as i128; - add r58.liquidity_net r93 into r94; - cast r2.pool r94 r76 r2.tick_lower r65 r68 r91 r92 into r95 as Tick; - set r95 into ticks[r53]; - branch.eq r62 false to end_then_0_6; - cast r83.pool r83.liquidity_net r83.liquidity_gross r83.tick r83.fee_growth_outside0_64 r83.fee_growth_outside1_64 r83.prev r2.tick_lower into r96 as Tick; - set r96 into ticks[r82]; - cast r2.pool r92 into r97 as TickKey; - hash.bhp256 r97 into r98 as field; - get ticks[r98] into r99; - cast r99.pool r99.liquidity_net r99.liquidity_gross r99.tick r99.fee_growth_outside0_64 r99.fee_growth_outside1_64 r2.tick_lower r99.next into r100 as Tick; - set r100 into ticks[r98]; - branch.eq true true to end_otherwise_0_7; - position end_then_0_6; - position end_otherwise_0_7; - get.or_use ticks[r55] r57 into r101; - ternary r61 -400001i32 r2.tick_upper_hint into r102; - cast r2.pool r102 into r103 as TickKey; - hash.bhp256 r103 into r104 as field; - get ticks[r104] into r105; - branch.eq r69 false to end_then_0_8; - is.eq r105.pool r2.pool into r106; - assert.eq r106 true; - is.eq r105.tick r2.tick_upper_hint into r107; - assert.eq r107 true; - is.eq r2.tick_upper_hint -400001i32 into r108; - gt r105.liquidity_gross 0u128 into r109; - or r108 r109 into r110; - assert.eq r110 true; - lt r105.tick r2.tick_upper into r111; - assert.eq r111 true; - gt r105.next r2.tick_upper into r112; - assert.eq r112 true; - branch.eq true true to end_otherwise_0_9; - position end_then_0_8; - position end_otherwise_0_9; - ternary r61 r101.prev r2.tick_upper_hint into r113; - ternary r61 r101.next r105.next into r114; - cast r36 into r115 as i128; - sub r101.liquidity_net r115 into r116; - cast r2.pool r116 r77 r2.tick_upper r72 r75 r113 r114 into r117 as Tick; - set r117 into ticks[r55]; - branch.eq r69 false to end_then_0_10; - get ticks[r104] into r118; - cast r118.pool r118.liquidity_net r118.liquidity_gross r118.tick r118.fee_growth_outside0_64 r118.fee_growth_outside1_64 r118.prev r2.tick_upper into r119 as Tick; - set r119 into ticks[r104]; - cast r2.pool r114 into r120 as TickKey; - hash.bhp256 r120 into r121 as field; - get ticks[r121] into r122; - cast r122.pool r122.liquidity_net r122.liquidity_gross r122.tick r122.fee_growth_outside0_64 r122.fee_growth_outside1_64 r2.tick_upper r122.next into r123 as Tick; - set r123 into ticks[r121]; - branch.eq true true to end_otherwise_0_11; - position end_then_0_10; - position end_otherwise_0_11; - get ticks[r53] into r124; - get ticks[r55] into r125; - gte r18.tick r124.tick into r126; - gte r18.fee_growth_global0_x_64 r124.fee_growth_outside0_64 into r127; - ternary r127 r18.fee_growth_global0_x_64 r124.fee_growth_outside0_64 into r128; - ternary r127 r124.fee_growth_outside0_64 r18.fee_growth_global0_x_64 into r129; - sub r128 r129 into r130; - gt r130 0u128 into r131; - ternary r131 r130 1u128 into r132; - sub 340282366920938463463374607431768211455u128 r132 into r133; - add r133 1u128 into r134; - ternary r127 r130 r134 into r135; - gte r18.fee_growth_global1_x_64 r124.fee_growth_outside1_64 into r136; - ternary r136 r18.fee_growth_global1_x_64 r124.fee_growth_outside1_64 into r137; - ternary r136 r124.fee_growth_outside1_64 r18.fee_growth_global1_x_64 into r138; - sub r137 r138 into r139; - gt r139 0u128 into r140; - ternary r140 r139 1u128 into r141; - sub 340282366920938463463374607431768211455u128 r141 into r142; - add r142 1u128 into r143; - ternary r136 r139 r143 into r144; - ternary r126 r124.fee_growth_outside0_64 r135 into r145; - ternary r126 r124.fee_growth_outside1_64 r144 into r146; - lt r18.tick r125.tick into r147; - gte r18.fee_growth_global0_x_64 r125.fee_growth_outside0_64 into r148; - ternary r148 r18.fee_growth_global0_x_64 r125.fee_growth_outside0_64 into r149; - ternary r148 r125.fee_growth_outside0_64 r18.fee_growth_global0_x_64 into r150; - sub r149 r150 into r151; - gt r151 0u128 into r152; - ternary r152 r151 1u128 into r153; - sub 340282366920938463463374607431768211455u128 r153 into r154; - add r154 1u128 into r155; - ternary r148 r151 r155 into r156; - gte r18.fee_growth_global1_x_64 r125.fee_growth_outside1_64 into r157; - ternary r157 r18.fee_growth_global1_x_64 r125.fee_growth_outside1_64 into r158; - ternary r157 r125.fee_growth_outside1_64 r18.fee_growth_global1_x_64 into r159; - sub r158 r159 into r160; - gt r160 0u128 into r161; - ternary r161 r160 1u128 into r162; - sub 340282366920938463463374607431768211455u128 r162 into r163; - add r163 1u128 into r164; - ternary r157 r160 r164 into r165; - ternary r147 r125.fee_growth_outside0_64 r156 into r166; - ternary r147 r125.fee_growth_outside1_64 r165 into r167; - gte r18.fee_growth_global0_x_64 r145 into r168; - ternary r168 r18.fee_growth_global0_x_64 r145 into r169; - ternary r168 r145 r18.fee_growth_global0_x_64 into r170; - sub r169 r170 into r171; - gt r171 0u128 into r172; - ternary r172 r171 1u128 into r173; - sub 340282366920938463463374607431768211455u128 r173 into r174; - add r174 1u128 into r175; - ternary r168 r171 r175 into r176; - gte r176 r166 into r177; - ternary r177 r176 r166 into r178; - ternary r177 r166 r176 into r179; - sub r178 r179 into r180; - gt r180 0u128 into r181; - ternary r181 r180 1u128 into r182; - sub 340282366920938463463374607431768211455u128 r182 into r183; - add r183 1u128 into r184; - ternary r177 r180 r184 into r185; - gte r18.fee_growth_global1_x_64 r146 into r186; - ternary r186 r18.fee_growth_global1_x_64 r146 into r187; - ternary r186 r146 r18.fee_growth_global1_x_64 into r188; - sub r187 r188 into r189; - gt r189 0u128 into r190; - ternary r190 r189 1u128 into r191; - sub 340282366920938463463374607431768211455u128 r191 into r192; - add r192 1u128 into r193; - ternary r186 r189 r193 into r194; - gte r194 r167 into r195; - ternary r195 r194 r167 into r196; - ternary r195 r167 r194 into r197; - sub r196 r197 into r198; - gt r198 0u128 into r199; - ternary r199 r198 1u128 into r200; - sub 340282366920938463463374607431768211455u128 r200 into r201; - add r201 1u128 into r202; - ternary r195 r198 r202 into r203; - contains positions[r3] into r204; - not r204 into r205; - assert.eq r205 true; - sub r34 r38 into r206; - sub r35 r39 into r207; - cast r3 r2.pool r2.tick_lower r2.tick_upper r36 r185 r203 r206 r207 into r208 as Position; - set r208 into positions[r3]; - lte r2.tick_lower r18.tick into r209; - and r62 r209 into r210; - gt r2.tick_lower r18.next_init_below into r211; - and r210 r211 into r212; - ternary r212 r2.tick_lower r18.next_init_below into r213; - gt r2.tick_lower r18.tick into r214; - and r62 r214 into r215; - lt r2.tick_lower r18.next_init_above into r216; - and r215 r216 into r217; - ternary r217 r2.tick_lower r18.next_init_above into r218; - lte r2.tick_upper r18.tick into r219; - and r69 r219 into r220; - gt r2.tick_upper r213 into r221; - and r220 r221 into r222; - ternary r222 r2.tick_upper r213 into r223; - gt r2.tick_upper r18.tick into r224; - and r69 r224 into r225; - lt r2.tick_upper r218 into r226; - and r225 r226 into r227; - ternary r227 r2.tick_upper r218 into r228; - gte r18.tick r2.tick_lower into r229; - lt r18.tick r2.tick_upper into r230; - and r229 r230 into r231; - add r18.liquidity r36 into r232; - ternary r231 r232 r18.liquidity into r233; - cast r18.tick r18.tick_spacing r18.sqrt_price r18.fee_protocol r233 r18.fee_growth_global0_x_64 r18.fee_growth_global1_x_64 r18.fee_residual0_x_64 r18.fee_residual1_x_64 r18.max_liquidity_per_tick r18.protocol_fees0 r18.protocol_fees1 r223 r228 into r234 as Slot; - set r234 into slots[r2.pool]; - -function decrease_liquidity: - input r0 as PositionNFT.record; - input r1 as u128.public; - input r2 as u128.public; - input r3 as u128.public; - cast r0.owner r0.token_id r0.token0_id r0.token1_id r0.pool r0.tick_lower r0.tick_upper into r4 as PositionNFT.record; - async decrease_liquidity r0.token_id r0.pool r0.tick_lower r0.tick_upper r1 r2 r3 into r5; - output r0.token_id as field.public; - output r4 as PositionNFT.record; - output r5 as shield_swap_v3.aleo/decrease_liquidity.future; - -finalize decrease_liquidity: - input r0 as field.public; - input r1 as field.public; - input r2 as i32.public; - input r3 as i32.public; - input r4 as u128.public; - input r5 as u128.public; - input r6 as u128.public; - get positions[r0] into r7; - contains frozen_position[r0] into r8; - not r8 into r9; - assert.eq r9 true; - is.eq r7.pool r1 into r10; - is.eq r7.tick_lower r2 into r11; - and r10 r11 into r12; - is.eq r7.tick_upper r3 into r13; - and r12 r13 into r14; - assert.eq r14 true; - lte r4 r7.liquidity into r15; - assert.eq r15 true; - get positions[r0] into r16; - get slots[r16.pool] into r17; - call view_sqrt_price_at_tick r16.tick_lower into r18; - call view_sqrt_price_at_tick r16.tick_upper into r19; - call view_amounts_for_liquidity r17.sqrt_price r18 r19 r4 false into r20 r21; - cast r16.pool r16.tick_lower into r22 as TickKey; - hash.bhp256 r22 into r23 as field; - cast r16.pool r16.tick_upper into r24 as TickKey; - hash.bhp256 r24 into r25 as field; - get ticks[r23] into r26; - get ticks[r25] into r27; - gt r26.liquidity_gross 0u128 into r28; - gt r27.liquidity_gross 0u128 into r29; - sub r26.liquidity_gross r4 into r30; - sub r27.liquidity_gross r4 into r31; - is.eq r30 0u128 into r32; - and r28 r32 into r33; - is.eq r31 0u128 into r34; - and r29 r34 into r35; - cast r4 into r36 as i128; - sub r26.liquidity_net r36 into r37; - cast r26.pool r37 r30 r26.tick r26.fee_growth_outside0_64 r26.fee_growth_outside1_64 r26.prev r26.next into r38 as Tick; - set r38 into ticks[r23]; - branch.eq r33 false to end_then_0_0; - cast r16.pool r26.prev into r39 as TickKey; - hash.bhp256 r39 into r40 as field; - get ticks[r40] into r41; - cast r41.pool r41.liquidity_net r41.liquidity_gross r41.tick r41.fee_growth_outside0_64 r41.fee_growth_outside1_64 r41.prev r26.next into r42 as Tick; - set r42 into ticks[r40]; - cast r16.pool r26.next into r43 as TickKey; - hash.bhp256 r43 into r44 as field; - get ticks[r44] into r45; - cast r45.pool r45.liquidity_net r45.liquidity_gross r45.tick r45.fee_growth_outside0_64 r45.fee_growth_outside1_64 r26.prev r45.next into r46 as Tick; - set r46 into ticks[r44]; - branch.eq true true to end_otherwise_0_1; - position end_then_0_0; - position end_otherwise_0_1; - get ticks[r25] into r47; - cast r4 into r48 as i128; - add r47.liquidity_net r48 into r49; - cast r47.pool r49 r31 r47.tick r47.fee_growth_outside0_64 r47.fee_growth_outside1_64 r47.prev r47.next into r50 as Tick; - set r50 into ticks[r25]; - branch.eq r35 false to end_then_0_2; - cast r16.pool r47.prev into r51 as TickKey; - hash.bhp256 r51 into r52 as field; - get ticks[r52] into r53; - cast r53.pool r53.liquidity_net r53.liquidity_gross r53.tick r53.fee_growth_outside0_64 r53.fee_growth_outside1_64 r53.prev r47.next into r54 as Tick; - set r54 into ticks[r52]; - cast r16.pool r47.next into r55 as TickKey; - hash.bhp256 r55 into r56 as field; - get ticks[r56] into r57; - cast r57.pool r57.liquidity_net r57.liquidity_gross r57.tick r57.fee_growth_outside0_64 r57.fee_growth_outside1_64 r47.prev r57.next into r58 as Tick; - set r58 into ticks[r56]; - branch.eq true true to end_otherwise_0_3; - position end_then_0_2; - position end_otherwise_0_3; - get ticks[r23] into r59; - get ticks[r25] into r60; - gte r17.tick r59.tick into r61; - gte r17.fee_growth_global0_x_64 r59.fee_growth_outside0_64 into r62; - ternary r62 r17.fee_growth_global0_x_64 r59.fee_growth_outside0_64 into r63; - ternary r62 r59.fee_growth_outside0_64 r17.fee_growth_global0_x_64 into r64; - sub r63 r64 into r65; - gt r65 0u128 into r66; - ternary r66 r65 1u128 into r67; - sub 340282366920938463463374607431768211455u128 r67 into r68; - add r68 1u128 into r69; - ternary r62 r65 r69 into r70; - gte r17.fee_growth_global1_x_64 r59.fee_growth_outside1_64 into r71; - ternary r71 r17.fee_growth_global1_x_64 r59.fee_growth_outside1_64 into r72; - ternary r71 r59.fee_growth_outside1_64 r17.fee_growth_global1_x_64 into r73; - sub r72 r73 into r74; - gt r74 0u128 into r75; - ternary r75 r74 1u128 into r76; - sub 340282366920938463463374607431768211455u128 r76 into r77; - add r77 1u128 into r78; - ternary r71 r74 r78 into r79; - ternary r61 r59.fee_growth_outside0_64 r70 into r80; - ternary r61 r59.fee_growth_outside1_64 r79 into r81; - lt r17.tick r60.tick into r82; - gte r17.fee_growth_global0_x_64 r60.fee_growth_outside0_64 into r83; - ternary r83 r17.fee_growth_global0_x_64 r60.fee_growth_outside0_64 into r84; - ternary r83 r60.fee_growth_outside0_64 r17.fee_growth_global0_x_64 into r85; - sub r84 r85 into r86; - gt r86 0u128 into r87; - ternary r87 r86 1u128 into r88; - sub 340282366920938463463374607431768211455u128 r88 into r89; - add r89 1u128 into r90; - ternary r83 r86 r90 into r91; - gte r17.fee_growth_global1_x_64 r60.fee_growth_outside1_64 into r92; - ternary r92 r17.fee_growth_global1_x_64 r60.fee_growth_outside1_64 into r93; - ternary r92 r60.fee_growth_outside1_64 r17.fee_growth_global1_x_64 into r94; - sub r93 r94 into r95; - gt r95 0u128 into r96; - ternary r96 r95 1u128 into r97; - sub 340282366920938463463374607431768211455u128 r97 into r98; - add r98 1u128 into r99; - ternary r92 r95 r99 into r100; - ternary r82 r60.fee_growth_outside0_64 r91 into r101; - ternary r82 r60.fee_growth_outside1_64 r100 into r102; - gte r17.fee_growth_global0_x_64 r80 into r103; - ternary r103 r17.fee_growth_global0_x_64 r80 into r104; - ternary r103 r80 r17.fee_growth_global0_x_64 into r105; - sub r104 r105 into r106; - gt r106 0u128 into r107; - ternary r107 r106 1u128 into r108; - sub 340282366920938463463374607431768211455u128 r108 into r109; - add r109 1u128 into r110; - ternary r103 r106 r110 into r111; - gte r111 r101 into r112; - ternary r112 r111 r101 into r113; - ternary r112 r101 r111 into r114; - sub r113 r114 into r115; - gt r115 0u128 into r116; - ternary r116 r115 1u128 into r117; - sub 340282366920938463463374607431768211455u128 r117 into r118; - add r118 1u128 into r119; - ternary r112 r115 r119 into r120; - gte r17.fee_growth_global1_x_64 r81 into r121; - ternary r121 r17.fee_growth_global1_x_64 r81 into r122; - ternary r121 r81 r17.fee_growth_global1_x_64 into r123; - sub r122 r123 into r124; - gt r124 0u128 into r125; - ternary r125 r124 1u128 into r126; - sub 340282366920938463463374607431768211455u128 r126 into r127; - add r127 1u128 into r128; - ternary r121 r124 r128 into r129; - gte r129 r102 into r130; - ternary r130 r129 r102 into r131; - ternary r130 r102 r129 into r132; - sub r131 r132 into r133; - gt r133 0u128 into r134; - ternary r134 r133 1u128 into r135; - sub 340282366920938463463374607431768211455u128 r135 into r136; - add r136 1u128 into r137; - ternary r130 r133 r137 into r138; - gte r120 r16.fee_growth_inside0_last_64 into r139; - ternary r139 r120 r16.fee_growth_inside0_last_64 into r140; - ternary r139 r16.fee_growth_inside0_last_64 r120 into r141; - sub r140 r141 into r142; - gt r142 0u128 into r143; - ternary r143 r142 1u128 into r144; - sub 340282366920938463463374607431768211455u128 r144 into r145; - add r145 1u128 into r146; - ternary r139 r142 r146 into r147; - and r147 18446744073709551615u128 into r148; - shr r147 64u8 into r149; - and r16.liquidity 18446744073709551615u128 into r150; - shr r16.liquidity 64u8 into r151; - mul r148 r150 into r152; - mul r148 r151 into r153; - mul r149 r150 into r154; - mul r149 r151 into r155; - and r152 18446744073709551615u128 into r156; - shr r152 64u8 into r157; - and r153 18446744073709551615u128 into r158; - add r157 r158 into r159; - and r154 18446744073709551615u128 into r160; - add r159 r160 into r161; - and r161 18446744073709551615u128 into r162; - shr r161 64u8 into r163; - shr r153 64u8 into r164; - shr r154 64u8 into r165; - add r164 r165 into r166; - and r155 18446744073709551615u128 into r167; - add r166 r167 into r168; - add r168 r163 into r169; - and r169 18446744073709551615u128 into r170; - shr r169 64u8 into r171; - shr r155 64u8 into r172; - add r172 r171 into r173; - shl r162 64u8 into r174; - add r174 r156 into r175; - shl r173 64u8 into r176; - add r176 r170 into r177; - shl r177 65u8 into r178; - shr r175 63u8 into r179; - add r178 r179 into r180; - add r16.tokens_owed0 r180 into r181; - add r181 r20 into r182; - gte r138 r16.fee_growth_inside1_last_64 into r183; - ternary r183 r138 r16.fee_growth_inside1_last_64 into r184; - ternary r183 r16.fee_growth_inside1_last_64 r138 into r185; - sub r184 r185 into r186; - gt r186 0u128 into r187; - ternary r187 r186 1u128 into r188; - sub 340282366920938463463374607431768211455u128 r188 into r189; - add r189 1u128 into r190; - ternary r183 r186 r190 into r191; - and r191 18446744073709551615u128 into r192; - shr r191 64u8 into r193; - and r16.liquidity 18446744073709551615u128 into r194; - shr r16.liquidity 64u8 into r195; - mul r192 r194 into r196; - mul r192 r195 into r197; - mul r193 r194 into r198; - mul r193 r195 into r199; - and r196 18446744073709551615u128 into r200; - shr r196 64u8 into r201; - and r197 18446744073709551615u128 into r202; - add r201 r202 into r203; - and r198 18446744073709551615u128 into r204; - add r203 r204 into r205; - and r205 18446744073709551615u128 into r206; - shr r205 64u8 into r207; - shr r197 64u8 into r208; - shr r198 64u8 into r209; - add r208 r209 into r210; - and r199 18446744073709551615u128 into r211; - add r210 r211 into r212; - add r212 r207 into r213; - and r213 18446744073709551615u128 into r214; - shr r213 64u8 into r215; - shr r199 64u8 into r216; - add r216 r215 into r217; - shl r206 64u8 into r218; - add r218 r200 into r219; - shl r217 64u8 into r220; - add r220 r214 into r221; - shl r221 65u8 into r222; - shr r219 63u8 into r223; - add r222 r223 into r224; - add r16.tokens_owed1 r224 into r225; - add r225 r21 into r226; - sub r16.liquidity r4 into r227; - cast r0 r16.pool r16.tick_lower r16.tick_upper r227 r120 r138 r182 r226 into r228 as Position; - set r228 into positions[r0]; - is.eq r17.next_init_below r16.tick_lower into r229; - and r33 r229 into r230; - ternary r230 r26.prev r17.next_init_below into r231; - is.eq r17.next_init_above r16.tick_lower into r232; - and r33 r232 into r233; - ternary r233 r26.next r17.next_init_above into r234; - is.eq r231 r16.tick_upper into r235; - and r35 r235 into r236; - ternary r236 r47.prev r231 into r237; - is.eq r234 r16.tick_upper into r238; - and r35 r238 into r239; - ternary r239 r47.next r234 into r240; - gte r17.tick r16.tick_lower into r241; - lt r17.tick r16.tick_upper into r242; - and r241 r242 into r243; - ternary r243 r4 0u128 into r244; - sub r17.liquidity r244 into r245; - cast r17.tick r17.tick_spacing r17.sqrt_price r17.fee_protocol r245 r17.fee_growth_global0_x_64 r17.fee_growth_global1_x_64 r17.fee_residual0_x_64 r17.fee_residual1_x_64 r17.max_liquidity_per_tick r17.protocol_fees0 r17.protocol_fees1 r237 r240 into r246 as Slot; - set r246 into slots[r16.pool]; - branch.eq r33 false to end_then_0_4; - remove ticks[r23]; - branch.eq true true to end_otherwise_0_5; - position end_then_0_4; - position end_otherwise_0_5; - branch.eq r35 false to end_then_0_6; - remove ticks[r25]; - branch.eq true true to end_otherwise_0_7; - position end_then_0_6; - position end_otherwise_0_7; - get pools[r1] into r247; - mul r20 r247.scale0 into r248; - gte r248 r5 into r249; - mul r21 r247.scale1 into r250; - gte r250 r6 into r251; - and r249 r251 into r252; - assert.eq r252 true; - -function increase_liquidity: - input r0 as PositionNFT.record; - input r1 as dynamic.record; - input r2 as dynamic.record; - input r3 as u128.public; - input r4 as u128.public; - input r5 as u128.public; - input r6 as u128.public; - input r7 as field.public; - input r8 as field.public; - input r9 as i32.public; - input r10 as i32.public; - cast r0.owner r0.token_id r0.token0_id r0.token1_id r0.pool r0.tick_lower r0.tick_upper into r11 as PositionNFT.record; - call.dynamic r7 'aleo' 'transfer_private_to_public' with r1 shield_swap_v3.aleo r3 (as dynamic.record address.public u128.public) into r12 r13 (as dynamic.record dynamic.future); - call.dynamic r8 'aleo' 'transfer_private_to_public' with r2 shield_swap_v3.aleo r4 (as dynamic.record address.public u128.public) into r14 r15 (as dynamic.record dynamic.future); - async increase_liquidity r13 r15 r0.token_id r0.pool r0.tick_lower r0.tick_upper r3 r4 r5 r6 r7 r8 r9 r10 into r16; - output r0.token_id as field.public; - output r11 as PositionNFT.record; - output r12 as dynamic.record; - output r14 as dynamic.record; - output r16 as shield_swap_v3.aleo/increase_liquidity.future; - -finalize increase_liquidity: - input r0 as dynamic.future; - input r1 as dynamic.future; - input r2 as field.public; - input r3 as field.public; - input r4 as i32.public; - input r5 as i32.public; - input r6 as u128.public; - input r7 as u128.public; - input r8 as u128.public; - input r9 as u128.public; - input r10 as field.public; - input r11 as field.public; - input r12 as i32.public; - input r13 as i32.public; - await r0; - await r1; - get.or_use global_paused[true] false into r14; - not r14 into r15; - assert.eq r15 true; - get pools[r3] into r16; - assert.eq r16.enabled true; - get.or_use token_paused[r16.token0] false into r17; - not r17 into r18; - assert.eq r18 true; - get.or_use token_paused[r16.token1] false into r19; - not r19 into r20; - assert.eq r20 true; - cast r16.token0 r16.token1 into r21 as PairKey; - get.or_use pair_paused[r21] false into r22; - not r22 into r23; - assert.eq r23 true; - is.eq r16.token0 r10 into r24; - assert.eq r24 true; - is.eq r16.token1 r11 into r25; - assert.eq r25 true; - get slots[r3] into r26; - get positions[r2] into r27; - contains frozen_position[r2] into r28; - not r28 into r29; - assert.eq r29 true; - is.eq r27.pool r3 into r30; - is.eq r27.tick_lower r4 into r31; - and r30 r31 into r32; - is.eq r27.tick_upper r5 into r33; - and r32 r33 into r34; - assert.eq r34 true; - call view_sqrt_price_at_tick r4 into r35; - call view_sqrt_price_at_tick r5 into r36; - rem r6 r16.scale0 into r37; - is.eq r37 0u128 into r38; - assert.eq r38 true; - rem r7 r16.scale1 into r39; - is.eq r39 0u128 into r40; - assert.eq r40 true; - div r6 r16.scale0 into r41; - div r7 r16.scale1 into r42; - call view_liquidity_for_amounts r26.sqrt_price r35 r36 r41 r42 into r43; - gt r43 0u128 into r44; - assert.eq r44 true; - call view_amounts_for_liquidity r26.sqrt_price r35 r36 r43 false into r45 r46; - lte r45 r41 into r47; - lte r46 r42 into r48; - and r47 r48 into r49; - assert.eq r49 true; - mul r45 r16.scale0 into r50; - gte r50 r8 into r51; - mul r46 r16.scale1 into r52; - gte r52 r9 into r53; - and r51 r53 into r54; - assert.eq r54 true; - lt r26.sqrt_price r36 into r55; - branch.eq r55 false to end_then_0_0; - gt r45 0u128 into r56; - assert.eq r56 true; - branch.eq true true to end_otherwise_0_1; - position end_then_0_0; - position end_otherwise_0_1; - gt r26.sqrt_price r35 into r57; - branch.eq r57 false to end_then_0_2; - gt r46 0u128 into r58; - assert.eq r58 true; - branch.eq true true to end_otherwise_0_3; - position end_then_0_2; - position end_otherwise_0_3; - cast r3 r4 into r59 as TickKey; - hash.bhp256 r59 into r60 as field; - cast r3 r5 into r61 as TickKey; - hash.bhp256 r61 into r62 as field; - cast r3 0i128 0u128 r4 0u128 0u128 0i32 0i32 into r63 as Tick; - cast r3 0i128 0u128 r5 0u128 0u128 0i32 0i32 into r64 as Tick; - get.or_use ticks[r60] r63 into r65; - get.or_use ticks[r62] r64 into r66; - gt r65.liquidity_gross 0u128 into r67; - gt r66.liquidity_gross 0u128 into r68; - add r65.liquidity_gross r43 into r69; - add r66.liquidity_gross r43 into r70; - lte r69 r26.max_liquidity_per_tick into r71; - assert.eq r71 true; - lte r70 r26.max_liquidity_per_tick into r72; - assert.eq r72 true; - not r67 into r73; - lte r4 r26.tick into r74; - and r73 r74 into r75; - ternary r75 r26.fee_growth_global0_x_64 r65.fee_growth_outside0_64 into r76; - lte r4 r26.tick into r77; - and r73 r77 into r78; - ternary r78 r26.fee_growth_global1_x_64 r65.fee_growth_outside1_64 into r79; - not r68 into r80; - lte r5 r26.tick into r81; - and r80 r81 into r82; - ternary r82 r26.fee_growth_global0_x_64 r66.fee_growth_outside0_64 into r83; - lte r5 r26.tick into r84; - and r80 r84 into r85; - ternary r85 r26.fee_growth_global1_x_64 r66.fee_growth_outside1_64 into r86; - ternary r67 -400001i32 r12 into r87; - cast r3 r87 into r88 as TickKey; - hash.bhp256 r88 into r89 as field; - get ticks[r89] into r90; - branch.eq r73 false to end_then_0_4; - is.eq r90.pool r3 into r91; - assert.eq r91 true; - is.eq r90.tick r12 into r92; - assert.eq r92 true; - is.eq r12 -400001i32 into r93; - gt r90.liquidity_gross 0u128 into r94; - or r93 r94 into r95; - assert.eq r95 true; - lt r90.tick r4 into r96; - assert.eq r96 true; - gt r90.next r4 into r97; - assert.eq r97 true; - branch.eq true true to end_otherwise_0_5; - position end_then_0_4; - position end_otherwise_0_5; - ternary r67 r65.prev r12 into r98; - ternary r67 r65.next r90.next into r99; - cast r43 into r100 as i128; - add r65.liquidity_net r100 into r101; - cast r3 r101 r69 r4 r76 r79 r98 r99 into r102 as Tick; - set r102 into ticks[r60]; - branch.eq r73 false to end_then_0_6; - cast r90.pool r90.liquidity_net r90.liquidity_gross r90.tick r90.fee_growth_outside0_64 r90.fee_growth_outside1_64 r90.prev r4 into r103 as Tick; - set r103 into ticks[r89]; - cast r3 r99 into r104 as TickKey; - hash.bhp256 r104 into r105 as field; - get ticks[r105] into r106; - cast r106.pool r106.liquidity_net r106.liquidity_gross r106.tick r106.fee_growth_outside0_64 r106.fee_growth_outside1_64 r4 r106.next into r107 as Tick; - set r107 into ticks[r105]; - branch.eq true true to end_otherwise_0_7; - position end_then_0_6; - position end_otherwise_0_7; - get.or_use ticks[r62] r64 into r108; - ternary r68 -400001i32 r13 into r109; - cast r3 r109 into r110 as TickKey; - hash.bhp256 r110 into r111 as field; - get ticks[r111] into r112; - branch.eq r80 false to end_then_0_8; - is.eq r112.pool r3 into r113; - assert.eq r113 true; - is.eq r112.tick r13 into r114; - assert.eq r114 true; - is.eq r13 -400001i32 into r115; - gt r112.liquidity_gross 0u128 into r116; - or r115 r116 into r117; - assert.eq r117 true; - lt r112.tick r5 into r118; - assert.eq r118 true; - gt r112.next r5 into r119; - assert.eq r119 true; - branch.eq true true to end_otherwise_0_9; - position end_then_0_8; - position end_otherwise_0_9; - ternary r68 r108.prev r13 into r120; - ternary r68 r108.next r112.next into r121; - cast r43 into r122 as i128; - sub r108.liquidity_net r122 into r123; - cast r3 r123 r70 r5 r83 r86 r120 r121 into r124 as Tick; - set r124 into ticks[r62]; - branch.eq r80 false to end_then_0_10; - get ticks[r111] into r125; - cast r125.pool r125.liquidity_net r125.liquidity_gross r125.tick r125.fee_growth_outside0_64 r125.fee_growth_outside1_64 r125.prev r5 into r126 as Tick; - set r126 into ticks[r111]; - cast r3 r121 into r127 as TickKey; - hash.bhp256 r127 into r128 as field; - get ticks[r128] into r129; - cast r129.pool r129.liquidity_net r129.liquidity_gross r129.tick r129.fee_growth_outside0_64 r129.fee_growth_outside1_64 r5 r129.next into r130 as Tick; - set r130 into ticks[r128]; - branch.eq true true to end_otherwise_0_11; - position end_then_0_10; - position end_otherwise_0_11; - get ticks[r60] into r131; - get ticks[r62] into r132; - gte r26.tick r131.tick into r133; - gte r26.fee_growth_global0_x_64 r131.fee_growth_outside0_64 into r134; - ternary r134 r26.fee_growth_global0_x_64 r131.fee_growth_outside0_64 into r135; - ternary r134 r131.fee_growth_outside0_64 r26.fee_growth_global0_x_64 into r136; - sub r135 r136 into r137; - gt r137 0u128 into r138; - ternary r138 r137 1u128 into r139; - sub 340282366920938463463374607431768211455u128 r139 into r140; - add r140 1u128 into r141; - ternary r134 r137 r141 into r142; - gte r26.fee_growth_global1_x_64 r131.fee_growth_outside1_64 into r143; - ternary r143 r26.fee_growth_global1_x_64 r131.fee_growth_outside1_64 into r144; - ternary r143 r131.fee_growth_outside1_64 r26.fee_growth_global1_x_64 into r145; - sub r144 r145 into r146; - gt r146 0u128 into r147; - ternary r147 r146 1u128 into r148; - sub 340282366920938463463374607431768211455u128 r148 into r149; - add r149 1u128 into r150; - ternary r143 r146 r150 into r151; - ternary r133 r131.fee_growth_outside0_64 r142 into r152; - ternary r133 r131.fee_growth_outside1_64 r151 into r153; - lt r26.tick r132.tick into r154; - gte r26.fee_growth_global0_x_64 r132.fee_growth_outside0_64 into r155; - ternary r155 r26.fee_growth_global0_x_64 r132.fee_growth_outside0_64 into r156; - ternary r155 r132.fee_growth_outside0_64 r26.fee_growth_global0_x_64 into r157; - sub r156 r157 into r158; - gt r158 0u128 into r159; - ternary r159 r158 1u128 into r160; - sub 340282366920938463463374607431768211455u128 r160 into r161; - add r161 1u128 into r162; - ternary r155 r158 r162 into r163; - gte r26.fee_growth_global1_x_64 r132.fee_growth_outside1_64 into r164; - ternary r164 r26.fee_growth_global1_x_64 r132.fee_growth_outside1_64 into r165; - ternary r164 r132.fee_growth_outside1_64 r26.fee_growth_global1_x_64 into r166; - sub r165 r166 into r167; - gt r167 0u128 into r168; - ternary r168 r167 1u128 into r169; - sub 340282366920938463463374607431768211455u128 r169 into r170; - add r170 1u128 into r171; - ternary r164 r167 r171 into r172; - ternary r154 r132.fee_growth_outside0_64 r163 into r173; - ternary r154 r132.fee_growth_outside1_64 r172 into r174; - gte r26.fee_growth_global0_x_64 r152 into r175; - ternary r175 r26.fee_growth_global0_x_64 r152 into r176; - ternary r175 r152 r26.fee_growth_global0_x_64 into r177; - sub r176 r177 into r178; - gt r178 0u128 into r179; - ternary r179 r178 1u128 into r180; - sub 340282366920938463463374607431768211455u128 r180 into r181; - add r181 1u128 into r182; - ternary r175 r178 r182 into r183; - gte r183 r173 into r184; - ternary r184 r183 r173 into r185; - ternary r184 r173 r183 into r186; - sub r185 r186 into r187; - gt r187 0u128 into r188; - ternary r188 r187 1u128 into r189; - sub 340282366920938463463374607431768211455u128 r189 into r190; - add r190 1u128 into r191; - ternary r184 r187 r191 into r192; - gte r26.fee_growth_global1_x_64 r153 into r193; - ternary r193 r26.fee_growth_global1_x_64 r153 into r194; - ternary r193 r153 r26.fee_growth_global1_x_64 into r195; - sub r194 r195 into r196; - gt r196 0u128 into r197; - ternary r197 r196 1u128 into r198; - sub 340282366920938463463374607431768211455u128 r198 into r199; - add r199 1u128 into r200; - ternary r193 r196 r200 into r201; - gte r201 r174 into r202; - ternary r202 r201 r174 into r203; - ternary r202 r174 r201 into r204; - sub r203 r204 into r205; - gt r205 0u128 into r206; - ternary r206 r205 1u128 into r207; - sub 340282366920938463463374607431768211455u128 r207 into r208; - add r208 1u128 into r209; - ternary r202 r205 r209 into r210; - gte r192 r27.fee_growth_inside0_last_64 into r211; - ternary r211 r192 r27.fee_growth_inside0_last_64 into r212; - ternary r211 r27.fee_growth_inside0_last_64 r192 into r213; - sub r212 r213 into r214; - gt r214 0u128 into r215; - ternary r215 r214 1u128 into r216; - sub 340282366920938463463374607431768211455u128 r216 into r217; - add r217 1u128 into r218; - ternary r211 r214 r218 into r219; - and r219 18446744073709551615u128 into r220; - shr r219 64u8 into r221; - and r27.liquidity 18446744073709551615u128 into r222; - shr r27.liquidity 64u8 into r223; - mul r220 r222 into r224; - mul r220 r223 into r225; - mul r221 r222 into r226; - mul r221 r223 into r227; - and r224 18446744073709551615u128 into r228; - shr r224 64u8 into r229; - and r225 18446744073709551615u128 into r230; - add r229 r230 into r231; - and r226 18446744073709551615u128 into r232; - add r231 r232 into r233; - and r233 18446744073709551615u128 into r234; - shr r233 64u8 into r235; - shr r225 64u8 into r236; - shr r226 64u8 into r237; - add r236 r237 into r238; - and r227 18446744073709551615u128 into r239; - add r238 r239 into r240; - add r240 r235 into r241; - and r241 18446744073709551615u128 into r242; - shr r241 64u8 into r243; - shr r227 64u8 into r244; - add r244 r243 into r245; - shl r234 64u8 into r246; - add r246 r228 into r247; - shl r245 64u8 into r248; - add r248 r242 into r249; - shl r249 65u8 into r250; - shr r247 63u8 into r251; - add r250 r251 into r252; - gte r210 r27.fee_growth_inside1_last_64 into r253; - ternary r253 r210 r27.fee_growth_inside1_last_64 into r254; - ternary r253 r27.fee_growth_inside1_last_64 r210 into r255; - sub r254 r255 into r256; - gt r256 0u128 into r257; - ternary r257 r256 1u128 into r258; - sub 340282366920938463463374607431768211455u128 r258 into r259; - add r259 1u128 into r260; - ternary r253 r256 r260 into r261; - and r261 18446744073709551615u128 into r262; - shr r261 64u8 into r263; - and r27.liquidity 18446744073709551615u128 into r264; - shr r27.liquidity 64u8 into r265; - mul r262 r264 into r266; - mul r262 r265 into r267; - mul r263 r264 into r268; - mul r263 r265 into r269; - and r266 18446744073709551615u128 into r270; - shr r266 64u8 into r271; - and r267 18446744073709551615u128 into r272; - add r271 r272 into r273; - and r268 18446744073709551615u128 into r274; - add r273 r274 into r275; - and r275 18446744073709551615u128 into r276; - shr r275 64u8 into r277; - shr r267 64u8 into r278; - shr r268 64u8 into r279; - add r278 r279 into r280; - and r269 18446744073709551615u128 into r281; - add r280 r281 into r282; - add r282 r277 into r283; - and r283 18446744073709551615u128 into r284; - shr r283 64u8 into r285; - shr r269 64u8 into r286; - add r286 r285 into r287; - shl r276 64u8 into r288; - add r288 r270 into r289; - shl r287 64u8 into r290; - add r290 r284 into r291; - shl r291 65u8 into r292; - shr r289 63u8 into r293; - add r292 r293 into r294; - sub r41 r45 into r295; - sub r42 r46 into r296; - add r27.liquidity r43 into r297; - add r27.tokens_owed0 r252 into r298; - add r298 r295 into r299; - add r27.tokens_owed1 r294 into r300; - add r300 r296 into r301; - cast r2 r3 r4 r5 r297 r192 r210 r299 r301 into r302 as Position; - set r302 into positions[r2]; - lte r4 r26.tick into r303; - and r73 r303 into r304; - gt r4 r26.next_init_below into r305; - and r304 r305 into r306; - ternary r306 r4 r26.next_init_below into r307; - gt r4 r26.tick into r308; - and r73 r308 into r309; - lt r4 r26.next_init_above into r310; - and r309 r310 into r311; - ternary r311 r4 r26.next_init_above into r312; - lte r5 r26.tick into r313; - and r80 r313 into r314; - gt r5 r307 into r315; - and r314 r315 into r316; - ternary r316 r5 r307 into r317; - gt r5 r26.tick into r318; - and r80 r318 into r319; - lt r5 r312 into r320; - and r319 r320 into r321; - ternary r321 r5 r312 into r322; - gte r26.tick r4 into r323; - lt r26.tick r5 into r324; - and r323 r324 into r325; - add r26.liquidity r43 into r326; - ternary r325 r326 r26.liquidity into r327; - cast r26.tick r26.tick_spacing r26.sqrt_price r26.fee_protocol r327 r26.fee_growth_global0_x_64 r26.fee_growth_global1_x_64 r26.fee_residual0_x_64 r26.fee_residual1_x_64 r26.max_liquidity_per_tick r26.protocol_fees0 r26.protocol_fees1 r317 r322 into r328 as Slot; - set r328 into slots[r3]; - -function collect: - input r0 as PositionNFT.record; - input r1 as u128.public; - input r2 as u128.public; - input r3 as field.public; - input r4 as field.public; - input r5 as address.private; - assert.neq r5 shield_swap_v3.aleo; - cast r0.owner r0.token_id r0.token0_id r0.token1_id r0.pool r0.tick_lower r0.tick_upper into r6 as PositionNFT.record; - call.dynamic r3 'aleo' 'transfer_public_to_private' with r5 r1 (as address.private u128.public) into r7 r8 (as dynamic.record dynamic.future); - call.dynamic r4 'aleo' 'transfer_public_to_private' with r5 r2 (as address.private u128.public) into r9 r10 (as dynamic.record dynamic.future); - async collect r8 r10 r0.token_id r0.pool r0.tick_lower r0.tick_upper r1 r2 r3 r4 into r11; - output r6 as PositionNFT.record; - output r7 as dynamic.record; - output r9 as dynamic.record; - output r11 as shield_swap_v3.aleo/collect.future; - -finalize collect: - input r0 as dynamic.future; - input r1 as dynamic.future; - input r2 as field.public; - input r3 as field.public; - input r4 as i32.public; - input r5 as i32.public; - input r6 as u128.public; - input r7 as u128.public; - input r8 as field.public; - input r9 as field.public; - await r0; - await r1; - get pools[r3] into r10; - is.eq r10.token0 r8 into r11; - is.eq r10.token1 r9 into r12; - and r11 r12 into r13; - assert.eq r13 true; - get slots[r3] into r14; - get positions[r2] into r15; - contains frozen_position[r2] into r16; - not r16 into r17; - assert.eq r17 true; - is.eq r15.pool r3 into r18; - is.eq r15.tick_lower r4 into r19; - and r18 r19 into r20; - is.eq r15.tick_upper r5 into r21; - and r20 r21 into r22; - assert.eq r22 true; - cast r3 0i128 0u128 r4 0u128 0u128 0i32 0i32 into r23 as Tick; - cast r3 0i128 0u128 r5 0u128 0u128 0i32 0i32 into r24 as Tick; - cast r3 r4 into r25 as TickKey; - hash.bhp256 r25 into r26 as field; - get.or_use ticks[r26] r23 into r27; - cast r3 r5 into r28 as TickKey; - hash.bhp256 r28 into r29 as field; - get.or_use ticks[r29] r24 into r30; - gte r14.tick r27.tick into r31; - gte r14.fee_growth_global0_x_64 r27.fee_growth_outside0_64 into r32; - ternary r32 r14.fee_growth_global0_x_64 r27.fee_growth_outside0_64 into r33; - ternary r32 r27.fee_growth_outside0_64 r14.fee_growth_global0_x_64 into r34; - sub r33 r34 into r35; - gt r35 0u128 into r36; - ternary r36 r35 1u128 into r37; - sub 340282366920938463463374607431768211455u128 r37 into r38; - add r38 1u128 into r39; - ternary r32 r35 r39 into r40; - gte r14.fee_growth_global1_x_64 r27.fee_growth_outside1_64 into r41; - ternary r41 r14.fee_growth_global1_x_64 r27.fee_growth_outside1_64 into r42; - ternary r41 r27.fee_growth_outside1_64 r14.fee_growth_global1_x_64 into r43; - sub r42 r43 into r44; - gt r44 0u128 into r45; - ternary r45 r44 1u128 into r46; - sub 340282366920938463463374607431768211455u128 r46 into r47; - add r47 1u128 into r48; - ternary r41 r44 r48 into r49; - ternary r31 r27.fee_growth_outside0_64 r40 into r50; - ternary r31 r27.fee_growth_outside1_64 r49 into r51; - lt r14.tick r30.tick into r52; - gte r14.fee_growth_global0_x_64 r30.fee_growth_outside0_64 into r53; - ternary r53 r14.fee_growth_global0_x_64 r30.fee_growth_outside0_64 into r54; - ternary r53 r30.fee_growth_outside0_64 r14.fee_growth_global0_x_64 into r55; - sub r54 r55 into r56; - gt r56 0u128 into r57; - ternary r57 r56 1u128 into r58; - sub 340282366920938463463374607431768211455u128 r58 into r59; - add r59 1u128 into r60; - ternary r53 r56 r60 into r61; - gte r14.fee_growth_global1_x_64 r30.fee_growth_outside1_64 into r62; - ternary r62 r14.fee_growth_global1_x_64 r30.fee_growth_outside1_64 into r63; - ternary r62 r30.fee_growth_outside1_64 r14.fee_growth_global1_x_64 into r64; - sub r63 r64 into r65; - gt r65 0u128 into r66; - ternary r66 r65 1u128 into r67; - sub 340282366920938463463374607431768211455u128 r67 into r68; - add r68 1u128 into r69; - ternary r62 r65 r69 into r70; - ternary r52 r30.fee_growth_outside0_64 r61 into r71; - ternary r52 r30.fee_growth_outside1_64 r70 into r72; - gte r14.fee_growth_global0_x_64 r50 into r73; - ternary r73 r14.fee_growth_global0_x_64 r50 into r74; - ternary r73 r50 r14.fee_growth_global0_x_64 into r75; - sub r74 r75 into r76; - gt r76 0u128 into r77; - ternary r77 r76 1u128 into r78; - sub 340282366920938463463374607431768211455u128 r78 into r79; - add r79 1u128 into r80; - ternary r73 r76 r80 into r81; - gte r81 r71 into r82; - ternary r82 r81 r71 into r83; - ternary r82 r71 r81 into r84; - sub r83 r84 into r85; - gt r85 0u128 into r86; - ternary r86 r85 1u128 into r87; - sub 340282366920938463463374607431768211455u128 r87 into r88; - add r88 1u128 into r89; - ternary r82 r85 r89 into r90; - gte r14.fee_growth_global1_x_64 r51 into r91; - ternary r91 r14.fee_growth_global1_x_64 r51 into r92; - ternary r91 r51 r14.fee_growth_global1_x_64 into r93; - sub r92 r93 into r94; - gt r94 0u128 into r95; - ternary r95 r94 1u128 into r96; - sub 340282366920938463463374607431768211455u128 r96 into r97; - add r97 1u128 into r98; - ternary r91 r94 r98 into r99; - gte r99 r72 into r100; - ternary r100 r99 r72 into r101; - ternary r100 r72 r99 into r102; - sub r101 r102 into r103; - gt r103 0u128 into r104; - ternary r104 r103 1u128 into r105; - sub 340282366920938463463374607431768211455u128 r105 into r106; - add r106 1u128 into r107; - ternary r100 r103 r107 into r108; - rem r6 r10.scale0 into r109; - is.eq r109 0u128 into r110; - rem r7 r10.scale1 into r111; - is.eq r111 0u128 into r112; - and r110 r112 into r113; - assert.eq r113 true; - div r6 r10.scale0 into r114; - div r7 r10.scale1 into r115; - gte r90 r15.fee_growth_inside0_last_64 into r116; - ternary r116 r90 r15.fee_growth_inside0_last_64 into r117; - ternary r116 r15.fee_growth_inside0_last_64 r90 into r118; - sub r117 r118 into r119; - gt r119 0u128 into r120; - ternary r120 r119 1u128 into r121; - sub 340282366920938463463374607431768211455u128 r121 into r122; - add r122 1u128 into r123; - ternary r116 r119 r123 into r124; - and r124 18446744073709551615u128 into r125; - shr r124 64u8 into r126; - and r15.liquidity 18446744073709551615u128 into r127; - shr r15.liquidity 64u8 into r128; - mul r125 r127 into r129; - mul r125 r128 into r130; - mul r126 r127 into r131; - mul r126 r128 into r132; - and r129 18446744073709551615u128 into r133; - shr r129 64u8 into r134; - and r130 18446744073709551615u128 into r135; - add r134 r135 into r136; - and r131 18446744073709551615u128 into r137; - add r136 r137 into r138; - and r138 18446744073709551615u128 into r139; - shr r138 64u8 into r140; - shr r130 64u8 into r141; - shr r131 64u8 into r142; - add r141 r142 into r143; - and r132 18446744073709551615u128 into r144; - add r143 r144 into r145; - add r145 r140 into r146; - and r146 18446744073709551615u128 into r147; - shr r146 64u8 into r148; - shr r132 64u8 into r149; - add r149 r148 into r150; - shl r139 64u8 into r151; - add r151 r133 into r152; - shl r150 64u8 into r153; - add r153 r147 into r154; - shl r154 65u8 into r155; - shr r152 63u8 into r156; - add r155 r156 into r157; - add r15.tokens_owed0 r157 into r158; - gte r108 r15.fee_growth_inside1_last_64 into r159; - ternary r159 r108 r15.fee_growth_inside1_last_64 into r160; - ternary r159 r15.fee_growth_inside1_last_64 r108 into r161; - sub r160 r161 into r162; - gt r162 0u128 into r163; - ternary r163 r162 1u128 into r164; - sub 340282366920938463463374607431768211455u128 r164 into r165; - add r165 1u128 into r166; - ternary r159 r162 r166 into r167; - and r167 18446744073709551615u128 into r168; - shr r167 64u8 into r169; - and r15.liquidity 18446744073709551615u128 into r170; - shr r15.liquidity 64u8 into r171; - mul r168 r170 into r172; - mul r168 r171 into r173; - mul r169 r170 into r174; - mul r169 r171 into r175; - and r172 18446744073709551615u128 into r176; - shr r172 64u8 into r177; - and r173 18446744073709551615u128 into r178; - add r177 r178 into r179; - and r174 18446744073709551615u128 into r180; - add r179 r180 into r181; - and r181 18446744073709551615u128 into r182; - shr r181 64u8 into r183; - shr r173 64u8 into r184; - shr r174 64u8 into r185; - add r184 r185 into r186; - and r175 18446744073709551615u128 into r187; - add r186 r187 into r188; - add r188 r183 into r189; - and r189 18446744073709551615u128 into r190; - shr r189 64u8 into r191; - shr r175 64u8 into r192; - add r192 r191 into r193; - shl r182 64u8 into r194; - add r194 r176 into r195; - shl r193 64u8 into r196; - add r196 r190 into r197; - shl r197 65u8 into r198; - shr r195 63u8 into r199; - add r198 r199 into r200; - add r15.tokens_owed1 r200 into r201; - lte r114 r158 into r202; - lte r115 r201 into r203; - and r202 r203 into r204; - assert.eq r204 true; - sub r158 r114 into r205; - sub r201 r115 into r206; - cast r2 r3 r4 r5 r15.liquidity r90 r108 r205 r206 into r207 as Position; - set r207 into positions[r2]; - -function burn: - input r0 as PositionNFT.record; - async burn r0.token_id into r1; - output r0.token_id as field.public; - output self.signer as address.public; - output r1 as shield_swap_v3.aleo/burn.future; - -finalize burn: - input r0 as field.public; - contains frozen_position[r0] into r1; - not r1 into r2; - assert.eq r2 true; - get positions[r0] into r3; - is.eq r3.liquidity 0u128 into r4; - assert.eq r4 true; - is.eq r3.tokens_owed0 0u128 into r5; - assert.eq r5 true; - is.eq r3.tokens_owed1 0u128 into r6; - assert.eq r6 true; - remove positions[r0]; - -closure verify_blinded_address: - input r0 as address; - input r1 as address; - input r2 as field; - input r3 as address; - cast r0 into r4 as field; - cast r1 into r5 as field; - cast r4 11835072102227764468342786961086432175093421716844963782363567713633field r5 r2 into r6 as [field; 4u32]; - hash.psd8.raw r6 into r7 as address; - assert.eq r7 r3; - -view view_swap_iteration: - input r0 as SwapIterCfg.public; - input r1 as i32.public; - input r2 as Tick.public; - input r3 as SwapIterState.public; - gte r1 -873409i32 into r4; - lte r1 873409i32 into r5; - and r4 r5 into r6; - assert.eq r6 true; - lt r1 0i32 into r7; - sub 0i32 r1 into r8; - ternary r7 r8 r1 into r9; - gte r9 0i32 into r10; - assert.eq r10 true; - cast r9 into r11 as u32; - and r11 3u32 into r12; - is.eq r12 0u32 into r13; - is.eq r12 1u32 into r14; - is.eq r12 2u32 into r15; - ternary r15 9222449791875588096u128 9221988703967300608u128 into r16; - ternary r14 9222910902837697536u128 r16 into r17; - ternary r13 9223372036854775808u128 r17 into r18; - and r11 4u32 into r19; - is.neq r19 0u32 into r20; - mul r18 9221527639111677952u128 into r21; - shr r21 63u8 into r22; - ternary r20 r22 r18 into r23; - and r11 8u32 into r24; - is.neq r24 0u32 into r25; - mul r23 9219683610192801792u128 into r26; - shr r26 63u8 into r27; - ternary r25 r27 r23 into r28; - and r11 16u32 into r29; - is.neq r29 0u32 into r30; - mul r28 9215996658532725760u128 into r31; - shr r31 63u8 into r32; - ternary r30 r32 r28 into r33; - and r11 32u32 into r34; - is.neq r34 0u32 into r35; - mul r33 9208627177859081216u128 into r36; - shr r36 63u8 into r37; - ternary r35 r37 r33 into r38; - and r11 64u32 into r39; - is.neq r39 0u32 into r40; - mul r38 9193905890596798464u128 into r41; - shr r41 63u8 into r42; - ternary r40 r42 r38 into r43; - and r11 128u32 into r44; - is.neq r44 0u32 into r45; - mul r43 9164533880601766912u128 into r46; - shr r46 63u8 into r47; - ternary r45 r47 r43 into r48; - and r11 256u32 into r49; - is.neq r49 0u32 into r50; - mul r48 9106071067403056128u128 into r51; - shr r51 63u8 into r52; - ternary r50 r52 r48 into r53; - and r11 512u32 into r54; - is.neq r54 0u32 into r55; - mul r53 8990261907820801024u128 into r56; - shr r56 63u8 into r57; - ternary r55 r57 r53 into r58; - and r11 1024u32 into r59; - is.neq r59 0u32 into r60; - mul r58 8763043369415622656u128 into r61; - shr r61 63u8 into r62; - ternary r60 r62 r58 into r63; - and r11 2048u32 into r64; - is.neq r64 0u32 into r65; - mul r63 8325689215117605888u128 into r66; - shr r66 63u8 into r67; - ternary r65 r67 r63 into r68; - and r11 4096u32 into r69; - is.neq r69 0u32 into r70; - mul r68 7515375139346884608u128 into r71; - shr r71 63u8 into r72; - ternary r70 r72 r68 into r73; - and r11 8192u32 into r74; - is.neq r74 0u32 into r75; - mul r73 6123667489441693696u128 into r76; - shr r76 63u8 into r77; - ternary r75 r77 r73 into r78; - and r11 16384u32 into r79; - is.neq r79 0u32 into r80; - mul r78 4065682634442729984u128 into r81; - shr r81 63u8 into r82; - ternary r80 r82 r78 into r83; - and r11 32768u32 into r84; - is.neq r84 0u32 into r85; - mul r83 1792161827361994496u128 into r86; - shr r86 63u8 into r87; - ternary r85 r87 r83 into r88; - and r11 65536u32 into r89; - is.neq r89 0u32 into r90; - mul r88 348228825923923264u128 into r91; - shr r91 63u8 into r92; - ternary r90 r92 r88 into r93; - and r11 131072u32 into r94; - is.neq r94 0u32 into r95; - mul r93 13147394978735516u128 into r96; - shr r96 63u8 into r97; - ternary r95 r97 r93 into r98; - and r11 262144u32 into r99; - is.neq r99 0u32 into r100; - mul r98 18740867660568u128 into r101; - shr r101 63u8 into r102; - ternary r100 r102 r98 into r103; - and r11 524288u32 into r104; - is.neq r104 0u32 into r105; - mul r103 38079361u128 into r106; - shr r106 63u8 into r107; - ternary r105 r107 r103 into r108; - gt r1 0i32 into r109; - div 85070591730234615865843651857942052864u128 r108 into r110; - ternary r109 r110 r108 into r111; - lt r111 r0.lim into r112; - ternary r112 r0.lim r111 into r113; - gt r111 r0.lim into r114; - ternary r114 r0.lim r111 into r115; - ternary r0.z r113 r115 into r116; - gt r3.rem 0u128 into r117; - and r3.crossed r117 into r118; - is.eq r3.liq 0u128 into r119; - and r118 r119 into r120; - gt r3.liq 0u128 into r121; - and r117 r121 into r122; - and r122 r3.crossed into r123; - gt r116 r3.sp into r124; - ternary r124 r3.sp r116 into r125; - ternary r124 r116 r3.sp into r126; - gt r125 0u128 into r127; - gt r126 0u128 into r128; - and r127 r128 into r129; - ternary r128 r126 1u128 into r130; - ternary r127 r125 1u128 into r131; - and r3.liq 18446744073709551615u128 into r132; - shr r3.liq 64u8 into r133; - mul r132 9223372036854775808u128 into r134; - mul r133 9223372036854775808u128 into r135; - and r134 18446744073709551615u128 into r136; - shr r134 64u8 into r137; - and r135 18446744073709551615u128 into r138; - add r137 r138 into r139; - and r139 18446744073709551615u128 into r140; - shr r139 64u8 into r141; - shr r135 64u8 into r142; - add r142 r141 into r143; - and r143 18446744073709551615u128 into r144; - shr r143 64u8 into r145; - shl r140 64u8 into r146; - add r146 r136 into r147; - shl r145 64u8 into r148; - add r148 r144 into r149; - lt r149 r131 into r150; - assert.eq r150 true; - shr r147 96u8 into r151; - and r151 4294967295u128 into r152; - shl r149 32u8 into r153; - add r153 r152 into r154; - div r154 r131 into r155; - rem r154 r131 into r156; - shr r147 64u8 into r157; - and r157 4294967295u128 into r158; - shl r156 32u8 into r159; - add r159 r158 into r160; - shl r155 32u8 into r161; - div r160 r131 into r162; - add r161 r162 into r163; - rem r160 r131 into r164; - shr r147 32u8 into r165; - and r165 4294967295u128 into r166; - shl r164 32u8 into r167; - add r167 r166 into r168; - shl r163 32u8 into r169; - div r168 r131 into r170; - add r169 r170 into r171; - rem r168 r131 into r172; - shr r147 0u8 into r173; - and r173 4294967295u128 into r174; - shl r172 32u8 into r175; - add r175 r174 into r176; - shl r171 32u8 into r177; - div r176 r131 into r178; - add r177 r178 into r179; - rem r176 r131 into r180; - gt r180 0u128 into r181; - add r179 1u128 into r182; - ternary r181 r182 r179 into r183; - add r137 r138 into r184; - and r184 18446744073709551615u128 into r185; - shr r184 64u8 into r186; - add r142 r186 into r187; - and r187 18446744073709551615u128 into r188; - shr r187 64u8 into r189; - shl r185 64u8 into r190; - add r190 r136 into r191; - shl r189 64u8 into r192; - add r192 r188 into r193; - lt r193 r130 into r194; - assert.eq r194 true; - shr r191 96u8 into r195; - and r195 4294967295u128 into r196; - shl r193 32u8 into r197; - add r197 r196 into r198; - div r198 r130 into r199; - rem r198 r130 into r200; - shr r191 64u8 into r201; - and r201 4294967295u128 into r202; - shl r200 32u8 into r203; - add r203 r202 into r204; - shl r199 32u8 into r205; - div r204 r130 into r206; - add r205 r206 into r207; - rem r204 r130 into r208; - shr r191 32u8 into r209; - and r209 4294967295u128 into r210; - shl r208 32u8 into r211; - add r211 r210 into r212; - shl r207 32u8 into r213; - div r212 r130 into r214; - add r213 r214 into r215; - rem r212 r130 into r216; - shr r191 0u8 into r217; - and r217 4294967295u128 into r218; - shl r216 32u8 into r219; - add r219 r218 into r220; - shl r215 32u8 into r221; - div r220 r130 into r222; - add r221 r222 into r223; - rem r220 r130 into r224; - add r223 1u128 into r225; - gte r183 r223 into r226; - ternary r226 r183 r223 into r227; - ternary r226 r223 r183 into r228; - sub r227 r228 into r229; - ternary r226 r229 0u128 into r230; - lt r125 r126 into r231; - and r129 r231 into r232; - ternary r232 r230 0u128 into r233; - gt r3.sp r116 into r234; - ternary r234 r116 r3.sp into r235; - ternary r234 r3.sp r116 into r236; - sub r236 r235 into r237; - and r237 18446744073709551615u128 into r238; - shr r237 64u8 into r239; - mul r132 r238 into r240; - mul r132 r239 into r241; - mul r133 r238 into r242; - mul r133 r239 into r243; - and r240 18446744073709551615u128 into r244; - shr r240 64u8 into r245; - and r241 18446744073709551615u128 into r246; - add r245 r246 into r247; - and r242 18446744073709551615u128 into r248; - add r247 r248 into r249; - and r249 18446744073709551615u128 into r250; - shr r249 64u8 into r251; - shr r241 64u8 into r252; - shr r242 64u8 into r253; - add r252 r253 into r254; - and r243 18446744073709551615u128 into r255; - add r254 r255 into r256; - add r256 r251 into r257; - and r257 18446744073709551615u128 into r258; - shr r257 64u8 into r259; - shr r243 64u8 into r260; - add r260 r259 into r261; - shl r250 64u8 into r262; - add r262 r244 into r263; - shl r261 64u8 into r264; - add r264 r258 into r265; - lt r265 9223372036854775808u128 into r266; - assert.eq r266 true; - shr r263 96u8 into r267; - and r267 4294967295u128 into r268; - shl r265 32u8 into r269; - add r269 r268 into r270; - div r270 9223372036854775808u128 into r271; - rem r270 9223372036854775808u128 into r272; - shr r263 64u8 into r273; - and r273 4294967295u128 into r274; - shl r272 32u8 into r275; - add r275 r274 into r276; - shl r271 32u8 into r277; - div r276 9223372036854775808u128 into r278; - add r277 r278 into r279; - rem r276 9223372036854775808u128 into r280; - shr r263 32u8 into r281; - and r281 4294967295u128 into r282; - shl r280 32u8 into r283; - add r283 r282 into r284; - shl r279 32u8 into r285; - div r284 9223372036854775808u128 into r286; - add r285 r286 into r287; - rem r284 9223372036854775808u128 into r288; - shr r263 0u8 into r289; - and r289 4294967295u128 into r290; - shl r288 32u8 into r291; - add r291 r290 into r292; - shl r287 32u8 into r293; - div r292 9223372036854775808u128 into r294; - add r293 r294 into r295; - rem r292 9223372036854775808u128 into r296; - gt r296 0u128 into r297; - add r295 1u128 into r298; - ternary r297 r298 r295 into r299; - ternary r0.z r233 r299 into r300; - cast r0.fee_pips into r301 as u128; - sub 1000000u128 r301 into r302; - and r3.rem 18446744073709551615u128 into r303; - shr r3.rem 64u8 into r304; - and r302 18446744073709551615u128 into r305; - shr r302 64u8 into r306; - mul r303 r305 into r307; - mul r303 r306 into r308; - mul r304 r305 into r309; - mul r304 r306 into r310; - and r307 18446744073709551615u128 into r311; - shr r307 64u8 into r312; - and r308 18446744073709551615u128 into r313; - add r312 r313 into r314; - and r309 18446744073709551615u128 into r315; - add r314 r315 into r316; - and r316 18446744073709551615u128 into r317; - shr r316 64u8 into r318; - shr r308 64u8 into r319; - shr r309 64u8 into r320; - add r319 r320 into r321; - and r310 18446744073709551615u128 into r322; - add r321 r322 into r323; - add r323 r318 into r324; - and r324 18446744073709551615u128 into r325; - shr r324 64u8 into r326; - shr r310 64u8 into r327; - add r327 r326 into r328; - shl r317 64u8 into r329; - add r329 r311 into r330; - shl r328 64u8 into r331; - add r331 r325 into r332; - lt r332 1000000u128 into r333; - assert.eq r333 true; - shr r330 96u8 into r334; - and r334 4294967295u128 into r335; - shl r332 32u8 into r336; - add r336 r335 into r337; - div r337 1000000u128 into r338; - rem r337 1000000u128 into r339; - shr r330 64u8 into r340; - and r340 4294967295u128 into r341; - shl r339 32u8 into r342; - add r342 r341 into r343; - shl r338 32u8 into r344; - div r343 1000000u128 into r345; - add r344 r345 into r346; - rem r343 1000000u128 into r347; - shr r330 32u8 into r348; - and r348 4294967295u128 into r349; - shl r347 32u8 into r350; - add r350 r349 into r351; - shl r346 32u8 into r352; - div r351 1000000u128 into r353; - add r352 r353 into r354; - rem r351 1000000u128 into r355; - shr r330 0u8 into r356; - and r356 4294967295u128 into r357; - shl r355 32u8 into r358; - add r358 r357 into r359; - shl r354 32u8 into r360; - div r359 1000000u128 into r361; - add r360 r361 into r362; - rem r359 1000000u128 into r363; - add r362 1u128 into r364; - gte r362 r300 into r365; - is.eq r362 0u128 into r366; - shl r189 64u8 into r367; - add r367 r188 into r368; - lt r368 r3.sp into r369; - assert.eq r369 true; - shl r368 32u8 into r370; - add r370 r196 into r371; - div r371 r3.sp into r372; - rem r371 r3.sp into r373; - shl r373 32u8 into r374; - add r374 r202 into r375; - shl r372 32u8 into r376; - div r375 r3.sp into r377; - add r376 r377 into r378; - rem r375 r3.sp into r379; - shl r379 32u8 into r380; - add r380 r210 into r381; - shl r378 32u8 into r382; - div r381 r3.sp into r383; - add r382 r383 into r384; - rem r381 r3.sp into r385; - shl r385 32u8 into r386; - add r386 r218 into r387; - shl r384 32u8 into r388; - div r387 r3.sp into r389; - add r388 r389 into r390; - rem r387 r3.sp into r391; - add r390 1u128 into r392; - add r390 r362 into r393; - gt r362 r390 into r394; - ternary r394 r390 r362 into r395; - sub r390 r395 into r396; - lt r368 r393 into r397; - assert.eq r397 true; - gte r368 170141183460469231731687303715884105728u128 into r398; - add.w r368 r368 into r399; - shr r191 127u8 into r400; - and r400 1u128 into r401; - add r399 r401 into r402; - gte r402 r393 into r403; - or r398 r403 into r404; - sub.w r402 r393 into r405; - ternary r404 r405 r402 into r406; - ternary r404 170141183460469231731687303715884105728u128 0u128 into r407; - gte r406 170141183460469231731687303715884105728u128 into r408; - add.w r406 r406 into r409; - shr r191 126u8 into r410; - and r410 1u128 into r411; - add r409 r411 into r412; - gte r412 r393 into r413; - or r408 r413 into r414; - sub.w r412 r393 into r415; - ternary r414 r415 r412 into r416; - add r407 85070591730234615865843651857942052864u128 into r417; - ternary r414 r417 r407 into r418; - gte r416 170141183460469231731687303715884105728u128 into r419; - add.w r416 r416 into r420; - shr r191 125u8 into r421; - and r421 1u128 into r422; - add r420 r422 into r423; - gte r423 r393 into r424; - or r419 r424 into r425; - sub.w r423 r393 into r426; - ternary r425 r426 r423 into r427; - add r418 42535295865117307932921825928971026432u128 into r428; - ternary r425 r428 r418 into r429; - gte r427 170141183460469231731687303715884105728u128 into r430; - add.w r427 r427 into r431; - shr r191 124u8 into r432; - and r432 1u128 into r433; - add r431 r433 into r434; - gte r434 r393 into r435; - or r430 r435 into r436; - sub.w r434 r393 into r437; - ternary r436 r437 r434 into r438; - add r429 21267647932558653966460912964485513216u128 into r439; - ternary r436 r439 r429 into r440; - gte r438 170141183460469231731687303715884105728u128 into r441; - add.w r438 r438 into r442; - shr r191 123u8 into r443; - and r443 1u128 into r444; - add r442 r444 into r445; - gte r445 r393 into r446; - or r441 r446 into r447; - sub.w r445 r393 into r448; - ternary r447 r448 r445 into r449; - add r440 10633823966279326983230456482242756608u128 into r450; - ternary r447 r450 r440 into r451; - gte r449 170141183460469231731687303715884105728u128 into r452; - add.w r449 r449 into r453; - shr r191 122u8 into r454; - and r454 1u128 into r455; - add r453 r455 into r456; - gte r456 r393 into r457; - or r452 r457 into r458; - sub.w r456 r393 into r459; - ternary r458 r459 r456 into r460; - add r451 5316911983139663491615228241121378304u128 into r461; - ternary r458 r461 r451 into r462; - gte r460 170141183460469231731687303715884105728u128 into r463; - add.w r460 r460 into r464; - shr r191 121u8 into r465; - and r465 1u128 into r466; - add r464 r466 into r467; - gte r467 r393 into r468; - or r463 r468 into r469; - sub.w r467 r393 into r470; - ternary r469 r470 r467 into r471; - add r462 2658455991569831745807614120560689152u128 into r472; - ternary r469 r472 r462 into r473; - gte r471 170141183460469231731687303715884105728u128 into r474; - add.w r471 r471 into r475; - shr r191 120u8 into r476; - and r476 1u128 into r477; - add r475 r477 into r478; - gte r478 r393 into r479; - or r474 r479 into r480; - sub.w r478 r393 into r481; - ternary r480 r481 r478 into r482; - add r473 1329227995784915872903807060280344576u128 into r483; - ternary r480 r483 r473 into r484; - gte r482 170141183460469231731687303715884105728u128 into r485; - add.w r482 r482 into r486; - shr r191 119u8 into r487; - and r487 1u128 into r488; - add r486 r488 into r489; - gte r489 r393 into r490; - or r485 r490 into r491; - sub.w r489 r393 into r492; - ternary r491 r492 r489 into r493; - add r484 664613997892457936451903530140172288u128 into r494; - ternary r491 r494 r484 into r495; - gte r493 170141183460469231731687303715884105728u128 into r496; - add.w r493 r493 into r497; - shr r191 118u8 into r498; - and r498 1u128 into r499; - add r497 r499 into r500; - gte r500 r393 into r501; - or r496 r501 into r502; - sub.w r500 r393 into r503; - ternary r502 r503 r500 into r504; - add r495 332306998946228968225951765070086144u128 into r505; - ternary r502 r505 r495 into r506; - gte r504 170141183460469231731687303715884105728u128 into r507; - add.w r504 r504 into r508; - shr r191 117u8 into r509; - and r509 1u128 into r510; - add r508 r510 into r511; - gte r511 r393 into r512; - or r507 r512 into r513; - sub.w r511 r393 into r514; - ternary r513 r514 r511 into r515; - add r506 166153499473114484112975882535043072u128 into r516; - ternary r513 r516 r506 into r517; - gte r515 170141183460469231731687303715884105728u128 into r518; - add.w r515 r515 into r519; - shr r191 116u8 into r520; - and r520 1u128 into r521; - add r519 r521 into r522; - gte r522 r393 into r523; - or r518 r523 into r524; - sub.w r522 r393 into r525; - ternary r524 r525 r522 into r526; - add r517 83076749736557242056487941267521536u128 into r527; - ternary r524 r527 r517 into r528; - gte r526 170141183460469231731687303715884105728u128 into r529; - add.w r526 r526 into r530; - shr r191 115u8 into r531; - and r531 1u128 into r532; - add r530 r532 into r533; - gte r533 r393 into r534; - or r529 r534 into r535; - sub.w r533 r393 into r536; - ternary r535 r536 r533 into r537; - add r528 41538374868278621028243970633760768u128 into r538; - ternary r535 r538 r528 into r539; - gte r537 170141183460469231731687303715884105728u128 into r540; - add.w r537 r537 into r541; - shr r191 114u8 into r542; - and r542 1u128 into r543; - add r541 r543 into r544; - gte r544 r393 into r545; - or r540 r545 into r546; - sub.w r544 r393 into r547; - ternary r546 r547 r544 into r548; - add r539 20769187434139310514121985316880384u128 into r549; - ternary r546 r549 r539 into r550; - gte r548 170141183460469231731687303715884105728u128 into r551; - add.w r548 r548 into r552; - shr r191 113u8 into r553; - and r553 1u128 into r554; - add r552 r554 into r555; - gte r555 r393 into r556; - or r551 r556 into r557; - sub.w r555 r393 into r558; - ternary r557 r558 r555 into r559; - add r550 10384593717069655257060992658440192u128 into r560; - ternary r557 r560 r550 into r561; - gte r559 170141183460469231731687303715884105728u128 into r562; - add.w r559 r559 into r563; - shr r191 112u8 into r564; - and r564 1u128 into r565; - add r563 r565 into r566; - gte r566 r393 into r567; - or r562 r567 into r568; - sub.w r566 r393 into r569; - ternary r568 r569 r566 into r570; - add r561 5192296858534827628530496329220096u128 into r571; - ternary r568 r571 r561 into r572; - gte r570 170141183460469231731687303715884105728u128 into r573; - add.w r570 r570 into r574; - shr r191 111u8 into r575; - and r575 1u128 into r576; - add r574 r576 into r577; - gte r577 r393 into r578; - or r573 r578 into r579; - sub.w r577 r393 into r580; - ternary r579 r580 r577 into r581; - add r572 2596148429267413814265248164610048u128 into r582; - ternary r579 r582 r572 into r583; - gte r581 170141183460469231731687303715884105728u128 into r584; - add.w r581 r581 into r585; - shr r191 110u8 into r586; - and r586 1u128 into r587; - add r585 r587 into r588; - gte r588 r393 into r589; - or r584 r589 into r590; - sub.w r588 r393 into r591; - ternary r590 r591 r588 into r592; - add r583 1298074214633706907132624082305024u128 into r593; - ternary r590 r593 r583 into r594; - gte r592 170141183460469231731687303715884105728u128 into r595; - add.w r592 r592 into r596; - shr r191 109u8 into r597; - and r597 1u128 into r598; - add r596 r598 into r599; - gte r599 r393 into r600; - or r595 r600 into r601; - sub.w r599 r393 into r602; - ternary r601 r602 r599 into r603; - add r594 649037107316853453566312041152512u128 into r604; - ternary r601 r604 r594 into r605; - gte r603 170141183460469231731687303715884105728u128 into r606; - add.w r603 r603 into r607; - shr r191 108u8 into r608; - and r608 1u128 into r609; - add r607 r609 into r610; - gte r610 r393 into r611; - or r606 r611 into r612; - sub.w r610 r393 into r613; - ternary r612 r613 r610 into r614; - add r605 324518553658426726783156020576256u128 into r615; - ternary r612 r615 r605 into r616; - gte r614 170141183460469231731687303715884105728u128 into r617; - add.w r614 r614 into r618; - shr r191 107u8 into r619; - and r619 1u128 into r620; - add r618 r620 into r621; - gte r621 r393 into r622; - or r617 r622 into r623; - sub.w r621 r393 into r624; - ternary r623 r624 r621 into r625; - add r616 162259276829213363391578010288128u128 into r626; - ternary r623 r626 r616 into r627; - gte r625 170141183460469231731687303715884105728u128 into r628; - add.w r625 r625 into r629; - shr r191 106u8 into r630; - and r630 1u128 into r631; - add r629 r631 into r632; - gte r632 r393 into r633; - or r628 r633 into r634; - sub.w r632 r393 into r635; - ternary r634 r635 r632 into r636; - add r627 81129638414606681695789005144064u128 into r637; - ternary r634 r637 r627 into r638; - gte r636 170141183460469231731687303715884105728u128 into r639; - add.w r636 r636 into r640; - shr r191 105u8 into r641; - and r641 1u128 into r642; - add r640 r642 into r643; - gte r643 r393 into r644; - or r639 r644 into r645; - sub.w r643 r393 into r646; - ternary r645 r646 r643 into r647; - add r638 40564819207303340847894502572032u128 into r648; - ternary r645 r648 r638 into r649; - gte r647 170141183460469231731687303715884105728u128 into r650; - add.w r647 r647 into r651; - shr r191 104u8 into r652; - and r652 1u128 into r653; - add r651 r653 into r654; - gte r654 r393 into r655; - or r650 r655 into r656; - sub.w r654 r393 into r657; - ternary r656 r657 r654 into r658; - add r649 20282409603651670423947251286016u128 into r659; - ternary r656 r659 r649 into r660; - gte r658 170141183460469231731687303715884105728u128 into r661; - add.w r658 r658 into r662; - shr r191 103u8 into r663; - and r663 1u128 into r664; - add r662 r664 into r665; - gte r665 r393 into r666; - or r661 r666 into r667; - sub.w r665 r393 into r668; - ternary r667 r668 r665 into r669; - add r660 10141204801825835211973625643008u128 into r670; - ternary r667 r670 r660 into r671; - gte r669 170141183460469231731687303715884105728u128 into r672; - add.w r669 r669 into r673; - shr r191 102u8 into r674; - and r674 1u128 into r675; - add r673 r675 into r676; - gte r676 r393 into r677; - or r672 r677 into r678; - sub.w r676 r393 into r679; - ternary r678 r679 r676 into r680; - add r671 5070602400912917605986812821504u128 into r681; - ternary r678 r681 r671 into r682; - gte r680 170141183460469231731687303715884105728u128 into r683; - add.w r680 r680 into r684; - shr r191 101u8 into r685; - and r685 1u128 into r686; - add r684 r686 into r687; - gte r687 r393 into r688; - or r683 r688 into r689; - sub.w r687 r393 into r690; - ternary r689 r690 r687 into r691; - add r682 2535301200456458802993406410752u128 into r692; - ternary r689 r692 r682 into r693; - gte r691 170141183460469231731687303715884105728u128 into r694; - add.w r691 r691 into r695; - shr r191 100u8 into r696; - and r696 1u128 into r697; - add r695 r697 into r698; - gte r698 r393 into r699; - or r694 r699 into r700; - sub.w r698 r393 into r701; - ternary r700 r701 r698 into r702; - add r693 1267650600228229401496703205376u128 into r703; - ternary r700 r703 r693 into r704; - gte r702 170141183460469231731687303715884105728u128 into r705; - add.w r702 r702 into r706; - shr r191 99u8 into r707; - and r707 1u128 into r708; - add r706 r708 into r709; - gte r709 r393 into r710; - or r705 r710 into r711; - sub.w r709 r393 into r712; - ternary r711 r712 r709 into r713; - add r704 633825300114114700748351602688u128 into r714; - ternary r711 r714 r704 into r715; - gte r713 170141183460469231731687303715884105728u128 into r716; - add.w r713 r713 into r717; - shr r191 98u8 into r718; - and r718 1u128 into r719; - add r717 r719 into r720; - gte r720 r393 into r721; - or r716 r721 into r722; - sub.w r720 r393 into r723; - ternary r722 r723 r720 into r724; - add r715 316912650057057350374175801344u128 into r725; - ternary r722 r725 r715 into r726; - gte r724 170141183460469231731687303715884105728u128 into r727; - add.w r724 r724 into r728; - shr r191 97u8 into r729; - and r729 1u128 into r730; - add r728 r730 into r731; - gte r731 r393 into r732; - or r727 r732 into r733; - sub.w r731 r393 into r734; - ternary r733 r734 r731 into r735; - add r726 158456325028528675187087900672u128 into r736; - ternary r733 r736 r726 into r737; - gte r735 170141183460469231731687303715884105728u128 into r738; - add.w r735 r735 into r739; - and r195 1u128 into r740; - add r739 r740 into r741; - gte r741 r393 into r742; - or r738 r742 into r743; - sub.w r741 r393 into r744; - ternary r743 r744 r741 into r745; - add r737 79228162514264337593543950336u128 into r746; - ternary r743 r746 r737 into r747; - gte r745 170141183460469231731687303715884105728u128 into r748; - add.w r745 r745 into r749; - shr r191 95u8 into r750; - and r750 1u128 into r751; - add r749 r751 into r752; - gte r752 r393 into r753; - or r748 r753 into r754; - sub.w r752 r393 into r755; - ternary r754 r755 r752 into r756; - add r747 39614081257132168796771975168u128 into r757; - ternary r754 r757 r747 into r758; - gte r756 170141183460469231731687303715884105728u128 into r759; - add.w r756 r756 into r760; - shr r191 94u8 into r761; - and r761 1u128 into r762; - add r760 r762 into r763; - gte r763 r393 into r764; - or r759 r764 into r765; - sub.w r763 r393 into r766; - ternary r765 r766 r763 into r767; - add r758 19807040628566084398385987584u128 into r768; - ternary r765 r768 r758 into r769; - gte r767 170141183460469231731687303715884105728u128 into r770; - add.w r767 r767 into r771; - shr r191 93u8 into r772; - and r772 1u128 into r773; - add r771 r773 into r774; - gte r774 r393 into r775; - or r770 r775 into r776; - sub.w r774 r393 into r777; - ternary r776 r777 r774 into r778; - add r769 9903520314283042199192993792u128 into r779; - ternary r776 r779 r769 into r780; - gte r778 170141183460469231731687303715884105728u128 into r781; - add.w r778 r778 into r782; - shr r191 92u8 into r783; - and r783 1u128 into r784; - add r782 r784 into r785; - gte r785 r393 into r786; - or r781 r786 into r787; - sub.w r785 r393 into r788; - ternary r787 r788 r785 into r789; - add r780 4951760157141521099596496896u128 into r790; - ternary r787 r790 r780 into r791; - gte r789 170141183460469231731687303715884105728u128 into r792; - add.w r789 r789 into r793; - shr r191 91u8 into r794; - and r794 1u128 into r795; - add r793 r795 into r796; - gte r796 r393 into r797; - or r792 r797 into r798; - sub.w r796 r393 into r799; - ternary r798 r799 r796 into r800; - add r791 2475880078570760549798248448u128 into r801; - ternary r798 r801 r791 into r802; - gte r800 170141183460469231731687303715884105728u128 into r803; - add.w r800 r800 into r804; - shr r191 90u8 into r805; - and r805 1u128 into r806; - add r804 r806 into r807; - gte r807 r393 into r808; - or r803 r808 into r809; - sub.w r807 r393 into r810; - ternary r809 r810 r807 into r811; - add r802 1237940039285380274899124224u128 into r812; - ternary r809 r812 r802 into r813; - gte r811 170141183460469231731687303715884105728u128 into r814; - add.w r811 r811 into r815; - shr r191 89u8 into r816; - and r816 1u128 into r817; - add r815 r817 into r818; - gte r818 r393 into r819; - or r814 r819 into r820; - sub.w r818 r393 into r821; - ternary r820 r821 r818 into r822; - add r813 618970019642690137449562112u128 into r823; - ternary r820 r823 r813 into r824; - gte r822 170141183460469231731687303715884105728u128 into r825; - add.w r822 r822 into r826; - shr r191 88u8 into r827; - and r827 1u128 into r828; - add r826 r828 into r829; - gte r829 r393 into r830; - or r825 r830 into r831; - sub.w r829 r393 into r832; - ternary r831 r832 r829 into r833; - add r824 309485009821345068724781056u128 into r834; - ternary r831 r834 r824 into r835; - gte r833 170141183460469231731687303715884105728u128 into r836; - add.w r833 r833 into r837; - shr r191 87u8 into r838; - and r838 1u128 into r839; - add r837 r839 into r840; - gte r840 r393 into r841; - or r836 r841 into r842; - sub.w r840 r393 into r843; - ternary r842 r843 r840 into r844; - add r835 154742504910672534362390528u128 into r845; - ternary r842 r845 r835 into r846; - gte r844 170141183460469231731687303715884105728u128 into r847; - add.w r844 r844 into r848; - shr r191 86u8 into r849; - and r849 1u128 into r850; - add r848 r850 into r851; - gte r851 r393 into r852; - or r847 r852 into r853; - sub.w r851 r393 into r854; - ternary r853 r854 r851 into r855; - add r846 77371252455336267181195264u128 into r856; - ternary r853 r856 r846 into r857; - gte r855 170141183460469231731687303715884105728u128 into r858; - add.w r855 r855 into r859; - shr r191 85u8 into r860; - and r860 1u128 into r861; - add r859 r861 into r862; - gte r862 r393 into r863; - or r858 r863 into r864; - sub.w r862 r393 into r865; - ternary r864 r865 r862 into r866; - add r857 38685626227668133590597632u128 into r867; - ternary r864 r867 r857 into r868; - gte r866 170141183460469231731687303715884105728u128 into r869; - add.w r866 r866 into r870; - shr r191 84u8 into r871; - and r871 1u128 into r872; - add r870 r872 into r873; - gte r873 r393 into r874; - or r869 r874 into r875; - sub.w r873 r393 into r876; - ternary r875 r876 r873 into r877; - add r868 19342813113834066795298816u128 into r878; - ternary r875 r878 r868 into r879; - gte r877 170141183460469231731687303715884105728u128 into r880; - add.w r877 r877 into r881; - shr r191 83u8 into r882; - and r882 1u128 into r883; - add r881 r883 into r884; - gte r884 r393 into r885; - or r880 r885 into r886; - sub.w r884 r393 into r887; - ternary r886 r887 r884 into r888; - add r879 9671406556917033397649408u128 into r889; - ternary r886 r889 r879 into r890; - gte r888 170141183460469231731687303715884105728u128 into r891; - add.w r888 r888 into r892; - shr r191 82u8 into r893; - and r893 1u128 into r894; - add r892 r894 into r895; - gte r895 r393 into r896; - or r891 r896 into r897; - sub.w r895 r393 into r898; - ternary r897 r898 r895 into r899; - add r890 4835703278458516698824704u128 into r900; - ternary r897 r900 r890 into r901; - gte r899 170141183460469231731687303715884105728u128 into r902; - add.w r899 r899 into r903; - shr r191 81u8 into r904; - and r904 1u128 into r905; - add r903 r905 into r906; - gte r906 r393 into r907; - or r902 r907 into r908; - sub.w r906 r393 into r909; - ternary r908 r909 r906 into r910; - add r901 2417851639229258349412352u128 into r911; - ternary r908 r911 r901 into r912; - gte r910 170141183460469231731687303715884105728u128 into r913; - add.w r910 r910 into r914; - shr r191 80u8 into r915; - and r915 1u128 into r916; - add r914 r916 into r917; - gte r917 r393 into r918; - or r913 r918 into r919; - sub.w r917 r393 into r920; - ternary r919 r920 r917 into r921; - add r912 1208925819614629174706176u128 into r922; - ternary r919 r922 r912 into r923; - gte r921 170141183460469231731687303715884105728u128 into r924; - add.w r921 r921 into r925; - shr r191 79u8 into r926; - and r926 1u128 into r927; - add r925 r927 into r928; - gte r928 r393 into r929; - or r924 r929 into r930; - sub.w r928 r393 into r931; - ternary r930 r931 r928 into r932; - add r923 604462909807314587353088u128 into r933; - ternary r930 r933 r923 into r934; - gte r932 170141183460469231731687303715884105728u128 into r935; - add.w r932 r932 into r936; - shr r191 78u8 into r937; - and r937 1u128 into r938; - add r936 r938 into r939; - gte r939 r393 into r940; - or r935 r940 into r941; - sub.w r939 r393 into r942; - ternary r941 r942 r939 into r943; - add r934 302231454903657293676544u128 into r944; - ternary r941 r944 r934 into r945; - gte r943 170141183460469231731687303715884105728u128 into r946; - add.w r943 r943 into r947; - shr r191 77u8 into r948; - and r948 1u128 into r949; - add r947 r949 into r950; - gte r950 r393 into r951; - or r946 r951 into r952; - sub.w r950 r393 into r953; - ternary r952 r953 r950 into r954; - add r945 151115727451828646838272u128 into r955; - ternary r952 r955 r945 into r956; - gte r954 170141183460469231731687303715884105728u128 into r957; - add.w r954 r954 into r958; - shr r191 76u8 into r959; - and r959 1u128 into r960; - add r958 r960 into r961; - gte r961 r393 into r962; - or r957 r962 into r963; - sub.w r961 r393 into r964; - ternary r963 r964 r961 into r965; - add r956 75557863725914323419136u128 into r966; - ternary r963 r966 r956 into r967; - gte r965 170141183460469231731687303715884105728u128 into r968; - add.w r965 r965 into r969; - shr r191 75u8 into r970; - and r970 1u128 into r971; - add r969 r971 into r972; - gte r972 r393 into r973; - or r968 r973 into r974; - sub.w r972 r393 into r975; - ternary r974 r975 r972 into r976; - add r967 37778931862957161709568u128 into r977; - ternary r974 r977 r967 into r978; - gte r976 170141183460469231731687303715884105728u128 into r979; - add.w r976 r976 into r980; - shr r191 74u8 into r981; - and r981 1u128 into r982; - add r980 r982 into r983; - gte r983 r393 into r984; - or r979 r984 into r985; - sub.w r983 r393 into r986; - ternary r985 r986 r983 into r987; - add r978 18889465931478580854784u128 into r988; - ternary r985 r988 r978 into r989; - gte r987 170141183460469231731687303715884105728u128 into r990; - add.w r987 r987 into r991; - shr r191 73u8 into r992; - and r992 1u128 into r993; - add r991 r993 into r994; - gte r994 r393 into r995; - or r990 r995 into r996; - sub.w r994 r393 into r997; - ternary r996 r997 r994 into r998; - add r989 9444732965739290427392u128 into r999; - ternary r996 r999 r989 into r1000; - gte r998 170141183460469231731687303715884105728u128 into r1001; - add.w r998 r998 into r1002; - shr r191 72u8 into r1003; - and r1003 1u128 into r1004; - add r1002 r1004 into r1005; - gte r1005 r393 into r1006; - or r1001 r1006 into r1007; - sub.w r1005 r393 into r1008; - ternary r1007 r1008 r1005 into r1009; - add r1000 4722366482869645213696u128 into r1010; - ternary r1007 r1010 r1000 into r1011; - gte r1009 170141183460469231731687303715884105728u128 into r1012; - add.w r1009 r1009 into r1013; - shr r191 71u8 into r1014; - and r1014 1u128 into r1015; - add r1013 r1015 into r1016; - gte r1016 r393 into r1017; - or r1012 r1017 into r1018; - sub.w r1016 r393 into r1019; - ternary r1018 r1019 r1016 into r1020; - add r1011 2361183241434822606848u128 into r1021; - ternary r1018 r1021 r1011 into r1022; - gte r1020 170141183460469231731687303715884105728u128 into r1023; - add.w r1020 r1020 into r1024; - shr r191 70u8 into r1025; - and r1025 1u128 into r1026; - add r1024 r1026 into r1027; - gte r1027 r393 into r1028; - or r1023 r1028 into r1029; - sub.w r1027 r393 into r1030; - ternary r1029 r1030 r1027 into r1031; - add r1022 1180591620717411303424u128 into r1032; - ternary r1029 r1032 r1022 into r1033; - gte r1031 170141183460469231731687303715884105728u128 into r1034; - add.w r1031 r1031 into r1035; - shr r191 69u8 into r1036; - and r1036 1u128 into r1037; - add r1035 r1037 into r1038; - gte r1038 r393 into r1039; - or r1034 r1039 into r1040; - sub.w r1038 r393 into r1041; - ternary r1040 r1041 r1038 into r1042; - add r1033 590295810358705651712u128 into r1043; - ternary r1040 r1043 r1033 into r1044; - gte r1042 170141183460469231731687303715884105728u128 into r1045; - add.w r1042 r1042 into r1046; - shr r191 68u8 into r1047; - and r1047 1u128 into r1048; - add r1046 r1048 into r1049; - gte r1049 r393 into r1050; - or r1045 r1050 into r1051; - sub.w r1049 r393 into r1052; - ternary r1051 r1052 r1049 into r1053; - add r1044 295147905179352825856u128 into r1054; - ternary r1051 r1054 r1044 into r1055; - gte r1053 170141183460469231731687303715884105728u128 into r1056; - add.w r1053 r1053 into r1057; - shr r191 67u8 into r1058; - and r1058 1u128 into r1059; - add r1057 r1059 into r1060; - gte r1060 r393 into r1061; - or r1056 r1061 into r1062; - sub.w r1060 r393 into r1063; - ternary r1062 r1063 r1060 into r1064; - add r1055 147573952589676412928u128 into r1065; - ternary r1062 r1065 r1055 into r1066; - gte r1064 170141183460469231731687303715884105728u128 into r1067; - add.w r1064 r1064 into r1068; - shr r191 66u8 into r1069; - and r1069 1u128 into r1070; - add r1068 r1070 into r1071; - gte r1071 r393 into r1072; - or r1067 r1072 into r1073; - sub.w r1071 r393 into r1074; - ternary r1073 r1074 r1071 into r1075; - add r1066 73786976294838206464u128 into r1076; - ternary r1073 r1076 r1066 into r1077; - gte r1075 170141183460469231731687303715884105728u128 into r1078; - add.w r1075 r1075 into r1079; - shr r191 65u8 into r1080; - and r1080 1u128 into r1081; - add r1079 r1081 into r1082; - gte r1082 r393 into r1083; - or r1078 r1083 into r1084; - sub.w r1082 r393 into r1085; - ternary r1084 r1085 r1082 into r1086; - add r1077 36893488147419103232u128 into r1087; - ternary r1084 r1087 r1077 into r1088; - gte r1086 170141183460469231731687303715884105728u128 into r1089; - add.w r1086 r1086 into r1090; - and r201 1u128 into r1091; - add r1090 r1091 into r1092; - gte r1092 r393 into r1093; - or r1089 r1093 into r1094; - sub.w r1092 r393 into r1095; - ternary r1094 r1095 r1092 into r1096; - add r1088 18446744073709551616u128 into r1097; - ternary r1094 r1097 r1088 into r1098; - gte r1096 170141183460469231731687303715884105728u128 into r1099; - add.w r1096 r1096 into r1100; - shr r191 63u8 into r1101; - and r1101 1u128 into r1102; - add r1100 r1102 into r1103; - gte r1103 r393 into r1104; - or r1099 r1104 into r1105; - sub.w r1103 r393 into r1106; - ternary r1105 r1106 r1103 into r1107; - add r1098 9223372036854775808u128 into r1108; - ternary r1105 r1108 r1098 into r1109; - gte r1107 170141183460469231731687303715884105728u128 into r1110; - add.w r1107 r1107 into r1111; - shr r191 62u8 into r1112; - and r1112 1u128 into r1113; - add r1111 r1113 into r1114; - gte r1114 r393 into r1115; - or r1110 r1115 into r1116; - sub.w r1114 r393 into r1117; - ternary r1116 r1117 r1114 into r1118; - add r1109 4611686018427387904u128 into r1119; - ternary r1116 r1119 r1109 into r1120; - gte r1118 170141183460469231731687303715884105728u128 into r1121; - add.w r1118 r1118 into r1122; - shr r191 61u8 into r1123; - and r1123 1u128 into r1124; - add r1122 r1124 into r1125; - gte r1125 r393 into r1126; - or r1121 r1126 into r1127; - sub.w r1125 r393 into r1128; - ternary r1127 r1128 r1125 into r1129; - add r1120 2305843009213693952u128 into r1130; - ternary r1127 r1130 r1120 into r1131; - gte r1129 170141183460469231731687303715884105728u128 into r1132; - add.w r1129 r1129 into r1133; - shr r191 60u8 into r1134; - and r1134 1u128 into r1135; - add r1133 r1135 into r1136; - gte r1136 r393 into r1137; - or r1132 r1137 into r1138; - sub.w r1136 r393 into r1139; - ternary r1138 r1139 r1136 into r1140; - add r1131 1152921504606846976u128 into r1141; - ternary r1138 r1141 r1131 into r1142; - gte r1140 170141183460469231731687303715884105728u128 into r1143; - add.w r1140 r1140 into r1144; - shr r191 59u8 into r1145; - and r1145 1u128 into r1146; - add r1144 r1146 into r1147; - gte r1147 r393 into r1148; - or r1143 r1148 into r1149; - sub.w r1147 r393 into r1150; - ternary r1149 r1150 r1147 into r1151; - add r1142 576460752303423488u128 into r1152; - ternary r1149 r1152 r1142 into r1153; - gte r1151 170141183460469231731687303715884105728u128 into r1154; - add.w r1151 r1151 into r1155; - shr r191 58u8 into r1156; - and r1156 1u128 into r1157; - add r1155 r1157 into r1158; - gte r1158 r393 into r1159; - or r1154 r1159 into r1160; - sub.w r1158 r393 into r1161; - ternary r1160 r1161 r1158 into r1162; - add r1153 288230376151711744u128 into r1163; - ternary r1160 r1163 r1153 into r1164; - gte r1162 170141183460469231731687303715884105728u128 into r1165; - add.w r1162 r1162 into r1166; - shr r191 57u8 into r1167; - and r1167 1u128 into r1168; - add r1166 r1168 into r1169; - gte r1169 r393 into r1170; - or r1165 r1170 into r1171; - sub.w r1169 r393 into r1172; - ternary r1171 r1172 r1169 into r1173; - add r1164 144115188075855872u128 into r1174; - ternary r1171 r1174 r1164 into r1175; - gte r1173 170141183460469231731687303715884105728u128 into r1176; - add.w r1173 r1173 into r1177; - shr r191 56u8 into r1178; - and r1178 1u128 into r1179; - add r1177 r1179 into r1180; - gte r1180 r393 into r1181; - or r1176 r1181 into r1182; - sub.w r1180 r393 into r1183; - ternary r1182 r1183 r1180 into r1184; - add r1175 72057594037927936u128 into r1185; - ternary r1182 r1185 r1175 into r1186; - gte r1184 170141183460469231731687303715884105728u128 into r1187; - add.w r1184 r1184 into r1188; - shr r191 55u8 into r1189; - and r1189 1u128 into r1190; - add r1188 r1190 into r1191; - gte r1191 r393 into r1192; - or r1187 r1192 into r1193; - sub.w r1191 r393 into r1194; - ternary r1193 r1194 r1191 into r1195; - add r1186 36028797018963968u128 into r1196; - ternary r1193 r1196 r1186 into r1197; - gte r1195 170141183460469231731687303715884105728u128 into r1198; - add.w r1195 r1195 into r1199; - shr r191 54u8 into r1200; - and r1200 1u128 into r1201; - add r1199 r1201 into r1202; - gte r1202 r393 into r1203; - or r1198 r1203 into r1204; - sub.w r1202 r393 into r1205; - ternary r1204 r1205 r1202 into r1206; - add r1197 18014398509481984u128 into r1207; - ternary r1204 r1207 r1197 into r1208; - gte r1206 170141183460469231731687303715884105728u128 into r1209; - add.w r1206 r1206 into r1210; - shr r191 53u8 into r1211; - and r1211 1u128 into r1212; - add r1210 r1212 into r1213; - gte r1213 r393 into r1214; - or r1209 r1214 into r1215; - sub.w r1213 r393 into r1216; - ternary r1215 r1216 r1213 into r1217; - add r1208 9007199254740992u128 into r1218; - ternary r1215 r1218 r1208 into r1219; - gte r1217 170141183460469231731687303715884105728u128 into r1220; - add.w r1217 r1217 into r1221; - shr r191 52u8 into r1222; - and r1222 1u128 into r1223; - add r1221 r1223 into r1224; - gte r1224 r393 into r1225; - or r1220 r1225 into r1226; - sub.w r1224 r393 into r1227; - ternary r1226 r1227 r1224 into r1228; - add r1219 4503599627370496u128 into r1229; - ternary r1226 r1229 r1219 into r1230; - gte r1228 170141183460469231731687303715884105728u128 into r1231; - add.w r1228 r1228 into r1232; - shr r191 51u8 into r1233; - and r1233 1u128 into r1234; - add r1232 r1234 into r1235; - gte r1235 r393 into r1236; - or r1231 r1236 into r1237; - sub.w r1235 r393 into r1238; - ternary r1237 r1238 r1235 into r1239; - add r1230 2251799813685248u128 into r1240; - ternary r1237 r1240 r1230 into r1241; - gte r1239 170141183460469231731687303715884105728u128 into r1242; - add.w r1239 r1239 into r1243; - shr r191 50u8 into r1244; - and r1244 1u128 into r1245; - add r1243 r1245 into r1246; - gte r1246 r393 into r1247; - or r1242 r1247 into r1248; - sub.w r1246 r393 into r1249; - ternary r1248 r1249 r1246 into r1250; - add r1241 1125899906842624u128 into r1251; - ternary r1248 r1251 r1241 into r1252; - gte r1250 170141183460469231731687303715884105728u128 into r1253; - add.w r1250 r1250 into r1254; - shr r191 49u8 into r1255; - and r1255 1u128 into r1256; - add r1254 r1256 into r1257; - gte r1257 r393 into r1258; - or r1253 r1258 into r1259; - sub.w r1257 r393 into r1260; - ternary r1259 r1260 r1257 into r1261; - add r1252 562949953421312u128 into r1262; - ternary r1259 r1262 r1252 into r1263; - gte r1261 170141183460469231731687303715884105728u128 into r1264; - add.w r1261 r1261 into r1265; - shr r191 48u8 into r1266; - and r1266 1u128 into r1267; - add r1265 r1267 into r1268; - gte r1268 r393 into r1269; - or r1264 r1269 into r1270; - sub.w r1268 r393 into r1271; - ternary r1270 r1271 r1268 into r1272; - add r1263 281474976710656u128 into r1273; - ternary r1270 r1273 r1263 into r1274; - gte r1272 170141183460469231731687303715884105728u128 into r1275; - add.w r1272 r1272 into r1276; - shr r191 47u8 into r1277; - and r1277 1u128 into r1278; - add r1276 r1278 into r1279; - gte r1279 r393 into r1280; - or r1275 r1280 into r1281; - sub.w r1279 r393 into r1282; - ternary r1281 r1282 r1279 into r1283; - add r1274 140737488355328u128 into r1284; - ternary r1281 r1284 r1274 into r1285; - gte r1283 170141183460469231731687303715884105728u128 into r1286; - add.w r1283 r1283 into r1287; - shr r191 46u8 into r1288; - and r1288 1u128 into r1289; - add r1287 r1289 into r1290; - gte r1290 r393 into r1291; - or r1286 r1291 into r1292; - sub.w r1290 r393 into r1293; - ternary r1292 r1293 r1290 into r1294; - add r1285 70368744177664u128 into r1295; - ternary r1292 r1295 r1285 into r1296; - gte r1294 170141183460469231731687303715884105728u128 into r1297; - add.w r1294 r1294 into r1298; - shr r191 45u8 into r1299; - and r1299 1u128 into r1300; - add r1298 r1300 into r1301; - gte r1301 r393 into r1302; - or r1297 r1302 into r1303; - sub.w r1301 r393 into r1304; - ternary r1303 r1304 r1301 into r1305; - add r1296 35184372088832u128 into r1306; - ternary r1303 r1306 r1296 into r1307; - gte r1305 170141183460469231731687303715884105728u128 into r1308; - add.w r1305 r1305 into r1309; - shr r191 44u8 into r1310; - and r1310 1u128 into r1311; - add r1309 r1311 into r1312; - gte r1312 r393 into r1313; - or r1308 r1313 into r1314; - sub.w r1312 r393 into r1315; - ternary r1314 r1315 r1312 into r1316; - add r1307 17592186044416u128 into r1317; - ternary r1314 r1317 r1307 into r1318; - gte r1316 170141183460469231731687303715884105728u128 into r1319; - add.w r1316 r1316 into r1320; - shr r191 43u8 into r1321; - and r1321 1u128 into r1322; - add r1320 r1322 into r1323; - gte r1323 r393 into r1324; - or r1319 r1324 into r1325; - sub.w r1323 r393 into r1326; - ternary r1325 r1326 r1323 into r1327; - add r1318 8796093022208u128 into r1328; - ternary r1325 r1328 r1318 into r1329; - gte r1327 170141183460469231731687303715884105728u128 into r1330; - add.w r1327 r1327 into r1331; - shr r191 42u8 into r1332; - and r1332 1u128 into r1333; - add r1331 r1333 into r1334; - gte r1334 r393 into r1335; - or r1330 r1335 into r1336; - sub.w r1334 r393 into r1337; - ternary r1336 r1337 r1334 into r1338; - add r1329 4398046511104u128 into r1339; - ternary r1336 r1339 r1329 into r1340; - gte r1338 170141183460469231731687303715884105728u128 into r1341; - add.w r1338 r1338 into r1342; - shr r191 41u8 into r1343; - and r1343 1u128 into r1344; - add r1342 r1344 into r1345; - gte r1345 r393 into r1346; - or r1341 r1346 into r1347; - sub.w r1345 r393 into r1348; - ternary r1347 r1348 r1345 into r1349; - add r1340 2199023255552u128 into r1350; - ternary r1347 r1350 r1340 into r1351; - gte r1349 170141183460469231731687303715884105728u128 into r1352; - add.w r1349 r1349 into r1353; - shr r191 40u8 into r1354; - and r1354 1u128 into r1355; - add r1353 r1355 into r1356; - gte r1356 r393 into r1357; - or r1352 r1357 into r1358; - sub.w r1356 r393 into r1359; - ternary r1358 r1359 r1356 into r1360; - add r1351 1099511627776u128 into r1361; - ternary r1358 r1361 r1351 into r1362; - gte r1360 170141183460469231731687303715884105728u128 into r1363; - add.w r1360 r1360 into r1364; - shr r191 39u8 into r1365; - and r1365 1u128 into r1366; - add r1364 r1366 into r1367; - gte r1367 r393 into r1368; - or r1363 r1368 into r1369; - sub.w r1367 r393 into r1370; - ternary r1369 r1370 r1367 into r1371; - add r1362 549755813888u128 into r1372; - ternary r1369 r1372 r1362 into r1373; - gte r1371 170141183460469231731687303715884105728u128 into r1374; - add.w r1371 r1371 into r1375; - shr r191 38u8 into r1376; - and r1376 1u128 into r1377; - add r1375 r1377 into r1378; - gte r1378 r393 into r1379; - or r1374 r1379 into r1380; - sub.w r1378 r393 into r1381; - ternary r1380 r1381 r1378 into r1382; - add r1373 274877906944u128 into r1383; - ternary r1380 r1383 r1373 into r1384; - gte r1382 170141183460469231731687303715884105728u128 into r1385; - add.w r1382 r1382 into r1386; - shr r191 37u8 into r1387; - and r1387 1u128 into r1388; - add r1386 r1388 into r1389; - gte r1389 r393 into r1390; - or r1385 r1390 into r1391; - sub.w r1389 r393 into r1392; - ternary r1391 r1392 r1389 into r1393; - add r1384 137438953472u128 into r1394; - ternary r1391 r1394 r1384 into r1395; - gte r1393 170141183460469231731687303715884105728u128 into r1396; - add.w r1393 r1393 into r1397; - shr r191 36u8 into r1398; - and r1398 1u128 into r1399; - add r1397 r1399 into r1400; - gte r1400 r393 into r1401; - or r1396 r1401 into r1402; - sub.w r1400 r393 into r1403; - ternary r1402 r1403 r1400 into r1404; - add r1395 68719476736u128 into r1405; - ternary r1402 r1405 r1395 into r1406; - gte r1404 170141183460469231731687303715884105728u128 into r1407; - add.w r1404 r1404 into r1408; - shr r191 35u8 into r1409; - and r1409 1u128 into r1410; - add r1408 r1410 into r1411; - gte r1411 r393 into r1412; - or r1407 r1412 into r1413; - sub.w r1411 r393 into r1414; - ternary r1413 r1414 r1411 into r1415; - add r1406 34359738368u128 into r1416; - ternary r1413 r1416 r1406 into r1417; - gte r1415 170141183460469231731687303715884105728u128 into r1418; - add.w r1415 r1415 into r1419; - shr r191 34u8 into r1420; - and r1420 1u128 into r1421; - add r1419 r1421 into r1422; - gte r1422 r393 into r1423; - or r1418 r1423 into r1424; - sub.w r1422 r393 into r1425; - ternary r1424 r1425 r1422 into r1426; - add r1417 17179869184u128 into r1427; - ternary r1424 r1427 r1417 into r1428; - gte r1426 170141183460469231731687303715884105728u128 into r1429; - add.w r1426 r1426 into r1430; - shr r191 33u8 into r1431; - and r1431 1u128 into r1432; - add r1430 r1432 into r1433; - gte r1433 r393 into r1434; - or r1429 r1434 into r1435; - sub.w r1433 r393 into r1436; - ternary r1435 r1436 r1433 into r1437; - add r1428 8589934592u128 into r1438; - ternary r1435 r1438 r1428 into r1439; - gte r1437 170141183460469231731687303715884105728u128 into r1440; - add.w r1437 r1437 into r1441; - and r209 1u128 into r1442; - add r1441 r1442 into r1443; - gte r1443 r393 into r1444; - or r1440 r1444 into r1445; - sub.w r1443 r393 into r1446; - ternary r1445 r1446 r1443 into r1447; - add r1439 4294967296u128 into r1448; - ternary r1445 r1448 r1439 into r1449; - gte r1447 170141183460469231731687303715884105728u128 into r1450; - add.w r1447 r1447 into r1451; - shr r191 31u8 into r1452; - and r1452 1u128 into r1453; - add r1451 r1453 into r1454; - gte r1454 r393 into r1455; - or r1450 r1455 into r1456; - sub.w r1454 r393 into r1457; - ternary r1456 r1457 r1454 into r1458; - add r1449 2147483648u128 into r1459; - ternary r1456 r1459 r1449 into r1460; - gte r1458 170141183460469231731687303715884105728u128 into r1461; - add.w r1458 r1458 into r1462; - shr r191 30u8 into r1463; - and r1463 1u128 into r1464; - add r1462 r1464 into r1465; - gte r1465 r393 into r1466; - or r1461 r1466 into r1467; - sub.w r1465 r393 into r1468; - ternary r1467 r1468 r1465 into r1469; - add r1460 1073741824u128 into r1470; - ternary r1467 r1470 r1460 into r1471; - gte r1469 170141183460469231731687303715884105728u128 into r1472; - add.w r1469 r1469 into r1473; - shr r191 29u8 into r1474; - and r1474 1u128 into r1475; - add r1473 r1475 into r1476; - gte r1476 r393 into r1477; - or r1472 r1477 into r1478; - sub.w r1476 r393 into r1479; - ternary r1478 r1479 r1476 into r1480; - add r1471 536870912u128 into r1481; - ternary r1478 r1481 r1471 into r1482; - gte r1480 170141183460469231731687303715884105728u128 into r1483; - add.w r1480 r1480 into r1484; - shr r191 28u8 into r1485; - and r1485 1u128 into r1486; - add r1484 r1486 into r1487; - gte r1487 r393 into r1488; - or r1483 r1488 into r1489; - sub.w r1487 r393 into r1490; - ternary r1489 r1490 r1487 into r1491; - add r1482 268435456u128 into r1492; - ternary r1489 r1492 r1482 into r1493; - gte r1491 170141183460469231731687303715884105728u128 into r1494; - add.w r1491 r1491 into r1495; - shr r191 27u8 into r1496; - and r1496 1u128 into r1497; - add r1495 r1497 into r1498; - gte r1498 r393 into r1499; - or r1494 r1499 into r1500; - sub.w r1498 r393 into r1501; - ternary r1500 r1501 r1498 into r1502; - add r1493 134217728u128 into r1503; - ternary r1500 r1503 r1493 into r1504; - gte r1502 170141183460469231731687303715884105728u128 into r1505; - add.w r1502 r1502 into r1506; - shr r191 26u8 into r1507; - and r1507 1u128 into r1508; - add r1506 r1508 into r1509; - gte r1509 r393 into r1510; - or r1505 r1510 into r1511; - sub.w r1509 r393 into r1512; - ternary r1511 r1512 r1509 into r1513; - add r1504 67108864u128 into r1514; - ternary r1511 r1514 r1504 into r1515; - gte r1513 170141183460469231731687303715884105728u128 into r1516; - add.w r1513 r1513 into r1517; - shr r191 25u8 into r1518; - and r1518 1u128 into r1519; - add r1517 r1519 into r1520; - gte r1520 r393 into r1521; - or r1516 r1521 into r1522; - sub.w r1520 r393 into r1523; - ternary r1522 r1523 r1520 into r1524; - add r1515 33554432u128 into r1525; - ternary r1522 r1525 r1515 into r1526; - gte r1524 170141183460469231731687303715884105728u128 into r1527; - add.w r1524 r1524 into r1528; - shr r191 24u8 into r1529; - and r1529 1u128 into r1530; - add r1528 r1530 into r1531; - gte r1531 r393 into r1532; - or r1527 r1532 into r1533; - sub.w r1531 r393 into r1534; - ternary r1533 r1534 r1531 into r1535; - add r1526 16777216u128 into r1536; - ternary r1533 r1536 r1526 into r1537; - gte r1535 170141183460469231731687303715884105728u128 into r1538; - add.w r1535 r1535 into r1539; - shr r191 23u8 into r1540; - and r1540 1u128 into r1541; - add r1539 r1541 into r1542; - gte r1542 r393 into r1543; - or r1538 r1543 into r1544; - sub.w r1542 r393 into r1545; - ternary r1544 r1545 r1542 into r1546; - add r1537 8388608u128 into r1547; - ternary r1544 r1547 r1537 into r1548; - gte r1546 170141183460469231731687303715884105728u128 into r1549; - add.w r1546 r1546 into r1550; - shr r191 22u8 into r1551; - and r1551 1u128 into r1552; - add r1550 r1552 into r1553; - gte r1553 r393 into r1554; - or r1549 r1554 into r1555; - sub.w r1553 r393 into r1556; - ternary r1555 r1556 r1553 into r1557; - add r1548 4194304u128 into r1558; - ternary r1555 r1558 r1548 into r1559; - gte r1557 170141183460469231731687303715884105728u128 into r1560; - add.w r1557 r1557 into r1561; - shr r191 21u8 into r1562; - and r1562 1u128 into r1563; - add r1561 r1563 into r1564; - gte r1564 r393 into r1565; - or r1560 r1565 into r1566; - sub.w r1564 r393 into r1567; - ternary r1566 r1567 r1564 into r1568; - add r1559 2097152u128 into r1569; - ternary r1566 r1569 r1559 into r1570; - gte r1568 170141183460469231731687303715884105728u128 into r1571; - add.w r1568 r1568 into r1572; - shr r191 20u8 into r1573; - and r1573 1u128 into r1574; - add r1572 r1574 into r1575; - gte r1575 r393 into r1576; - or r1571 r1576 into r1577; - sub.w r1575 r393 into r1578; - ternary r1577 r1578 r1575 into r1579; - add r1570 1048576u128 into r1580; - ternary r1577 r1580 r1570 into r1581; - gte r1579 170141183460469231731687303715884105728u128 into r1582; - add.w r1579 r1579 into r1583; - shr r191 19u8 into r1584; - and r1584 1u128 into r1585; - add r1583 r1585 into r1586; - gte r1586 r393 into r1587; - or r1582 r1587 into r1588; - sub.w r1586 r393 into r1589; - ternary r1588 r1589 r1586 into r1590; - add r1581 524288u128 into r1591; - ternary r1588 r1591 r1581 into r1592; - gte r1590 170141183460469231731687303715884105728u128 into r1593; - add.w r1590 r1590 into r1594; - shr r191 18u8 into r1595; - and r1595 1u128 into r1596; - add r1594 r1596 into r1597; - gte r1597 r393 into r1598; - or r1593 r1598 into r1599; - sub.w r1597 r393 into r1600; - ternary r1599 r1600 r1597 into r1601; - add r1592 262144u128 into r1602; - ternary r1599 r1602 r1592 into r1603; - gte r1601 170141183460469231731687303715884105728u128 into r1604; - add.w r1601 r1601 into r1605; - shr r191 17u8 into r1606; - and r1606 1u128 into r1607; - add r1605 r1607 into r1608; - gte r1608 r393 into r1609; - or r1604 r1609 into r1610; - sub.w r1608 r393 into r1611; - ternary r1610 r1611 r1608 into r1612; - add r1603 131072u128 into r1613; - ternary r1610 r1613 r1603 into r1614; - gte r1612 170141183460469231731687303715884105728u128 into r1615; - add.w r1612 r1612 into r1616; - shr r191 16u8 into r1617; - and r1617 1u128 into r1618; - add r1616 r1618 into r1619; - gte r1619 r393 into r1620; - or r1615 r1620 into r1621; - sub.w r1619 r393 into r1622; - ternary r1621 r1622 r1619 into r1623; - add r1614 65536u128 into r1624; - ternary r1621 r1624 r1614 into r1625; - gte r1623 170141183460469231731687303715884105728u128 into r1626; - add.w r1623 r1623 into r1627; - shr r191 15u8 into r1628; - and r1628 1u128 into r1629; - add r1627 r1629 into r1630; - gte r1630 r393 into r1631; - or r1626 r1631 into r1632; - sub.w r1630 r393 into r1633; - ternary r1632 r1633 r1630 into r1634; - add r1625 32768u128 into r1635; - ternary r1632 r1635 r1625 into r1636; - gte r1634 170141183460469231731687303715884105728u128 into r1637; - add.w r1634 r1634 into r1638; - shr r191 14u8 into r1639; - and r1639 1u128 into r1640; - add r1638 r1640 into r1641; - gte r1641 r393 into r1642; - or r1637 r1642 into r1643; - sub.w r1641 r393 into r1644; - ternary r1643 r1644 r1641 into r1645; - add r1636 16384u128 into r1646; - ternary r1643 r1646 r1636 into r1647; - gte r1645 170141183460469231731687303715884105728u128 into r1648; - add.w r1645 r1645 into r1649; - shr r191 13u8 into r1650; - and r1650 1u128 into r1651; - add r1649 r1651 into r1652; - gte r1652 r393 into r1653; - or r1648 r1653 into r1654; - sub.w r1652 r393 into r1655; - ternary r1654 r1655 r1652 into r1656; - add r1647 8192u128 into r1657; - ternary r1654 r1657 r1647 into r1658; - gte r1656 170141183460469231731687303715884105728u128 into r1659; - add.w r1656 r1656 into r1660; - shr r191 12u8 into r1661; - and r1661 1u128 into r1662; - add r1660 r1662 into r1663; - gte r1663 r393 into r1664; - or r1659 r1664 into r1665; - sub.w r1663 r393 into r1666; - ternary r1665 r1666 r1663 into r1667; - add r1658 4096u128 into r1668; - ternary r1665 r1668 r1658 into r1669; - gte r1667 170141183460469231731687303715884105728u128 into r1670; - add.w r1667 r1667 into r1671; - shr r191 11u8 into r1672; - and r1672 1u128 into r1673; - add r1671 r1673 into r1674; - gte r1674 r393 into r1675; - or r1670 r1675 into r1676; - sub.w r1674 r393 into r1677; - ternary r1676 r1677 r1674 into r1678; - add r1669 2048u128 into r1679; - ternary r1676 r1679 r1669 into r1680; - gte r1678 170141183460469231731687303715884105728u128 into r1681; - add.w r1678 r1678 into r1682; - shr r191 10u8 into r1683; - and r1683 1u128 into r1684; - add r1682 r1684 into r1685; - gte r1685 r393 into r1686; - or r1681 r1686 into r1687; - sub.w r1685 r393 into r1688; - ternary r1687 r1688 r1685 into r1689; - add r1680 1024u128 into r1690; - ternary r1687 r1690 r1680 into r1691; - gte r1689 170141183460469231731687303715884105728u128 into r1692; - add.w r1689 r1689 into r1693; - shr r191 9u8 into r1694; - and r1694 1u128 into r1695; - add r1693 r1695 into r1696; - gte r1696 r393 into r1697; - or r1692 r1697 into r1698; - sub.w r1696 r393 into r1699; - ternary r1698 r1699 r1696 into r1700; - add r1691 512u128 into r1701; - ternary r1698 r1701 r1691 into r1702; - gte r1700 170141183460469231731687303715884105728u128 into r1703; - add.w r1700 r1700 into r1704; - shr r191 8u8 into r1705; - and r1705 1u128 into r1706; - add r1704 r1706 into r1707; - gte r1707 r393 into r1708; - or r1703 r1708 into r1709; - sub.w r1707 r393 into r1710; - ternary r1709 r1710 r1707 into r1711; - add r1702 256u128 into r1712; - ternary r1709 r1712 r1702 into r1713; - gte r1711 170141183460469231731687303715884105728u128 into r1714; - add.w r1711 r1711 into r1715; - shr r191 7u8 into r1716; - and r1716 1u128 into r1717; - add r1715 r1717 into r1718; - gte r1718 r393 into r1719; - or r1714 r1719 into r1720; - sub.w r1718 r393 into r1721; - ternary r1720 r1721 r1718 into r1722; - add r1713 128u128 into r1723; - ternary r1720 r1723 r1713 into r1724; - gte r1722 170141183460469231731687303715884105728u128 into r1725; - add.w r1722 r1722 into r1726; - shr r191 6u8 into r1727; - and r1727 1u128 into r1728; - add r1726 r1728 into r1729; - gte r1729 r393 into r1730; - or r1725 r1730 into r1731; - sub.w r1729 r393 into r1732; - ternary r1731 r1732 r1729 into r1733; - add r1724 64u128 into r1734; - ternary r1731 r1734 r1724 into r1735; - gte r1733 170141183460469231731687303715884105728u128 into r1736; - add.w r1733 r1733 into r1737; - shr r191 5u8 into r1738; - and r1738 1u128 into r1739; - add r1737 r1739 into r1740; - gte r1740 r393 into r1741; - or r1736 r1741 into r1742; - sub.w r1740 r393 into r1743; - ternary r1742 r1743 r1740 into r1744; - add r1735 32u128 into r1745; - ternary r1742 r1745 r1735 into r1746; - gte r1744 170141183460469231731687303715884105728u128 into r1747; - add.w r1744 r1744 into r1748; - shr r191 4u8 into r1749; - and r1749 1u128 into r1750; - add r1748 r1750 into r1751; - gte r1751 r393 into r1752; - or r1747 r1752 into r1753; - sub.w r1751 r393 into r1754; - ternary r1753 r1754 r1751 into r1755; - add r1746 16u128 into r1756; - ternary r1753 r1756 r1746 into r1757; - gte r1755 170141183460469231731687303715884105728u128 into r1758; - add.w r1755 r1755 into r1759; - shr r191 3u8 into r1760; - and r1760 1u128 into r1761; - add r1759 r1761 into r1762; - gte r1762 r393 into r1763; - or r1758 r1763 into r1764; - sub.w r1762 r393 into r1765; - ternary r1764 r1765 r1762 into r1766; - add r1757 8u128 into r1767; - ternary r1764 r1767 r1757 into r1768; - gte r1766 170141183460469231731687303715884105728u128 into r1769; - add.w r1766 r1766 into r1770; - shr r191 2u8 into r1771; - and r1771 1u128 into r1772; - add r1770 r1772 into r1773; - gte r1773 r393 into r1774; - or r1769 r1774 into r1775; - sub.w r1773 r393 into r1776; - ternary r1775 r1776 r1773 into r1777; - add r1768 4u128 into r1778; - ternary r1775 r1778 r1768 into r1779; - gte r1777 170141183460469231731687303715884105728u128 into r1780; - add.w r1777 r1777 into r1781; - shr r191 1u8 into r1782; - and r1782 1u128 into r1783; - add r1781 r1783 into r1784; - gte r1784 r393 into r1785; - or r1780 r1785 into r1786; - sub.w r1784 r393 into r1787; - ternary r1786 r1787 r1784 into r1788; - add r1779 2u128 into r1789; - ternary r1786 r1789 r1779 into r1790; - gte r1788 170141183460469231731687303715884105728u128 into r1791; - add.w r1788 r1788 into r1792; - and r217 1u128 into r1793; - add r1792 r1793 into r1794; - gte r1794 r393 into r1795; - or r1791 r1795 into r1796; - sub.w r1794 r393 into r1797; - ternary r1796 r1797 r1794 into r1798; - add r1790 1u128 into r1799; - ternary r1796 r1799 r1790 into r1800; - gt r1798 0u128 into r1801; - add r1800 1u128 into r1802; - ternary r1801 r1802 r1800 into r1803; - ternary r366 r3.sp r1803 into r1804; - ternary r121 r3.liq 1u128 into r1805; - and r362 18446744073709551615u128 into r1806; - shr r362 64u8 into r1807; - mul r1806 9223372036854775808u128 into r1808; - mul r1807 9223372036854775808u128 into r1809; - and r1808 18446744073709551615u128 into r1810; - shr r1808 64u8 into r1811; - and r1809 18446744073709551615u128 into r1812; - add r1811 r1812 into r1813; - and r1813 18446744073709551615u128 into r1814; - shr r1813 64u8 into r1815; - shr r1809 64u8 into r1816; - add r1816 r1815 into r1817; - and r1817 18446744073709551615u128 into r1818; - shr r1817 64u8 into r1819; - shl r1814 64u8 into r1820; - add r1820 r1810 into r1821; - shl r1819 64u8 into r1822; - add r1822 r1818 into r1823; - lt r1823 r1805 into r1824; - assert.eq r1824 true; - shr r1821 96u8 into r1825; - and r1825 4294967295u128 into r1826; - shl r1823 32u8 into r1827; - add r1827 r1826 into r1828; - div r1828 r1805 into r1829; - rem r1828 r1805 into r1830; - shr r1821 64u8 into r1831; - and r1831 4294967295u128 into r1832; - shl r1830 32u8 into r1833; - add r1833 r1832 into r1834; - shl r1829 32u8 into r1835; - div r1834 r1805 into r1836; - add r1835 r1836 into r1837; - rem r1834 r1805 into r1838; - shr r1821 32u8 into r1839; - and r1839 4294967295u128 into r1840; - shl r1838 32u8 into r1841; - add r1841 r1840 into r1842; - shl r1837 32u8 into r1843; - div r1842 r1805 into r1844; - add r1843 r1844 into r1845; - rem r1842 r1805 into r1846; - shr r1821 0u8 into r1847; - and r1847 4294967295u128 into r1848; - shl r1846 32u8 into r1849; - add r1849 r1848 into r1850; - shl r1845 32u8 into r1851; - div r1850 r1805 into r1852; - add r1851 r1852 into r1853; - rem r1850 r1805 into r1854; - add r1853 1u128 into r1855; - ternary r121 r1853 0u128 into r1856; - add r3.sp r1856 into r1857; - gt r1856 r3.sp into r1858; - ternary r1858 r3.sp r1856 into r1859; - sub r3.sp r1859 into r1860; - ternary r0.z r1804 r1857 into r1861; - ternary r365 r116 r1861 into r1862; - gt r1862 r3.sp into r1863; - ternary r1863 r3.sp r1862 into r1864; - ternary r1863 r1862 r3.sp into r1865; - gt r1864 0u128 into r1866; - gt r1865 0u128 into r1867; - and r1866 r1867 into r1868; - ternary r1867 r1865 1u128 into r1869; - ternary r1866 r1864 1u128 into r1870; - lt r368 r1870 into r1871; - assert.eq r1871 true; - shl r368 32u8 into r1872; - add r1872 r196 into r1873; - div r1873 r1870 into r1874; - rem r1873 r1870 into r1875; - shl r1875 32u8 into r1876; - add r1876 r202 into r1877; - shl r1874 32u8 into r1878; - div r1877 r1870 into r1879; - add r1878 r1879 into r1880; - rem r1877 r1870 into r1881; - shl r1881 32u8 into r1882; - add r1882 r210 into r1883; - shl r1880 32u8 into r1884; - div r1883 r1870 into r1885; - add r1884 r1885 into r1886; - rem r1883 r1870 into r1887; - shl r1887 32u8 into r1888; - add r1888 r218 into r1889; - shl r1886 32u8 into r1890; - div r1889 r1870 into r1891; - add r1890 r1891 into r1892; - rem r1889 r1870 into r1893; - gt r1893 0u128 into r1894; - add r1892 1u128 into r1895; - ternary r1894 r1895 r1892 into r1896; - lt r368 r1869 into r1897; - assert.eq r1897 true; - div r1873 r1869 into r1898; - rem r1873 r1869 into r1899; - shl r1899 32u8 into r1900; - add r1900 r202 into r1901; - shl r1898 32u8 into r1902; - div r1901 r1869 into r1903; - add r1902 r1903 into r1904; - rem r1901 r1869 into r1905; - shl r1905 32u8 into r1906; - add r1906 r210 into r1907; - shl r1904 32u8 into r1908; - div r1907 r1869 into r1909; - add r1908 r1909 into r1910; - rem r1907 r1869 into r1911; - shl r1911 32u8 into r1912; - add r1912 r218 into r1913; - shl r1910 32u8 into r1914; - div r1913 r1869 into r1915; - add r1914 r1915 into r1916; - rem r1913 r1869 into r1917; - add r1916 1u128 into r1918; - gte r1896 r1916 into r1919; - ternary r1919 r1896 r1916 into r1920; - ternary r1919 r1916 r1896 into r1921; - sub r1920 r1921 into r1922; - ternary r1919 r1922 0u128 into r1923; - lt r1864 r1865 into r1924; - and r1868 r1924 into r1925; - ternary r1925 r1923 0u128 into r1926; - gt r3.sp r1862 into r1927; - ternary r1927 r1862 r3.sp into r1928; - ternary r1927 r3.sp r1862 into r1929; - sub r1929 r1928 into r1930; - and r1930 18446744073709551615u128 into r1931; - shr r1930 64u8 into r1932; - mul r132 r1931 into r1933; - mul r132 r1932 into r1934; - mul r133 r1931 into r1935; - mul r133 r1932 into r1936; - and r1933 18446744073709551615u128 into r1937; - shr r1933 64u8 into r1938; - and r1934 18446744073709551615u128 into r1939; - add r1938 r1939 into r1940; - and r1935 18446744073709551615u128 into r1941; - add r1940 r1941 into r1942; - and r1942 18446744073709551615u128 into r1943; - shr r1942 64u8 into r1944; - shr r1934 64u8 into r1945; - shr r1935 64u8 into r1946; - add r1945 r1946 into r1947; - and r1936 18446744073709551615u128 into r1948; - add r1947 r1948 into r1949; - add r1949 r1944 into r1950; - and r1950 18446744073709551615u128 into r1951; - shr r1950 64u8 into r1952; - shr r1936 64u8 into r1953; - add r1953 r1952 into r1954; - shl r1943 64u8 into r1955; - add r1955 r1937 into r1956; - shl r1954 64u8 into r1957; - add r1957 r1951 into r1958; - lt r1958 9223372036854775808u128 into r1959; - assert.eq r1959 true; - shr r1956 96u8 into r1960; - and r1960 4294967295u128 into r1961; - shl r1958 32u8 into r1962; - add r1962 r1961 into r1963; - div r1963 9223372036854775808u128 into r1964; - rem r1963 9223372036854775808u128 into r1965; - shr r1956 64u8 into r1966; - and r1966 4294967295u128 into r1967; - shl r1965 32u8 into r1968; - add r1968 r1967 into r1969; - shl r1964 32u8 into r1970; - div r1969 9223372036854775808u128 into r1971; - add r1970 r1971 into r1972; - rem r1969 9223372036854775808u128 into r1973; - shr r1956 32u8 into r1974; - and r1974 4294967295u128 into r1975; - shl r1973 32u8 into r1976; - add r1976 r1975 into r1977; - shl r1972 32u8 into r1978; - div r1977 9223372036854775808u128 into r1979; - add r1978 r1979 into r1980; - rem r1977 9223372036854775808u128 into r1981; - shr r1956 0u8 into r1982; - and r1982 4294967295u128 into r1983; - shl r1981 32u8 into r1984; - add r1984 r1983 into r1985; - shl r1980 32u8 into r1986; - div r1985 9223372036854775808u128 into r1987; - add r1986 r1987 into r1988; - rem r1985 9223372036854775808u128 into r1989; - gt r1989 0u128 into r1990; - add r1988 1u128 into r1991; - ternary r1990 r1991 r1988 into r1992; - ternary r0.z r1926 r1992 into r1993; - ternary r365 r300 r1993 into r1994; - gt r1862 r3.sp into r1995; - ternary r1995 r3.sp r1862 into r1996; - ternary r1995 r1862 r3.sp into r1997; - sub r1997 r1996 into r1998; - and r1998 18446744073709551615u128 into r1999; - shr r1998 64u8 into r2000; - mul r132 r1999 into r2001; - mul r132 r2000 into r2002; - mul r133 r1999 into r2003; - mul r133 r2000 into r2004; - and r2001 18446744073709551615u128 into r2005; - shr r2001 64u8 into r2006; - and r2002 18446744073709551615u128 into r2007; - add r2006 r2007 into r2008; - and r2003 18446744073709551615u128 into r2009; - add r2008 r2009 into r2010; - and r2010 18446744073709551615u128 into r2011; - shr r2010 64u8 into r2012; - shr r2002 64u8 into r2013; - shr r2003 64u8 into r2014; - add r2013 r2014 into r2015; - and r2004 18446744073709551615u128 into r2016; - add r2015 r2016 into r2017; - add r2017 r2012 into r2018; - and r2018 18446744073709551615u128 into r2019; - shr r2018 64u8 into r2020; - shr r2004 64u8 into r2021; - add r2021 r2020 into r2022; - shl r2011 64u8 into r2023; - add r2023 r2005 into r2024; - shl r2022 64u8 into r2025; - add r2025 r2019 into r2026; - lt r2026 9223372036854775808u128 into r2027; - assert.eq r2027 true; - shr r2024 96u8 into r2028; - and r2028 4294967295u128 into r2029; - shl r2026 32u8 into r2030; - add r2030 r2029 into r2031; - div r2031 9223372036854775808u128 into r2032; - rem r2031 9223372036854775808u128 into r2033; - shr r2024 64u8 into r2034; - and r2034 4294967295u128 into r2035; - shl r2033 32u8 into r2036; - add r2036 r2035 into r2037; - shl r2032 32u8 into r2038; - div r2037 9223372036854775808u128 into r2039; - add r2038 r2039 into r2040; - rem r2037 9223372036854775808u128 into r2041; - shr r2024 32u8 into r2042; - and r2042 4294967295u128 into r2043; - shl r2041 32u8 into r2044; - add r2044 r2043 into r2045; - shl r2040 32u8 into r2046; - div r2045 9223372036854775808u128 into r2047; - add r2046 r2047 into r2048; - rem r2045 9223372036854775808u128 into r2049; - shr r2024 0u8 into r2050; - and r2050 4294967295u128 into r2051; - shl r2049 32u8 into r2052; - add r2052 r2051 into r2053; - shl r2048 32u8 into r2054; - div r2053 9223372036854775808u128 into r2055; - add r2054 r2055 into r2056; - rem r2053 9223372036854775808u128 into r2057; - add r2056 1u128 into r2058; - gt r1928 0u128 into r2059; - gt r1929 0u128 into r2060; - and r2059 r2060 into r2061; - ternary r2060 r1929 1u128 into r2062; - ternary r2059 r1928 1u128 into r2063; - lt r368 r2063 into r2064; - assert.eq r2064 true; - div r1873 r2063 into r2065; - rem r1873 r2063 into r2066; - shl r2066 32u8 into r2067; - add r2067 r202 into r2068; - shl r2065 32u8 into r2069; - div r2068 r2063 into r2070; - add r2069 r2070 into r2071; - rem r2068 r2063 into r2072; - shl r2072 32u8 into r2073; - add r2073 r210 into r2074; - shl r2071 32u8 into r2075; - div r2074 r2063 into r2076; - add r2075 r2076 into r2077; - rem r2074 r2063 into r2078; - shl r2078 32u8 into r2079; - add r2079 r218 into r2080; - shl r2077 32u8 into r2081; - div r2080 r2063 into r2082; - add r2081 r2082 into r2083; - rem r2080 r2063 into r2084; - add r2083 1u128 into r2085; - lt r368 r2062 into r2086; - assert.eq r2086 true; - div r1873 r2062 into r2087; - rem r1873 r2062 into r2088; - shl r2088 32u8 into r2089; - add r2089 r202 into r2090; - shl r2087 32u8 into r2091; - div r2090 r2062 into r2092; - add r2091 r2092 into r2093; - rem r2090 r2062 into r2094; - shl r2094 32u8 into r2095; - add r2095 r210 into r2096; - shl r2093 32u8 into r2097; - div r2096 r2062 into r2098; - add r2097 r2098 into r2099; - rem r2096 r2062 into r2100; - shl r2100 32u8 into r2101; - add r2101 r218 into r2102; - shl r2099 32u8 into r2103; - div r2102 r2062 into r2104; - add r2103 r2104 into r2105; - rem r2102 r2062 into r2106; - gt r2106 0u128 into r2107; - add r2105 1u128 into r2108; - ternary r2107 r2108 r2105 into r2109; - gte r2083 r2109 into r2110; - ternary r2110 r2083 r2109 into r2111; - ternary r2110 r2109 r2083 into r2112; - sub r2111 r2112 into r2113; - ternary r2110 r2113 0u128 into r2114; - lt r1928 r1929 into r2115; - and r2061 r2115 into r2116; - ternary r2116 r2114 0u128 into r2117; - ternary r0.z r2056 r2117 into r2118; - cast r0.fee_pips into r2119 as u128; - cast r0.fee_pips into r2120 as u128; - sub 1000000u128 r2120 into r2121; - and r1994 18446744073709551615u128 into r2122; - shr r1994 64u8 into r2123; - and r2119 18446744073709551615u128 into r2124; - shr r2119 64u8 into r2125; - mul r2122 r2124 into r2126; - mul r2122 r2125 into r2127; - mul r2123 r2124 into r2128; - mul r2123 r2125 into r2129; - and r2126 18446744073709551615u128 into r2130; - shr r2126 64u8 into r2131; - and r2127 18446744073709551615u128 into r2132; - add r2131 r2132 into r2133; - and r2128 18446744073709551615u128 into r2134; - add r2133 r2134 into r2135; - and r2135 18446744073709551615u128 into r2136; - shr r2135 64u8 into r2137; - shr r2127 64u8 into r2138; - shr r2128 64u8 into r2139; - add r2138 r2139 into r2140; - and r2129 18446744073709551615u128 into r2141; - add r2140 r2141 into r2142; - add r2142 r2137 into r2143; - and r2143 18446744073709551615u128 into r2144; - shr r2143 64u8 into r2145; - shr r2129 64u8 into r2146; - add r2146 r2145 into r2147; - shl r2136 64u8 into r2148; - add r2148 r2130 into r2149; - shl r2147 64u8 into r2150; - add r2150 r2144 into r2151; - lt r2151 r2121 into r2152; - assert.eq r2152 true; - shr r2149 96u8 into r2153; - and r2153 4294967295u128 into r2154; - shl r2151 32u8 into r2155; - add r2155 r2154 into r2156; - div r2156 r2121 into r2157; - rem r2156 r2121 into r2158; - shr r2149 64u8 into r2159; - and r2159 4294967295u128 into r2160; - shl r2158 32u8 into r2161; - add r2161 r2160 into r2162; - shl r2157 32u8 into r2163; - div r2162 r2121 into r2164; - add r2163 r2164 into r2165; - rem r2162 r2121 into r2166; - shr r2149 32u8 into r2167; - and r2167 4294967295u128 into r2168; - shl r2166 32u8 into r2169; - add r2169 r2168 into r2170; - shl r2165 32u8 into r2171; - div r2170 r2121 into r2172; - add r2171 r2172 into r2173; - rem r2170 r2121 into r2174; - shr r2149 0u8 into r2175; - and r2175 4294967295u128 into r2176; - shl r2174 32u8 into r2177; - add r2177 r2176 into r2178; - shl r2173 32u8 into r2179; - div r2178 r2121 into r2180; - add r2179 r2180 into r2181; - rem r2178 r2121 into r2182; - gt r2182 0u128 into r2183; - add r2181 1u128 into r2184; - ternary r2183 r2184 r2181 into r2185; - gt r1994 r3.rem into r2186; - ternary r2186 r3.rem r1994 into r2187; - sub r3.rem r2187 into r2188; - ternary r365 r2185 r2188 into r2189; - ternary r120 r116 r3.sp into r2190; - ternary r123 r1862 r2190 into r2191; - ternary r123 r1994 0u128 into r2192; - ternary r123 r2118 0u128 into r2193; - ternary r123 r2189 0u128 into r2194; - cast r0.fee_protocol into r2195 as u128; - mul r2194 r2195 into r2196; - div r2196 16u128 into r2197; - sub r2194 r2197 into r2198; - add r3.pf r2197 into r2199; - add r2192 r2194 into r2200; - gt r2200 r3.rem into r2201; - ternary r2201 r3.rem r2200 into r2202; - sub r3.rem r2202 into r2203; - add r3.out r2193 into r2204; - and r2198 18446744073709551615u128 into r2205; - shr r2198 64u8 into r2206; - mul r2205 9223372036854775808u128 into r2207; - mul r2206 9223372036854775808u128 into r2208; - and r2207 18446744073709551615u128 into r2209; - shr r2207 64u8 into r2210; - and r2208 18446744073709551615u128 into r2211; - add r2210 r2211 into r2212; - and r2212 18446744073709551615u128 into r2213; - shr r2212 64u8 into r2214; - shr r2208 64u8 into r2215; - add r2215 r2214 into r2216; - and r2216 18446744073709551615u128 into r2217; - shr r2216 64u8 into r2218; - shl r2213 64u8 into r2219; - add r2219 r2209 into r2220; - shl r2218 64u8 into r2221; - add r2221 r2217 into r2222; - lt r2222 r1805 into r2223; - assert.eq r2223 true; - shr r2220 96u8 into r2224; - and r2224 4294967295u128 into r2225; - shl r2222 32u8 into r2226; - add r2226 r2225 into r2227; - div r2227 r1805 into r2228; - rem r2227 r1805 into r2229; - shr r2220 64u8 into r2230; - and r2230 4294967295u128 into r2231; - shl r2229 32u8 into r2232; - add r2232 r2231 into r2233; - shl r2228 32u8 into r2234; - div r2233 r1805 into r2235; - add r2234 r2235 into r2236; - rem r2233 r1805 into r2237; - shr r2220 32u8 into r2238; - and r2238 4294967295u128 into r2239; - shl r2237 32u8 into r2240; - add r2240 r2239 into r2241; - shl r2236 32u8 into r2242; - div r2241 r1805 into r2243; - add r2242 r2243 into r2244; - rem r2241 r1805 into r2245; - shr r2220 0u8 into r2246; - and r2246 4294967295u128 into r2247; - shl r2245 32u8 into r2248; - add r2248 r2247 into r2249; - shl r2244 32u8 into r2250; - div r2249 r1805 into r2251; - add r2250 r2251 into r2252; - rem r2249 r1805 into r2253; - add r2252 1u128 into r2254; - mul.w r2198 9223372036854775808u128 into r2255; - mul.w r2252 r1805 into r2256; - sub.w r2255 r2256 into r2257; - sub r1805 r2257 into r2258; - gte r3.resid r2258 into r2259; - and r121 r2259 into r2260; - sub.w r3.resid r2258 into r2261; - add.w r2257 r3.resid into r2262; - ternary r2260 r2261 r2262 into r2263; - ternary r2260 1u128 0u128 into r2264; - add r2252 r2264 into r2265; - sub 340282366920938463463374607431768211455u128 r3.fg into r2266; - gt r2265 r2266 into r2267; - ternary r2267 0u128 r2265 into r2268; - add r3.fg r2268 into r2269; - gte r2265 r2266 into r2270; - ternary r2270 r2265 r2266 into r2271; - sub r2271 r2266 into r2272; - gte r2272 1u128 into r2273; - ternary r2273 r2272 1u128 into r2274; - sub r2274 1u128 into r2275; - ternary r2267 r2275 r2269 into r2276; - is.eq r2191 r111 into r2277; - and r3.crossed r2277 into r2278; - is.neq r111 r0.lim into r2279; - and r2278 r2279 into r2280; - ternary r0.z r2276 r0.slot_fg0 into r2281; - ternary r0.z r0.slot_fg1 r2276 into r2282; - gte r2281 r2.fee_growth_outside0_64 into r2283; - ternary r2283 r2281 r2.fee_growth_outside0_64 into r2284; - ternary r2283 r2.fee_growth_outside0_64 r2281 into r2285; - sub r2284 r2285 into r2286; - gt r2286 0u128 into r2287; - ternary r2287 r2286 1u128 into r2288; - sub 340282366920938463463374607431768211455u128 r2288 into r2289; - add r2289 1u128 into r2290; - ternary r2283 r2286 r2290 into r2291; - gte r2282 r2.fee_growth_outside1_64 into r2292; - ternary r2292 r2282 r2.fee_growth_outside1_64 into r2293; - ternary r2292 r2.fee_growth_outside1_64 r2282 into r2294; - sub r2293 r2294 into r2295; - gt r2295 0u128 into r2296; - ternary r2296 r2295 1u128 into r2297; - sub 340282366920938463463374607431768211455u128 r2297 into r2298; - add r2298 1u128 into r2299; - ternary r2292 r2295 r2299 into r2300; - ternary r2280 r2.pool r2.pool into r2301; - ternary r2280 r2.liquidity_net r2.liquidity_net into r2302; - ternary r2280 r2.liquidity_gross r2.liquidity_gross into r2303; - ternary r2280 r2.tick r2.tick into r2304; - ternary r2280 r2291 r2.fee_growth_outside0_64 into r2305; - ternary r2280 r2300 r2.fee_growth_outside1_64 into r2306; - ternary r2280 r2.prev r2.prev into r2307; - ternary r2280 r2.next r2.next into r2308; - cast r2301 r2302 r2303 r2304 r2305 r2306 r2307 r2308 into r2309 as Tick; - sub 0i128 r2.liquidity_net into r2310; - ternary r0.z r2310 r2.liquidity_net into r2311; - ternary r2280 r2311 0i128 into r2312; - sub 0i128 r2312 into r2313; - gt r2312 0i128 into r2314; - ternary r2314 r2312 0i128 into r2315; - gt r2313 0i128 into r2316; - ternary r2316 r2313 0i128 into r2317; - cast r2315 into r2318 as u128; - cast r2317 into r2319 as u128; - gte r3.liq r2319 into r2320; - assert.eq r2320 true; - sub r3.liq r2319 into r2321; - add r3.liq r2318 into r2322; - lt r2312 0i128 into r2323; - ternary r2323 r2321 r2322 into r2324; - ternary r2280 r2324 r3.liq into r2325; - sub r1 1i32 into r2326; - ternary r0.z r2326 r1 into r2327; - is.eq r2191 r3.sp into r2328; - gte r2191 18446744073709551616u128 into r2329; - shr r2191 64u8 into r2330; - ternary r2329 r2330 r2191 into r2331; - ternary r2329 64u32 0u32 into r2332; - gte r2331 4294967296u128 into r2333; - shr r2331 32u8 into r2334; - add r2332 32u32 into r2335; - ternary r2333 r2334 r2331 into r2336; - ternary r2333 r2335 r2332 into r2337; - gte r2336 65536u128 into r2338; - shr r2336 16u8 into r2339; - add r2337 16u32 into r2340; - ternary r2338 r2339 r2336 into r2341; - ternary r2338 r2340 r2337 into r2342; - gte r2341 256u128 into r2343; - shr r2341 8u8 into r2344; - add r2342 8u32 into r2345; - ternary r2343 r2344 r2341 into r2346; - ternary r2343 r2345 r2342 into r2347; - gte r2346 16u128 into r2348; - shr r2346 4u8 into r2349; - add r2347 4u32 into r2350; - ternary r2348 r2349 r2346 into r2351; - ternary r2348 r2350 r2347 into r2352; - gte r2351 4u128 into r2353; - shr r2351 2u8 into r2354; - add r2352 2u32 into r2355; - ternary r2353 r2354 r2351 into r2356; - ternary r2353 r2355 r2352 into r2357; - gte r2356 2u128 into r2358; - add r2357 1u32 into r2359; - ternary r2358 r2359 r2357 into r2360; - gte r2360 63u32 into r2361; - ternary r2361 r2360 63u32 into r2362; - ternary r2361 63u32 r2360 into r2363; - sub r2362 r2363 into r2364; - cast r2364 into r2365 as u8; - shr r2191 r2365 into r2366; - shl r2191 r2365 into r2367; - ternary r2361 r2366 r2367 into r2368; - mul r2368 r2368 into r2369; - shr r2369 63u8 into r2370; - shr r2370 64u8 into r2371; - shl r2371 63u8 into r2372; - cast r2371 into r2373 as u8; - shr r2370 r2373 into r2374; - mul r2374 r2374 into r2375; - shr r2375 63u8 into r2376; - shr r2376 64u8 into r2377; - shl r2377 62u8 into r2378; - or r2372 r2378 into r2379; - cast r2377 into r2380 as u8; - shr r2376 r2380 into r2381; - mul r2381 r2381 into r2382; - shr r2382 63u8 into r2383; - shr r2383 64u8 into r2384; - shl r2384 61u8 into r2385; - or r2379 r2385 into r2386; - cast r2384 into r2387 as u8; - shr r2383 r2387 into r2388; - mul r2388 r2388 into r2389; - shr r2389 63u8 into r2390; - shr r2390 64u8 into r2391; - shl r2391 60u8 into r2392; - or r2386 r2392 into r2393; - cast r2391 into r2394 as u8; - shr r2390 r2394 into r2395; - mul r2395 r2395 into r2396; - shr r2396 63u8 into r2397; - shr r2397 64u8 into r2398; - shl r2398 59u8 into r2399; - or r2393 r2399 into r2400; - cast r2398 into r2401 as u8; - shr r2397 r2401 into r2402; - mul r2402 r2402 into r2403; - shr r2403 63u8 into r2404; - shr r2404 64u8 into r2405; - shl r2405 58u8 into r2406; - or r2400 r2406 into r2407; - cast r2405 into r2408 as u8; - shr r2404 r2408 into r2409; - mul r2409 r2409 into r2410; - shr r2410 63u8 into r2411; - shr r2411 64u8 into r2412; - shl r2412 57u8 into r2413; - or r2407 r2413 into r2414; - cast r2412 into r2415 as u8; - shr r2411 r2415 into r2416; - mul r2416 r2416 into r2417; - shr r2417 63u8 into r2418; - shr r2418 64u8 into r2419; - shl r2419 56u8 into r2420; - or r2414 r2420 into r2421; - cast r2419 into r2422 as u8; - shr r2418 r2422 into r2423; - mul r2423 r2423 into r2424; - shr r2424 63u8 into r2425; - shr r2425 64u8 into r2426; - shl r2426 55u8 into r2427; - or r2421 r2427 into r2428; - cast r2426 into r2429 as u8; - shr r2425 r2429 into r2430; - mul r2430 r2430 into r2431; - shr r2431 63u8 into r2432; - shr r2432 64u8 into r2433; - shl r2433 54u8 into r2434; - or r2428 r2434 into r2435; - cast r2433 into r2436 as u8; - shr r2432 r2436 into r2437; - mul r2437 r2437 into r2438; - shr r2438 63u8 into r2439; - shr r2439 64u8 into r2440; - shl r2440 53u8 into r2441; - or r2435 r2441 into r2442; - cast r2440 into r2443 as u8; - shr r2439 r2443 into r2444; - mul r2444 r2444 into r2445; - shr r2445 63u8 into r2446; - shr r2446 64u8 into r2447; - shl r2447 52u8 into r2448; - or r2442 r2448 into r2449; - cast r2447 into r2450 as u8; - shr r2446 r2450 into r2451; - mul r2451 r2451 into r2452; - shr r2452 63u8 into r2453; - shr r2453 64u8 into r2454; - shl r2454 51u8 into r2455; - or r2449 r2455 into r2456; - cast r2454 into r2457 as u8; - shr r2453 r2457 into r2458; - mul r2458 r2458 into r2459; - shr r2459 63u8 into r2460; - shr r2460 64u8 into r2461; - shl r2461 50u8 into r2462; - or r2456 r2462 into r2463; - cast r2360 into r2464 as i128; - sub r2464 63i128 into r2465; - shl r2465 64u8 into r2466; - cast r2463 into r2467 as i128; - add r2466 r2467 into r2468; - div r2468 1330584781654114i128 into r2469; - cast r2469 into r2470 as i32; - add r2470 1i32 into r2471; - gte r2471 -873409i32 into r2472; - lte r2471 873409i32 into r2473; - and r2472 r2473 into r2474; - assert.eq r2474 true; - lt r2471 0i32 into r2475; - sub 0i32 r2471 into r2476; - ternary r2475 r2476 r2471 into r2477; - gte r2477 0i32 into r2478; - assert.eq r2478 true; - cast r2477 into r2479 as u32; - and r2479 3u32 into r2480; - is.eq r2480 0u32 into r2481; - is.eq r2480 1u32 into r2482; - is.eq r2480 2u32 into r2483; - ternary r2483 9222449791875588096u128 9221988703967300608u128 into r2484; - ternary r2482 9222910902837697536u128 r2484 into r2485; - ternary r2481 9223372036854775808u128 r2485 into r2486; - and r2479 4u32 into r2487; - is.neq r2487 0u32 into r2488; - mul r2486 9221527639111677952u128 into r2489; - shr r2489 63u8 into r2490; - ternary r2488 r2490 r2486 into r2491; - and r2479 8u32 into r2492; - is.neq r2492 0u32 into r2493; - mul r2491 9219683610192801792u128 into r2494; - shr r2494 63u8 into r2495; - ternary r2493 r2495 r2491 into r2496; - and r2479 16u32 into r2497; - is.neq r2497 0u32 into r2498; - mul r2496 9215996658532725760u128 into r2499; - shr r2499 63u8 into r2500; - ternary r2498 r2500 r2496 into r2501; - and r2479 32u32 into r2502; - is.neq r2502 0u32 into r2503; - mul r2501 9208627177859081216u128 into r2504; - shr r2504 63u8 into r2505; - ternary r2503 r2505 r2501 into r2506; - and r2479 64u32 into r2507; - is.neq r2507 0u32 into r2508; - mul r2506 9193905890596798464u128 into r2509; - shr r2509 63u8 into r2510; - ternary r2508 r2510 r2506 into r2511; - and r2479 128u32 into r2512; - is.neq r2512 0u32 into r2513; - mul r2511 9164533880601766912u128 into r2514; - shr r2514 63u8 into r2515; - ternary r2513 r2515 r2511 into r2516; - and r2479 256u32 into r2517; - is.neq r2517 0u32 into r2518; - mul r2516 9106071067403056128u128 into r2519; - shr r2519 63u8 into r2520; - ternary r2518 r2520 r2516 into r2521; - and r2479 512u32 into r2522; - is.neq r2522 0u32 into r2523; - mul r2521 8990261907820801024u128 into r2524; - shr r2524 63u8 into r2525; - ternary r2523 r2525 r2521 into r2526; - and r2479 1024u32 into r2527; - is.neq r2527 0u32 into r2528; - mul r2526 8763043369415622656u128 into r2529; - shr r2529 63u8 into r2530; - ternary r2528 r2530 r2526 into r2531; - and r2479 2048u32 into r2532; - is.neq r2532 0u32 into r2533; - mul r2531 8325689215117605888u128 into r2534; - shr r2534 63u8 into r2535; - ternary r2533 r2535 r2531 into r2536; - and r2479 4096u32 into r2537; - is.neq r2537 0u32 into r2538; - mul r2536 7515375139346884608u128 into r2539; - shr r2539 63u8 into r2540; - ternary r2538 r2540 r2536 into r2541; - and r2479 8192u32 into r2542; - is.neq r2542 0u32 into r2543; - mul r2541 6123667489441693696u128 into r2544; - shr r2544 63u8 into r2545; - ternary r2543 r2545 r2541 into r2546; - and r2479 16384u32 into r2547; - is.neq r2547 0u32 into r2548; - mul r2546 4065682634442729984u128 into r2549; - shr r2549 63u8 into r2550; - ternary r2548 r2550 r2546 into r2551; - and r2479 32768u32 into r2552; - is.neq r2552 0u32 into r2553; - mul r2551 1792161827361994496u128 into r2554; - shr r2554 63u8 into r2555; - ternary r2553 r2555 r2551 into r2556; - and r2479 65536u32 into r2557; - is.neq r2557 0u32 into r2558; - mul r2556 348228825923923264u128 into r2559; - shr r2559 63u8 into r2560; - ternary r2558 r2560 r2556 into r2561; - and r2479 131072u32 into r2562; - is.neq r2562 0u32 into r2563; - mul r2561 13147394978735516u128 into r2564; - shr r2564 63u8 into r2565; - ternary r2563 r2565 r2561 into r2566; - and r2479 262144u32 into r2567; - is.neq r2567 0u32 into r2568; - mul r2566 18740867660568u128 into r2569; - shr r2569 63u8 into r2570; - ternary r2568 r2570 r2566 into r2571; - and r2479 524288u32 into r2572; - is.neq r2572 0u32 into r2573; - mul r2571 38079361u128 into r2574; - shr r2574 63u8 into r2575; - ternary r2573 r2575 r2571 into r2576; - gt r2471 0i32 into r2577; - div 85070591730234615865843651857942052864u128 r2576 into r2578; - ternary r2577 r2578 r2576 into r2579; - gte r2191 r2579 into r2580; - ternary r2580 r2471 r2470 into r2581; - gte r2581 -873409i32 into r2582; - lte r2581 873409i32 into r2583; - and r2582 r2583 into r2584; - assert.eq r2584 true; - lt r2581 0i32 into r2585; - sub 0i32 r2581 into r2586; - ternary r2585 r2586 r2581 into r2587; - gte r2587 0i32 into r2588; - assert.eq r2588 true; - cast r2587 into r2589 as u32; - and r2589 3u32 into r2590; - is.eq r2590 0u32 into r2591; - is.eq r2590 1u32 into r2592; - is.eq r2590 2u32 into r2593; - ternary r2593 9222449791875588096u128 9221988703967300608u128 into r2594; - ternary r2592 9222910902837697536u128 r2594 into r2595; - ternary r2591 9223372036854775808u128 r2595 into r2596; - and r2589 4u32 into r2597; - is.neq r2597 0u32 into r2598; - mul r2596 9221527639111677952u128 into r2599; - shr r2599 63u8 into r2600; - ternary r2598 r2600 r2596 into r2601; - and r2589 8u32 into r2602; - is.neq r2602 0u32 into r2603; - mul r2601 9219683610192801792u128 into r2604; - shr r2604 63u8 into r2605; - ternary r2603 r2605 r2601 into r2606; - and r2589 16u32 into r2607; - is.neq r2607 0u32 into r2608; - mul r2606 9215996658532725760u128 into r2609; - shr r2609 63u8 into r2610; - ternary r2608 r2610 r2606 into r2611; - and r2589 32u32 into r2612; - is.neq r2612 0u32 into r2613; - mul r2611 9208627177859081216u128 into r2614; - shr r2614 63u8 into r2615; - ternary r2613 r2615 r2611 into r2616; - and r2589 64u32 into r2617; - is.neq r2617 0u32 into r2618; - mul r2616 9193905890596798464u128 into r2619; - shr r2619 63u8 into r2620; - ternary r2618 r2620 r2616 into r2621; - and r2589 128u32 into r2622; - is.neq r2622 0u32 into r2623; - mul r2621 9164533880601766912u128 into r2624; - shr r2624 63u8 into r2625; - ternary r2623 r2625 r2621 into r2626; - and r2589 256u32 into r2627; - is.neq r2627 0u32 into r2628; - mul r2626 9106071067403056128u128 into r2629; - shr r2629 63u8 into r2630; - ternary r2628 r2630 r2626 into r2631; - and r2589 512u32 into r2632; - is.neq r2632 0u32 into r2633; - mul r2631 8990261907820801024u128 into r2634; - shr r2634 63u8 into r2635; - ternary r2633 r2635 r2631 into r2636; - and r2589 1024u32 into r2637; - is.neq r2637 0u32 into r2638; - mul r2636 8763043369415622656u128 into r2639; - shr r2639 63u8 into r2640; - ternary r2638 r2640 r2636 into r2641; - and r2589 2048u32 into r2642; - is.neq r2642 0u32 into r2643; - mul r2641 8325689215117605888u128 into r2644; - shr r2644 63u8 into r2645; - ternary r2643 r2645 r2641 into r2646; - and r2589 4096u32 into r2647; - is.neq r2647 0u32 into r2648; - mul r2646 7515375139346884608u128 into r2649; - shr r2649 63u8 into r2650; - ternary r2648 r2650 r2646 into r2651; - and r2589 8192u32 into r2652; - is.neq r2652 0u32 into r2653; - mul r2651 6123667489441693696u128 into r2654; - shr r2654 63u8 into r2655; - ternary r2653 r2655 r2651 into r2656; - and r2589 16384u32 into r2657; - is.neq r2657 0u32 into r2658; - mul r2656 4065682634442729984u128 into r2659; - shr r2659 63u8 into r2660; - ternary r2658 r2660 r2656 into r2661; - and r2589 32768u32 into r2662; - is.neq r2662 0u32 into r2663; - mul r2661 1792161827361994496u128 into r2664; - shr r2664 63u8 into r2665; - ternary r2663 r2665 r2661 into r2666; - and r2589 65536u32 into r2667; - is.neq r2667 0u32 into r2668; - mul r2666 348228825923923264u128 into r2669; - shr r2669 63u8 into r2670; - ternary r2668 r2670 r2666 into r2671; - and r2589 131072u32 into r2672; - is.neq r2672 0u32 into r2673; - mul r2671 13147394978735516u128 into r2674; - shr r2674 63u8 into r2675; - ternary r2673 r2675 r2671 into r2676; - and r2589 262144u32 into r2677; - is.neq r2677 0u32 into r2678; - mul r2676 18740867660568u128 into r2679; - shr r2679 63u8 into r2680; - ternary r2678 r2680 r2676 into r2681; - and r2589 524288u32 into r2682; - is.neq r2682 0u32 into r2683; - mul r2681 38079361u128 into r2684; - shr r2684 63u8 into r2685; - ternary r2683 r2685 r2681 into r2686; - gt r2581 0i32 into r2687; - div 85070591730234615865843651857942052864u128 r2686 into r2688; - ternary r2687 r2688 r2686 into r2689; - gt r2689 r2191 into r2690; - sub r2581 1i32 into r2691; - ternary r2690 r2691 r2581 into r2692; - ternary r2328 r3.tk r2692 into r2693; - ternary r2280 r2327 r2693 into r2694; - ternary r0.z r2.prev r1 into r2695; - ternary r2280 r2695 r3.nb into r2696; - ternary r0.z r1 r2.next into r2697; - ternary r2280 r2697 r3.na into r2698; - cast r2191 r2203 r2204 r2276 r2325 r2694 r2280 r2199 r2696 r2698 r2263 into r2699 as SwapIterState; - output r2699 as SwapIterState.public; - output r2309 as Tick.public; - -function swap: - input r0 as dynamic.record; - input r1 as field.private; - input r2 as address.public; - input r3 as field.public; - input r4 as boolean.public; - input r5 as u128.public; - input r6 as u128.public; - input r7 as u128.public; - input r8 as u64.public; - input r9 as u32.public; - input r10 as field.public; - input r11 as field.public; - call verify_blinded_address shield_swap_v3.aleo self.signer r1 r2; - cast r3 r4 r5 r6 r7 r2 r8 r9 into r12 as SwapRequest; - cast r3 r4 r5 r7 r2 r8 r2 into r13 as SwapKey; - hash.bhp256 r13 into r14 as field; - ternary r4 r10 r11 into r15; - ternary r4 r11 r10 into r16; - cast aleo1t08epjqqv8h7jpuy2m2cxm80zy2pcy5c4f3m82hnac4sjmdrjyysvx3s2h r14 r15 r16 r12 self.caller r2 into r17 as SwapComplianceRecord.record; - call.dynamic r15 'aleo' 'transfer_private_to_public' with r0 shield_swap_v3.aleo r5 (as dynamic.record address.public u128.public) into r18 r19 (as dynamic.record dynamic.future); - async swap r19 r12 r10 r11 r14 r15 r16 r2 into r20; - output r14 as field.public; - output r18 as dynamic.record; - output r17 as SwapComplianceRecord.record; - output r20 as shield_swap_v3.aleo/swap.future; - -finalize swap: - input r0 as dynamic.future; - input r1 as SwapRequest.public; - input r2 as field.public; - input r3 as field.public; - input r4 as field.public; - input r5 as field.public; - input r6 as field.public; - input r7 as address.public; - await r0; - lte block.height r1.deadline into r8; - assert.eq r8 true; - get.or_use global_paused[true] false into r9; - not r9 into r10; - assert.eq r10 true; - get pools[r1.pool] into r11; - assert.eq r11.enabled true; - get.or_use token_paused[r11.token0] false into r12; - not r12 into r13; - assert.eq r13 true; - get.or_use token_paused[r11.token1] false into r14; - not r14 into r15; - assert.eq r15 true; - cast r11.token0 r11.token1 into r16 as PairKey; - get.or_use pair_paused[r16] false into r17; - not r17 into r18; - assert.eq r18 true; - is.eq r11.token0 r2 into r19; - assert.eq r19 true; - is.eq r11.token1 r3 into r20; - assert.eq r20 true; - get slots[r1.pool] into r21; - cast r11.fee into r22 as u32; - gte r1.sqrt_price_limit 19029805711u128 into r23; - lte r1.sqrt_price_limit 4470386772317930780047134862u128 into r24; - and r23 r24 into r25; - assert.eq r25 true; - lt r1.sqrt_price_limit r21.sqrt_price into r26; - gt r1.sqrt_price_limit r21.sqrt_price into r27; - ternary r1.zero_for_one r26 r27 into r28; - assert.eq r28 true; - gt r1.amount_in 0u128 into r29; - assert.eq r29 true; - ternary r1.zero_for_one r11.scale0 r11.scale1 into r30; - ternary r1.zero_for_one r11.scale1 r11.scale0 into r31; - rem r1.amount_in r30 into r32; - is.eq r32 0u128 into r33; - assert.eq r33 true; - div r1.amount_in r30 into r34; - ternary r1.zero_for_one r21.fee_growth_global0_x_64 r21.fee_growth_global1_x_64 into r35; - ternary r1.zero_for_one r21.fee_residual0_x_64 r21.fee_residual1_x_64 into r36; - cast r1.zero_for_one r1.sqrt_price_limit r22 r21.fee_protocol r21.fee_growth_global0_x_64 r21.fee_growth_global1_x_64 into r37 as SwapIterCfg; - ternary r1.zero_for_one r21.next_init_below r21.next_init_above into r38; - cast r1.pool r38 into r39 as TickKey; - hash.bhp256 r39 into r40 as field; - get ticks[r40] into r41; - cast r21.sqrt_price r34 0u128 r35 r21.liquidity r21.tick true 0u128 r21.next_init_below r21.next_init_above r36 into r42 as SwapIterState; - call view_swap_iteration r37 r38 r41 r42 into r43 r44; - cast r1.pool r38 into r45 as TickKey; - hash.bhp256 r45 into r46 as field; - set r44 into ticks[r46]; - ternary r1.zero_for_one r43.nb r43.na into r47; - cast r1.pool r47 into r48 as TickKey; - hash.bhp256 r48 into r49 as field; - get ticks[r49] into r50; - cast r43.sp r43.rem r43.out r43.fg r43.liq r43.tk r43.crossed r43.pf r43.nb r43.na r43.resid into r51 as SwapIterState; - call view_swap_iteration r37 r47 r50 r51 into r52 r53; - cast r1.pool r47 into r54 as TickKey; - hash.bhp256 r54 into r55 as field; - set r53 into ticks[r55]; - ternary r1.zero_for_one r52.nb r52.na into r56; - cast r1.pool r56 into r57 as TickKey; - hash.bhp256 r57 into r58 as field; - get ticks[r58] into r59; - cast r52.sp r52.rem r52.out r52.fg r52.liq r52.tk r52.crossed r52.pf r52.nb r52.na r52.resid into r60 as SwapIterState; - call view_swap_iteration r37 r56 r59 r60 into r61 r62; - cast r1.pool r56 into r63 as TickKey; - hash.bhp256 r63 into r64 as field; - set r62 into ticks[r64]; - ternary r1.zero_for_one r61.nb r61.na into r65; - cast r1.pool r65 into r66 as TickKey; - hash.bhp256 r66 into r67 as field; - get ticks[r67] into r68; - cast r61.sp r61.rem r61.out r61.fg r61.liq r61.tk r61.crossed r61.pf r61.nb r61.na r61.resid into r69 as SwapIterState; - call view_swap_iteration r37 r65 r68 r69 into r70 r71; - cast r1.pool r65 into r72 as TickKey; - hash.bhp256 r72 into r73 as field; - set r71 into ticks[r73]; - ternary r1.zero_for_one r70.nb r70.na into r74; - cast r1.pool r74 into r75 as TickKey; - hash.bhp256 r75 into r76 as field; - get ticks[r76] into r77; - cast r70.sp r70.rem r70.out r70.fg r70.liq r70.tk r70.crossed r70.pf r70.nb r70.na r70.resid into r78 as SwapIterState; - call view_swap_iteration r37 r74 r77 r78 into r79 r80; - cast r1.pool r74 into r81 as TickKey; - hash.bhp256 r81 into r82 as field; - set r80 into ticks[r82]; - mul r79.out r31 into r83; - mul r79.rem r30 into r84; - gte r83 r1.amount_out_min into r85; - assert.eq r85 true; - add r21.protocol_fees0 r79.pf into r86; - ternary r1.zero_for_one r86 r21.protocol_fees0 into r87; - add r21.protocol_fees1 r79.pf into r88; - ternary r1.zero_for_one r21.protocol_fees1 r88 into r89; - ternary r1.zero_for_one r79.fg r21.fee_growth_global0_x_64 into r90; - ternary r1.zero_for_one r21.fee_growth_global1_x_64 r79.fg into r91; - ternary r1.zero_for_one r79.resid r21.fee_residual0_x_64 into r92; - ternary r1.zero_for_one r21.fee_residual1_x_64 r79.resid into r93; - cast r79.tk r21.tick_spacing r79.sp r21.fee_protocol r79.liq r90 r91 r92 r93 r21.max_liquidity_per_tick r87 r89 r79.nb r79.na into r94 as Slot; - set r94 into slots[r1.pool]; - contains swap_outputs[r4] into r95; - not r95 into r96; - assert.eq r96 true; - cast r1.recipient r7 r5 r6 r83 r84 r5 0u128 r5 0u128 into r97 as SwapOutput; - set r97 into swap_outputs[r4]; - contains used_blinded_addresses[r7] into r98; - not r98 into r99; - assert.eq r99 true; - set true into used_blinded_addresses[r7]; - -function claim_swap_output: - input r0 as field.private; - input r1 as address.public; - input r2 as field.public; - input r3 as field.public; - input r4 as field.public; - input r5 as u128.public; - input r6 as u128.public; - call verify_blinded_address shield_swap_v3.aleo self.signer r0 r1; - call.dynamic r4 'aleo' 'transfer_public_to_private' with self.signer r5 (as address.private u128.public) into r7 r8 (as dynamic.record dynamic.future); - call.dynamic r3 'aleo' 'transfer_public_to_private' with self.signer r6 (as address.private u128.public) into r9 r10 (as dynamic.record dynamic.future); - async claim_swap_output r8 r10 r2 r3 r4 r5 r6 r1 into r11; - output r7 as dynamic.record; - output r9 as dynamic.record; - output r11 as shield_swap_v3.aleo/claim_swap_output.future; - -finalize claim_swap_output: - input r0 as dynamic.future; - input r1 as dynamic.future; - input r2 as field.public; - input r3 as field.public; - input r4 as field.public; - input r5 as u128.public; - input r6 as u128.public; - input r7 as address.public; - await r0; - await r1; - get swap_outputs[r2] into r8; - is.eq r8.caller r7 into r9; - assert.eq r9 true; - is.eq r8.recipient r7 into r10; - assert.eq r10 true; - is.eq r8.token_in r3 into r11; - assert.eq r11 true; - is.eq r8.token_out r4 into r12; - assert.eq r12 true; - is.eq r8.amount_out r5 into r13; - assert.eq r13 true; - is.eq r8.amount_remaining r6 into r14; - assert.eq r14 true; - is.eq r8.amount_remaining_1 0u128 into r15; - assert.eq r15 true; - is.eq r8.amount_remaining_2 0u128 into r16; - assert.eq r16 true; - remove swap_outputs[r2]; - -function swap_multi_hop: - input r0 as field.private; - input r1 as address.public; - input r2 as dynamic.record; - input r3 as field.public; - input r4 as field.public; - input r5 as u128.public; - input r6 as u128.public; - input r7 as SwapHop.public; - input r8 as SwapHop.public; - input r9 as SwapHop.public; - input r10 as u8.public; - input r11 as u64.public; - input r12 as u32.public; - call verify_blinded_address shield_swap_v3.aleo self.signer r0 r1; - cast r3 r4 r5 r6 r1 r7 r8 r9 r10 r11 r12 r1 into r13 as SwapMultiHopRequest; - hash.bhp256 r13 into r14 as field; - cast aleo1t08epjqqv8h7jpuy2m2cxm80zy2pcy5c4f3m82hnac4sjmdrjyysvx3s2h r14 r13 self.caller r1 into r15 as MultiHopSwapComplianceRecord.record; - call.dynamic r3 'aleo' 'transfer_private_to_public' with r2 shield_swap_v3.aleo r5 (as dynamic.record address.public u128.public) into r16 r17 (as dynamic.record dynamic.future); - async swap_multi_hop r17 r13 r14 into r18; - output r14 as field.public; - output r16 as dynamic.record; - output r15 as MultiHopSwapComplianceRecord.record; - output r18 as shield_swap_v3.aleo/swap_multi_hop.future; - -finalize swap_multi_hop: - input r0 as dynamic.future; - input r1 as SwapMultiHopRequest.public; - input r2 as field.public; - await r0; - lte block.height r1.deadline into r3; - assert.eq r3 true; - gte r1.hop_count 2u8 into r4; - lte r1.hop_count 3u8 into r5; - and r4 r5 into r6; - assert.eq r6 true; - gt r1.amount_in 0u128 into r7; - assert.eq r7 true; - get.or_use global_paused[true] false into r8; - not r8 into r9; - assert.eq r9 true; - get pools[r1.hop0.pool] into r10; - assert.eq r10.enabled true; - get.or_use token_paused[r10.token0] false into r11; - not r11 into r12; - assert.eq r12 true; - get.or_use token_paused[r10.token1] false into r13; - not r13 into r14; - assert.eq r14 true; - cast r10.token0 r10.token1 into r15 as PairKey; - get.or_use pair_paused[r15] false into r16; - not r16 into r17; - assert.eq r17 true; - ternary r1.hop0.zero_for_one r10.token0 r10.token1 into r18; - ternary r1.hop0.zero_for_one r10.token1 r10.token0 into r19; - is.eq r18 r1.token_in into r20; - assert.eq r20 true; - get slots[r1.hop0.pool] into r21; - cast r10.fee into r22 as u32; - gte r1.hop0.sqrt_price_limit 19029805711u128 into r23; - lte r1.hop0.sqrt_price_limit 4470386772317930780047134862u128 into r24; - and r23 r24 into r25; - assert.eq r25 true; - lt r1.hop0.sqrt_price_limit r21.sqrt_price into r26; - gt r1.hop0.sqrt_price_limit r21.sqrt_price into r27; - ternary r1.hop0.zero_for_one r26 r27 into r28; - assert.eq r28 true; - ternary r1.hop0.zero_for_one r10.scale0 r10.scale1 into r29; - rem r1.amount_in r29 into r30; - is.eq r30 0u128 into r31; - assert.eq r31 true; - div r1.amount_in r29 into r32; - ternary r1.hop0.zero_for_one r21.fee_growth_global0_x_64 r21.fee_growth_global1_x_64 into r33; - ternary r1.hop0.zero_for_one r21.fee_residual0_x_64 r21.fee_residual1_x_64 into r34; - cast r1.hop0.zero_for_one r1.hop0.sqrt_price_limit r22 r21.fee_protocol r21.fee_growth_global0_x_64 r21.fee_growth_global1_x_64 into r35 as SwapIterCfg; - ternary r1.hop0.zero_for_one r21.next_init_below r21.next_init_above into r36; - cast r1.hop0.pool r36 into r37 as TickKey; - hash.bhp256 r37 into r38 as field; - get ticks[r38] into r39; - cast r21.sqrt_price r32 0u128 r33 r21.liquidity r21.tick true 0u128 r21.next_init_below r21.next_init_above r34 into r40 as SwapIterState; - call view_swap_iteration r35 r36 r39 r40 into r41 r42; - cast r1.hop0.pool r36 into r43 as TickKey; - hash.bhp256 r43 into r44 as field; - set r42 into ticks[r44]; - ternary r1.hop0.zero_for_one r41.nb r41.na into r45; - cast r1.hop0.pool r45 into r46 as TickKey; - hash.bhp256 r46 into r47 as field; - get ticks[r47] into r48; - cast r41.sp r41.rem r41.out r41.fg r41.liq r41.tk r41.crossed r41.pf r41.nb r41.na r41.resid into r49 as SwapIterState; - call view_swap_iteration r35 r45 r48 r49 into r50 r51; - cast r1.hop0.pool r45 into r52 as TickKey; - hash.bhp256 r52 into r53 as field; - set r51 into ticks[r53]; - ternary r1.hop0.zero_for_one r50.nb r50.na into r54; - cast r1.hop0.pool r54 into r55 as TickKey; - hash.bhp256 r55 into r56 as field; - get ticks[r56] into r57; - cast r50.sp r50.rem r50.out r50.fg r50.liq r50.tk r50.crossed r50.pf r50.nb r50.na r50.resid into r58 as SwapIterState; - call view_swap_iteration r35 r54 r57 r58 into r59 r60; - cast r1.hop0.pool r54 into r61 as TickKey; - hash.bhp256 r61 into r62 as field; - set r60 into ticks[r62]; - add r21.protocol_fees0 r59.pf into r63; - ternary r1.hop0.zero_for_one r63 r21.protocol_fees0 into r64; - add r21.protocol_fees1 r59.pf into r65; - ternary r1.hop0.zero_for_one r21.protocol_fees1 r65 into r66; - ternary r1.hop0.zero_for_one r59.fg r21.fee_growth_global0_x_64 into r67; - ternary r1.hop0.zero_for_one r21.fee_growth_global1_x_64 r59.fg into r68; - ternary r1.hop0.zero_for_one r59.resid r21.fee_residual0_x_64 into r69; - ternary r1.hop0.zero_for_one r21.fee_residual1_x_64 r59.resid into r70; - cast r59.tk r21.tick_spacing r59.sp r21.fee_protocol r59.liq r67 r68 r69 r70 r21.max_liquidity_per_tick r64 r66 r59.nb r59.na into r71 as Slot; - set r71 into slots[r1.hop0.pool]; - get pools[r1.hop1.pool] into r72; - assert.eq r72.enabled true; - get.or_use token_paused[r72.token0] false into r73; - not r73 into r74; - assert.eq r74 true; - get.or_use token_paused[r72.token1] false into r75; - not r75 into r76; - assert.eq r76 true; - cast r72.token0 r72.token1 into r77 as PairKey; - get.or_use pair_paused[r77] false into r78; - not r78 into r79; - assert.eq r79 true; - ternary r1.hop1.zero_for_one r72.token0 r72.token1 into r80; - ternary r1.hop1.zero_for_one r72.token1 r72.token0 into r81; - is.eq r80 r19 into r82; - assert.eq r82 true; - get slots[r1.hop1.pool] into r83; - cast r72.fee into r84 as u32; - gte r1.hop1.sqrt_price_limit 19029805711u128 into r85; - lte r1.hop1.sqrt_price_limit 4470386772317930780047134862u128 into r86; - and r85 r86 into r87; - assert.eq r87 true; - lt r1.hop1.sqrt_price_limit r83.sqrt_price into r88; - gt r1.hop1.sqrt_price_limit r83.sqrt_price into r89; - ternary r1.hop1.zero_for_one r88 r89 into r90; - assert.eq r90 true; - ternary r1.hop1.zero_for_one r83.fee_growth_global0_x_64 r83.fee_growth_global1_x_64 into r91; - ternary r1.hop1.zero_for_one r83.fee_residual0_x_64 r83.fee_residual1_x_64 into r92; - cast r1.hop1.zero_for_one r1.hop1.sqrt_price_limit r84 r83.fee_protocol r83.fee_growth_global0_x_64 r83.fee_growth_global1_x_64 into r93 as SwapIterCfg; - ternary r1.hop1.zero_for_one r83.next_init_below r83.next_init_above into r94; - cast r1.hop1.pool r94 into r95 as TickKey; - hash.bhp256 r95 into r96 as field; - get ticks[r96] into r97; - cast r83.sqrt_price r59.out 0u128 r91 r83.liquidity r83.tick true 0u128 r83.next_init_below r83.next_init_above r92 into r98 as SwapIterState; - call view_swap_iteration r93 r94 r97 r98 into r99 r100; - cast r1.hop1.pool r94 into r101 as TickKey; - hash.bhp256 r101 into r102 as field; - set r100 into ticks[r102]; - ternary r1.hop1.zero_for_one r99.nb r99.na into r103; - cast r1.hop1.pool r103 into r104 as TickKey; - hash.bhp256 r104 into r105 as field; - get ticks[r105] into r106; - cast r99.sp r99.rem r99.out r99.fg r99.liq r99.tk r99.crossed r99.pf r99.nb r99.na r99.resid into r107 as SwapIterState; - call view_swap_iteration r93 r103 r106 r107 into r108 r109; - cast r1.hop1.pool r103 into r110 as TickKey; - hash.bhp256 r110 into r111 as field; - set r109 into ticks[r111]; - ternary r1.hop1.zero_for_one r108.nb r108.na into r112; - cast r1.hop1.pool r112 into r113 as TickKey; - hash.bhp256 r113 into r114 as field; - get ticks[r114] into r115; - cast r108.sp r108.rem r108.out r108.fg r108.liq r108.tk r108.crossed r108.pf r108.nb r108.na r108.resid into r116 as SwapIterState; - call view_swap_iteration r93 r112 r115 r116 into r117 r118; - cast r1.hop1.pool r112 into r119 as TickKey; - hash.bhp256 r119 into r120 as field; - set r118 into ticks[r120]; - add r83.protocol_fees0 r117.pf into r121; - ternary r1.hop1.zero_for_one r121 r83.protocol_fees0 into r122; - add r83.protocol_fees1 r117.pf into r123; - ternary r1.hop1.zero_for_one r83.protocol_fees1 r123 into r124; - ternary r1.hop1.zero_for_one r117.fg r83.fee_growth_global0_x_64 into r125; - ternary r1.hop1.zero_for_one r83.fee_growth_global1_x_64 r117.fg into r126; - ternary r1.hop1.zero_for_one r117.resid r83.fee_residual0_x_64 into r127; - ternary r1.hop1.zero_for_one r83.fee_residual1_x_64 r117.resid into r128; - cast r117.tk r83.tick_spacing r117.sp r83.fee_protocol r117.liq r125 r126 r127 r128 r83.max_liquidity_per_tick r122 r124 r117.nb r117.na into r129 as Slot; - set r129 into slots[r1.hop1.pool]; - is.eq r1.hop_count 3u8 into r130; - cast 0field 0field 0u16 false 1u128 1u128 into r131 as PoolState; - get.or_use pools[r1.hop2.pool] r131 into r132; - branch.eq r130 false to end_then_0_0; - assert.eq r132.enabled true; - get.or_use token_paused[r132.token0] false into r133; - not r133 into r134; - assert.eq r134 true; - get.or_use token_paused[r132.token1] false into r135; - not r135 into r136; - assert.eq r136 true; - cast r132.token0 r132.token1 into r137 as PairKey; - get.or_use pair_paused[r137] false into r138; - not r138 into r139; - assert.eq r139 true; - branch.eq true true to end_otherwise_0_1; - position end_then_0_0; - position end_otherwise_0_1; - ternary r1.hop2.zero_for_one r132.token0 r132.token1 into r140; - ternary r1.hop2.zero_for_one r132.token1 r132.token0 into r141; - not r130 into r142; - is.eq r140 r81 into r143; - or r142 r143 into r144; - assert.eq r144 true; - ternary r130 r141 r81 into r145; - is.eq r145 r1.token_out into r146; - assert.eq r146 true; - cast 0i32 1u32 9223372036854775808u128 0u8 0u128 0u128 0u128 0u128 0u128 0u128 0u128 0u128 0i32 0i32 into r147 as Slot; - get.or_use slots[r1.hop2.pool] r147 into r148; - cast r132.fee into r149 as u32; - gte r1.hop2.sqrt_price_limit 19029805711u128 into r150; - lte r1.hop2.sqrt_price_limit 4470386772317930780047134862u128 into r151; - and r150 r151 into r152; - or r142 r152 into r153; - assert.eq r153 true; - lt r1.hop2.sqrt_price_limit r148.sqrt_price into r154; - gt r1.hop2.sqrt_price_limit r148.sqrt_price into r155; - ternary r1.hop2.zero_for_one r154 r155 into r156; - or r142 r156 into r157; - assert.eq r157 true; - ternary r1.hop2.zero_for_one r148.fee_growth_global0_x_64 r148.fee_growth_global1_x_64 into r158; - ternary r1.hop2.zero_for_one r148.fee_residual0_x_64 r148.fee_residual1_x_64 into r159; - cast r1.hop2.zero_for_one r1.hop2.sqrt_price_limit r149 r148.fee_protocol r148.fee_growth_global0_x_64 r148.fee_growth_global1_x_64 into r160 as SwapIterCfg; - ternary r1.hop2.zero_for_one r148.next_init_below r148.next_init_above into r161; - cast r1.hop2.pool 0i128 0u128 r161 0u128 0u128 r161 r161 into r162 as Tick; - cast r1.hop2.pool r161 into r163 as TickKey; - hash.bhp256 r163 into r164 as field; - get.or_use ticks[r164] r162 into r165; - cast r148.sqrt_price r117.out 0u128 r158 r148.liquidity r148.tick r130 0u128 r148.next_init_below r148.next_init_above r159 into r166 as SwapIterState; - call view_swap_iteration r160 r161 r165 r166 into r167 r168; - branch.eq r130 false to end_then_0_2; - cast r1.hop2.pool r161 into r169 as TickKey; - hash.bhp256 r169 into r170 as field; - set r168 into ticks[r170]; - branch.eq true true to end_otherwise_0_3; - position end_then_0_2; - position end_otherwise_0_3; - ternary r1.hop2.zero_for_one r167.nb r167.na into r171; - cast r1.hop2.pool 0i128 0u128 r171 0u128 0u128 r171 r171 into r172 as Tick; - cast r1.hop2.pool r171 into r173 as TickKey; - hash.bhp256 r173 into r174 as field; - get.or_use ticks[r174] r172 into r175; - cast r167.sp r167.rem r167.out r167.fg r167.liq r167.tk r167.crossed r167.pf r167.nb r167.na r167.resid into r176 as SwapIterState; - call view_swap_iteration r160 r171 r175 r176 into r177 r178; - branch.eq r130 false to end_then_0_4; - cast r1.hop2.pool r171 into r179 as TickKey; - hash.bhp256 r179 into r180 as field; - set r178 into ticks[r180]; - branch.eq true true to end_otherwise_0_5; - position end_then_0_4; - position end_otherwise_0_5; - ternary r1.hop2.zero_for_one r177.nb r177.na into r181; - cast r1.hop2.pool 0i128 0u128 r181 0u128 0u128 r181 r181 into r182 as Tick; - cast r1.hop2.pool r181 into r183 as TickKey; - hash.bhp256 r183 into r184 as field; - get.or_use ticks[r184] r182 into r185; - cast r177.sp r177.rem r177.out r177.fg r177.liq r177.tk r177.crossed r177.pf r177.nb r177.na r177.resid into r186 as SwapIterState; - call view_swap_iteration r160 r181 r185 r186 into r187 r188; - branch.eq r130 false to end_then_0_6; - cast r1.hop2.pool r181 into r189 as TickKey; - hash.bhp256 r189 into r190 as field; - set r188 into ticks[r190]; - branch.eq true true to end_otherwise_0_7; - position end_then_0_6; - position end_otherwise_0_7; - add r148.protocol_fees0 r187.pf into r191; - ternary r1.hop2.zero_for_one r191 r148.protocol_fees0 into r192; - add r148.protocol_fees1 r187.pf into r193; - ternary r1.hop2.zero_for_one r148.protocol_fees1 r193 into r194; - branch.eq r130 false to end_then_0_8; - ternary r1.hop2.zero_for_one r187.fg r148.fee_growth_global0_x_64 into r195; - ternary r1.hop2.zero_for_one r148.fee_growth_global1_x_64 r187.fg into r196; - ternary r1.hop2.zero_for_one r187.resid r148.fee_residual0_x_64 into r197; - ternary r1.hop2.zero_for_one r148.fee_residual1_x_64 r187.resid into r198; - cast r187.tk r148.tick_spacing r187.sp r148.fee_protocol r187.liq r195 r196 r197 r198 r148.max_liquidity_per_tick r192 r194 r187.nb r187.na into r199 as Slot; - set r199 into slots[r1.hop2.pool]; - branch.eq true true to end_otherwise_0_9; - position end_then_0_8; - position end_otherwise_0_9; - ternary r1.hop1.zero_for_one r72.scale0 r72.scale1 into r200; - ternary r1.hop2.zero_for_one r132.scale0 r132.scale1 into r201; - ternary r1.hop2.zero_for_one r132.scale1 r132.scale0 into r202; - ternary r1.hop1.zero_for_one r72.scale1 r72.scale0 into r203; - ternary r130 r202 r203 into r204; - ternary r130 r187.out r117.out into r205; - mul r205 r204 into r206; - gte r206 r1.amount_out_min into r207; - assert.eq r207 true; - contains swap_outputs[r2] into r208; - not r208 into r209; - assert.eq r209 true; - ternary r130 r140 r80 into r210; - mul r59.rem r29 into r211; - mul r117.rem r200 into r212; - mul r187.rem r201 into r213; - ternary r130 r213 0u128 into r214; - cast r1.recipient r1.caller r18 r1.token_out r206 r211 r80 r212 r210 r214 into r215 as SwapOutput; - set r215 into swap_outputs[r2]; - contains used_blinded_addresses[r1.caller] into r216; - not r216 into r217; - assert.eq r217 true; - set true into used_blinded_addresses[r1.caller]; - -function claim_multi_hop_output: - input r0 as field.private; - input r1 as address.public; - input r2 as field.public; - input r3 as field.public; - input r4 as field.public; - input r5 as u128.public; - input r6 as u128.public; - input r7 as field.public; - input r8 as u128.public; - input r9 as field.public; - input r10 as u128.public; - call verify_blinded_address shield_swap_v3.aleo self.signer r0 r1; - call.dynamic r4 'aleo' 'transfer_public_to_private' with self.signer r5 (as address.private u128.public) into r11 r12 (as dynamic.record dynamic.future); - call.dynamic r3 'aleo' 'transfer_public_to_private' with self.signer r6 (as address.private u128.public) into r13 r14 (as dynamic.record dynamic.future); - call.dynamic r7 'aleo' 'transfer_public_to_private' with self.signer r8 (as address.private u128.public) into r15 r16 (as dynamic.record dynamic.future); - call.dynamic r9 'aleo' 'transfer_public_to_private' with self.signer r10 (as address.private u128.public) into r17 r18 (as dynamic.record dynamic.future); - async claim_multi_hop_output r12 r14 r16 r18 r2 r3 r4 r5 r6 r7 r8 r9 r10 r1 into r19; - output r11 as dynamic.record; - output r13 as dynamic.record; - output r15 as dynamic.record; - output r17 as dynamic.record; - output r19 as shield_swap_v3.aleo/claim_multi_hop_output.future; - -finalize claim_multi_hop_output: - input r0 as dynamic.future; - input r1 as dynamic.future; - input r2 as dynamic.future; - input r3 as dynamic.future; - input r4 as field.public; - input r5 as field.public; - input r6 as field.public; - input r7 as u128.public; - input r8 as u128.public; - input r9 as field.public; - input r10 as u128.public; - input r11 as field.public; - input r12 as u128.public; - input r13 as address.public; - await r0; - await r1; - await r2; - await r3; - get swap_outputs[r4] into r14; - is.eq r14.caller r13 into r15; - assert.eq r15 true; - is.eq r14.recipient r13 into r16; - assert.eq r16 true; - is.eq r14.token_in r5 into r17; - assert.eq r17 true; - is.eq r14.token_out r6 into r18; - assert.eq r18 true; - is.eq r14.amount_out r7 into r19; - assert.eq r19 true; - is.eq r14.amount_remaining r8 into r20; - assert.eq r20 true; - is.eq r14.token_in_1 r9 into r21; - assert.eq r21 true; - is.eq r14.amount_remaining_1 r10 into r22; - assert.eq r22 true; - is.eq r14.token_in_2 r11 into r23; - assert.eq r23 true; - is.eq r14.amount_remaining_2 r12 into r24; - assert.eq r24 true; - remove swap_outputs[r4]; - -constructor: - is.eq edition 0u16 into r0; - branch.eq r0 false to end_then_0_0; - contains admin[true] into r1; - not r1 into r2; - assert.eq r2 true; - set aleo1z3zwzgpgakk89xpknync5rtklkjkyv33g7cvaqe0gku64zs3lv9qyux0qc into admin[true]; - set false into pool_creation_is_open[true]; - set false into global_paused[true]; - branch.eq true true to end_otherwise_0_1; - position end_then_0_0; - position end_otherwise_0_1; - gt edition 0u16 into r3; - branch.eq r3 false to end_then_0_2; - cast checksum edition into r4 as ChecksumEdition; - hash.bhp256 r4 into r5 as field; - cast shield_swap_v3.aleo r5 into r6 as test_shield_swap_multisig_core.aleo/WalletSigningOpId; - hash.bhp256 r6 into r7 as field; - contains test_shield_swap_multisig_core.aleo/completed_signing_ops[r7] into r8; - assert.eq r8 true; - branch.eq true true to end_otherwise_0_3; - position end_then_0_2; - position end_otherwise_0_3; - diff --git a/shield-swap-sdk/tests/integration/devnode_amm.py b/shield-swap-sdk/tests/integration/devnode_amm.py index d9917709..e2171fb7 100644 --- a/shield-swap-sdk/tests/integration/devnode_amm.py +++ b/shield-swap-sdk/tests/integration/devnode_amm.py @@ -3,8 +3,11 @@ Python port of the TS suite's ``devnodeAmm.ts``: boots ``aleo-devnode``, advances past the last TEST consensus-version height (the devnode's snarkVM uses the test schedule — V17 from height 20), deploys the vendored AMM + -multisig import and two locally-compiled ARC-20 test tokens, runs the admin -configuration, and funds a non-admin user. Fully hermetic — no live network. +its multisig/freezelist imports and two locally-compiled ARC-20 test +tokens, initializes the freezelist, runs the admin configuration, and funds +a non-admin user. Fully hermetic — no live network. Plain/plain flows +only: the wrapper programs (and their underlying stablecoins) are not +deployed here — wrapped routing is covered by the live tier. Two execution ladders (see the suite docstring): @@ -34,11 +37,15 @@ FIXTURES = Path(__file__).parents[1] / "fixtures" / "programs" -AMM_PROGRAM = "shield_swap_v3.aleo" -MULTISIG_PROGRAM = "test_shield_swap_multisig_core.aleo" +AMM_PROGRAM = "shield_swap.aleo" +MULTISIG_PROGRAM = "shield_swap_multisig_core.aleo" +FREEZELIST_PROGRAM = "shield_swap_freezelist.aleo" TOKEN_A = "test_token_a.aleo" TOKEN_B = "test_token_b.aleo" +# Grace window (blocks) for accepting the previous freezelist root. +FREEZELIST_WINDOW = 100 + # One million tokens at 6 decimals — the per-user provisioning amount. TOKEN_SUPPLY = 1_000_000_000_000 @@ -64,13 +71,13 @@ def read_fixture(file_name: str) -> str: def patch_admin_address(source: str, admin_address: str) -> str: - """Rewrites the baked deployer/admin address in the AMM source to - *admin_address* — the constructor promotes that literal to the ``admin`` - mapping at edition 0.""" + """Rewrites the baked deployer/admin address to *admin_address* — + EVERY occurrence, not just the constructor's: the freezelist bakes the + same literal into its ``initialize`` finalize (caller gate).""" constructor = source[source.index("constructor:"):] baked = re.search(r"aleo1[a-z0-9]{58}", constructor) if not baked: - raise RuntimeError("No admin address literal found in the AMM constructor") + raise RuntimeError("No admin address literal found in the constructor") return source.replace(baked.group(0), admin_address) @@ -216,6 +223,8 @@ def setup_amm_devnode() -> AmmDevnode: devnode.advance(LAST_TEST_CONSENSUS_HEIGHT + 2) multisig_source = read_fixture(MULTISIG_PROGRAM) + freezelist_source = patch_admin_address(read_fixture(FREEZELIST_PROGRAM), + str(admin.address)) amm_source = patch_admin_address(read_fixture(AMM_PROGRAM), str(admin.address)) token_a_source = read_fixture(f"{TOKEN_A.removesuffix('.aleo')}.aleo") token_b_source = read_fixture(f"{TOKEN_B.removesuffix('.aleo')}.aleo") @@ -223,6 +232,7 @@ def setup_amm_devnode() -> AmmDevnode: imports = { MULTISIG_PROGRAM: multisig_source, + FREEZELIST_PROGRAM: freezelist_source, AMM_PROGRAM: amm_source, TOKEN_A: token_a_source, TOKEN_B: token_b_source, @@ -241,13 +251,23 @@ def setup_amm_devnode() -> AmmDevnode: token1_program=TOKEN_B if a_first else TOKEN_A, ) - # Deploy in dependency order; the AMM statically imports the multisig. + # Deploy in dependency order; the AMM statically imports the multisig + # and the freezelist. ctx.deploy_program(multisig_source, MULTISIG_PROGRAM) + ctx.deploy_program(freezelist_source, FREEZELIST_PROGRAM) ctx.deploy_program(amm_source, AMM_PROGRAM) ctx.deploy_program(token_a_source, TOKEN_A) ctx.deploy_program(token_b_source, TOKEN_B) + # Freezelist bootstrap: initialize (empty tree + manager role) BEFORE + # any mint / claim / collect — their finalize reads the root. + ctx.execute(admin, FREEZELIST_PROGRAM, "initialize", + [str(admin.address), f"{FREEZELIST_WINDOW}u32"], + "freezelist initialize") + # Admin configuration: fee tiers, spacings, bindings, token registration. + # allow_token is one-time and takes (token_id, underlying_token_id) — + # plain ARC-20s register as (t, t) with no wrapper mapping entry. for label, function, inputs in [ ("add_fee_tier 3000", "add_fee_tier", ["3000u16"]), ("add_fee_tier 500", "add_fee_tier", ["500u16"]), @@ -255,12 +275,12 @@ def setup_amm_devnode() -> AmmDevnode: ("add_tick_spacing 10", "add_tick_spacing", ["10u32"]), ("bind 3000->60", "bind_fee_to_tick_spacing", ["3000u16", "60u32"]), ("bind 500->10", "bind_fee_to_tick_spacing", ["500u16", "10u32"]), - ("decimals A", "set_token_decimals", [a_field, "6u8"]), - ("decimals B", "set_token_decimals", [b_field, "6u8"]), - ("allow A", "allow_token", [a_field]), - ("allow B", "allow_token", [b_field]), + ("allow A", "allow_token", [a_field, a_field]), + ("allow B", "allow_token", [b_field, b_field]), ("open pool creation", "set_pool_creation_is_open", ["true"]), ]: + if function == "allow_token" and ctx.read_mapping("token_allowed", inputs[0]): + continue # one-time registration — skip completed rows ctx.execute(admin, AMM_PROGRAM, function, inputs, f"admin {label}") # A non-admin user proves the open-pool-creation gate: fund fees, mint diff --git a/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py b/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py index 7af1b52e..b1228604 100644 --- a/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py +++ b/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py @@ -68,12 +68,14 @@ def test_full_lifecycle_from_fresh_profile(tmp_path, monkeypatch): # Pick a pool whose tokens we actually hold (the conversation pattern). pool = next(p for p in pools if p.token0 in held or p.token1 in held) token_in = pool.token0 if pool.token0 in held else pool.token1 - state = dex.get_pool(pool.key) - scale_in = state.scale0 if token_in == pool.token0 else state.scale1 + # Raw native units (the AMM no longer scales): ~1e-5 of a token. + d0 = pool.token0_info.decimals if pool.token0_info else 9 + d1 = pool.token1_info.decimals if pool.token1_info else 9 + dec_in = d0 if token_in == pool.token0 else d1 # ── Swaps: concurrent counters, journaled handles ─────────────────────── batch = dex.swap_many(pool_key=pool.key, token_in_id=token_in, - amount_in=10**4 * int(scale_in), count=2) + amount_in=10 ** max(dec_in - 5, 1), count=2) assert len(batch.handles) == 2, f"swap failures: {batch.failures}" assert len({h.blinded_address for h in batch.handles}) == 2 @@ -89,7 +91,8 @@ def test_full_lifecycle_from_fresh_profile(tmp_path, monkeypatch): # ── Liquidity: mint, resize, collect the owed earnings ───────────────── lo, hi = dex.get_slot(pool.key).tick_range(width=4) - scale0, scale1 = int(state.scale0), int(state.scale1) + # ~1e-7 of each token, raw native units. + amt0, amt1 = 10 ** max(d0 - 7, 1), 10 ** max(d1 - 7, 1) # Right after claims, the scanner can still serve just-spent records; a # mint built on one is silently dropped. Model the careful client: @@ -98,8 +101,8 @@ def test_full_lifecycle_from_fresh_profile(tmp_path, monkeypatch): for attempt in range(3): try: minted = dex.mint(pool_key=pool.key, tick_lower=lo, tick_upper=hi, - amount0_desired=100 * scale0, - amount1_desired=100 * scale1).delegate() + amount0_desired=amt0, + amount1_desired=amt1).delegate() break except Exception: if attempt == 2: diff --git a/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py b/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py index 95bb6ea3..57295658 100644 --- a/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py +++ b/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py @@ -27,7 +27,7 @@ from aleo_shield_swap import ShieldSwap from aleo_shield_swap.errors import SwapOutputNotFinalizedError -from aleo_shield_swap.tick_math import MIN_TICK +from aleo_shield_swap.tick_math import MIN_TICK, u256_to_int from .devnode_amm import AMM_PROGRAM, AmmDevnode, setup_amm_devnode @@ -135,11 +135,20 @@ def test_admin_setup_landed(ctx): assert ctx.read_mapping("tick_spacings", "60u32") == "true" assert ctx.read_mapping("fee_to_tick_spacing", "500u16") == "10u32" assert ctx.read_mapping("token_allowed", ctx.token0_field) == "true" - assert ctx.read_mapping("token_decimals", ctx.token1_field) == "6u8" + # Plain tokens register as (t, t) and get NO wrapper mapping entry. + assert ctx.read_mapping("from_wrapper_token_id", ctx.token0_field) is None assert ctx.read_mapping("pool_creation_is_open", "true") == "true" assert ctx.read_mapping("admin", "true") == str(ctx.admin.address) +def test_freezelist_initialized(ctx): + from aleo_shield_swap._core import normalize_mapping_value + raw = ctx.aleo.programs.get("shield_swap_freezelist.aleo") \ + .mapping("freeze_list_root").get("1u8") + assert normalize_mapping_value(raw) is not None, \ + "freezelist root missing — mint/claim/collect finalize would abort" + + def test_non_admin_creates_two_pools(ctx, dex, journey): for pool_case in journey.pools: call = dex.create_pool( @@ -265,10 +274,12 @@ def test_swaps_both_directions_and_claims(ctx, dex, journey): dex.get_swap_output(handle) # the claim consumed the entry slot_after = dex.get_slot(pool_case["pool_key"]) + sp_after = u256_to_int(slot_after.raw.sqrt_price) + sp_before = u256_to_int(slot_before.raw.sqrt_price) if zero_for_one: - assert slot_after.sqrt_price < slot_before.sqrt_price + assert sp_after < sp_before else: - assert slot_after.sqrt_price > slot_before.sqrt_price + assert sp_after > sp_before def test_collect_pays_out_owed(ctx, dex, journey): @@ -298,6 +309,46 @@ def test_collect_pays_out_owed(ctx, dex, journey): assert paid_out > 0 +def test_collect_pays_immutable_withdrawal(ctx, dex, journey): + """owner != withdrawal: the collect payout lands with the withdrawal + address (the admin here), while the NFT stays with the owner (user).""" + pool_case = journey.pools[0] + spacing = pool_case["tick_spacing"] + record0 = ctx.privatize_token(ctx.user, ctx.token0_program, 50_000_000) + record1 = ctx.privatize_token(ctx.user, ctx.token1_program, 50_000_000) + result = _submit(ctx, dex.mint( + pool_key=pool_case["pool_key"], + tick_lower=-5 * spacing, tick_upper=5 * spacing, + amount0_desired=20_000_000, amount1_desired=20_000_000, + token0_record=record0, token1_record=record1, + withdrawal=str(ctx.admin.address), + imports=ctx.imports, account=ctx.user), ctx.user) + nft = next(r for r in ctx.records_of(ctx.user, result.transaction_id) + if "tick_lower" in r) + assert str(ctx.admin.address) in nft # withdrawal baked into the NFT + + result = _submit(ctx, dex.decrease_liquidity( + pool_key=pool_case["pool_key"], liquidity_to_remove=1_000, + position_record=nft, imports=ctx.imports, account=ctx.user), ctx.user) + nft = next(r for r in ctx.records_of(ctx.user, result.transaction_id) + if "tick_lower" in r) + owed = ctx.read_mapping("positions", result.position_token_id) + m0 = re.search(r"tokens_owed0:\s*(\d+)u128", owed) + m1 = re.search(r"tokens_owed1:\s*(\d+)u128", owed) + + result = _submit(ctx, dex.collect( + pool_key=pool_case["pool_key"], + amount0_requested=int(m0.group(1)), amount1_requested=int(m1.group(1)), + position_record=nft, imports=ctx.imports, account=ctx.user), ctx.user) + # The payout Token records belong to the WITHDRAWAL address, not the owner. + admin_records = ctx.records_of(ctx.admin, result.transaction_id) + assert any("amount:" in r for r in admin_records), \ + "collect payout did not land with the withdrawal address" + user_token_records = [r for r in ctx.records_of(ctx.user, result.transaction_id) + if "amount:" in r and "tick_lower" not in r] + assert not user_token_records, "owner received the payout despite withdrawal" + + def test_burn_exits_positions(ctx, dex, journey): for pool_case in journey.pools: remaining = _position(ctx, pool_case) diff --git a/shield-swap-sdk/tests/integration/test_drift.py b/shield-swap-sdk/tests/integration/test_drift.py index 6aa59f6a..e3457fa6 100644 --- a/shield-swap-sdk/tests/integration/test_drift.py +++ b/shield-swap-sdk/tests/integration/test_drift.py @@ -10,7 +10,7 @@ pytestmark = pytest.mark.live ABI_PATH = Path(__file__).parents[2] / "codegen" / "shield_swap.abi.json" -PROGRAM = "shield_swap_v3.aleo" +PROGRAM = "shield_swap.aleo" def _fetch(program_id: str) -> str: @@ -21,15 +21,23 @@ def _fetch(program_id: str) -> str: return r.json() +def _load_deps(program_id: str, seen: dict) -> None: + """Post-order DFS: dependencies land in *seen* before their dependents + (the freezelist itself imports the multisig).""" + src = _fetch(program_id) + for dep in re.findall(r"^import\s+(\S+?);\s*$", src, re.MULTILINE): + if dep not in seen and dep != "credits.aleo": + _load_deps(dep, seen) + seen[program_id] = src + + def test_pinned_abi_matches_deployed(): import aleo.abi - src = _fetch(PROGRAM) - deps = [] - for dep in re.findall(r"^import\s+(\S+?);\s*$", src, re.MULTILINE): - if dep != "credits.aleo": - deps.append((dep, _fetch(dep))) - live = aleo.abi.generate_abi(src, "testnet", imports=deps) + seen: dict = {} + _load_deps(PROGRAM, seen) + src = seen.pop(PROGRAM) + live = aleo.abi.generate_abi(src, "testnet", imports=list(seen.items())) violations = aleo.abi.check_compatibility(live, json.loads(ABI_PATH.read_text())) assert violations == [], ( f"deployed {PROGRAM} drifted from the pinned ABI — rerun " diff --git a/shield-swap-sdk/tests/integration/test_reads_live.py b/shield-swap-sdk/tests/integration/test_reads_live.py index 35bab5b0..88c1eb97 100644 --- a/shield-swap-sdk/tests/integration/test_reads_live.py +++ b/shield-swap-sdk/tests/integration/test_reads_live.py @@ -14,10 +14,11 @@ ) from .conftest import skip_if_access_gated from aleo_shield_swap.tick_math import ( - MAX_SQRT_PRICE, + MAX_SQRT_RATIO_X128, MAX_TICK, - MIN_SQRT_PRICE, + MIN_SQRT_RATIO_X128, MIN_TICK, + u256_to_int, ) pytestmark = pytest.mark.live @@ -46,7 +47,7 @@ def test_api_get_pools_shapes(pools): assert isinstance(entry.enabled, bool) if entry.token0_info is not None: assert entry.token0_info.decimals >= 0 - assert entry.token0_info.wrapper_program.endswith(".aleo") + assert entry.token0_info.amm_token_program.endswith(".aleo") def test_api_get_tokens(live_dex_module): @@ -97,12 +98,15 @@ def test_get_pool_matches_api(live_dex_module, pool): chain_pool = live_dex_module.get_pool(pool.key) assert chain_pool.token0 == pool.token0 assert chain_pool.token1 == pool.token1 - assert chain_pool.scale0 >= 1 and chain_pool.scale1 >= 1 + # New stack: raw native amounts — the scale fields are gone. + assert not hasattr(chain_pool, "scale0") + assert isinstance(chain_pool.enabled, bool) def test_get_slot_invariants(live_dex_module, pool): slot = live_dex_module.get_slot(pool.key) - assert MIN_SQRT_PRICE <= slot.sqrt_price <= MAX_SQRT_PRICE + sqrt_price = u256_to_int(slot.raw.sqrt_price) + assert MIN_SQRT_RATIO_X128 <= sqrt_price <= MAX_SQRT_RATIO_X128 assert MIN_TICK <= slot.tick <= MAX_TICK assert slot.tick_spacing > 0 assert slot.next_init_below <= slot.tick <= slot.next_init_above @@ -111,6 +115,22 @@ def test_get_slot_invariants(live_dex_module, pool): assert slot.price(d0, d1) > 0 +def test_registry_agrees_with_chain_on_wrappedness(live_dex_module): + """Staging registry rows vs the chain's from_wrapper_token_id mapping: + a token is wrapped exactly when its underlying token id differs from + its own address.""" + checked = 0 + for tok in live_dex_module.api.get_tokens(): + if tok.underlying_token_id is None: + continue + registry_wrapped = tok.underlying_token_id != tok.address + assert live_dex_module._is_wrapped(tok.address) == registry_wrapped, tok.symbol + if registry_wrapped: + assert tok.underlying_program != tok.amm_token_program + checked += 1 + assert checked > 0, "registry exposed no underlying_token_id rows" + + def test_is_pool_initialized(live_dex_module, pool): assert live_dex_module.is_pool_initialized(pool.key) is True assert live_dex_module.is_pool_initialized("1field") is False diff --git a/shield-swap-sdk/tests/integration/test_swap_lifecycle.py b/shield-swap-sdk/tests/integration/test_swap_lifecycle.py index c8b945fe..e005c4d7 100644 --- a/shield-swap-sdk/tests/integration/test_swap_lifecycle.py +++ b/shield-swap-sdk/tests/integration/test_swap_lifecycle.py @@ -49,7 +49,10 @@ def test_private_swap_roundtrip(): assert pools pool = pools[0] token_in = pool.token0 - program_in = pool.token0_info.wrapper_program + # Records that FUND a token live in the underlying program (wrapped + # assets) or the ARC-20 itself (plain). + program_in = (pool.token0_info.underlying_program + or pool.token0_info.amm_token_program) balances = dex.get_private_balances([program_in], account=acct) amount_in = min(balances[program_in], 10 ** max(pool.token0_info.decimals - 2, 0)) @@ -82,3 +85,68 @@ def test_private_swap_roundtrip(): result = _with_retry(lambda: dex.claim_swap_output(handle).delegate(acct)) assert result.amount_out > 0 + + +@write_tier +def test_wrapped_flow_roundtrip(): + """Cutover check (guide §7): a wrapped-side swap auto-routes through + shield_swap_router, funded with UNDERLYING records; the claim of a + wrapped output routes even when the swap started on the core.""" + from aleo import Aleo, HTTPProvider + + from aleo_shield_swap import ShieldSwap + + provider = HTTPProvider(ENDPOINT, network="testnet", + api_key=os.environ["ALEO_E2E_API_KEY"]) + aleo = Aleo(provider) + aleo.network_client.consumer_id = os.environ["ALEO_E2E_CONSUMER_ID"] + acct = aleo.account.from_private_key(os.environ["ALEO_E2E_PRIVATE_KEY"]) + aleo.default_account = acct + aleo.records.register(acct) + dex = ShieldSwap(aleo) + + tokens = {t.address: t for t in dex.api.get_tokens()} + case = None + for pool in dex.api.get_pools(): + for token_in, token_out in ((pool.token0, pool.token1), + (pool.token1, pool.token0)): + tok = tokens.get(token_in) + if (tok and tok.underlying_token_id + and tok.underlying_token_id != tok.address): + case = (pool, token_in, tok) + break + if case: + break + if case is None: + pytest.skip("no pool with a wrapped side on the new core yet") + pool, token_in, tok = case + + # Registry and chain must agree before we spend anything on it. + assert dex._is_wrapped(token_in), f"{tok.symbol}: registry/chain disagree" + program_in = tok.underlying_program # UNDERLYING records fund it + + balances = dex.get_private_balances([program_in], account=acct) + amount_in = min(balances.get(program_in, 0), + 10 ** max(tok.decimals - 2, 0)) + if amount_in == 0: + pytest.skip(f"no private {program_in} records to fund the wrapped swap") + + handle = _with_retry(lambda: dex.swap( + pool_key=pool.key, token_in_id=token_in, amount_in=amount_in, + slippage_bps=500, token_in_program=program_in).delegate(acct)) + assert handle.swap_id and handle.blinded_address + + deadline = time.time() + 300 + while True: + try: + dex.get_swap_output(handle.swap_id) + break + except SwapOutputNotFinalizedError: + if time.time() > deadline: + pytest.fail("routed swap request did not finalize within 5 minutes") + time.sleep(10) + + # Claim dispatches by the finalized SwapOutput's token shapes — the + # wrapped refund side unwraps to the signer in the same transaction. + result = _with_retry(lambda: dex.claim_swap_output(handle).delegate(acct)) + assert result.amount_out > 0 From 7b2a234da84859e53d8201b74acbdb95f9262182 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 12:24:57 -0500 Subject: [PATCH 12/23] fix(codegen): satisfy strict pyright on Array support --- sdk/python/aleo/codegen/_emit.py | 4 ++-- sdk/python/aleo/codegen/runtime.py | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sdk/python/aleo/codegen/_emit.py b/sdk/python/aleo/codegen/_emit.py index 4928be82..68d3f2ed 100644 --- a/sdk/python/aleo/codegen/_emit.py +++ b/sdk/python/aleo/codegen/_emit.py @@ -12,7 +12,7 @@ import keyword import re from dataclasses import dataclass, field -from typing import Any, Callable +from typing import Any, Callable, Iterator _PROGRAM_ID_RE = re.compile(r"[a-zA-Z0-9_.]+") @@ -140,7 +140,7 @@ def emit_struct(struct: dict[str, Any]) -> str: ) -def _iter_struct_refs(ty: Any): +def _iter_struct_refs(ty: Any) -> "Iterator[dict[str, Any]]": """Yield every ``{"Struct": ...}`` reference in a ty tree (arrays included).""" if isinstance(ty, dict) and "Struct" in ty: yield ty diff --git a/sdk/python/aleo/codegen/runtime.py b/sdk/python/aleo/codegen/runtime.py index 8d657c33..f1d6e3f0 100644 --- a/sdk/python/aleo/codegen/runtime.py +++ b/sdk/python/aleo/codegen/runtime.py @@ -19,7 +19,7 @@ from __future__ import annotations import re -from typing import Any +from typing import Any, Callable, cast _INT_RE = re.compile(r"^(-?\d+)(u8|u16|u32|u64|u128|i8|i16|i32|i64|i128)$") _MODE_RE = re.compile(r"\.(private|public|constant)$") @@ -158,10 +158,11 @@ def fmt_address(v: object) -> str: return v -def fmt_array(v: object, encode_one: Any, length: int) -> str: +def fmt_array(v: object, encode_one: Callable[[Any], str], length: int) -> str: """Format a fixed-length list as an Aleo array literal.""" if not isinstance(v, list): raise ValueError(f"Expected a list of length {length}, got {type(v).__name__}") - if len(v) != length: - raise ValueError(f"Expected a list of length {length}, got length {len(v)}") - return "[" + ", ".join(encode_one(x) for x in v) + "]" + items = cast("list[Any]", v) + if len(items) != length: + raise ValueError(f"Expected a list of length {length}, got length {len(items)}") + return "[" + ", ".join(encode_one(x) for x in items) + "]" From a646c5521c5bc2be109a9111c3de3909ae2a26c6 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 12:56:18 -0500 Subject: [PATCH 13/23] fix(shield-swap): pin mcp extra below 2.0 pending API port --- shield-swap-sdk/pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shield-swap-sdk/pyproject.toml b/shield-swap-sdk/pyproject.toml index 9026f28e..f40e315d 100644 --- a/shield-swap-sdk/pyproject.toml +++ b/shield-swap-sdk/pyproject.toml @@ -8,7 +8,9 @@ dependencies = ["aleo-sdk>=0.2", "requests>=2"] [project.optional-dependencies] async = ["httpx>=0.27"] -mcp = ["mcp>=1.0"] +# mcp 2.0 renamed the Server registration API and Tool fields — pin to 1.x +# until the server is ported. +mcp = ["mcp>=1.0,<2"] dev = ["datamodel-code-generator>=0.25", "pytest>=8", "pytest-asyncio>=0.23"] [build-system] From c18548b8a1be1c044fc19109f86ba51ef93d67a8 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 13:24:51 -0500 Subject: [PATCH 14/23] test(shield-swap): pin router ABIs as drift guards with input-count parity --- shield-swap-sdk/codegen/regen-abi.sh | 12 + .../codegen/shield_swap_lp_router.abi.json | 1513 +++++++++++++++++ .../codegen/shield_swap_router.abi.json | 715 ++++++++ .../tests/integration/test_drift.py | 19 +- shield-swap-sdk/tests/test_routing.py | 36 + 5 files changed, 2288 insertions(+), 7 deletions(-) create mode 100644 shield-swap-sdk/codegen/shield_swap_lp_router.abi.json create mode 100644 shield-swap-sdk/codegen/shield_swap_router.abi.json diff --git a/shield-swap-sdk/codegen/regen-abi.sh b/shield-swap-sdk/codegen/regen-abi.sh index 376be119..95dfd6f0 100755 --- a/shield-swap-sdk/codegen/regen-abi.sh +++ b/shield-swap-sdk/codegen/regen-abi.sh @@ -46,6 +46,18 @@ abi = aleo.abi.generate_abi(src, "testnet", imports=deps) json.dump(abi, open("shield_swap.abi.json", "w"), indent=1) print(f"wrote shield_swap.abi.json ({len(abi['structs'])} structs, " f"{len(abi['records'])} records, {len(abi['mappings'])} mappings)") + +# The routers are pinned as DRIFT GUARDS only (test_drift.py + the input-count +# parity test) — no Python is generated from them: their calls reuse the +# core's structs and the client assembles inputs positionally. +for router in ("shield_swap_router.aleo", "shield_swap_lp_router.aleo"): + seen = {} + load_deps(router, seen) + src = seen.pop(router) + abi = aleo.abi.generate_abi(src, "testnet", imports=list(seen.items())) + out = router.removesuffix(".aleo") + ".abi.json" + json.dump(abi, open(out, "w"), indent=1) + print(f"wrote {out} ({len(abi['functions'])} functions)") EOF "$PYTHON" -m aleo.codegen --abi shield_swap.abi.json \ --out ../python/aleo_shield_swap/_generated.py diff --git a/shield-swap-sdk/codegen/shield_swap_lp_router.abi.json b/shield-swap-sdk/codegen/shield_swap_lp_router.abi.json new file mode 100644 index 00000000..7f312fbf --- /dev/null +++ b/shield-swap-sdk/codegen/shield_swap_lp_router.abi.json @@ -0,0 +1,1513 @@ +{ + "program": "shield_swap_lp_router.aleo", + "structs": [ + { + "path": [ + "MerkleProof" + ], + "fields": [ + { + "name": "siblings", + "ty": { + "Array": { + "element": { + "Primitive": "Field" + }, + "length": 16 + } + } + }, + { + "name": "leaf_index", + "ty": { + "Primitive": { + "UInt": "U32" + } + } + } + ] + } + ], + "records": [], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "mint_from_wrapped_arc20", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "MintPositionRequest" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "MintComplianceRecord" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "Final" + ] + }, + { + "name": "mint_from_arc20_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + "DynamicRecord", + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "MintPositionRequest" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "MintComplianceRecord" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "Final" + ] + }, + { + "name": "mint_from_wrapped_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "MintPositionRequest" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + "DynamicRecord", + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "MintComplianceRecord" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "Final" + ] + }, + { + "name": "increase_from_wrapped_arc20", + "inputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "Int": "I32" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "Int": "I32" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + "Final" + ] + }, + { + "name": "increase_from_arc20_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "Int": "I32" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "Int": "I32" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + "Final" + ] + }, + { + "name": "increase_from_wrapped_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "Int": "I32" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "Int": "I32" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + "DynamicRecord", + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "Final" + ] + }, + { + "name": "collect_to_wrapped_arc20", + "inputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + "DynamicRecord", + "Final" + ] + }, + { + "name": "collect_to_arc20_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + "DynamicRecord", + "Final" + ] + }, + { + "name": "collect_to_wrapped_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_lp_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "PositionNFT" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "DynamicRecord", + "DynamicRecord", + "Final" + ] + }, + { + "name": "collect_protocol_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Boolean" + }, + "mode": "Public" + } + } + ], + "outputs": [ + "Final" + ] + }, + { + "name": "collect_protocol_both_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + } + ], + "outputs": [ + "Final" + ] + } + ] +} \ No newline at end of file diff --git a/shield-swap-sdk/codegen/shield_swap_router.abi.json b/shield-swap-sdk/codegen/shield_swap_router.abi.json new file mode 100644 index 00000000..352e1d69 --- /dev/null +++ b/shield-swap-sdk/codegen/shield_swap_router.abi.json @@ -0,0 +1,715 @@ +{ + "program": "shield_swap_router.aleo", + "structs": [ + { + "path": [ + "U256__8JquwLopp8" + ], + "fields": [ + { + "name": "hi", + "ty": { + "Primitive": { + "UInt": "U128" + } + } + }, + { + "name": "lo", + "ty": { + "Primitive": { + "UInt": "U128" + } + } + } + ] + }, + { + "path": [ + "MerkleProof" + ], + "fields": [ + { + "name": "siblings", + "ty": { + "Array": { + "element": { + "Primitive": "Field" + }, + "length": 16 + } + } + }, + { + "name": "leaf_index", + "ty": { + "Primitive": { + "UInt": "U32" + } + } + } + ] + } + ], + "records": [], + "mappings": [], + "storage_variables": [], + "functions": [ + { + "name": "swap_from_wrapped", + "inputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Boolean" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "U256__8JquwLopp8" + ], + "program": "shield_swap_router.aleo" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U32" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + } + ], + "outputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "SwapComplianceRecord" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "Final" + ] + }, + { + "name": "swap_mh_from_wrapped", + "inputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "SwapHop" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "SwapHop" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "SwapHop" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U8" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U64" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U32" + } + }, + "mode": "Public" + } + } + ], + "outputs": [ + "DynamicRecord", + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Struct": { + "path": [ + "MultiHopSwapComplianceRecord" + ], + "program": "shield_swap.aleo" + } + }, + "mode": "Private" + } + }, + "Final" + ] + }, + { + "name": "claim_to_wrapped_refund_arc20", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + "DynamicRecord", + "DynamicRecord", + "Final" + ] + }, + { + "name": "claim_to_arc20_refund_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + "DynamicRecord", + "DynamicRecord", + "Final" + ] + }, + { + "name": "claim_to_wrapped_refund_wrapped", + "inputs": [ + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Address" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": "Field" + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Primitive": { + "UInt": "U128" + } + }, + "mode": "Public" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + }, + { + "Plaintext": { + "ty": { + "Array": { + "element": { + "Struct": { + "path": [ + "MerkleProof" + ], + "program": "shield_swap_router.aleo" + } + }, + "length": 2 + } + }, + "mode": "Private" + } + } + ], + "outputs": [ + "DynamicRecord", + "DynamicRecord", + "Final" + ] + } + ] +} \ No newline at end of file diff --git a/shield-swap-sdk/tests/integration/test_drift.py b/shield-swap-sdk/tests/integration/test_drift.py index e3457fa6..bb9c0f50 100644 --- a/shield-swap-sdk/tests/integration/test_drift.py +++ b/shield-swap-sdk/tests/integration/test_drift.py @@ -9,8 +9,11 @@ pytestmark = pytest.mark.live -ABI_PATH = Path(__file__).parents[2] / "codegen" / "shield_swap.abi.json" -PROGRAM = "shield_swap.aleo" +CODEGEN = Path(__file__).parents[2] / "codegen" +# Core drives codegen; the routers are pinned as pure drift guards — the +# client assembles their inputs positionally from these exact signatures. +PROGRAMS = ["shield_swap.aleo", "shield_swap_router.aleo", + "shield_swap_lp_router.aleo"] def _fetch(program_id: str) -> str: @@ -31,15 +34,17 @@ def _load_deps(program_id: str, seen: dict) -> None: seen[program_id] = src -def test_pinned_abi_matches_deployed(): +@pytest.mark.parametrize("program", PROGRAMS) +def test_pinned_abi_matches_deployed(program): import aleo.abi seen: dict = {} - _load_deps(PROGRAM, seen) - src = seen.pop(PROGRAM) + _load_deps(program, seen) + src = seen.pop(program) live = aleo.abi.generate_abi(src, "testnet", imports=list(seen.items())) - violations = aleo.abi.check_compatibility(live, json.loads(ABI_PATH.read_text())) + pinned_path = CODEGEN / (program.removesuffix(".aleo") + ".abi.json") + violations = aleo.abi.check_compatibility(live, json.loads(pinned_path.read_text())) assert violations == [], ( - f"deployed {PROGRAM} drifted from the pinned ABI — rerun " + f"deployed {program} drifted from the pinned ABI — rerun " f"codegen/regen-abi.sh and review the diff: {violations}" ) diff --git a/shield-swap-sdk/tests/test_routing.py b/shield-swap-sdk/tests/test_routing.py index b2980457..22b22df0 100644 --- a/shield-swap-sdk/tests/test_routing.py +++ b/shield-swap-sdk/tests/test_routing.py @@ -35,3 +35,39 @@ def test_lp_routes(): assert collect_route(False, True) == (LP_ROUTER_ID, "collect_to_arc20_wrapped") assert collect_route(True, True) == (LP_ROUTER_ID, "collect_to_wrapped_wrapped") assert collect_route(False, False) == (CORE, "collect") + + +def test_client_input_counts_match_pinned_router_abis(): + """ABI ↔ client parity: the input counts the dispatch tests pin on the + client side must equal the pinned router signatures. A router redeploy + that changes a signature fails here hermetically (and in the live drift + test), instead of as an authorization error on a wrapped flow.""" + import json + from pathlib import Path + + pinned: dict[str, int] = {} + codegen = Path(__file__).parents[1] / "codegen" + for name in ("shield_swap_router", "shield_swap_lp_router"): + abi = json.loads((codegen / f"{name}.abi.json").read_text()) + pinned.update({fn["name"]: len(fn["inputs"]) for fn in abi["functions"]}) + + # The exact input lists the client assembles (asserted in + # test_swap/test_claim/test_liquidity against the stub recorder). + assembled = { + "swap_from_wrapped": 13, + "claim_to_wrapped_refund_arc20": 9, + "claim_to_arc20_refund_wrapped": 9, + "claim_to_wrapped_refund_wrapped": 10, + "mint_from_wrapped_arc20": 12, + "mint_from_arc20_wrapped": 12, + "mint_from_wrapped_wrapped": 13, + "increase_from_wrapped_arc20": 12, + "increase_from_arc20_wrapped": 12, + "increase_from_wrapped_wrapped": 13, + "collect_to_wrapped_arc20": 8, + "collect_to_arc20_wrapped": 8, + "collect_to_wrapped_wrapped": 9, + } + for fn, count in assembled.items(): + assert pinned[fn] == count, ( + f"{fn}: pinned ABI takes {pinned[fn]} inputs, client assembles {count}") From 5cf449fccd38e333f3d4add5ca20c85654be94a7 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 13:42:48 -0500 Subject: [PATCH 15/23] fix(shield-swap): adapt auth to staging session model - /auth/verify: send challenge_id from the challenge payload - sessions are httpOnly cookies + X-CSRF-Token (legacy body-JWT kept) - is_authenticated covers both credential kinds - salted retry on DPS consumer-username collisions - lifecycle live test: invite codes are pasted, never generated; shed SHIELD_SWAP_PRIVATE_KEY so the fresh-profile premise holds --- shield-swap-sdk/AGENTS.md | 9 ++- .../python/aleo_shield_swap/AGENTS.md | 9 ++- .../python/aleo_shield_swap/api.py | 63 +++++++++++++++---- .../python/aleo_shield_swap/client.py | 3 +- .../python/aleo_shield_swap/lifecycle.py | 23 ++++--- .../integration/test_agent_lifecycle_live.py | 33 ++++------ 6 files changed, 96 insertions(+), 44 deletions(-) diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index cde9d76e..ea742834 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -218,7 +218,14 @@ the stages use: ### `api.authenticate(self, address: 'str', sign: 'Any') -> 'str'` -Challenge/verify handshake; stores and returns the JWT. +Challenge/verify handshake; establishes the session. + +The staging API issues the session as httpOnly cookies on this +client's HTTP session plus a CSRF token (stored and echoed as +``X-CSRF-Token``); older deployments return a bearer JWT in the +body — both are handled. Returns the stored credential (CSRF token +or JWT). Sessions are short-lived — mint a durable ``ss_…`` token +via :meth:`create_api_token` for anything long-running. *sign* is a callable taking the challenge message string and returning an Aleo signature literal (``sign1…``) — e.g.:: diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index cde9d76e..ea742834 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -218,7 +218,14 @@ the stages use: ### `api.authenticate(self, address: 'str', sign: 'Any') -> 'str'` -Challenge/verify handshake; stores and returns the JWT. +Challenge/verify handshake; establishes the session. + +The staging API issues the session as httpOnly cookies on this +client's HTTP session plus a CSRF token (stored and echoed as +``X-CSRF-Token``); older deployments return a bearer JWT in the +body — both are handled. Returns the stored credential (CSRF token +or JWT). Sessions are short-lived — mint a durable ``ss_…`` token +via :meth:`create_api_token` for anything long-running. *sign* is a callable taking the challenge message string and returning an Aleo signature literal (``sign1…``) — e.g.:: diff --git a/shield-swap-sdk/python/aleo_shield_swap/api.py b/shield-swap-sdk/python/aleo_shield_swap/api.py index ed4f6ba4..9e65fadf 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/api.py +++ b/shield-swap-sdk/python/aleo_shield_swap/api.py @@ -97,14 +97,25 @@ def __init__(self, base_url: str = DEFAULT_API_URL, session: Any | None = None, self.base_url = base_url.rstrip("/") self._session = session or requests.Session() self._token = token + self._csrf: str | None = None # cookie-session CSRF (authenticate()) def __repr__(self) -> str: return f"ApiClient({self.base_url!r})" + @property + def is_authenticated(self) -> bool: + """True when a credential is loaded: an ``ss_…``/JWT bearer token or + a cookie session from :meth:`authenticate`.""" + return bool(self._token or self._csrf) + def _headers(self) -> dict[str, str]: headers = {"accept": "application/json"} if self._token: headers["authorization"] = f"Bearer {self._token}" + if self._csrf: + # Cookie sessions: the access token rides as an httpOnly cookie + # on self._session; state-changing calls must echo the CSRF. + headers["x-csrf-token"] = self._csrf return headers def _get(self, path: str, params: dict[str, Any] | None = None) -> Any: @@ -122,7 +133,14 @@ def _post(self, path: str, body: dict[str, Any]) -> Any: # ── Auth ─────────────────────────────────────────────────────────────── def authenticate(self, address: str, sign: Any) -> str: - """Challenge/verify handshake; stores and returns the JWT. + """Challenge/verify handshake; establishes the session. + + The staging API issues the session as httpOnly cookies on this + client's HTTP session plus a CSRF token (stored and echoed as + ``X-CSRF-Token``); older deployments return a bearer JWT in the + body — both are handled. Returns the stored credential (CSRF token + or JWT). Sessions are short-lived — mint a durable ``ss_…`` token + via :meth:`create_api_token` for anything long-running. *sign* is a callable taking the challenge message string and returning an Aleo signature literal (``sign1…``) — e.g.:: @@ -131,12 +149,19 @@ def authenticate(self, address: str, sign: Any) -> str: api.authenticate(str(pk.address), lambda msg: str(pk.sign(msg.encode()))) """ - challenge = self._post("/auth/challenge", {"address": address}) - signature = sign(challenge["data"]["message"]) - verified = self._post("/auth/verify", - {"address": address, "signature": str(signature)}) - self._token = verified["data"]["token"] - return self._token + challenge = self._post("/auth/challenge", {"address": address})["data"] + signature = sign(challenge["message"]) + body = {"address": address, "signature": str(signature)} + # Staging binds the verify to its challenge; older deployments don't + # return an id — send it only when the challenge carried one. + if challenge.get("challenge_id"): + body["challenge_id"] = challenge["challenge_id"] + data = self._post("/auth/verify", body)["data"] + if data.get("token"): # legacy body-JWT deployments + self._token = data["token"] + return self._token + self._csrf = data["csrf_token"] + return self._csrf def set_token(self, token: str) -> None: """Adopt a previously issued JWT.""" @@ -259,14 +284,21 @@ def __init__(self, base_url: str = DEFAULT_API_URL, client: Any | None = None, client = httpx.AsyncClient(timeout=_TIMEOUT) self._client = client self._token = token + self._csrf: str | None = None # cookie-session CSRF (authenticate()) def __repr__(self) -> str: return f"AsyncApiClient({self.base_url!r})" + @property + def is_authenticated(self) -> bool: + return bool(self._token or self._csrf) + def _headers(self) -> dict[str, str]: headers = {"accept": "application/json"} if self._token: headers["authorization"] = f"Bearer {self._token}" + if self._csrf: + headers["x-csrf-token"] = self._csrf return headers async def _get(self, path: str, params: dict[str, Any] | None = None) -> Any: @@ -283,12 +315,17 @@ async def _post(self, path: str, body: dict[str, Any]) -> Any: async def authenticate(self, address: str, sign: Any) -> str: """Async challenge/verify handshake; stores and returns the JWT.""" - challenge = await self._post("/auth/challenge", {"address": address}) - signature = sign(challenge["data"]["message"]) - verified = await self._post("/auth/verify", - {"address": address, "signature": str(signature)}) - self._token = verified["data"]["token"] - return self._token + challenge = (await self._post("/auth/challenge", {"address": address}))["data"] + signature = sign(challenge["message"]) + body = {"address": address, "signature": str(signature)} + if challenge.get("challenge_id"): + body["challenge_id"] = challenge["challenge_id"] + data = (await self._post("/auth/verify", body))["data"] + if data.get("token"): # legacy body-JWT deployments + self._token = data["token"] + return self._token + self._csrf = data["csrf_token"] + return self._csrf def set_token(self, token: str) -> None: self._token = token diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index 34f734a8..ef55b854 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -274,7 +274,8 @@ def status(self) -> SessionStatus: registered, what do I hold, what is in flight" from the profile, journal, chain, and API without changing anything. """ - authenticated = getattr(self.api, "_token", None) is not None + authenticated = bool(getattr(self.api, "is_authenticated", False) + or getattr(self.api, "_token", None)) has_access: Optional[bool] = None if authenticated: try: diff --git a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py index 871b1d21..0f62bd79 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py +++ b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py @@ -95,17 +95,24 @@ def provision_provable_credentials(endpoint: str, username: str) -> tuple[str, s """Create a Provable API consumer + key (``POST /consumers``, keyless). Returns ``(api_key, consumer_id)`` — the pair the scanner and delegated - proving authenticate with. + proving authenticate with. Usernames are labels with a UNIQUE + constraint server-side; on a 409 collision, retry once with a random + suffix (the key/id pair is what matters, not the name). """ + import secrets + import requests - resp = requests.post(f"{endpoint.rstrip('/')}/consumers", - json={"username": username}, timeout=30.0) - if not 200 <= resp.status_code < 300: - raise CredentialsMissingError( - f"POST /consumers -> {resp.status_code}: {resp.text[:120]}") - data = resp.json() - return data["key"], data["consumer"]["id"] + for name in (username, f"{username}-{secrets.token_hex(4)}"): + resp = requests.post(f"{endpoint.rstrip('/')}/consumers", + json={"username": name}, timeout=30.0) + if 200 <= resp.status_code < 300: + data = resp.json() + return data["key"], data["consumer"]["id"] + if resp.status_code != 409: + break + raise CredentialsMissingError( + f"POST /consumers -> {resp.status_code}: {resp.text[:120]}") def _creds_done(ctx: _Ctx) -> bool: diff --git a/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py b/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py index b1228604..9aef9d83 100644 --- a/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py +++ b/shield-swap-sdk/tests/integration/test_agent_lifecycle_live.py @@ -1,8 +1,9 @@ """Live proof of the full agent lifecycle — fresh profile to collected swap. Opt in: python -m pytest tests/integration/test_agent_lifecycle_live.py -m live -Env: ALEO_E2E_PRIVATE_KEY mints a fresh invite code (or set - SHIELD_SWAP_INVITE_CODE explicitly) +Env: SHIELD_SWAP_INVITE_CODE a fresh, unredeemed invite code — codes + are single-use and human-supplied by + design; the SDK never generates them. Provable + DEX API credentials self-provision during onboarding. One ordered test: onboarding a fresh account is rate-limited and slow, so @@ -19,31 +20,23 @@ pytestmark = pytest.mark.live -_HAS_CODE_SOURCE = bool(os.environ.get("SHIELD_SWAP_INVITE_CODE") - or os.environ.get("ALEO_E2E_PRIVATE_KEY")) - def _invite_code() -> str: - explicit = os.environ.get("SHIELD_SWAP_INVITE_CODE") - if explicit: - return explicit - import aleo - - from aleo_shield_swap import ApiClient - - pk = aleo.testnet.PrivateKey.from_string(os.environ["ALEO_E2E_PRIVATE_KEY"]) - api = ApiClient() - api.authenticate(str(pk.address), lambda m: str(pk.sign(m.encode()))) - return api._post("/access/generate", {"count": 1})["data"]["codes"][0] + return os.environ["SHIELD_SWAP_INVITE_CODE"] -@pytest.mark.skipif(not _HAS_CODE_SOURCE, - reason="no invite code source (SHIELD_SWAP_INVITE_CODE " - "or ALEO_E2E_PRIVATE_KEY)") +@pytest.mark.skipif(not os.environ.get("SHIELD_SWAP_INVITE_CODE"), + reason="SHIELD_SWAP_INVITE_CODE not set — paste a fresh, " + "unredeemed invite code to run the lifecycle") def test_full_lifecycle_from_fresh_profile(tmp_path, monkeypatch): - # Prove the participant path: credentials must SELF-provision. + # Prove the participant path: credentials must SELF-provision and the + # profile key must be genuinely fresh (a developer shell may carry + # SHIELD_SWAP_PRIVATE_KEY, which would import a funded, already-redeemed + # account and void every "fresh account" assertion below). monkeypatch.delenv("ALEO_E2E_API_KEY", raising=False) monkeypatch.delenv("ALEO_E2E_CONSUMER_ID", raising=False) + monkeypatch.delenv("SHIELD_SWAP_PRIVATE_KEY", raising=False) + monkeypatch.delenv("SHIELD_SWAP_PRIVATE_KEY_FILE", raising=False) from aleo_shield_swap import ShieldSwap # ── Startup: fresh key material, full registration, airdrop ──────────── From 8cc498234e0d77a395d00c8e933e93d57c7cad25 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 13:46:36 -0500 Subject: [PATCH 16/23] fix(shield-swap): accept referral codes in redeem_code --- shield-swap-sdk/AGENTS.md | 8 +++++- .../python/aleo_shield_swap/AGENTS.md | 8 +++++- .../python/aleo_shield_swap/api.py | 26 +++++++++++++++---- shield-swap-sdk/tests/test_api_client.py | 22 ++++++++++++++++ 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index ea742834..ae9a0b16 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -240,7 +240,13 @@ Whether this authenticated account has redeemed an invite code. ### `api.redeem_code(self, code: 'str') -> 'models.AccessRedeemResponse'` -Redeem an invite code. +Redeem an invite — access codes and referral codes both work. + +``/access/redeem`` takes admin-minted access codes; user-shared +invites are REFERRAL codes served by ``/referral/redeem`` (same +wire shape, same effect on ``access_status``). Callers paste +whichever they were given — an "invalid access code" 400 falls +through to the referral endpoint. The staging API no longer returns a session token here (sessions moved to the ``/auth/*`` endpoints) — re-authenticate after diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index ea742834..ae9a0b16 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -240,7 +240,13 @@ Whether this authenticated account has redeemed an invite code. ### `api.redeem_code(self, code: 'str') -> 'models.AccessRedeemResponse'` -Redeem an invite code. +Redeem an invite — access codes and referral codes both work. + +``/access/redeem`` takes admin-minted access codes; user-shared +invites are REFERRAL codes served by ``/referral/redeem`` (same +wire shape, same effect on ``access_status``). Callers paste +whichever they were given — an "invalid access code" 400 falls +through to the referral endpoint. The staging API no longer returns a session token here (sessions moved to the ``/auth/*`` endpoints) — re-authenticate after diff --git a/shield-swap-sdk/python/aleo_shield_swap/api.py b/shield-swap-sdk/python/aleo_shield_swap/api.py index 9e65fadf..f1f2244d 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/api.py +++ b/shield-swap-sdk/python/aleo_shield_swap/api.py @@ -177,14 +177,25 @@ def access_status(self) -> models.AccessStatusResponse: self._get("/access/status")["data"]) def redeem_code(self, code: str) -> models.AccessRedeemResponse: - """Redeem an invite code. + """Redeem an invite — access codes and referral codes both work. + + ``/access/redeem`` takes admin-minted access codes; user-shared + invites are REFERRAL codes served by ``/referral/redeem`` (same + wire shape, same effect on ``access_status``). Callers paste + whichever they were given — an "invalid access code" 400 falls + through to the referral endpoint. The staging API no longer returns a session token here (sessions moved to the ``/auth/*`` endpoints) — re-authenticate after redeeming. A token is still adopted if the API resurrects one. """ - out = _build(models.AccessRedeemResponse, - self._post("/access/redeem", {"code": code})["data"]) + try: + data = self._post("/access/redeem", {"code": code})["data"] + except DexApiError as exc: + if exc.status != 400 or "invalid access code" not in (exc.body or ""): + raise + data = self._post("/referral/redeem", {"code": code})["data"] + out = _build(models.AccessRedeemResponse, data) token = getattr(out, "token", None) if token: self._token = token @@ -339,8 +350,13 @@ async def access_status(self) -> models.AccessStatusResponse: async def redeem_code(self, code: str) -> models.AccessRedeemResponse: """Redeem an invite code — see :meth:`ApiClient.redeem_code`.""" - out = _build(models.AccessRedeemResponse, - (await self._post("/access/redeem", {"code": code}))["data"]) + try: + data = (await self._post("/access/redeem", {"code": code}))["data"] + except DexApiError as exc: + if exc.status != 400 or "invalid access code" not in (exc.body or ""): + raise + data = (await self._post("/referral/redeem", {"code": code}))["data"] + out = _build(models.AccessRedeemResponse, data) token = getattr(out, "token", None) if token: self._token = token diff --git a/shield-swap-sdk/tests/test_api_client.py b/shield-swap-sdk/tests/test_api_client.py index efc609a8..09ffb048 100644 --- a/shield-swap-sdk/tests/test_api_client.py +++ b/shield-swap-sdk/tests/test_api_client.py @@ -204,3 +204,25 @@ async def test_async_lifecycle_endpoints(): assert job.results[0].amm_token_program == "weth.aleo" with pytest.raises(AirdropRateLimitedError): await api.request_airdrop("aleo1a") + + +def test_redeem_code_falls_back_to_referral_endpoint(): + # User-shared invites are referral codes: /access/redeem rejects them + # with 400 "invalid access code" and the client retries /referral/redeem. + api, s = _lifecycle_client( + _Resp(400, {"error": "invalid access code"}), + _Resp(200, {"data": {"code": "XPC6", "status": "redeemed"}}), + ) + out = api.redeem_code("XPC6") + assert out.status == "redeemed" + assert [c[1] for c in s.calls] == ["https://x/access/redeem", + "https://x/referral/redeem"] + + +def test_redeem_code_other_errors_do_not_fall_back(): + import pytest + from aleo_shield_swap.errors import DexApiError + api, s = _lifecycle_client(_Resp(400, {"error": "code already redeemed"})) + with pytest.raises(DexApiError, match="already redeemed"): + api.redeem_code("XPC6") + assert len(s.calls) == 1 From ef126b23c8968f37edc36bf904c7ee9be9088baf Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 13:48:42 -0500 Subject: [PATCH 17/23] feat(shield-swap): pasted invites are referral codes; access codes self-register --- shield-swap-sdk/AGENTS.md | 18 +++--- .../python/aleo_shield_swap/AGENTS.md | 18 +++--- .../python/aleo_shield_swap/api.py | 57 ++++++++++++------- shield-swap-sdk/tests/test_api_client.py | 36 +++++------- 4 files changed, 68 insertions(+), 61 deletions(-) diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index ae9a0b16..d279720f 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -240,17 +240,17 @@ Whether this authenticated account has redeemed an invite code. ### `api.redeem_code(self, code: 'str') -> 'models.AccessRedeemResponse'` -Redeem an invite — access codes and referral codes both work. +Redeem a pasted invite — always a REFERRAL code. -``/access/redeem`` takes admin-minted access codes; user-shared -invites are REFERRAL codes served by ``/referral/redeem`` (same -wire shape, same effect on ``access_status``). Callers paste -whichever they were given — an "invalid access code" 400 falls -through to the referral endpoint. +User-shared invites are referral codes (``/referral/redeem``); +that is the ONLY kind a person pastes. Access codes are a +programmatic self-registration flow — see +:meth:`generate_access_codes` / :meth:`redeem_access_code` — +never routed through here. -The staging API no longer returns a session token here (sessions -moved to the ``/auth/*`` endpoints) — re-authenticate after -redeeming. A token is still adopted if the API resurrects one. +Sessions moved to the ``/auth/*`` endpoints, so no token comes +back — re-authenticate if needed (one is still adopted if the API +resurrects the legacy body-JWT). ### `api.request_airdrop(self, address: 'str') -> 'models.AirdropStartResult'` diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index ae9a0b16..d279720f 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -240,17 +240,17 @@ Whether this authenticated account has redeemed an invite code. ### `api.redeem_code(self, code: 'str') -> 'models.AccessRedeemResponse'` -Redeem an invite — access codes and referral codes both work. +Redeem a pasted invite — always a REFERRAL code. -``/access/redeem`` takes admin-minted access codes; user-shared -invites are REFERRAL codes served by ``/referral/redeem`` (same -wire shape, same effect on ``access_status``). Callers paste -whichever they were given — an "invalid access code" 400 falls -through to the referral endpoint. +User-shared invites are referral codes (``/referral/redeem``); +that is the ONLY kind a person pastes. Access codes are a +programmatic self-registration flow — see +:meth:`generate_access_codes` / :meth:`redeem_access_code` — +never routed through here. -The staging API no longer returns a session token here (sessions -moved to the ``/auth/*`` endpoints) — re-authenticate after -redeeming. A token is still adopted if the API resurrects one. +Sessions moved to the ``/auth/*`` endpoints, so no token comes +back — re-authenticate if needed (one is still adopted if the API +resurrects the legacy body-JWT). ### `api.request_airdrop(self, address: 'str') -> 'models.AirdropStartResult'` diff --git a/shield-swap-sdk/python/aleo_shield_swap/api.py b/shield-swap-sdk/python/aleo_shield_swap/api.py index f1f2244d..05fac0b5 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/api.py +++ b/shield-swap-sdk/python/aleo_shield_swap/api.py @@ -177,30 +177,38 @@ def access_status(self) -> models.AccessStatusResponse: self._get("/access/status")["data"]) def redeem_code(self, code: str) -> models.AccessRedeemResponse: - """Redeem an invite — access codes and referral codes both work. + """Redeem a pasted invite — always a REFERRAL code. - ``/access/redeem`` takes admin-minted access codes; user-shared - invites are REFERRAL codes served by ``/referral/redeem`` (same - wire shape, same effect on ``access_status``). Callers paste - whichever they were given — an "invalid access code" 400 falls - through to the referral endpoint. + User-shared invites are referral codes (``/referral/redeem``); + that is the ONLY kind a person pastes. Access codes are a + programmatic self-registration flow — see + :meth:`generate_access_codes` / :meth:`redeem_access_code` — + never routed through here. - The staging API no longer returns a session token here (sessions - moved to the ``/auth/*`` endpoints) — re-authenticate after - redeeming. A token is still adopted if the API resurrects one. + Sessions moved to the ``/auth/*`` endpoints, so no token comes + back — re-authenticate if needed (one is still adopted if the API + resurrects the legacy body-JWT). """ - try: - data = self._post("/access/redeem", {"code": code})["data"] - except DexApiError as exc: - if exc.status != 400 or "invalid access code" not in (exc.body or ""): - raise - data = self._post("/referral/redeem", {"code": code})["data"] + data = self._post("/referral/redeem", {"code": code})["data"] out = _build(models.AccessRedeemResponse, data) token = getattr(out, "token", None) if token: self._token = token return out + def generate_access_codes(self, count: int = 1) -> list[str]: + """Mint access codes (``POST /access/generate``) — the + self-registration tier for operators/services; requires an + account with generate rights.""" + return list(self._post("/access/generate", {"count": count})["data"]["codes"]) + + def redeem_access_code(self, code: str) -> models.AccessRedeemResponse: + """Redeem a programmatically minted access code + (``POST /access/redeem``) — the self-registration counterpart of + :meth:`generate_access_codes`; not for human-pasted invites.""" + data = self._post("/access/redeem", {"code": code})["data"] + return _build(models.AccessRedeemResponse, data) + def request_airdrop(self, address: str) -> models.AirdropStartResult: """Start the test-token airdrop job for *address* (private records). @@ -349,19 +357,24 @@ async def access_status(self) -> models.AccessStatusResponse: (await self._get("/access/status"))["data"]) async def redeem_code(self, code: str) -> models.AccessRedeemResponse: - """Redeem an invite code — see :meth:`ApiClient.redeem_code`.""" - try: - data = (await self._post("/access/redeem", {"code": code}))["data"] - except DexApiError as exc: - if exc.status != 400 or "invalid access code" not in (exc.body or ""): - raise - data = (await self._post("/referral/redeem", {"code": code}))["data"] + """Redeem a pasted (referral) invite — see :meth:`ApiClient.redeem_code`.""" + data = (await self._post("/referral/redeem", {"code": code}))["data"] out = _build(models.AccessRedeemResponse, data) token = getattr(out, "token", None) if token: self._token = token return out + async def generate_access_codes(self, count: int = 1) -> list[str]: + """Mint access codes — see :meth:`ApiClient.generate_access_codes`.""" + return list((await self._post("/access/generate", + {"count": count}))["data"]["codes"]) + + async def redeem_access_code(self, code: str) -> models.AccessRedeemResponse: + """Redeem an access code — see :meth:`ApiClient.redeem_access_code`.""" + data = (await self._post("/access/redeem", {"code": code}))["data"] + return _build(models.AccessRedeemResponse, data) + async def request_airdrop(self, address: str) -> models.AirdropStartResult: """Start the airdrop job for *address* — see :meth:`ApiClient.request_airdrop`.""" return _build(models.AirdropStartResult, diff --git a/shield-swap-sdk/tests/test_api_client.py b/shield-swap-sdk/tests/test_api_client.py index 09ffb048..0db6f122 100644 --- a/shield-swap-sdk/tests/test_api_client.py +++ b/shield-swap-sdk/tests/test_api_client.py @@ -121,14 +121,15 @@ def test_access_status(): assert s.calls[0][:2] == ("GET", "https://x/access/status") -def test_redeem_code_no_longer_returns_a_token(): - # Staging moved sessions to /auth/* — redeem returns code/status only - # and the client keeps its existing credential. +def test_redeem_code_targets_referral_endpoint_only(): + # Pasted invites are ALWAYS referral codes; access codes belong to the + # programmatic self-registration flow and are never routed through here. api, s = _lifecycle_client(_Resp(200, {"data": {"code": "C", "status": "redeemed"}})) out = api.redeem_code("C") assert out.status == "redeemed" + assert s.calls[0][1] == "https://x/referral/redeem" assert s.calls[0][2] == {"code": "C"} - assert api._token == "t" + assert api._token == "t" # sessions moved to /auth/* — no rotation def test_request_airdrop_and_poll(): @@ -206,23 +207,16 @@ async def test_async_lifecycle_endpoints(): await api.request_airdrop("aleo1a") -def test_redeem_code_falls_back_to_referral_endpoint(): - # User-shared invites are referral codes: /access/redeem rejects them - # with 400 "invalid access code" and the client retries /referral/redeem. +def test_access_code_self_registration_flow(): + # Operators mint access codes and redeem them programmatically — + # a separate surface from the human referral-paste path. api, s = _lifecycle_client( - _Resp(400, {"error": "invalid access code"}), - _Resp(200, {"data": {"code": "XPC6", "status": "redeemed"}}), + _Resp(200, {"data": {"codes": ["ACODE12CHARS"]}}), + _Resp(200, {"data": {"code": "ACODE12CHARS", "status": "redeemed"}}), ) - out = api.redeem_code("XPC6") + codes = api.generate_access_codes() + assert codes == ["ACODE12CHARS"] + out = api.redeem_access_code(codes[0]) assert out.status == "redeemed" - assert [c[1] for c in s.calls] == ["https://x/access/redeem", - "https://x/referral/redeem"] - - -def test_redeem_code_other_errors_do_not_fall_back(): - import pytest - from aleo_shield_swap.errors import DexApiError - api, s = _lifecycle_client(_Resp(400, {"error": "code already redeemed"})) - with pytest.raises(DexApiError, match="already redeemed"): - api.redeem_code("XPC6") - assert len(s.calls) == 1 + assert [c[1] for c in s.calls] == ["https://x/access/generate", + "https://x/access/redeem"] From 4e4dc0d8725313a2d30f26e87ea2db98ec408574 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 13:57:28 -0500 Subject: [PATCH 18/23] fix(shield-swap): cookie session outranks bearer; onboarding idempotent under cookie auth - _headers: prefer the live session (csrf + cookies) over Authorization; ss_ tokens don't cover the /access tier and the server reads the header first - 401 while both credentials are loaded drops the expired session and retries as bearer (15-min sessions) - _auth_done recognizes cookie sessions; CSRF never persisted as jwt; from_profile prefers the durable ss_ token over stale session creds --- .../python/aleo_shield_swap/api.py | 42 ++++++++++++++++--- .../python/aleo_shield_swap/client.py | 8 ++-- .../python/aleo_shield_swap/lifecycle.py | 25 +++++++---- shield-swap-sdk/tests/test_api_client.py | 26 ++++++++++++ 4 files changed, 85 insertions(+), 16 deletions(-) diff --git a/shield-swap-sdk/python/aleo_shield_swap/api.py b/shield-swap-sdk/python/aleo_shield_swap/api.py index 05fac0b5..96244064 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/api.py +++ b/shield-swap-sdk/python/aleo_shield_swap/api.py @@ -110,23 +110,40 @@ def is_authenticated(self) -> bool: def _headers(self) -> dict[str, str]: headers = {"accept": "application/json"} - if self._token: - headers["authorization"] = f"Bearer {self._token}" if self._csrf: - # Cookie sessions: the access token rides as an httpOnly cookie - # on self._session; state-changing calls must echo the CSRF. + # A live cookie session outranks a bearer credential: it covers + # every tier (ss_ tokens are data/trading-only) and the server + # honors the Authorization header over cookies when both are + # sent. The access token rides as an httpOnly cookie on + # self._session; requests echo the CSRF. headers["x-csrf-token"] = self._csrf + elif self._token: + headers["authorization"] = f"Bearer {self._token}" return headers + def _expired_session(self, resp: Any) -> bool: + """A 401 while riding a cookie session with a bearer in reserve: + the (15-min) session expired — drop it and retry as bearer.""" + if resp.status_code == 401 and self._csrf and self._token: + self._csrf = None + return True + return False + def _get(self, path: str, params: dict[str, Any] | None = None) -> Any: resp = self._session.get(f"{self.base_url}{path}", params=params, headers=self._headers(), timeout=_TIMEOUT) + if self._expired_session(resp): + resp = self._session.get(f"{self.base_url}{path}", params=params, + headers=self._headers(), timeout=_TIMEOUT) _check(resp) return resp.json() def _post(self, path: str, body: dict[str, Any]) -> Any: resp = self._session.post(f"{self.base_url}{path}", json=body, headers=self._headers(), timeout=_TIMEOUT) + if self._expired_session(resp): + resp = self._session.post(f"{self.base_url}{path}", json=body, + headers=self._headers(), timeout=_TIMEOUT) _check(resp) return resp.json() @@ -314,21 +331,34 @@ def is_authenticated(self) -> bool: def _headers(self) -> dict[str, str]: headers = {"accept": "application/json"} - if self._token: - headers["authorization"] = f"Bearer {self._token}" if self._csrf: + # Cookie session outranks bearer — see ApiClient._headers. headers["x-csrf-token"] = self._csrf + elif self._token: + headers["authorization"] = f"Bearer {self._token}" return headers + def _expired_session(self, resp: Any) -> bool: + if resp.status_code == 401 and self._csrf and self._token: + self._csrf = None + return True + return False + async def _get(self, path: str, params: dict[str, Any] | None = None) -> Any: resp = await self._client.get(f"{self.base_url}{path}", params=params, headers=self._headers()) + if self._expired_session(resp): + resp = await self._client.get(f"{self.base_url}{path}", params=params, + headers=self._headers()) _check(resp) return resp.json() async def _post(self, path: str, body: dict[str, Any]) -> Any: resp = await self._client.post(f"{self.base_url}{path}", json=body, headers=self._headers()) + if self._expired_session(resp): + resp = await self._client.post(f"{self.base_url}{path}", json=body, + headers=self._headers()) _check(resp) return resp.json() diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index ef55b854..291025c5 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -126,10 +126,12 @@ def from_profile(cls, home: Any = None) -> "ShieldSwap": dex = cls(aleo) dex.profile = profile dex.journal = Journal(profile.journal_path) - if creds.get("jwt"): - dex.api.set_token(creds["jwt"]) # session tier (24h) - elif creds.get("dex_api_token"): + # Durable ss_ token first — session JWTs are short-lived and stale + # ones would shadow a perfectly good API token. + if creds.get("dex_api_token"): dex.api.set_token(creds["dex_api_token"]) # durable data tier + elif creds.get("jwt"): + dex.api.set_token(creds["jwt"]) # session tier return dex def _refresh_credentials(self) -> None: diff --git a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py index 0f62bd79..439707f3 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py +++ b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py @@ -60,9 +60,12 @@ class Stage: # ── Stages ──────────────────────────────────────────────────────────────────── def _auth_done(ctx: _Ctx) -> bool: - if getattr(ctx.dex.api, "_token", None) is None: + # A credential may be a bearer token OR a cookie session (staging). + authed = getattr(ctx.dex.api, "is_authenticated", + getattr(ctx.dex.api, "_token", None) is not None) + if not authed: return False - try: # a stored-but-expired JWT is not auth + try: # a stored-but-expired credential is not auth ctx.dex.api.access_status() return True except NotAuthenticatedError: @@ -73,10 +76,16 @@ def _auth_run(ctx: _Ctx) -> str: import aleo net = getattr(aleo, ctx.profile.network) pk = net.PrivateKey.from_string(ctx.profile.private_key) - jwt = ctx.dex.api.authenticate(ctx.profile.address, - lambda msg: str(pk.sign(msg.encode()))) - ctx.profile.save_credentials(jwt=jwt) - return "authenticated (24h JWT)" + ctx.dex.api.authenticate(ctx.profile.address, + lambda msg: str(pk.sign(msg.encode()))) + # Only a body-JWT (legacy deployments) is worth persisting — a cookie + # session's CSRF token is useless in a new process and would shadow the + # durable ss_ token if saved as "jwt". + jwt = getattr(ctx.dex.api, "_token", None) + if jwt: + ctx.profile.save_credentials(jwt=jwt) + return "authenticated (JWT)" + return "authenticated (cookie session)" def _redeem_done(ctx: _Ctx) -> bool: @@ -87,7 +96,9 @@ def _redeem_run(ctx: _Ctx) -> str: if not ctx.invite_code: raise NotRedeemedError() out = ctx.dex.api.redeem_code(ctx.invite_code) - ctx.profile.save_credentials(jwt=getattr(out, "token", None)) + token = getattr(out, "token", None) + if token: # legacy deployments only + ctx.profile.save_credentials(jwt=token) return f"invite redeemed ({out.status})" diff --git a/shield-swap-sdk/tests/test_api_client.py b/shield-swap-sdk/tests/test_api_client.py index 0db6f122..8f6a3da7 100644 --- a/shield-swap-sdk/tests/test_api_client.py +++ b/shield-swap-sdk/tests/test_api_client.py @@ -220,3 +220,29 @@ def test_access_code_self_registration_flow(): assert out.status == "redeemed" assert [c[1] for c in s.calls] == ["https://x/access/generate", "https://x/access/redeem"] + + +def test_cookie_session_outranks_bearer(): + # With both credentials loaded, requests ride the cookie session (CSRF + # header, no Authorization) — the server honors Authorization first and + # ss_ tokens don't cover the /access tier. + s = _Session([_Resp(200, {"data": []})]) + api = ApiClient(base_url="https://x", session=s, token="ss_durable") + api._csrf = "csrf-1" + api._get("/access/status") + headers = s.calls[0][3] + assert headers["x-csrf-token"] == "csrf-1" + assert "authorization" not in headers + + +def test_expired_cookie_session_falls_back_to_bearer(): + s = _Session([ + _Resp(401, {"error": "session expired"}), + _Resp(200, {"data": []}), + ]) + api = ApiClient(base_url="https://x", session=s, token="ss_durable") + api._csrf = "csrf-1" + api._get("/route") + assert api._csrf is None # session dropped + assert s.calls[0][3]["x-csrf-token"] == "csrf-1" + assert s.calls[1][3]["authorization"] == "Bearer ss_durable" From 073bec1a75e524706a9f2b141eb53c149779ca65 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 14:02:00 -0500 Subject: [PATCH 19/23] chore(shield-swap): rehearsal takes pasted referral codes, trades held pools --- shield-swap-sdk/scripts/rehearsal.py | 49 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/shield-swap-sdk/scripts/rehearsal.py b/shield-swap-sdk/scripts/rehearsal.py index 4d1ab81c..2a52b357 100644 --- a/shield-swap-sdk/scripts/rehearsal.py +++ b/shield-swap-sdk/scripts/rehearsal.py @@ -2,9 +2,9 @@ """Stress-test rehearsal: the four flows, end to end, via the tier-1 verbs. Usage: python scripts/rehearsal.py [--code INVITE] [--home DIR] -Needs: network access; ALEO_E2E_API_KEY/ALEO_E2E_CONSUMER_ID (until key -provisioning has an endpoint). Without --code, an invite is minted with -ALEO_E2E_PRIVATE_KEY (the e2e account can generate codes). +Needs: network access. ``--code`` takes a REFERRAL code (human-pasted by +design — the SDK never generates invites) and is only needed the first +time an account onboards; credentials self-provision. This script deliberately uses ONLY what AGENTS.md documents — if it needs anything more, that's a finding. @@ -12,36 +12,25 @@ from __future__ import annotations import argparse -import os import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "python")) -def _mint_invite_code() -> str: - import aleo - from aleo_shield_swap import ApiClient - - pk = aleo.testnet.PrivateKey.from_string(os.environ["ALEO_E2E_PRIVATE_KEY"]) - api = ApiClient() - api.authenticate(str(pk.address), lambda m: str(pk.sign(m.encode()))) - return api._post("/access/generate", {"count": 1})["data"]["codes"][0] - - def main() -> int: from aleo_shield_swap import ShieldSwap ap = argparse.ArgumentParser() ap.add_argument("--home", default=None) - ap.add_argument("--code", default=None) + ap.add_argument("--code", default=None, + help="referral code (first onboard only)") args = ap.parse_args() results: list[tuple[str, str]] = [] dex = ShieldSwap.from_profile(args.home) - code = args.code or _mint_invite_code() - report = dex.onboard(invite_code=code) + report = dex.onboard(invite_code=args.code) results.append(("startup", "ok" if report.funded else "NOT FUNDED")) st = dex.status() @@ -50,8 +39,18 @@ def main() -> int: f"ok: {len(pools)} pools, {len(st.balances)} tokens held, " f"{len(st.open_positions)} positions")) - batch = dex.swap_many(pool_key=pools[0].key, token_in_id=pools[0].token0, - amount_in=10**5, count=3) + # Trade a pool whose tokens the account actually holds; size amounts in + # raw native units from the token's decimals (~1e-5 of a token). + held = {tid for tid, v in st.balances.items() if v.get("private", 0) > 0} + pool = next((p for p in pools if p.token0 in held or p.token1 in held), + pools[0]) + token_in = pool.token0 if pool.token0 in held else pool.token1 + d0 = pool.token0_info.decimals if pool.token0_info else 9 + d1 = pool.token1_info.decimals if pool.token1_info else 9 + dec_in = d0 if token_in == pool.token0 else d1 + + batch = dex.swap_many(pool_key=pool.key, token_in_id=token_in, + amount_in=10 ** max(dec_in - 5, 1), count=3) results.append(("swaps", f"{len(batch.handles)} ok, " f"{len(batch.failures)} failed")) @@ -59,10 +58,10 @@ def main() -> int: results.append(("collection", f"{len(collected.claimed)} claimed, " f"{len(collected.still_pending)} pending")) - lo, hi = dex.get_slot(pools[0].key).tick_range(width=4) - minted = dex.mint(pool_key=pools[0].key, tick_lower=lo, tick_upper=hi, - amount0_desired=10**5, # raw native units — no scaling - amount1_desired=10**5).delegate() + lo, hi = dex.get_slot(pool.key).tick_range(width=4) + minted = dex.mint(pool_key=pool.key, tick_lower=lo, tick_upper=hi, + amount0_desired=10 ** max(d0 - 7, 1), # raw native units + amount1_desired=10 ** max(d1 - 7, 1)).delegate() pos = dex._position_state(minted.position_token_id) from aleo_shield_swap._core import find_position_plaintext import time @@ -70,10 +69,10 @@ def main() -> int: while time.monotonic() < deadline: # wait for the record to scan records = dex._aleo.record_provider.find( dex._aleo.default_account, program=dex.program, unspent=True) - if find_position_plaintext(records, pools[0].key): + if find_position_plaintext(records, pool.key): break time.sleep(15) - dex.decrease_liquidity(pool_key=pools[0].key, + dex.decrease_liquidity(pool_key=pool.key, liquidity_to_remove=pos.liquidity // 2).delegate() results.append(("liquidity", f"ok: minted {minted.position_token_id[:14]}…, " f"resized; run collection again for earnings")) From aa71c332fe259faf4c2d5694d4ce6d2994de9542 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 14:27:58 -0500 Subject: [PATCH 20/23] fix(shield-swap): mint hints walk the on-chain tick list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Slot-derived insert hints only validate for a pool's FIRST position — finalize asserts the true linked-list predecessors, so every later mint was rejected on populated pools. find_tick_predecessor walks the ticks mapping from the MIN sentinel (fresh pools anchor at the sentinel; initialized ticks return themselves since validation is skipped). --- .../python/aleo_shield_swap/client.py | 37 +++++++++++++++++- .../python/aleo_shield_swap/tick_math.py | 3 ++ shield-swap-sdk/tests/test_liquidity.py | 39 +++++++++++++++++-- 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index 291025c5..af56af68 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -70,6 +70,7 @@ from .tick_math import ( MAX_TICK, MIN_TICK, + MIN_TICK_SENTINEL, get_sqrt_price_at_tick_x128, int_to_u256_plaintext, round_tick_to_spacing, @@ -320,6 +321,34 @@ def derive_pool_key(self, token0: str, token1: str, fee: int) -> str: def derive_tick_key(self, pool_key: str, tick: int) -> str: return _derive_tick_key(pool_key, tick, network=self._aleo.network_name) + def find_tick_predecessor(self, pool_key: str, new_tick: int, + max_hops: int = 128) -> int: + """Predecessor of *new_tick* in the pool's initialized-tick list. + + The contract keeps ticks in an on-chain doubly-linked list and + ``mint`` asserts its hints are the true insertion neighbours — + static/slot-derived hints only work for a pool's FIRST position. + Walks from the MIN sentinel; an empty list (fresh pool) anchors at + the sentinel itself. For a tick already in the list, returns that + tick (the contract skips hint validation for initialized ticks). + """ + cur = MIN_TICK_SENTINEL + for _ in range(max_hops): + raw = self._mapping_value("ticks", self.derive_tick_key(pool_key, cur)) + if raw is None: + if cur == MIN_TICK_SENTINEL: + return MIN_TICK_SENTINEL # no list yet — fresh pool + raise ShieldSwapError( + f"tick {cur} missing from the initialized-tick list of " + f"pool {pool_key} — inconsistent chain state?") + nxt = int(g.Tick.from_plaintext(raw).next) + if nxt > new_tick: + return cur + cur = nxt + raise ShieldSwapError( + f"tick-list walk exceeded {max_hops} hops for pool {pool_key} — " + "pass tick_lower_hint=/tick_upper_hint= explicitly.") + # ── Balances ───────────────────────────────────────────────────────────── def get_private_balances(self, programs: list[str], @@ -943,8 +972,12 @@ def mint( if lo >= hi: raise ValueError(f"Empty tick range after spacing alignment: [{lo}, {hi})") - lo_hint = tick_lower_hint if tick_lower_hint is not None else pick_insert_hint(slot, lo) - upper_pred = tick_upper_hint if tick_upper_hint is not None else pick_insert_hint(slot, hi) + # Hints must be the ticks' true list predecessors (walked on-chain) — + # slot-derived hints only validate for a pool's first position. + lo_hint = (tick_lower_hint if tick_lower_hint is not None + else self.find_tick_predecessor(pool_key, lo)) + upper_pred = (tick_upper_hint if tick_upper_hint is not None + else self.find_tick_predecessor(pool_key, hi)) # The finalize inserts tick_lower before validating the upper hint, so # when nothing initialized sits between the bounds, the upper tick's # predecessor is the just-inserted lower tick. diff --git a/shield-swap-sdk/python/aleo_shield_swap/tick_math.py b/shield-swap-sdk/python/aleo_shield_swap/tick_math.py index d14904ca..991761d7 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/tick_math.py +++ b/shield-swap-sdk/python/aleo_shield_swap/tick_math.py @@ -11,6 +11,9 @@ Q128 = 1 << 128 MIN_TICK = -400000 MAX_TICK = 400000 +# Sentinel ticks anchoring the contract's initialized-tick linked list. +MIN_TICK_SENTINEL = -400001 +MAX_TICK_SENTINEL = 400001 # sqrt price at MIN_TICK / MAX_TICK — the bounds the swap finalize accepts. MIN_SQRT_RATIO_X128 = 702075911466779181339691826087 MAX_SQRT_RATIO_X128 = 484680305 * Q128 + 8756686347225649145659787327114459760 diff --git a/shield-swap-sdk/tests/test_liquidity.py b/shield-swap-sdk/tests/test_liquidity.py index a1b39940..5b136b22 100644 --- a/shield-swap-sdk/tests/test_liquidity.py +++ b/shield-swap-sdk/tests/test_liquidity.py @@ -86,9 +86,10 @@ def test_mint_inputs_rounding_and_request(): assert "tick_lower: -4080i32" in args[5] assert "tick_upper: 4020i32" in args[5] assert "amount0_desired: 1000000000u128" in args[5] - # slot neighbors: below=3960, above=4080; lower hint for -4080 (< tick) is 3960? - # pick_insert_hint(-4080 <= 4055) -> next_init_below = 3960 - assert "tick_lower_hint: 3960i32" in args[5] + # Empty ticks mapping = fresh pool: the lower hint anchors at the MIN + # sentinel and the upper tick's predecessor is the just-inserted lower. + assert "tick_lower_hint: -400001i32" in args[5] + assert "tick_upper_hint: -4080i32" in args[5] assert args[6] == "1field" and args[7] == "2field" proofs = default_merkle_proofs() assert args[8] == proofs and args[9] == proofs and args[10] == proofs @@ -266,3 +267,35 @@ def test_decrease_and_burn_always_direct(): assert stub.last_program == "shield_swap.aleo" dex.burn(pool_key="5field") assert stub.last_program == "shield_swap.aleo" + + +def _tick_text(pool, tick, prev, nxt): + return (f"{{ pool: {pool}, liquidity_net: 0i128, liquidity_gross: 1u128, " + f"tick: {tick}i32, " + "fee_growth_outside0_x_128: { hi: 0u128, lo: 0u128 }, " + "fee_growth_outside1_x_128: { hi: 0u128, lo: 0u128 }, " + f"prev: {prev}i32, next: {nxt}i32 }}") + + +def test_find_tick_predecessor_walks_the_chain_list(): + from aleo_shield_swap.tick_math import MIN_TICK_SENTINEL + stub = _stub() + dex = ShieldSwap(stub) + # Populated list: sentinel -> -1200 -> 300 -> MAX sentinel. + ticks = { + dex.derive_tick_key("5field", MIN_TICK_SENTINEL): + _tick_text("5field", MIN_TICK_SENTINEL, MIN_TICK_SENTINEL, -1200), + dex.derive_tick_key("5field", -1200): + _tick_text("5field", -1200, MIN_TICK_SENTINEL, 300), + dex.derive_tick_key("5field", 300): + _tick_text("5field", 300, -1200, 400001), + } + stub.programs._mappings["ticks"] = ticks + assert dex.find_tick_predecessor("5field", -4080) == MIN_TICK_SENTINEL + assert dex.find_tick_predecessor("5field", -600) == -1200 + assert dex.find_tick_predecessor("5field", 500) == 300 + # A tick already in the list returns itself (validation is skipped). + assert dex.find_tick_predecessor("5field", 300) == 300 + # Fresh pool (no sentinel entry) anchors at the sentinel. + stub.programs._mappings["ticks"] = {} + assert dex.find_tick_predecessor("5field", 0) == MIN_TICK_SENTINEL From 9fbec68a145deb23dd4a8735938f13fe27c61b5f Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Tue, 28 Jul 2026 14:47:54 -0500 Subject: [PATCH 21/23] chore: bump aleo-sdk, aleo-contract-abi-generator, shield-swap-sdk to 0.3.0 shield-swap-sdk now floors aleo-sdk at 0.3 (Array codegen runtime). Docs updated: staging auth/session + referral-vs-access invites, live- verified LP behaviors (tick-list hints, wrapped-side exact amounts, slippage headroom), sdk-abi example re-pointed at the new stack. --- sdk-abi/Cargo.lock | 2 +- sdk-abi/Cargo.toml | 2 +- sdk-abi/README.md | 5 +++-- sdk-abi/pyproject.toml | 2 +- sdk/Cargo.lock | 2 +- sdk/Cargo.toml | 2 +- sdk/pyproject.toml | 2 +- shield-swap-sdk/README.md | 20 ++++++++++++++++--- shield-swap-sdk/pyproject.toml | 4 ++-- .../python/aleo_shield_swap/__init__.py | 2 +- shield-swap-sdk/tests/test_package.py | 2 +- 11 files changed, 30 insertions(+), 15 deletions(-) diff --git a/sdk-abi/Cargo.lock b/sdk-abi/Cargo.lock index 550a81d2..c2a2bbdd 100644 --- a/sdk-abi/Cargo.lock +++ b/sdk-abi/Cargo.lock @@ -19,7 +19,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aleo-abi" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "leo-abi", diff --git a/sdk-abi/Cargo.toml b/sdk-abi/Cargo.toml index 5bc1351d..fdf586b2 100644 --- a/sdk-abi/Cargo.toml +++ b/sdk-abi/Cargo.toml @@ -5,7 +5,7 @@ [package] name = "aleo-abi" -version = "0.2.2" +version = "0.3.0" edition = "2024" license = "GPL-3.0-or-later" description = "Python bindings for ABI generation from Aleo bytecode (via Leo's leo-abi crate)" diff --git a/sdk-abi/README.md b/sdk-abi/README.md index 2b882453..9ead6ee6 100644 --- a/sdk-abi/README.md +++ b/sdk-abi/README.md @@ -50,8 +50,9 @@ dependents: ```python abi_json = aleo_abi.generate_abi( - "shield_swap_v3.aleo", amm_bytecode, "testnet", - [("test_shield_swap_multisig_core.aleo", multisig_bytecode)], + "shield_swap.aleo", amm_bytecode, "testnet", + [("shield_swap_multisig_core.aleo", multisig_bytecode), + ("shield_swap_freezelist.aleo", freezelist_bytecode)], ) ``` diff --git a/sdk-abi/pyproject.toml b/sdk-abi/pyproject.toml index 343d4268..ae4228e0 100644 --- a/sdk-abi/pyproject.toml +++ b/sdk-abi/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "aleo-contract-abi-generator" -version = "0.2.2" +version = "0.3.0" description = "Python bindings for ABI generation from Aleo bytecode" readme = "README.md" license = {text = "GPL-3.0-or-later"} diff --git a/sdk/Cargo.lock b/sdk/Cargo.lock index 61dc8864..27209f07 100644 --- a/sdk/Cargo.lock +++ b/sdk/Cargo.lock @@ -25,7 +25,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aleo" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "hex", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index c94107fe..d864b5a2 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "aleo" authors = ["Konstantin Pandl", "Mike Turner", "Roman Proskuryakov"] -version = "0.2.2" +version = "0.3.0" description = "A Python sdk for zero-knowledge cryptography based on Aleo" edition = "2021" license = "GPL-3.0-or-later" diff --git a/sdk/pyproject.toml b/sdk/pyproject.toml index 540fa8c6..9c4a441d 100644 --- a/sdk/pyproject.toml +++ b/sdk/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "aleo-sdk" description = "Python SDK for building zero-knowledge apps and DeFi on the Aleo network" -version = "0.2.2" +version = "0.3.0" readme = "Readme.md" license = {file = "LICENSE.md"} authors = [ diff --git a/shield-swap-sdk/README.md b/shield-swap-sdk/README.md index 22b30c94..8f8094ca 100644 --- a/shield-swap-sdk/README.md +++ b/shield-swap-sdk/README.md @@ -39,7 +39,7 @@ pip install -e "shield-swap-sdk[async]" # + AsyncShieldSwap (httpx) pip install -e "shield-swap-sdk[mcp]" # + the MCP server ``` -Requires `aleo-sdk>=0.2` (this repo's SDK; imports as `aleo`) and Python 3.10+. +Requires `aleo-sdk>=0.3` (this repo's SDK; imports as `aleo`) and Python 3.10+. ## Agents @@ -108,14 +108,28 @@ from the chain or the service. Quote before you swap: pass `expected_out` from `dex.api.get_route(...)` — without it a spot estimate is used, which ignores fees and price impact. +On busy pools leave slippage headroom: prices move between quote and +finalize, and a too-tight `amount_out_min` rejects safely at finalize. Amounts are `u128` base units of the token; fees are microcredits. +Two liquidity behaviors worth knowing (both verified live): `mint` walks +the pool's on-chain tick list to compute its insertion hints +(`find_tick_predecessor`) — pass `tick_*_hint=` only if you know better. +And when a pool side is **wrapped**, routed `mint`/`increase` amounts for +that side must be *exactly* what the range consumes (the router burns the +wrapper change record) — single-sided ranges make this deterministic; +in-range wrapped amounts depend on the live price. + **DEX API** (`dex.api`, standalone as `ApiClient`): `get_pools`, `get_tokens`, `get_route`, `get_swap`, `get_ohlcv`, `get_public_balances`. Route quoting, OHLCV, and balances are auth-gated — call `api.authenticate(address, sign)` once (challenge/verify by signature, no -funds required); some deployments additionally gate them behind an invite -code. +funds required; the session rides as httpOnly cookies + a CSRF header and +is short-lived — mint a durable `ss_…` token via `create_api_token` for +anything long-running). Accounts additionally need a one-time invite: +`redeem_code` takes the **referral code** a human pasted; access codes are +a separate programmatic self-registration tier +(`generate_access_codes` / `redeem_access_code`). ## Privacy diff --git a/shield-swap-sdk/pyproject.toml b/shield-swap-sdk/pyproject.toml index f40e315d..1b3ddc92 100644 --- a/shield-swap-sdk/pyproject.toml +++ b/shield-swap-sdk/pyproject.toml @@ -1,10 +1,10 @@ [project] name = "shield-swap-sdk" -version = "0.2.2" +version = "0.3.0" description = "Python SDK for the shield swap AMM Dex on Aleo" readme = "README.md" requires-python = ">=3.10" -dependencies = ["aleo-sdk>=0.2", "requests>=2"] +dependencies = ["aleo-sdk>=0.3", "requests>=2"] [project.optional-dependencies] async = ["httpx>=0.27"] diff --git a/shield-swap-sdk/python/aleo_shield_swap/__init__.py b/shield-swap-sdk/python/aleo_shield_swap/__init__.py index c9e4bc89..fc8e8e29 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/__init__.py +++ b/shield-swap-sdk/python/aleo_shield_swap/__init__.py @@ -70,7 +70,7 @@ def agent_guide() -> str: return files(__name__).joinpath("AGENTS.md").read_text() -__version__ = "0.2.2" +__version__ = "0.3.0" __all__ = [ "ShieldSwap", "AsyncShieldSwap", "ApiClient", "AsyncApiClient", diff --git a/shield-swap-sdk/tests/test_package.py b/shield-swap-sdk/tests/test_package.py index 472ac0b6..2df94037 100644 --- a/shield-swap-sdk/tests/test_package.py +++ b/shield-swap-sdk/tests/test_package.py @@ -2,7 +2,7 @@ def test_version(): - assert aleo_shield_swap.__version__ == "0.2.2" + assert aleo_shield_swap.__version__ == "0.3.0" def test_lifecycle_exports(): From 18730d2232af855520482d692c1e2844084e5502 Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Wed, 29 Jul 2026 05:30:51 -0500 Subject: [PATCH 22/23] chore: bump versions to 0.3.1 --- sdk-abi/Cargo.lock | 2 +- sdk-abi/Cargo.toml | 2 +- sdk-abi/pyproject.toml | 2 +- sdk/Cargo.lock | 2 +- sdk/Cargo.toml | 2 +- sdk/pyproject.toml | 2 +- shield-swap-sdk/pyproject.toml | 2 +- shield-swap-sdk/python/aleo_shield_swap/__init__.py | 2 +- shield-swap-sdk/tests/test_package.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk-abi/Cargo.lock b/sdk-abi/Cargo.lock index c2a2bbdd..2d60c7b6 100644 --- a/sdk-abi/Cargo.lock +++ b/sdk-abi/Cargo.lock @@ -19,7 +19,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aleo-abi" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "leo-abi", diff --git a/sdk-abi/Cargo.toml b/sdk-abi/Cargo.toml index fdf586b2..0c105f87 100644 --- a/sdk-abi/Cargo.toml +++ b/sdk-abi/Cargo.toml @@ -5,7 +5,7 @@ [package] name = "aleo-abi" -version = "0.3.0" +version = "0.3.1" edition = "2024" license = "GPL-3.0-or-later" description = "Python bindings for ABI generation from Aleo bytecode (via Leo's leo-abi crate)" diff --git a/sdk-abi/pyproject.toml b/sdk-abi/pyproject.toml index ae4228e0..96f423ff 100644 --- a/sdk-abi/pyproject.toml +++ b/sdk-abi/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "aleo-contract-abi-generator" -version = "0.3.0" +version = "0.3.1" description = "Python bindings for ABI generation from Aleo bytecode" readme = "README.md" license = {text = "GPL-3.0-or-later"} diff --git a/sdk/Cargo.lock b/sdk/Cargo.lock index 27209f07..cdf626f6 100644 --- a/sdk/Cargo.lock +++ b/sdk/Cargo.lock @@ -25,7 +25,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aleo" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "hex", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index d864b5a2..2d9e3d4a 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "aleo" authors = ["Konstantin Pandl", "Mike Turner", "Roman Proskuryakov"] -version = "0.3.0" +version = "0.3.1" description = "A Python sdk for zero-knowledge cryptography based on Aleo" edition = "2021" license = "GPL-3.0-or-later" diff --git a/sdk/pyproject.toml b/sdk/pyproject.toml index 9c4a441d..71aabbce 100644 --- a/sdk/pyproject.toml +++ b/sdk/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "aleo-sdk" description = "Python SDK for building zero-knowledge apps and DeFi on the Aleo network" -version = "0.3.0" +version = "0.3.1" readme = "Readme.md" license = {file = "LICENSE.md"} authors = [ diff --git a/shield-swap-sdk/pyproject.toml b/shield-swap-sdk/pyproject.toml index 1b3ddc92..a3d8eaaa 100644 --- a/shield-swap-sdk/pyproject.toml +++ b/shield-swap-sdk/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "shield-swap-sdk" -version = "0.3.0" +version = "0.3.1" description = "Python SDK for the shield swap AMM Dex on Aleo" readme = "README.md" requires-python = ">=3.10" diff --git a/shield-swap-sdk/python/aleo_shield_swap/__init__.py b/shield-swap-sdk/python/aleo_shield_swap/__init__.py index fc8e8e29..0852e2d3 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/__init__.py +++ b/shield-swap-sdk/python/aleo_shield_swap/__init__.py @@ -70,7 +70,7 @@ def agent_guide() -> str: return files(__name__).joinpath("AGENTS.md").read_text() -__version__ = "0.3.0" +__version__ = "0.3.1" __all__ = [ "ShieldSwap", "AsyncShieldSwap", "ApiClient", "AsyncApiClient", diff --git a/shield-swap-sdk/tests/test_package.py b/shield-swap-sdk/tests/test_package.py index 2df94037..05c48c45 100644 --- a/shield-swap-sdk/tests/test_package.py +++ b/shield-swap-sdk/tests/test_package.py @@ -2,7 +2,7 @@ def test_version(): - assert aleo_shield_swap.__version__ == "0.3.0" + assert aleo_shield_swap.__version__ == "0.3.1" def test_lifecycle_exports(): From bc96c42807c5fa17669a9144aa75955d6db08bdd Mon Sep 17 00:00:00 2001 From: Mike Turner Date: Thu, 30 Jul 2026 12:05:37 -0700 Subject: [PATCH 23/23] docs: voice.md docstrings for the undocumented public surface (#65) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: voice.md docstrings for the undocumented public surface Adds docstrings to the 206 public classes/methods in sdk/python/aleo and shield-swap-sdk that had none, following .agents/voice.md: present-tense verb lead, side effects named (network / fee / local-only), and each argument, return, and raised error described by consequence. Section syntax follows each file's local idiom rather than one global rule — numpy `Parameters` inside facade/ (54 existing blocks, and voice.md shipped in the same commit as those files), Google `Args:` elsewhere. shield-swap keeps its terser prose voice and its "see :meth:`ApiClient.X`" convention for async mirrors. Where a sync counterpart was already documented the text is mirrored, with async-specific facts corrected: wait_for_transaction_confirmation yields to the event loop via asyncio.sleep, AsyncDexCall.simulate explains why it is not awaited, and three cross-references now point at the async classes instead of RecordScanner / AleoNetworkClient. Three behaviours were checked against the code rather than assumed: get_block_range's end-inclusivity varies by node build (the e2e test says so) so the docstring warns against relying on the last element; decrypt_enabled gates find_credits_record(s), not owned(), which decrypts opportunistically; and codegen's main() exits via argparse on a usage error rather than returning 1. Also removes ApiClient.generate_access_codes and its async mirror. Minting invite/access codes should not be part of the SDK surface. redeem_access_code stays, so a code obtained out-of-band still works, and human-pasted referral invites keep going through redeem_code. Note this reduces SDK surface, not access: POST /access/generate is still reachable directly, and the real gate is the server-side generate right. test_minting_access_codes_is_not_exposed guards the removal. shield-swap-sdk/AGENTS.md is generated from these docstrings, so both copies are regenerated. Four TIER2 entries (api.get_pools, api.get_tokens, derive_pool_key, derive_tick_key) rendered with blank bodies before and now carry real text, which pushed the page past test_gen_context.py's compactness budget — that threshold moves 22k to 24k, with the reason recorded alongside the prior 20k to 22k raise. Verified: 890 passed (sdk, -m "not slow"), 174 passed (shield-swap), pyright strict 0 errors on sdk, gen_context.py --check clean. The 15 pyright errors in shield-swap-sdk are pre-existing and unchanged (confirmed by re-running against HEAD). * fix(facade): exact credits/microcredits conversion (#66) Both directions went through binary floating point and lost value. `credits_to_microcredits` multiplied by 1_000_000 as a float and then truncated toward zero with int(), so ordinary amounts silently underpaid: 1.005 credits became 1_004_999 microcredits, not 1_005_000. Sub-microcredit input was dropped with no error at all (0.9999999 -> 999_999). `microcredits_to_credits` returned a float. Microcredits are a u64, and past 2**53 a float cannot hold the integer — u64 max round-tripped off by one, and 2884 of the first 200_000 microcredit values failed `micro -> credits -> micro` identity. Both now compute in Decimal. Float input is routed through str(), which recovers the shortest representation that round-trips — i.e. the literal the caller wrote — which is what rescues 1.005; str and Decimal input are exact already. Sub-microcredit precision now raises ValueError naming the value, with allow_rounding=True to opt back into truncation, so lost value is an error rather than a silent underpayment. `from_microcredits` returns Decimal instead of float. It still compares equal to the obvious float, so existing assertions hold unchanged, but mixing it into float arithmetic now raises — convert with float() deliberately if you want that, accepting the loss. Scope is contained: these are user-facing convenience helpers only. No internal fee or amount path consumes them (the SDK is integer microcredits end to end), and shield-swap does not use them. Verified: 896 passed (sdk, -m "not slow"; +6 new), pyright strict 0 errors, shield-swap 174 passed and unaffected. * docs: clarify OwnedFilter uuid default wording * docs: drop the self-hosted-scanner recommendation from record docstrings * docs: drop redundant 'Hits the network' notes and the block-range build caveat * docs: make get_pools/get_tokens concrete, name methods instead of 'verbs' * docs(voice): ban "reach for" and vague hedges * docs: drop self-hosted-scanner advice everywhere, keep the view-key disclosure * docs(voice): drop self-hosting from the privacy stance * docs: drop self-hosted-scanner mentions from the READMEs * docs(shield-swap): say "methods", not "verbs" * docs: tighten get_pools, explain why token info can be None * docs: simplify the token-info None explanation * docs(voice): require plain verbs; reword get_tokens decimals note * docs: reword get_swap lag note and get_public_balances * docs: state get_ohlcv's real granularity values and unix-second bounds * docs: explain what the Journal is on the class itself * docs: state that a profile holds one Aleo address * docs: add a Profile create/load usage example --- .agents/voice.md | 38 +- .claude/skills/shield-swap/SKILL.md | 4 +- README.md | 2 +- sdk/Readme.md | 2 +- sdk/python/aleo/_client_common.py | 44 ++ sdk/python/aleo/_facade_common.py | 96 +++- sdk/python/aleo/_scanner_common.py | 47 ++ sdk/python/aleo/async_network_client.py | 485 ++++++++++++++++++ sdk/python/aleo/async_record_scanner.py | 72 +++ sdk/python/aleo/codegen/__main__.py | 14 + sdk/python/aleo/codegen/_emit.py | 16 + sdk/python/aleo/encryptor.py | 6 + sdk/python/aleo/facade/async_client.py | 311 ++++++++++- sdk/python/aleo/facade/client.py | 66 ++- sdk/python/aleo/facade/records.py | 30 +- sdk/python/aleo/network_client.py | 480 +++++++++++++++++ sdk/python/aleo/record_scanner.py | 72 +++ sdk/python/aleo/testing/devnode.py | 10 + sdk/python/tests/test_facade_client.py | 50 ++ sdk/python/tests/test_proving.py | 2 +- shield-swap-sdk/AGENTS.md | 49 +- shield-swap-sdk/README.md | 19 +- shield-swap-sdk/codegen/gen_context.py | 18 +- .../python/aleo_shield_swap/AGENTS.md | 49 +- .../python/aleo_shield_swap/_calls.py | 4 +- .../python/aleo_shield_swap/_core.py | 6 + .../python/aleo_shield_swap/_routing.py | 30 ++ .../python/aleo_shield_swap/agent.py | 6 +- .../python/aleo_shield_swap/api.py | 76 ++- .../python/aleo_shield_swap/async_client.py | 119 ++++- .../python/aleo_shield_swap/client.py | 63 ++- .../python/aleo_shield_swap/errors.py | 12 + .../python/aleo_shield_swap/journal.py | 102 +++- .../python/aleo_shield_swap/lifecycle.py | 12 + .../python/aleo_shield_swap/mcp.py | 8 +- .../python/aleo_shield_swap/profile.py | 75 ++- .../python/aleo_shield_swap/skills/SKILL.md | 4 +- .../python/aleo_shield_swap/types.py | 34 +- shield-swap-sdk/scripts/rehearsal.py | 2 +- .../integration/test_devnode_lifecycle.py | 2 +- shield-swap-sdk/tests/test_api_client.py | 23 +- shield-swap-sdk/tests/test_gen_context.py | 12 +- shield-swap-sdk/tests/test_liquidity.py | 2 +- 43 files changed, 2425 insertions(+), 149 deletions(-) diff --git a/.agents/voice.md b/.agents/voice.md index a64c1258..75b1e900 100644 --- a/.agents/voice.md +++ b/.agents/voice.md @@ -55,6 +55,41 @@ Why it fails: filler ("easily", "powerfully", "seamless"); restates types; says "a result" instead of what you get and what you do with it; no side-effect or error information. +### Phrasings to avoid + +Beyond the filler above, these are banned outright. Each one reads like guidance +while leaving the caller with nothing to act on — replace it with the concrete +instruction, or delete it. + +- **"reach for"** — never use it. Say what to call and when. +- **"defensively"**, **"as appropriate"**, **"where necessary"** — name the + actual condition instead. + +```python +# Bad — sounds like advice, gives none +"""… either may be ``None``, so reach for them defensively.""" + +# Good — states the check and what it protects +"""… treat both as optional — guard with ``if entry.token0_info`` before +reading a field rather than assuming a default.""" +``` + +### Plain verbs + +Say what the code does, not what it is like. A service or object does not +"speak", "know", "want", or "see" — it returns, accepts, requires, stores, +decrypts. Figurative verbs read as style and cost the reader a translation step. + +```python +# Bad — figurative +"""The API speaks decimal amounts; the contract speaks base units.""" +"""Every pool the indexer knows.""" + +# Good — plain +"""The API returns decimal amounts; the contract takes base units.""" +"""Every pool the DEX lists.""" +``` + ## Naming in prose and examples - Use the Pythonic surface: properties (`key.address`, not `key.address()`), @@ -71,4 +106,5 @@ error information. This is a privacy chain. Do not document or add affordances that link signatures to signer addresses (no `recover`-style verb). When a feature shares secret material with a service (e.g. delegated record scanning shares the view -key), state that tradeoff plainly and point to the self-hosted alternative. +key), state that tradeoff plainly. Where an alternative exists, name the +supported extension point (e.g. assigning a custom ``RecordProvider``). diff --git a/.claude/skills/shield-swap/SKILL.md b/.claude/skills/shield-swap/SKILL.md index 46baaaae..9643bd48 100644 --- a/.claude/skills/shield-swap/SKILL.md +++ b/.claude/skills/shield-swap/SKILL.md @@ -5,7 +5,7 @@ description: Use when the user wants to trade, LP, or build on the shield_swap A Read `shield-swap-sdk/AGENTS.md` (generated from the SDK — always current) and follow its Tier 1 lifecycle and conversation pattern. Write Python -against the SDK; don't re-implement flows the verbs already provide, and +against the SDK; don't re-implement flows the methods already provide, and don't read SDK source unless AGENTS.md genuinely lacks the answer. Preconditions are enforced in code — on error, read the exception message; -it names the verb that fixes it. +it names the method that fixes it. diff --git a/README.md b/README.md index c4647d57..c0b5a71e 100644 --- a/README.md +++ b/README.md @@ -203,7 +203,7 @@ credits.functions.transfer_private(record, str(recipient.address), 1) \ .delegate(account) ``` -`aleo.record_provider` is swappable: set it to your own object implementing the `RecordProvider` protocol (`get_unspent_credits_record` / `find`) — e.g. a self-hosted scanner — and the whole facade (including private-fee auto-sourcing) uses it, with no view-key sharing. +`aleo.record_provider` is swappable: set it to your own object implementing the `RecordProvider` protocol (`get_unspent_credits_record` / `find`), and the whole facade (including private-fee auto-sourcing) uses it, with no view-key sharing. ## Async (`AsyncAleo`) diff --git a/sdk/Readme.md b/sdk/Readme.md index 3fb9b327..bc5145d5 100644 --- a/sdk/Readme.md +++ b/sdk/Readme.md @@ -162,7 +162,7 @@ credits.functions.transfer_private(record, str(recipient.address), 1) \ .delegate(account) ``` -`aleo.record_provider` is swappable: set it to your own object implementing the `RecordProvider` protocol (`get_unspent_credits_record` / `find`) — e.g. a self-hosted scanner — and the whole facade (including private-fee auto-sourcing) uses it, with no view-key sharing. +`aleo.record_provider` is swappable: set it to your own object implementing the `RecordProvider` protocol (`get_unspent_credits_record` / `find`), and the whole facade (including private-fee auto-sourcing) uses it, with no view-key sharing. ## Async (`AsyncAleo`) diff --git a/sdk/python/aleo/_client_common.py b/sdk/python/aleo/_client_common.py index f46142a8..8c570135 100644 --- a/sdk/python/aleo/_client_common.py +++ b/sdk/python/aleo/_client_common.py @@ -53,6 +53,15 @@ def is_provable_host(url: str) -> bool: def package_version() -> str: + """Return the installed SDK version, for the telemetry headers. + + Checks the current distribution name first, then the pre-0.2 name, so older + installs still report their real version. + + Returns: + The version string, or ``"0.0.0"`` when the package metadata cannot be + read (a source tree that was never installed). + """ from importlib.metadata import version # "aleo" is the pre-0.2 distribution name; keep it as a fallback so @@ -78,6 +87,13 @@ def user_agent() -> str: def make_default_headers() -> dict[str, str]: + """Build the SDK's baseline telemetry headers for a new client. + + Returns: + The version and environment headers every default-transport request + carries. Callers who pass their own ``headers`` replace these outright, + and a custom transport strips them — see :func:`method_headers`. + """ return { "X-Aleo-SDK-Version": package_version(), "X-Aleo-environment": "python", @@ -94,6 +110,19 @@ def method_headers( method: str, has_custom_transport: bool, ) -> dict[str, str]: + """Build the headers for one request, honouring custom-transport mode. + + Args: + headers: The client's configured headers. + method: SDK method name, sent as ``X-ALEO-METHOD`` so calls can be + attributed server-side. + has_custom_transport: True when the caller owns the HTTP layer, in which + case every SDK-internal header — including the method name and + ``User-Agent`` — is withheld so the caller controls the wire format. + + Returns: + The headers to send. + """ if has_custom_transport: return user_headers(headers) return {**headers, "X-ALEO-METHOD": method, "User-Agent": user_agent()} @@ -106,6 +135,11 @@ def jwt_origin(host: str) -> str: def now_ms() -> int: + """Return the current wall-clock time in epoch milliseconds. + + Matches the unit JWT expiries are stored in, so the two compare directly. + Wall-clock, not monotonic — do not use it to measure elapsed time. + """ return int(time.time() * 1000) @@ -118,6 +152,16 @@ def jwt_expired(jwt_data: dict[str, Any]) -> bool: def validate_block_range(start: int, end: int) -> None: + """Reject a block range the node would refuse, before sending it. + + Args: + start: First height of the range. + end: Last height of the range. + + Raises: + ValueError: If *start* is negative, exceeds *end*, or the span is wider + than the 50-block per-request cap. + """ if start < 0: raise ValueError("start must be >= 0") if start > end: diff --git a/sdk/python/aleo/_facade_common.py b/sdk/python/aleo/_facade_common.py index 164ffc9f..3af59cc1 100644 --- a/sdk/python/aleo/_facade_common.py +++ b/sdk/python/aleo/_facade_common.py @@ -5,10 +5,15 @@ """ from __future__ import annotations -from typing import Any, Protocol, runtime_checkable +from decimal import Decimal, ROUND_DOWN +from typing import Any, Protocol, Union, runtime_checkable _MICROCREDITS_PER_CREDIT: int = 1_000_000 +#: What a credits amount may be written as. ``str`` and ``Decimal`` are exact; +#: ``float`` is not (see :func:`credits_to_microcredits`). +CreditsAmount = Union[str, int, Decimal, float] + @runtime_checkable class RecordProvider(Protocol): @@ -17,9 +22,8 @@ class RecordProvider(Protocol): The default implementation is :class:`~aleo.facade.records.RecordsModule` (``aleo.records``), which wraps a delegated :class:`~aleo.record_scanner.RecordScanner`. Any object that satisfies this Protocol can be assigned to - ``aleo.record_provider`` — e.g. a self-hosted scanner wrapper — so callers - who do not want to share their view key with a hosted scanning service can - plug in their own source of records. + ``aleo.record_provider``, so callers who do not want to share their view key + with a hosted scanning service can plug in their own source of records. Implementations are consumed by :meth:`~aleo.facade.call.BoundCall.build_transaction` (and the rest of the verb ladder) to auto-source a credits record for a @@ -46,8 +50,44 @@ def find(self, **filters: Any) -> list[Any]: ... -def credits_to_microcredits(credits: float | int) -> int: - """Convert a credits amount (float or int) to integer microcredits. +def _to_decimal(credits: CreditsAmount) -> Decimal: + """Interpret a credits amount exactly. + + A ``float`` has already lost the value the caller wrote — ``1.005`` is really + ``1.00499999999999989...`` — so it is routed through ``str()``, which yields + the shortest representation that round-trips, i.e. the literal as typed. + ``str``, ``int``, and ``Decimal`` are exact already. + """ + if isinstance(credits, Decimal): + return credits + if isinstance(credits, int): + return Decimal(credits) + return Decimal(str(credits)) + + +def credits_to_microcredits( + credits: CreditsAmount, *, allow_rounding: bool = False +) -> int: + """Convert a credits amount to integer microcredits, exactly. + + Computed in decimal, never binary floating point: ``1.005`` credits is + 1_005_000 microcredits, where a float multiply would truncate to 1_004_999 + and silently lose value. Pass *credits* as ``str`` or ``Decimal`` for full + exactness; a ``float`` is interpreted as the decimal literal it prints as. + + Args: + credits: Credits amount — ``"1.005"``, ``Decimal("1.005")``, ``1``, or + ``1.005``. + allow_rounding: Permit input finer than one microcredit, truncating + toward zero. Off by default so lost precision is an error rather + than a silent underpayment. + + Returns: + The amount in microcredits. + + Raises: + ValueError: If *credits* carries sub-microcredit precision and + *allow_rounding* is False, or is not a usable number. Examples -------- @@ -55,18 +95,46 @@ def credits_to_microcredits(credits: float | int) -> int: 1000000 >>> credits_to_microcredits(1.5) 1500000 + >>> credits_to_microcredits("1.005") + 1005000 """ - return int(credits * _MICROCREDITS_PER_CREDIT) - - -def microcredits_to_credits(microcredits: int) -> float: - """Convert an integer microcredits amount to a credits float. + try: + scaled = _to_decimal(credits) * _MICROCREDITS_PER_CREDIT + except (ArithmeticError, ValueError, TypeError) as exc: + raise ValueError(f"{credits!r} is not a valid credits amount") from exc + if not scaled.is_finite(): + raise ValueError(f"{credits!r} is not a finite credits amount") + rounded = scaled.to_integral_value(rounding=ROUND_DOWN) + if scaled != rounded and not allow_rounding: + raise ValueError( + f"{credits!r} credits is {scaled} microcredits — finer than the " + "chain's smallest unit. Round it yourself, or pass " + "allow_rounding=True to truncate toward zero." + ) + return int(rounded) + + +def microcredits_to_credits(microcredits: int) -> Decimal: + """Convert integer microcredits to credits, exactly. + + Returns a :class:`~decimal.Decimal` rather than a float: microcredits are a + ``u64``, and past 2**53 a float cannot even hold the integer, so a float + round-trip is not the identity. Compares equal to the obvious float + (``microcredits_to_credits(1_500_000) == 1.5``), but mixing it into float + arithmetic raises — convert deliberately with ``float(...)`` if you want + that, accepting the precision loss. + + Args: + microcredits: Amount in microcredits. + + Returns: + The amount in credits, exact at any ``u64`` magnitude. Examples -------- >>> microcredits_to_credits(1_000_000) - 1.0 + Decimal('1.000000') >>> microcredits_to_credits(1_500_000) - 1.5 + Decimal('1.500000') """ - return microcredits / _MICROCREDITS_PER_CREDIT + return Decimal(int(microcredits)).scaleb(-6) diff --git a/sdk/python/aleo/_scanner_common.py b/sdk/python/aleo/_scanner_common.py index 55f64b7c..73498aad 100644 --- a/sdk/python/aleo/_scanner_common.py +++ b/sdk/python/aleo/_scanner_common.py @@ -53,6 +53,13 @@ def __init__( # --------------------------------------------------------------------------- class RecordsResponseFilter(TypedDict, total=False): + """Selects which fields the scanner returns for each encrypted record. + + Set a key to True to include that field. Every key is optional; omitting all + of them lets the service pick its defaults. Narrowing the projection is the + cheapest way to cut response size on a wide scan. + """ + block_height: bool block_timestamp: bool checksum: bool @@ -72,6 +79,19 @@ class RecordsResponseFilter(TypedDict, total=False): class RecordsFilter(TypedDict, total=False): + """Narrows an encrypted-record query by range, program, and paging. + + Every key is optional and they compose as an AND. ``start``/``end`` bound the + block range; ``programs``/``records``/``functions`` filter by origin (with + ``program``/``record`` as the singular forms); ``page`` and + ``results_per_page`` walk large result sets; ``spent`` selects by spend + status. ``response`` controls which fields come back — see + :class:`RecordsResponseFilter`. + + Note that the scanner applies this filter server-side, so its contents tell + the service what you are looking for. + """ + commitments: list[str] response: RecordsResponseFilter start: int @@ -87,6 +107,14 @@ class RecordsFilter(TypedDict, total=False): class OwnedRecordsResponseFilter(TypedDict, total=False): + """Selects which fields the scanner returns for each owned record. + + Set a key to True to include that field. Differs from + :class:`RecordsResponseFilter` by carrying the ownership-derived ``tag`` and + ``spent`` fields, which only exist once a record has been matched to a + registered view key. + """ + commitment: bool owner: bool tag: bool @@ -106,6 +134,17 @@ class OwnedRecordsResponseFilter(TypedDict, total=False): class OwnedFilter(TypedDict, total=False): + """Narrows an owned-record query for one registered UUID. + + ``uuid`` picks which registration to read; it defaults to the scanner object's + configured UUID when omitted. ``unspent`` drops already-spent records, ``nonces`` + restricts to specific record nonces, and ``decrypt`` asks the service to + return plaintext — which requires it to hold your view key. Prefer local + decryption (see ``set_decrypt_enabled``) to keep the plaintext off the wire. + + ``filter`` and ``responseFilter`` nest the query and projection controls. + """ + uuid: str unspent: bool decrypt: bool @@ -115,6 +154,14 @@ class OwnedFilter(TypedDict, total=False): class OwnedRecord(TypedDict, total=False): + """One record the scanner matched to a registered view key. + + Which keys are present depends on the projection requested via + :class:`OwnedRecordsResponseFilter`, so treat every field as optional and read + it with ``.get``. ``record_plaintext`` appears only once the record has been + decrypted — either locally or by the service. + """ + block_height: int block_timestamp: int commitment: str diff --git a/sdk/python/aleo/async_network_client.py b/sdk/python/aleo/async_network_client.py index 32e6cdb7..2ba8d2dd 100644 --- a/sdk/python/aleo/async_network_client.py +++ b/sdk/python/aleo/async_network_client.py @@ -165,6 +165,18 @@ def _net(self) -> Any: # ── Mutators ────────────────────────────────────────────────────────── def set_host(self, host: str) -> None: + """Re-point the client at a different API host. + + Re-derives the read base, origin, and the delegated prover/scanner bases + from *host*, discarding any prover or scanner URI set earlier — call + :meth:`set_prover_uri` / :meth:`set_record_scanner_uri` again afterwards + if you had overridden them. Local only; opens no connection. + + Args: + host: Versioned API root, e.g. ``"https://api.provable.com/v2"``. + Off the hosted Provable API the prover and scanner bases are + left unset, since those services exist only there. + """ read_host, origin, prover_default, scanner_default = self._resolve_urls(host) self._origin = origin self._base_url = origin @@ -173,15 +185,39 @@ def set_host(self, host: str) -> None: self._record_scanner_uri = scanner_default def set_prover_uri(self, prover_uri: str) -> None: + """Point delegated proving at a specific prover host. + + Use this to prove against a non-default prover; the current network name + is appended for you, so pass the base without it. + + Args: + prover_uri: Prover base without the network suffix, e.g. + ``"https://api.provable.com/prove"``. + """ self._prover_uri = f"{prover_uri}/{self._network}" def set_record_scanner_uri(self, record_scanner_uri: str) -> None: + """Point record scanning at a specific scanner host. + + The current network name is appended for you, so pass the base without + it. Note that delegating a scan shares your view key with the service. + + Args: + record_scanner_uri: Scanner base without the network suffix, e.g. + ``"https://api.provable.com/scanner"``. + """ self._record_scanner_uri = f"{record_scanner_uri}/{self._network}" def set_account(self, account: Any) -> None: + """Attach an account for calls that need one to sign or decrypt. + + Args: + account: The account to associate with this client. + """ self._account = account def get_account(self) -> Any: + """Return the account attached by :meth:`set_account`, or None if unset.""" return self._account @property @@ -200,12 +236,35 @@ def scanner_uri(self) -> str | None: return self._record_scanner_uri def set_header(self, name: str, value: str) -> None: + """Set a header sent with every subsequent request. + + Overwrites any existing value for *name*, including the SDK defaults. + + Args: + name: Header name. + value: Header value. + """ self.headers[name] = value def remove_header(self, name: str) -> None: + """Stop sending a header, if it was set. Absent names are ignored. + + Args: + name: Header name to drop. + """ self.headers.pop(name, None) def set_verbose_errors(self, verbose: bool) -> None: + """Choose whether broadcasts ask the node to pre-check the transaction. + + When enabled (the default), :meth:`submit_transaction` broadcasts with + ``check_transaction=true`` so the node reports why a transaction is + invalid instead of silently dropping it — at the cost of extra node-side + verification work. + + Args: + verbose: True to request the pre-check, False to broadcast bare. + """ self._verbose_errors = verbose # ── Internal HTTP ───────────────────────────────────────────────────── @@ -306,53 +365,220 @@ async def _ensure_jwt( # ── Block endpoints ─────────────────────────────────────────────────── async def get_block(self, height: int) -> Any: + """Fetch the block at *height*. + + Args: + height: Block height to read. + + Returns: + The block as decoded JSON. + + Raises: + AleoNetworkError: If no block exists at that height, or the node + rejects the request. + """ return await self._get(f"/block/{height}", "getBlock") async def get_block_by_hash(self, block_hash: str) -> Any: + """Fetch a block by its hash. + + Args: + block_hash: Block hash (``ab1…``). + + Returns: + The block as decoded JSON. + + Raises: + AleoNetworkError: If the hash matches no block on this network. + """ return await self._get(f"/block/{block_hash}", "getBlockByHash") async def get_block_range(self, start: int, end: int) -> list[Any]: + """Fetch a range of blocks in one request. + + Args: + start: First height to fetch; must be non-negative. + end: Last height of the range; must be at least *start*, and no more + than 50 above it. + + Returns: + The blocks in ascending height order. + + Raises: + ValueError: If *start* is negative, exceeds *end*, or the span is + wider than 50 blocks — checked locally, before any request. + AleoNetworkError: If the node rejects the request. + """ validate_block_range(start, end) return await self._get(f"/blocks?start={start}&end={end}", "getBlockRange") async def get_latest_block(self) -> Any: + """Fetch the newest block the node has. + + Returns: + The latest block as decoded JSON. + + Raises: + AleoNetworkError: If the node rejects the request. + """ return await self._get("/block/latest", "getLatestBlock") async def get_latest_height(self) -> int: + """Fetch the current chain tip height. + + Cheaper than :meth:`get_latest_block` when you only need the number. + + Returns: + The height of the newest block. + + Raises: + AleoNetworkError: If the node rejects the request. + """ return int(await self._get("/block/height/latest", "getLatestHeight")) async def get_latest_block_hash(self) -> str: + """Fetch the hash of the newest block. + + Returns: + The latest block hash (``ab1…``). + + Raises: + AleoNetworkError: If the node rejects the request. + """ return str(await self._get("/block/hash/latest", "getLatestBlockHash")) async def get_latest_committee(self) -> Any: + """Fetch the current validator committee. + + Returns: + The committee — members and their stake — as decoded JSON. + + Raises: + AleoNetworkError: If the node rejects the request. + """ return await self._get("/committee/latest", "getLatestCommittee") async def get_committee_by_height(self, height: int) -> Any: + """Fetch the validator committee as of *height*. + + Args: + height: Block height whose committee you want. + + Returns: + The committee at that height as decoded JSON. + + Raises: + AleoNetworkError: If the node has pruned that height or rejects the + request. + """ return await self._get(f"/committee/{height}", "getCommitteeByHeight") async def get_state_root(self) -> str: + """Fetch the latest global state root. + + The state root pins the chain state an offline query is built against — + see :class:`OfflineQuery`. + + Returns: + The current state root (``sr1…``). + + Raises: + AleoNetworkError: If the node rejects the request. + """ return str(await self._get("/stateRoot/latest", "getStateRoot")) async def get_state_paths(self, commitments: list[str]) -> list[Any]: + """Fetch inclusion proofs for record commitments. + + State paths are what let a proof assert that a record was in the global + state tree without revealing which one — needed to execute offline. + + Args: + commitments: Record commitments to prove inclusion for; each is + URL-escaped before it goes on the wire. + + Returns: + One state path per commitment, in the order requested. + + Raises: + AleoNetworkError: If any commitment is unknown to the node, or the + node rejects the request. + """ csv = ",".join(quote(c, safe="") for c in commitments) return await self._get(f"/statePaths?commitments={csv}", "getStatePaths") # ── Program endpoints ───────────────────────────────────────────────── async def get_program(self, program_id: str, edition: int | None = None) -> str: + """Fetch a program's Aleo instructions source. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + edition: Which amendment to read; omit for the newest one on chain. + + Returns: + The program source text. + + Raises: + AleoNetworkError: If the program (or that edition of it) is not + deployed on this network. + """ if edition is not None: return await self._get(f"/program/{program_id}/{edition}", "getProgramVersion") return await self._get(f"/program/{program_id}", "getProgramVersion") async def get_latest_program_edition(self, program_id: str) -> int: + """Fetch the newest edition number for a program. + + Pass the result to :meth:`get_program` to pin a read to the edition you + checked, rather than racing a later amendment. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + + Returns: + The newest edition number on chain. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ raw = await self._get_raw(f"/program/{program_id}/latest_edition", "getLatestProgramEdition") return int(json.loads(raw)) async def get_program_amendment_count(self, program_id: str) -> Any: + """Fetch how many times a program has been amended. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + + Returns: + The amendment count as decoded JSON. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ raw = await self._get_raw(f"/program/{program_id}/amendment_count", "getProgramAmendmentCount") return json.loads(raw) async def get_program_object(self, program_id: str, edition: int | None = None) -> Any: + """Fetch a program and parse it into a ``Program``. + + Use this over :meth:`get_program` when you want to inspect functions, + mappings, or imports rather than hold the raw text. The result belongs to + the extension module matching this client's network — mainnet and testnet + types are not interchangeable. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + edition: Which amendment to read; omit for the newest one on chain. + + Returns: + The parsed program. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + ValueError: If the fetched source fails to parse. + """ Program = self._net().Program source = await self.get_program(program_id, edition) return Program.from_source(source) @@ -362,6 +588,26 @@ async def get_program_imports( program_id: str, imports: dict[str, str] | None = None, ) -> dict[str, str]: + """Fetch a program's full import closure, sources included. + + Walks imports depth-first, so an import's own imports are resolved before + it. Each distinct program is fetched once, but this still costs one + request per program in the closure. + + Args: + program_id: Program whose imports to resolve. + imports: Already-known ``{program_id: source}`` entries to treat as + fetched; mutated in place and returned. Pass a populated dict to + reuse a closure across calls. + + Returns: + Every transitive import as ``{program_id: source}``. The program + itself is not included. + + Raises: + AleoNetworkError: If the program or any of its imports is not + deployed on this network. + """ if imports is None: imports = {} source = await self.get_program(program_id) @@ -385,6 +631,20 @@ async def _collect_program_imports( return imports async def get_program_import_names(self, program_id: str) -> list[str]: + """Fetch the names a program imports directly. + + Unlike :meth:`get_program_imports` this does not recurse and does not + fetch the imported sources — one request, names only. + + Args: + program_id: Program whose imports to list. + + Returns: + The directly-imported program IDs, in declaration order. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ Program = self._net().Program source = await self.get_program(program_id) prog = Program.from_source(source) @@ -393,6 +653,25 @@ async def get_program_import_names(self, program_id: str) -> list[str]: async def get_program_mapping_plaintext( self, program_id: str, mapping_name: str, key: str ) -> Any: + """Read a mapping entry and parse it into a ``Plaintext``. + + Use this over :meth:`get_program_mapping_value` when the value is a struct + or record and you want to index into it instead of parsing the string + yourself. + + Args: + program_id: Program that owns the mapping. + mapping_name: Mapping to read. + key: Mapping key, written as the Aleo literal the mapping is keyed by. + + Returns: + The parsed value, from the extension module matching this client's + network. + + Raises: + AleoNetworkError: If the program or mapping does not exist. + ValueError: If the returned value fails to parse as plaintext. + """ Plaintext = self._net().Plaintext raw = await self._get_raw( f"/program/{program_id}/mapping/{mapping_name}/{key}", @@ -402,22 +681,78 @@ async def get_program_mapping_plaintext( return Plaintext.from_string(_json.loads(raw)) async def get_transaction_object(self, tx_id: str) -> Any: + """Fetch a transaction and parse it into a ``Transaction``. + + Use this over :meth:`get_transaction` when you want to walk transitions, + inputs, or outputs as typed objects. + + Args: + tx_id: Transaction ID (``at1…``). + + Returns: + The parsed transaction, from the extension module matching this + client's network. + + Raises: + AleoNetworkError: If the node does not know this transaction. + ValueError: If the response fails to parse as a transaction. + """ Transaction = self._net().Transaction raw = await self._get_raw(f"/transaction/{tx_id}", "getTransactionObject") return Transaction.from_json(raw) async def get_program_mapping_names(self, program_id: str) -> list[str]: + """Fetch the names of a program's mappings. + + Args: + program_id: Program whose mappings to list. + + Returns: + The mapping names declared by the program. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ return await self._get(f"/program/{program_id}/mappings", "getProgramMappingNames") async def get_program_mapping_value( self, program_id: str, mapping_name: str, key: str ) -> str: + """Read one entry out of a program mapping. + + Args: + program_id: Program that owns the mapping, e.g. ``"credits.aleo"``. + mapping_name: Mapping to read, e.g. ``"account"``. + key: Mapping key, written as the Aleo literal the mapping is keyed by + (an address for ``credits.aleo/account``). + + Returns: + The stored value as a string. An unset key reads back as the mapping's + zero value rather than raising. + + Raises: + AleoNetworkError: If the program or mapping does not exist, or the key + is malformed for the mapping's key type. + """ return await self._get( f"/program/{program_id}/mapping/{mapping_name}/{key}", "getProgramMappingValue", ) async def get_public_balance(self, address: str) -> int: + """Read an address's public ``credits.aleo`` balance. + + Public balance only — credits held privately in records are invisible + here, so a funded account can legitimately report 0. + + Args: + address: The address to look up (``aleo1…``). + + Returns: + The balance in microcredits, or 0 if the account has no public + balance. Network failures also read back as 0 rather than raising, + so do not use this to probe whether the node is reachable. + """ try: val = await self.get_program_mapping_value("credits.aleo", "account", address) return int(val) if val else 0 @@ -427,23 +762,97 @@ async def get_public_balance(self, address: str) -> int: # ── Transaction endpoints ───────────────────────────────────────────── async def get_transaction(self, tx_id: str) -> Any: + """Fetch a transaction by ID. + + Returns the transaction whether or not it has been confirmed; use + :meth:`get_confirmed_transaction` when you need its on-chain outcome. + + Args: + tx_id: Transaction ID (``at1…``). + + Returns: + The transaction as decoded JSON. + + Raises: + AleoNetworkError: If the node does not know this transaction. + """ return await self._get(f"/transaction/{tx_id}", "getTransaction") async def get_confirmed_transaction(self, tx_id: str) -> Any: + """Fetch a transaction along with its confirmed outcome. + + Args: + tx_id: Transaction ID (``at1…``). + + Returns: + The confirmed transaction as decoded JSON, including the ``status`` + field that distinguishes an accepted transaction from a rejected one. + + Raises: + AleoNetworkError: If the transaction is still unconfirmed or unknown + to the node. + """ return await self._get(f"/transaction/confirmed/{tx_id}", "getConfirmedTransaction") async def get_transactions(self, block_height: int) -> list[Any]: + """Fetch every transaction in one block. + + Args: + block_height: Height of the block to read. + + Returns: + The block's transactions as decoded JSON; empty if the block held + none. + + Raises: + AleoNetworkError: If no block exists at that height. + """ return await self._get(f"/block/{block_height}/transactions", "getTransactions") async def get_transactions_in_mempool(self) -> list[Any]: + """Fetch the transactions this node is holding unconfirmed. + + Mempool contents are per-node and change constantly — a transaction + missing here may still be in flight elsewhere. + + Returns: + The node's pending transactions as decoded JSON. + + Raises: + AleoNetworkError: If the node rejects the request — public nodes + often decline to expose their mempool. + """ return await self._get("/memoryPool/transactions", "getTransactionsInMempool") async def get_transition_id(self, input_or_output_id: str) -> str: + """Find which transition produced or consumed an input/output ID. + + Args: + input_or_output_id: A transition input or output ID to trace. + + Returns: + The enclosing transition ID (``au1…``). + + Raises: + AleoNetworkError: If nothing on chain matches that ID. + """ return await self._get( f"/find/transitionID/{input_or_output_id}", "getTransitionId" ) async def get_deployment_transaction_id_for_program(self, program_id: str) -> str: + """Find the transaction that deployed a program. + + Args: + program_id: Deployed program, e.g. ``"credits.aleo"``. + + Returns: + The deployment transaction ID (``at1…``), with the node's surrounding + JSON quotes stripped. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ raw = await self._get( f"/find/transactionID/deployment/{program_id}", "getDeploymentTransactionIDForProgram", @@ -451,12 +860,47 @@ async def get_deployment_transaction_id_for_program(self, program_id: str) -> st return strip_quotes(str(raw)) async def get_deployment_transaction_for_program(self, program_id: str) -> Any: + """Fetch the deployment transaction for a program. Costs two requests. + + Resolves the deployment ID, then fetches that transaction. + + Args: + program_id: Deployed program, e.g. ``"credits.aleo"``. + + Returns: + The deployment transaction as decoded JSON. + + Raises: + AleoNetworkError: If the program is not deployed on this network, or + the node cannot return its deployment transaction. + """ tx_id = await self.get_deployment_transaction_id_for_program(program_id) return await self.get_transaction(tx_id) # ── POST endpoints ──────────────────────────────────────────────────── async def submit_transaction(self, transaction: Any) -> str: + """Broadcast a proven transaction to the network. + + This spends the transaction's fee and is not reversible. Returning + successfully means the node accepted the broadcast, NOT that the + transaction was confirmed — pass the ID to + :meth:`wait_for_transaction_confirmation` for that. + + When verbose errors are on (the default) the node pre-checks the + transaction and explains rejections; see :meth:`set_verbose_errors`. + + Args: + transaction: The proven transaction; stringified before broadcast, so + either a ``Transaction`` or its serialized form works. + + Returns: + The broadcast transaction ID (``at1…``). + + Raises: + AleoNetworkError: If the node rejects the transaction — invalid proof, + insufficient fee, or a stale state root. + """ tx_str = str(transaction) endpoint = ( f"{self._host}/transaction/broadcast?check_transaction=true" @@ -467,6 +911,18 @@ async def submit_transaction(self, transaction: Any) -> str: return json.loads(resp.text) async def submit_solution(self, solution: str) -> str: + """Broadcast a prover solution to the network. + + Args: + solution: The serialized solution to submit. + + Returns: + The accepted solution's ID. + + Raises: + AleoNetworkError: If the node rejects the solution — stale epoch or + insufficient proof target. + """ resp = await self._post( f"{self._host}/solution/broadcast", solution, "submitSolution" ) @@ -480,6 +936,33 @@ async def wait_for_transaction_confirmation( check_interval: float = 2.0, timeout: float = 45.0, ) -> Any: + """Poll until a transaction is confirmed, yielding to the event loop. + + Sleeps with :func:`asyncio.sleep` between polls, so other tasks keep + running while this one waits. + + Polls the confirmed-transaction endpoint every *check_interval* seconds. + Transient failures — including the 404s expected while the transaction is + still propagating — are swallowed and retried; only an outright rejection + or a malformed ID stops the loop early. + + Args: + tx_id: Transaction ID to watch (``at1…``). + check_interval: Seconds to wait between polls. + timeout: Seconds to keep polling before giving up. Exceeding it means + the transaction never appeared, not that it failed — it may still + confirm afterwards. + + Returns: + The confirmed transaction as decoded JSON, once its status is + ``accepted``. + + Raises: + TimeoutError: If the transaction has not been confirmed within + *timeout* seconds. + AleoNetworkError: If the network rejected the transaction, or *tx_id* + is malformed. + """ import asyncio import time as _time @@ -528,6 +1011,7 @@ async def submit_proving_request_safe( consumer_id: str | None = None, jwt_data: dict[str, Any] | None = None, ) -> dict[str, Any]: + """Submit a proving request, returning {ok, data|error, status}. Never raises on HTTP errors.""" # Prover base: {origin}/prove/{network} on the hosted API (set at # construction). Off the hosted API there is no prover unless configured. prover_uri = url or self._prover_uri @@ -645,6 +1129,7 @@ async def submit_proving_request( consumer_id: str | None = None, jwt_data: dict[str, Any] | None = None, ) -> Any: + """Submit a proving request, raising AleoProvingError on failure.""" result = await self.submit_proving_request_safe( proving_request, url=url, diff --git a/sdk/python/aleo/async_record_scanner.py b/sdk/python/aleo/async_record_scanner.py index 628af59a..c55c3f14 100644 --- a/sdk/python/aleo/async_record_scanner.py +++ b/sdk/python/aleo/async_record_scanner.py @@ -124,18 +124,78 @@ def __init__( # ── Mutators ───────────────────────────────────────────────────────── def set_api_key(self, api_key: str | tuple[str, str] | dict[str, str]) -> None: + """Set the API key used to mint and refresh JWTs. + + Paired with :meth:`set_consumer_id`; with both set the scanner refreshes + its own JWT as needed. Local only — no request is made here. + + Parameters + ---------- + api_key: + The key as a bare string, a ``(header, value)`` pair, or a + ``{"header": ..., "value": ...}`` dict. A bare string uses the + default Provable API-key header. + """ self._api_key = normalize_api_key(api_key) def set_consumer_id(self, consumer_id: str) -> None: + """Set the consumer whose JWTs this scanner mints. + + Note that the scanner and the delegated prover share one consumer, and the + auth server keeps a single active JWT per consumer — so minting here can + invalidate the prover's cached JWT, and vice versa. Both sides re-mint on + rejection, so this self-heals. + + Parameters + ---------- + consumer_id: + The consumer ID registered with the auth service. + """ self.consumer_id = consumer_id def set_jwt_data(self, jwt_data: dict[str, Any] | None) -> None: + """Install a pre-minted JWT, skipping the next refresh. + + Parameters + ---------- + jwt_data: + ``{"jwt": str, "expiration": int}`` with the expiry in epoch + milliseconds. A JWT within five minutes of expiring is treated as + already expired and refreshed. Pass ``None`` to clear the cached + token and force a fresh mint on the next call. + """ self.jwt_data = jwt_data def set_auto_re_register(self, enabled: bool) -> None: + """Choose whether a dropped registration is silently re-established. + + When enabled, a 422 — the service reporting this UUID is not registered — + triggers a re-register and one retry, which re-sends the view key to the + service. + + Parameters + ---------- + enabled: + True to re-register and retry, False to surface the 422 as an error. + """ self.auto_re_register = enabled def set_decrypt_enabled(self, enabled: bool) -> None: + """Choose whether fetched records are decrypted in place. + + Decryption is local, using a stored view key — enabling it sends nothing + extra to the service. :meth:`owned` decrypts opportunistically, silently + leaving records encrypted when no view key is stored for the UUID; + :meth:`find_credits_record` and :meth:`find_credits_records` instead + require this to be on. + + Parameters + ---------- + enabled: + True to decrypt in place. While False, the ``find_credits_record*`` + helpers raise :exc:`DecryptionNotEnabledError` rather than returning + ciphertext they cannot search. + """ self.decrypt_enabled = enabled def add_view_key(self, view_key: Any) -> None: @@ -144,6 +204,18 @@ def add_view_key(self, view_key: Any) -> None: self._view_keys[str(uuid_field)] = view_key def remove_view_key(self, uuid: str) -> None: + """Forget a stored view key, so it can no longer decrypt records. + + Only drops the local copy — a registration already lodged with the hosted + scanner still holds that view key; call ``revoke()`` to withdraw it. + Unknown UUIDs are ignored. + + Parameters + ---------- + uuid: + UUID string the key was stored under, as computed by + :meth:`add_view_key`. + """ self._view_keys.pop(uuid, None) def set_uuid(self, key_material: Any) -> None: diff --git a/sdk/python/aleo/codegen/__main__.py b/sdk/python/aleo/codegen/__main__.py index 274f6cb0..28db5a9f 100644 --- a/sdk/python/aleo/codegen/__main__.py +++ b/sdk/python/aleo/codegen/__main__.py @@ -24,6 +24,20 @@ def _generate(abi_path: Path, out_path: Path) -> None: def main(argv: list[str] | None = None) -> int: + """Run the codegen CLI, writing generated modules to disk. + + Args: + argv: Command-line arguments; defaults to ``sys.argv[1:]``. + + Returns: + A process exit status — 0 on success, 1 if an ABI was unreadable or a + struct reference could not be resolved. Those failures are printed to + stderr rather than raised. + + Raises: + SystemExit: If neither ``--config`` nor both of ``--abi``/``--out`` were + given; argparse reports the usage error and exits. + """ p = argparse.ArgumentParser(prog="aleo.codegen") p.add_argument("--abi", type=Path, help="path to ABI JSON") p.add_argument("--out", type=Path, help="output .py path") diff --git a/sdk/python/aleo/codegen/_emit.py b/sdk/python/aleo/codegen/_emit.py index 68d3f2ed..9a8480d5 100644 --- a/sdk/python/aleo/codegen/_emit.py +++ b/sdk/python/aleo/codegen/_emit.py @@ -163,6 +163,11 @@ def _toposort(structs: list[dict[str, Any]]) -> list[dict[str, Any]]: seen: set[str] = set() def visit(name: str) -> None: + """Append *name* after its dependencies, skipping repeats. + + Names absent from this ABI are ignored — cross-program references are + rejected earlier, by ``_check_struct_refs``. + """ if name in seen or name not in by_name: return seen.add(name) @@ -224,6 +229,17 @@ class that is never generated (NameError at import/decode time), and two local = set(names) def check(ty: Any, context: str) -> None: + """Assert every struct *ty* references is defined in this program. + + Args: + ty: An ABI type to walk for struct references. + context: Where the type came from, quoted in the error so a failure + names the offending field. + + Raises: + ValueError: If a reference is undefined or points at another program — + the generated class would not exist. + """ for entry in _iter_struct_refs(ty): ref = entry["Struct"] name, prog = ref["path"][-1], ref.get("program", program) diff --git a/sdk/python/aleo/encryptor.py b/sdk/python/aleo/encryptor.py index e4c5379c..e32ca8c5 100644 --- a/sdk/python/aleo/encryptor.py +++ b/sdk/python/aleo/encryptor.py @@ -1,3 +1,9 @@ +"""Password-based encryption for Aleo private keys. + +Wraps a private key in a ciphertext that only the original secret reopens, so key +material can be written to disk or shipped between processes. All local — nothing +here touches the network. +""" from __future__ import annotations # Intentionally network-agnostic: private-key encryption (keys/ciphertext) does diff --git a/sdk/python/aleo/facade/async_client.py b/sdk/python/aleo/facade/async_client.py index 1cabd8d9..4aca3e21 100644 --- a/sdk/python/aleo/facade/async_client.py +++ b/sdk/python/aleo/facade/async_client.py @@ -32,10 +32,15 @@ import asyncio from contextlib import asynccontextmanager +from decimal import Decimal from typing import Any, AsyncGenerator from .._client_common import AleoNetworkError -from .._facade_common import credits_to_microcredits, microcredits_to_credits +from .._facade_common import ( + CreditsAmount, + credits_to_microcredits, + microcredits_to_credits, +) from .._scanner_common import OwnedRecord, RecordNotFoundError from .errors import ( ExecutionError, @@ -116,6 +121,7 @@ def raw(self) -> Any: @property def source(self) -> str: + """The program's Leo/Aleo source text.""" return str(self._raw.source) @property @@ -257,6 +263,17 @@ def scanner(self) -> Any: @scanner.setter def scanner(self, scanner: Any) -> None: + """Replace the underlying async record scanner. + + Assigning here bypasses the lazy default, so the client's provider config + is not consulted afterwards. + + Parameters + ---------- + scanner: + A pre-configured + :class:`~aleo.async_record_scanner.AsyncRecordScanner`. + """ self._scanner = scanner async def register(self, account: Any, start: int = 0) -> dict[str, Any]: @@ -268,9 +285,18 @@ async def register(self, account: Any, start: int = 0) -> dict[str, Any]: return await scanner.register(account.view_key, start) async def revoke(self) -> dict[str, Any]: + """Revoke the registered account's scanning registration. + + Delegates to :meth:`~aleo.async_record_scanner.AsyncRecordScanner.revoke` using the + scanner's configured UUID (derived from the registered account's view key). + """ return await self.scanner.revoke() async def status(self) -> dict[str, Any]: + """Return the scanning status for the registered account. + + Delegates to :meth:`~aleo.async_record_scanner.AsyncRecordScanner.status`. + """ return await self.scanner.status() async def find( @@ -407,43 +433,183 @@ def _nc(self) -> Any: return self._client.network_client async def get_latest_height(self) -> int: + """Return the latest block height. + + Returns + ------- + int + The current chain height. + """ return int(await self._nc().get_latest_height()) async def get_latest_block(self) -> Any: + """Return the latest block object (raw JSON dict). + + Returns + ------- + Any + Latest block as returned by the node. + """ return await self._nc().get_latest_block() async def get_block(self, height: int) -> Any: + """Return the block at *height*. + + Parameters + ---------- + height: + Block height (non-negative integer). + + Returns + ------- + Any + Block data dict. + """ return await self._nc().get_block(height) async def get_block_by_hash(self, block_hash: str) -> Any: + """Return the block identified by *block_hash*. + + Parameters + ---------- + block_hash: + Hex block hash string. + + Returns + ------- + Any + Block data dict. + """ return await self._nc().get_block_by_hash(block_hash) async def get_block_range(self, start: int, end: int) -> list[Any]: + """Return blocks in the range [*start*, *end*]. + + Parameters + ---------- + start: + Inclusive start height. + end: + Inclusive end height. + + Returns + ------- + list[Any] + Sequence of block dicts. + """ return await self._nc().get_block_range(start, end) async def get_latest_block_hash(self) -> str: + """Return the hash of the latest block. + + Returns + ------- + str + Block hash string. + """ return str(await self._nc().get_latest_block_hash()) async def get_state_root(self) -> str: + """Return the latest state root. + + Returns + ------- + str + State root string (``"sr1…"``). + """ return str(await self._nc().get_state_root()) async def get_program(self, program_id: str, edition: int | None = None) -> str: + """Return the Leo source for *program_id*. + + Parameters + ---------- + program_id: + Aleo program identifier (e.g. ``"credits.aleo"``). + edition: + Optional edition number. + + Returns + ------- + str + Program source text. + """ return await self._nc().get_program(program_id, edition) async def get_program_mapping_names(self, program_id: str) -> list[str]: + """Return the mapping names defined in *program_id*. + + Parameters + ---------- + program_id: + Aleo program identifier. + + Returns + ------- + list[str] + List of mapping names. + """ return await self._nc().get_program_mapping_names(program_id) async def get_program_mapping_value( self, program_id: str, mapping_name: str, key: str ) -> str: + """Return the current value at (*program_id*, *mapping_name*, *key*). + + Parameters + ---------- + program_id: + Aleo program identifier. + mapping_name: + Name of the mapping. + key: + Mapping key. + + Returns + ------- + str + Serialised mapping value. + """ return await self._nc().get_program_mapping_value( program_id, mapping_name, key ) async def get_public_balance(self, address: str) -> int: + """Return the public credits balance for *address* in microcredits. + + Queries the ``credits.aleo`` ``account`` mapping. Returns ``0`` when + the address has no balance or the mapping value is absent. + + Parameters + ---------- + address: + Aleo address string (``"aleo1…"``). + + Returns + ------- + int + Balance in microcredits. + """ return int(await self._nc().get_public_balance(address)) async def get_transaction(self, tx_id: str) -> Any: + """Return the (possibly unconfirmed) transaction for *tx_id*. + + Parameters + ---------- + tx_id: + Transaction ID string. + + Returns + ------- + Any + Transaction data dict. + + Raises + ------ + TransactionNotFound + If no transaction exists for *tx_id* (a 404 from the node). + """ try: return await self._nc().get_transaction(tx_id) except AleoNetworkError as exc: @@ -452,6 +618,23 @@ async def get_transaction(self, tx_id: str) -> Any: raise async def get_confirmed_transaction(self, tx_id: str) -> Any: + """Return the confirmed transaction for *tx_id*. + + Parameters + ---------- + tx_id: + Transaction ID string. + + Returns + ------- + Any + Confirmed transaction data dict. + + Raises + ------ + TransactionNotFound + If no confirmed transaction exists for *tx_id* (a 404 from the node). + """ try: return await self._nc().get_confirmed_transaction(tx_id) except AleoNetworkError as exc: @@ -472,9 +655,36 @@ async def get_transaction_object(self, tx_id: str) -> Any: raise async def get_transactions(self, block_height: int) -> list[Any]: + """Return all transactions in the block at *block_height*. + + Parameters + ---------- + block_height: + Block height to query. + + Returns + ------- + list[Any] + List of transaction dicts. + """ return await self._nc().get_transactions(block_height) async def submit_transaction(self, transaction: Any) -> str: + """Broadcast *transaction* to the network and return the transaction ID. + + Accepts either a :class:`Transaction` object (anything with a + ``__str__`` serialisation the node accepts) or a raw JSON string. + + Parameters + ---------- + transaction: + A :class:`Transaction` object or a serialised transaction string. + + Returns + ------- + str + The transaction ID returned by the node. + """ return str(await self._nc().submit_transaction(transaction)) send_raw_transaction = submit_transaction @@ -486,6 +696,36 @@ async def wait_for_transaction( timeout: float = 45.0, poll_interval: float = 2.0, ) -> Any: + """Poll until *tx_id* is confirmed, then return the transaction data. + + Delegates to + :meth:`~aleo.async_network_client.AsyncAleoNetworkClient.wait_for_transaction_confirmation` + and maps its :exc:`TimeoutError` to the facade-typed + :exc:`~aleo.facade.errors.TransactionConfirmationTimeout`. + + Parameters + ---------- + tx_id: + Transaction ID to wait on. + timeout: + Maximum seconds to wait before raising + :exc:`~aleo.facade.errors.TransactionConfirmationTimeout`. + Default is 45 s. + poll_interval: + Seconds between polls. Default is 2 s. + + Returns + ------- + Any + Confirmed transaction data dict. + + Raises + ------ + TransactionConfirmationTimeout + If the transaction is not confirmed within *timeout* seconds. + AleoNetworkError + If the node explicitly rejects the transaction. + """ try: return await self._nc().wait_for_transaction_confirmation( tx_id, @@ -888,6 +1128,7 @@ def __init__(self, provider: object) -> None: @property def provider(self) -> HTTPProvider: + """The :class:`~aleo.facade.provider.HTTPProvider` used to build this client.""" return self._provider @property @@ -911,10 +1152,19 @@ def process(self) -> Any: @property def default_account(self) -> Any: + """The default account used when a verb omits a signer.""" return self._default_account @default_account.setter def default_account(self, account: Any) -> None: + """Set the account verbs fall back to when no signer is passed. + + Parameters + ---------- + account: + The account to sign with by default. Set to ``None`` to require an + explicit signer on every verb. + """ self._default_account = account # ── Record provider ──────────────────────────────────────────────────── @@ -926,6 +1176,15 @@ def record_provider(self) -> Any: @record_provider.setter def record_provider(self, provider: Any) -> None: + """Replace the provider that auto-sources records for private fees. + + Parameters + ---------- + provider: + An async record provider — its ``get_unspent_credits_record`` must be + ``async def``. ``None`` disables automatic sourcing, which makes + private fees require an explicit ``fee_record``. + """ self._record_provider = provider # ── Network identity (sync — local) ──────────────────────────────────── @@ -942,6 +1201,11 @@ def network_id(self) -> int: @property def network_name(self) -> str: + """Human-readable network name string. + + Returns ``"mainnet"`` or ``"testnet"`` (the normalised provider + value, not the full snarkvm network display name). + """ return self._provider.network # ── Connectivity (async) ──────────────────────────────────────────────── @@ -977,15 +1241,54 @@ async def get_balance(self, address: str) -> int: # ── Unit conversions (sync) ───────────────────────────────────────────── - def to_microcredits(self, credits: float | int) -> int: - return credits_to_microcredits(credits) + def to_microcredits( + self, credits: CreditsAmount, *, allow_rounding: bool = False + ) -> int: + """Convert a credits amount to integer microcredits, exactly. + + Local and synchronous. See :meth:`Aleo.to_microcredits` — computed in + decimal, so ``1.005`` gives 1_005_000 rather than 1_004_999. - def from_microcredits(self, microcredits: int) -> float: + Parameters + ---------- + credits: + Credits amount; ``str`` and ``Decimal`` are exact. + allow_rounding: + Permit input finer than one microcredit, truncating toward zero. + + Raises + ------ + ValueError + If *credits* is finer than a microcredit and *allow_rounding* is + False, or is not a usable number. + """ + return credits_to_microcredits(credits, allow_rounding=allow_rounding) + + def from_microcredits(self, microcredits: int) -> Decimal: + """Convert an integer microcredits amount to credits, exactly. + + Local and synchronous. Returns a :class:`~decimal.Decimal` — see + :meth:`Aleo.from_microcredits` for why a float will not do. + + Parameters + ---------- + microcredits: + Integer microcredits (e.g. ``1_500_000``). + """ return microcredits_to_credits(microcredits) # ── Address validation (sync) ─────────────────────────────────────────── def is_valid_address(self, s: str) -> bool: + """Return ``True`` if *s* is a valid Aleo address. + + Wraps the network module's ``Address.is_valid`` class method. + + Parameters + ---------- + s: + The candidate address string. + """ try: net = self._provider.network if net == "testnet": diff --git a/sdk/python/aleo/facade/client.py b/sdk/python/aleo/facade/client.py index 32998f48..e626c03b 100644 --- a/sdk/python/aleo/facade/client.py +++ b/sdk/python/aleo/facade/client.py @@ -7,10 +7,15 @@ """ from __future__ import annotations +from decimal import Decimal from typing import Any from .._client_common import AleoNetworkError -from .._facade_common import credits_to_microcredits, microcredits_to_credits +from .._facade_common import ( + CreditsAmount, + credits_to_microcredits, + microcredits_to_credits, +) from .provider import HTTPProvider # AleoNetworkClient imported at runtime (avoid circular at module-level) @@ -99,6 +104,14 @@ def default_account(self) -> Any: @default_account.setter def default_account(self, account: Any) -> None: + """Set the account verbs fall back to when no signer is passed. + + Parameters + ---------- + account: + The account to sign with by default. Set to ``None`` to require an + explicit signer on every verb. + """ self._default_account = account # ── Record provider ────────────────────────────────────────────────────── @@ -108,15 +121,23 @@ def record_provider(self) -> Any: """The :class:`~aleo._facade_common.RecordProvider` used to auto-source records. Defaults to :attr:`records` (``aleo.records``), which wraps a delegated - record scanner. Assign a custom provider (e.g. a self-hosted scanner - wrapper) to keep your view key private, or set it to ``None`` to disable - automatic record sourcing (private fees then require an explicit - ``fee_record``). + record scanner. Assign a custom provider to keep your view key out of + that service, or set it to ``None`` to disable automatic record sourcing + (private fees then require an explicit ``fee_record``). """ return self._record_provider @record_provider.setter def record_provider(self, provider: Any) -> None: + """Replace the provider that auto-sources records for private fees. + + Parameters + ---------- + provider: + A :class:`~aleo._facade_common.RecordProvider`, or ``None`` to disable + automatic sourcing — private fees then require an explicit + ``fee_record``. + """ self._record_provider = provider # ── Network identity ─────────────────────────────────────────────────── @@ -193,20 +214,41 @@ def get_balance(self, address: str) -> int: # ── Unit conversions ─────────────────────────────────────────────────── - def to_microcredits(self, credits: float | int) -> int: - """Convert a credits amount to integer microcredits. + def to_microcredits( + self, credits: CreditsAmount, *, allow_rounding: bool = False + ) -> int: + """Convert a credits amount to integer microcredits, exactly. - ``1 credit == 1_000_000 microcredits`` + ``1 credit == 1_000_000 microcredits``. Computed in decimal, so + ``1.005`` gives 1_005_000 rather than the 1_004_999 a binary float + multiply would truncate to. Parameters ---------- credits: - Credits amount as a float or integer (e.g. ``1.5``). + Credits amount. ``str`` and ``Decimal`` are exact; a ``float`` is + read as the decimal literal it prints as, so prefer ``"1.005"`` over + ``1.005`` when the amount comes from text. + allow_rounding: + Permit input finer than one microcredit, truncating toward zero. + Off by default, so precision loss raises instead of silently + underpaying. + + Raises + ------ + ValueError + If *credits* is finer than a microcredit and *allow_rounding* is + False, or is not a usable number. """ - return credits_to_microcredits(credits) + return credits_to_microcredits(credits, allow_rounding=allow_rounding) + + def from_microcredits(self, microcredits: int) -> Decimal: + """Convert an integer microcredits amount to credits, exactly. - def from_microcredits(self, microcredits: int) -> float: - """Convert an integer microcredits amount to credits. + Returns a :class:`~decimal.Decimal`, not a float — microcredits are a + ``u64`` and past 2**53 a float cannot hold the integer. It compares + equal to the obvious float, but mixing it into float arithmetic raises; + call ``float(...)`` deliberately if you want that. Parameters ---------- diff --git a/sdk/python/aleo/facade/records.py b/sdk/python/aleo/facade/records.py index 44542847..4b0235ae 100644 --- a/sdk/python/aleo/facade/records.py +++ b/sdk/python/aleo/facade/records.py @@ -13,9 +13,8 @@ scanner is a *hosted* service, so :meth:`RecordsModule.register` sends your account's **view key** (sealed-box encrypted in transit) to that service — which can then decrypt every record you own. This is a real privacy - tradeoff. If you do not want to share your view key with a hosted scanner, - point ``aleo.records.scanner`` at a **self-hosted** endpoint, or assign your - own :class:`~aleo._facade_common.RecordProvider` implementation to + tradeoff. To keep the view key out of the service, assign your own + :class:`~aleo._facade_common.RecordProvider` implementation to ``aleo.record_provider``. """ from __future__ import annotations @@ -37,8 +36,7 @@ class RecordsModule: This module talks to a **delegated record scanner**. Registering an account (:meth:`register`) shares that account's **view key** with the scanning service, which can then decrypt every record the account owns. - For a self-custodial alternative, repoint :attr:`scanner` at a - self-hosted endpoint or assign a custom + To avoid that, assign a custom :class:`~aleo._facade_common.RecordProvider` to ``aleo.record_provider``. Parameters @@ -73,8 +71,8 @@ def _build_scanner(self) -> Any: (see :func:`~aleo.facade.provider.scanner_base`); its base, creds (api key + consumer id, shared with the delegated prover), network and transport are all derived from the client's - :class:`~aleo.facade.provider.HTTPProvider`. Point :attr:`scanner` - elsewhere to use a self-hosted scanning endpoint. + :class:`~aleo.facade.provider.HTTPProvider`. Assign :attr:`scanner` to + replace it. """ from ..record_scanner import RecordScanner from .provider import scanner_base @@ -101,8 +99,7 @@ def scanner(self) -> Any: """The underlying :class:`~aleo.record_scanner.RecordScanner` (escape hatch). Built lazily on first access from the client's provider config. Assign a - pre-configured scanner (e.g. one pointed at a self-hosted endpoint) to - override the default hosted service and keep your view key private. + pre-configured scanner to override the default. """ if self._scanner is None: self._scanner = self._build_scanner() @@ -110,6 +107,16 @@ def scanner(self) -> Any: @scanner.setter def scanner(self, scanner: Any) -> None: + """Replace the underlying record scanner. + + Assigning here bypasses the lazy default, so the client's provider config + is not consulted afterwards. + + Parameters + ---------- + scanner: + A pre-configured :class:`~aleo.record_scanner.RecordScanner`. + """ self._scanner = scanner # ── Registration / lifecycle ───────────────────────────────────────────── @@ -127,10 +134,9 @@ def register(self, account: Any, start: int = 0) -> dict[str, Any]: **view key** (sealed-box encrypted in transit) to the scanning service so it can decrypt the records you own on your behalf. The service can therefore see every record belonging to *account*. If - that is not acceptable, repoint :attr:`scanner` at a self-hosted - endpoint before calling :meth:`register`, or supply your own + that is not acceptable, supply your own :class:`~aleo._facade_common.RecordProvider` via - ``aleo.record_provider``. + ``aleo.record_provider`` instead of registering. Parameters ---------- diff --git a/sdk/python/aleo/network_client.py b/sdk/python/aleo/network_client.py index f601753a..ed8d3886 100644 --- a/sdk/python/aleo/network_client.py +++ b/sdk/python/aleo/network_client.py @@ -184,6 +184,18 @@ def _http( # ── Mutators ────────────────────────────────────────────────────────── def set_host(self, host: str) -> None: + """Re-point the client at a different API host. + + Re-derives the read base, origin, and the delegated prover/scanner bases + from *host*, discarding any prover or scanner URI set earlier — call + :meth:`set_prover_uri` / :meth:`set_record_scanner_uri` again afterwards + if you had overridden them. Local only; opens no connection. + + Args: + host: Versioned API root, e.g. ``"https://api.provable.com/v2"``. + Off the hosted Provable API the prover and scanner bases are + left unset, since those services exist only there. + """ read_host, origin, prover_default, scanner_default = self._resolve_urls(host) self._origin = origin self._base_url = origin @@ -194,15 +206,39 @@ def set_host(self, host: str) -> None: self._record_scanner_uri = scanner_default def set_prover_uri(self, prover_uri: str) -> None: + """Point delegated proving at a specific prover host. + + Use this to prove against a non-default prover; the current network name + is appended for you, so pass the base without it. + + Args: + prover_uri: Prover base without the network suffix, e.g. + ``"https://api.provable.com/prove"``. + """ self._prover_uri = f"{prover_uri}/{self._network}" def set_record_scanner_uri(self, record_scanner_uri: str) -> None: + """Point record scanning at a specific scanner host. + + The current network name is appended for you, so pass the base without + it. Note that delegating a scan shares your view key with the service. + + Args: + record_scanner_uri: Scanner base without the network suffix, e.g. + ``"https://api.provable.com/scanner"``. + """ self._record_scanner_uri = f"{record_scanner_uri}/{self._network}" def set_account(self, account: Any) -> None: + """Attach an account for calls that need one to sign or decrypt. + + Args: + account: The account to associate with this client. + """ self._account = account def get_account(self) -> Any: + """Return the account attached by :meth:`set_account`, or None if unset.""" return self._account # ── Derived-endpoint accessors ──────────────────────────────────────── @@ -223,12 +259,35 @@ def scanner_uri(self) -> str | None: return self._record_scanner_uri def set_header(self, name: str, value: str) -> None: + """Set a header sent with every subsequent request. + + Overwrites any existing value for *name*, including the SDK defaults. + + Args: + name: Header name. + value: Header value. + """ self.headers[name] = value def remove_header(self, name: str) -> None: + """Stop sending a header, if it was set. Absent names are ignored. + + Args: + name: Header name to drop. + """ self.headers.pop(name, None) def set_verbose_errors(self, verbose: bool) -> None: + """Choose whether broadcasts ask the node to pre-check the transaction. + + When enabled (the default), :meth:`submit_transaction` broadcasts with + ``check_transaction=true`` so the node reports why a transaction is + invalid instead of silently dropping it — at the cost of extra node-side + verification work. + + Args: + verbose: True to request the pre-check, False to broadcast bare. + """ self._verbose_errors = verbose # ── Internal HTTP ───────────────────────────────────────────────────── @@ -329,53 +388,220 @@ def _ensure_jwt( # ── Block endpoints ─────────────────────────────────────────────────── def get_block(self, height: int) -> Any: + """Fetch the block at *height*. + + Args: + height: Block height to read. + + Returns: + The block as decoded JSON. + + Raises: + AleoNetworkError: If no block exists at that height, or the node + rejects the request. + """ return self._get(f"/block/{height}", "getBlock") def get_block_by_hash(self, block_hash: str) -> Any: + """Fetch a block by its hash. + + Args: + block_hash: Block hash (``ab1…``). + + Returns: + The block as decoded JSON. + + Raises: + AleoNetworkError: If the hash matches no block on this network. + """ return self._get(f"/block/{block_hash}", "getBlockByHash") def get_block_range(self, start: int, end: int) -> list[Any]: + """Fetch a range of blocks in one request. + + Args: + start: First height to fetch; must be non-negative. + end: Last height of the range; must be at least *start*, and no more + than 50 above it. + + Returns: + The blocks in ascending height order. + + Raises: + ValueError: If *start* is negative, exceeds *end*, or the span is + wider than 50 blocks — checked locally, before any request. + AleoNetworkError: If the node rejects the request. + """ validate_block_range(start, end) return self._get(f"/blocks?start={start}&end={end}", "getBlockRange") def get_latest_block(self) -> Any: + """Fetch the newest block the node has. + + Returns: + The latest block as decoded JSON. + + Raises: + AleoNetworkError: If the node rejects the request. + """ return self._get("/block/latest", "getLatestBlock") def get_latest_height(self) -> int: + """Fetch the current chain tip height. + + Cheaper than :meth:`get_latest_block` when you only need the number. + + Returns: + The height of the newest block. + + Raises: + AleoNetworkError: If the node rejects the request. + """ return int(self._get("/block/height/latest", "getLatestHeight")) def get_latest_block_hash(self) -> str: + """Fetch the hash of the newest block. + + Returns: + The latest block hash (``ab1…``). + + Raises: + AleoNetworkError: If the node rejects the request. + """ return str(self._get("/block/hash/latest", "getLatestBlockHash")) def get_latest_committee(self) -> Any: + """Fetch the current validator committee. + + Returns: + The committee — members and their stake — as decoded JSON. + + Raises: + AleoNetworkError: If the node rejects the request. + """ return self._get("/committee/latest", "getLatestCommittee") def get_committee_by_height(self, height: int) -> Any: + """Fetch the validator committee as of *height*. + + Args: + height: Block height whose committee you want. + + Returns: + The committee at that height as decoded JSON. + + Raises: + AleoNetworkError: If the node has pruned that height or rejects the + request. + """ return self._get(f"/committee/{height}", "getCommitteeByHeight") def get_state_root(self) -> str: + """Fetch the latest global state root. + + The state root pins the chain state an offline query is built against — + see :class:`OfflineQuery`. + + Returns: + The current state root (``sr1…``). + + Raises: + AleoNetworkError: If the node rejects the request. + """ return str(self._get("/stateRoot/latest", "getStateRoot")) def get_state_paths(self, commitments: list[str]) -> list[Any]: + """Fetch inclusion proofs for record commitments. + + State paths are what let a proof assert that a record was in the global + state tree without revealing which one — needed to execute offline. + + Args: + commitments: Record commitments to prove inclusion for; each is + URL-escaped before it goes on the wire. + + Returns: + One state path per commitment, in the order requested. + + Raises: + AleoNetworkError: If any commitment is unknown to the node, or the + node rejects the request. + """ csv = ",".join(quote(c, safe="") for c in commitments) return self._get(f"/statePaths?commitments={csv}", "getStatePaths") # ── Program endpoints ───────────────────────────────────────────────── def get_program(self, program_id: str, edition: int | None = None) -> str: + """Fetch a program's Aleo instructions source. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + edition: Which amendment to read; omit for the newest one on chain. + + Returns: + The program source text. + + Raises: + AleoNetworkError: If the program (or that edition of it) is not + deployed on this network. + """ if edition is not None: return self._get(f"/program/{program_id}/{edition}", "getProgramVersion") return self._get(f"/program/{program_id}", "getProgramVersion") def get_latest_program_edition(self, program_id: str) -> int: + """Fetch the newest edition number for a program. + + Pass the result to :meth:`get_program` to pin a read to the edition you + checked, rather than racing a later amendment. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + + Returns: + The newest edition number on chain. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ raw = self._get_raw(f"/program/{program_id}/latest_edition", "getLatestProgramEdition") return int(json.loads(raw)) def get_program_amendment_count(self, program_id: str) -> Any: + """Fetch how many times a program has been amended. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + + Returns: + The amendment count as decoded JSON. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ raw = self._get_raw(f"/program/{program_id}/amendment_count", "getProgramAmendmentCount") return json.loads(raw) def get_program_object(self, program_id: str, edition: int | None = None) -> Any: + """Fetch a program and parse it into a ``Program``. + + Use this over :meth:`get_program` when you want to inspect functions, + mappings, or imports rather than hold the raw text. The result belongs to + the extension module matching this client's network — mainnet and testnet + types are not interchangeable. + + Args: + program_id: Program to read, e.g. ``"credits.aleo"``. + edition: Which amendment to read; omit for the newest one on chain. + + Returns: + The parsed program. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + ValueError: If the fetched source fails to parse. + """ Program = self._net().Program source = self.get_program(program_id, edition) return Program.from_source(source) @@ -385,6 +611,26 @@ def get_program_imports( program_id: str, imports: dict[str, str] | None = None, ) -> dict[str, str]: + """Fetch a program's full import closure, sources included. + + Walks imports depth-first, so an import's own imports are resolved before + it. Each distinct program is fetched once, but this still costs one + request per program in the closure. + + Args: + program_id: Program whose imports to resolve. + imports: Already-known ``{program_id: source}`` entries to treat as + fetched; mutated in place and returned. Pass a populated dict to + reuse a closure across calls. + + Returns: + Every transitive import as ``{program_id: source}``. The program + itself is not included. + + Raises: + AleoNetworkError: If the program or any of its imports is not + deployed on this network. + """ if imports is None: imports = {} source = self.get_program(program_id) @@ -408,17 +654,58 @@ def _collect_program_imports( return imports def get_program_import_names(self, program_id: str) -> list[str]: + """Fetch the names a program imports directly. + + Unlike :meth:`get_program_imports` this does not recurse and does not + fetch the imported sources — one request, names only. + + Args: + program_id: Program whose imports to list. + + Returns: + The directly-imported program IDs, in declaration order. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ Program = self._net().Program source = self.get_program(program_id) prog = Program.from_source(source) return [str(imp) for imp in prog.imports] def get_program_mapping_names(self, program_id: str) -> list[str]: + """Fetch the names of a program's mappings. + + Args: + program_id: Program whose mappings to list. + + Returns: + The mapping names declared by the program. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ return self._get(f"/program/{program_id}/mappings", "getProgramMappingNames") def get_program_mapping_value( self, program_id: str, mapping_name: str, key: str ) -> str: + """Read one entry out of a program mapping. + + Args: + program_id: Program that owns the mapping, e.g. ``"credits.aleo"``. + mapping_name: Mapping to read, e.g. ``"account"``. + key: Mapping key, written as the Aleo literal the mapping is keyed by + (an address for ``credits.aleo/account``). + + Returns: + The stored value as a string. An unset key reads back as the mapping's + zero value rather than raising. + + Raises: + AleoNetworkError: If the program or mapping does not exist, or the key + is malformed for the mapping's key type. + """ return self._get( f"/program/{program_id}/mapping/{mapping_name}/{key}", "getProgramMappingValue", @@ -427,6 +714,25 @@ def get_program_mapping_value( def get_program_mapping_plaintext( self, program_id: str, mapping_name: str, key: str ) -> Any: + """Read a mapping entry and parse it into a ``Plaintext``. + + Use this over :meth:`get_program_mapping_value` when the value is a struct + or record and you want to index into it instead of parsing the string + yourself. + + Args: + program_id: Program that owns the mapping. + mapping_name: Mapping to read. + key: Mapping key, written as the Aleo literal the mapping is keyed by. + + Returns: + The parsed value, from the extension module matching this client's + network. + + Raises: + AleoNetworkError: If the program or mapping does not exist. + ValueError: If the returned value fails to parse as plaintext. + """ Plaintext = self._net().Plaintext raw = self._get_raw( f"/program/{program_id}/mapping/{mapping_name}/{key}", @@ -435,6 +741,19 @@ def get_program_mapping_plaintext( return Plaintext.from_string(json.loads(raw)) def get_public_balance(self, address: str) -> int: + """Read an address's public ``credits.aleo`` balance. + + Public balance only — credits held privately in records are invisible + here, so a funded account can legitimately report 0. + + Args: + address: The address to look up (``aleo1…``). + + Returns: + The balance in microcredits, or 0 if the account has no public + balance. Network failures also read back as 0 rather than raising, + so do not use this to probe whether the node is reachable. + """ try: val = self.get_program_mapping_value("credits.aleo", "account", address) return int(val) if val else 0 @@ -444,28 +763,118 @@ def get_public_balance(self, address: str) -> int: # ── Transaction endpoints ───────────────────────────────────────────── def get_transaction(self, tx_id: str) -> Any: + """Fetch a transaction by ID. + + Returns the transaction whether or not it has been confirmed; use + :meth:`get_confirmed_transaction` when you need its on-chain outcome. + + Args: + tx_id: Transaction ID (``at1…``). + + Returns: + The transaction as decoded JSON. + + Raises: + AleoNetworkError: If the node does not know this transaction. + """ return self._get(f"/transaction/{tx_id}", "getTransaction") def get_confirmed_transaction(self, tx_id: str) -> Any: + """Fetch a transaction along with its confirmed outcome. + + Args: + tx_id: Transaction ID (``at1…``). + + Returns: + The confirmed transaction as decoded JSON, including the ``status`` + field that distinguishes an accepted transaction from a rejected one. + + Raises: + AleoNetworkError: If the transaction is still unconfirmed or unknown + to the node. + """ return self._get(f"/transaction/confirmed/{tx_id}", "getConfirmedTransaction") def get_transaction_object(self, tx_id: str) -> Any: + """Fetch a transaction and parse it into a ``Transaction``. + + Use this over :meth:`get_transaction` when you want to walk transitions, + inputs, or outputs as typed objects. + + Args: + tx_id: Transaction ID (``at1…``). + + Returns: + The parsed transaction, from the extension module matching this + client's network. + + Raises: + AleoNetworkError: If the node does not know this transaction. + ValueError: If the response fails to parse as a transaction. + """ Transaction = self._net().Transaction raw = self._get_raw(f"/transaction/{tx_id}", "getTransactionObject") return Transaction.from_json(raw) def get_transactions(self, block_height: int) -> list[Any]: + """Fetch every transaction in one block. + + Args: + block_height: Height of the block to read. + + Returns: + The block's transactions as decoded JSON; empty if the block held + none. + + Raises: + AleoNetworkError: If no block exists at that height. + """ return self._get(f"/block/{block_height}/transactions", "getTransactions") def get_transactions_in_mempool(self) -> list[Any]: + """Fetch the transactions this node is holding unconfirmed. + + Mempool contents are per-node and change constantly — a transaction + missing here may still be in flight elsewhere. + + Returns: + The node's pending transactions as decoded JSON. + + Raises: + AleoNetworkError: If the node rejects the request — public nodes + often decline to expose their mempool. + """ return self._get("/memoryPool/transactions", "getTransactionsInMempool") def get_transition_id(self, input_or_output_id: str) -> str: + """Find which transition produced or consumed an input/output ID. + + Args: + input_or_output_id: A transition input or output ID to trace. + + Returns: + The enclosing transition ID (``au1…``). + + Raises: + AleoNetworkError: If nothing on chain matches that ID. + """ return self._get( f"/find/transitionID/{input_or_output_id}", "getTransitionId" ) def get_deployment_transaction_id_for_program(self, program_id: str) -> str: + """Find the transaction that deployed a program. + + Args: + program_id: Deployed program, e.g. ``"credits.aleo"``. + + Returns: + The deployment transaction ID (``at1…``), with the node's surrounding + JSON quotes stripped. + + Raises: + AleoNetworkError: If the program is not deployed on this network. + """ raw = self._get( f"/find/transactionID/deployment/{program_id}", "getDeploymentTransactionIDForProgram", @@ -473,12 +882,47 @@ def get_deployment_transaction_id_for_program(self, program_id: str) -> str: return strip_quotes(str(raw)) def get_deployment_transaction_for_program(self, program_id: str) -> Any: + """Fetch the deployment transaction for a program. Costs two requests. + + Resolves the deployment ID, then fetches that transaction. + + Args: + program_id: Deployed program, e.g. ``"credits.aleo"``. + + Returns: + The deployment transaction as decoded JSON. + + Raises: + AleoNetworkError: If the program is not deployed on this network, or + the node cannot return its deployment transaction. + """ tx_id = self.get_deployment_transaction_id_for_program(program_id) return self.get_transaction(tx_id) # ── POST endpoints ──────────────────────────────────────────────────── def submit_transaction(self, transaction: Any) -> str: + """Broadcast a proven transaction to the network. + + This spends the transaction's fee and is not reversible. Returning + successfully means the node accepted the broadcast, NOT that the + transaction was confirmed — pass the ID to + :meth:`wait_for_transaction_confirmation` for that. + + When verbose errors are on (the default) the node pre-checks the + transaction and explains rejections; see :meth:`set_verbose_errors`. + + Args: + transaction: The proven transaction; stringified before broadcast, so + either a ``Transaction`` or its serialized form works. + + Returns: + The broadcast transaction ID (``at1…``). + + Raises: + AleoNetworkError: If the node rejects the transaction — invalid proof, + insufficient fee, or a stale state root. + """ tx_str = str(transaction) endpoint = ( f"{self._host}/transaction/broadcast?check_transaction=true" @@ -489,6 +933,18 @@ def submit_transaction(self, transaction: Any) -> str: return json.loads(resp.text) def submit_solution(self, solution: str) -> str: + """Broadcast a prover solution to the network. + + Args: + solution: The serialized solution to submit. + + Returns: + The accepted solution's ID. + + Raises: + AleoNetworkError: If the node rejects the solution — stale epoch or + insufficient proof target. + """ resp = self._post( f"{self._host}/solution/broadcast", solution, "submitSolution" ) @@ -502,6 +958,30 @@ def wait_for_transaction_confirmation( check_interval: float = 2.0, timeout: float = 45.0, ) -> Any: + """Poll until a transaction is confirmed, blocking the calling thread. + + Polls the confirmed-transaction endpoint every *check_interval* seconds. + Transient failures — including the 404s expected while the transaction is + still propagating — are swallowed and retried; only an outright rejection + or a malformed ID stops the loop early. + + Args: + tx_id: Transaction ID to watch (``at1…``). + check_interval: Seconds to wait between polls. + timeout: Seconds to keep polling before giving up. Exceeding it means + the transaction never appeared, not that it failed — it may still + confirm afterwards. + + Returns: + The confirmed transaction as decoded JSON, once its status is + ``accepted``. + + Raises: + TimeoutError: If the transaction has not been confirmed within + *timeout* seconds. + AleoNetworkError: If the network rejected the transaction, or *tx_id* + is malformed. + """ import time as _time start = _time.monotonic() diff --git a/sdk/python/aleo/record_scanner.py b/sdk/python/aleo/record_scanner.py index 40eb2289..5cebcfdc 100644 --- a/sdk/python/aleo/record_scanner.py +++ b/sdk/python/aleo/record_scanner.py @@ -201,18 +201,78 @@ def _post_raw(self, url: str, body: str) -> requests.Response: # ── Mutators ───────────────────────────────────────────────────────── def set_api_key(self, api_key: str | tuple[str, str] | dict[str, str]) -> None: + """Set the API key used to mint and refresh JWTs. + + Paired with :meth:`set_consumer_id`; with both set the scanner refreshes + its own JWT as needed. Local only — no request is made here. + + Parameters + ---------- + api_key: + The key as a bare string, a ``(header, value)`` pair, or a + ``{"header": ..., "value": ...}`` dict. A bare string uses the + default Provable API-key header. + """ self._api_key = normalize_api_key(api_key) def set_consumer_id(self, consumer_id: str) -> None: + """Set the consumer whose JWTs this scanner mints. + + Note that the scanner and the delegated prover share one consumer, and the + auth server keeps a single active JWT per consumer — so minting here can + invalidate the prover's cached JWT, and vice versa. Both sides re-mint on + rejection, so this self-heals. + + Parameters + ---------- + consumer_id: + The consumer ID registered with the auth service. + """ self.consumer_id = consumer_id def set_jwt_data(self, jwt_data: dict[str, Any] | None) -> None: + """Install a pre-minted JWT, skipping the next refresh. + + Parameters + ---------- + jwt_data: + ``{"jwt": str, "expiration": int}`` with the expiry in epoch + milliseconds. A JWT within five minutes of expiring is treated as + already expired and refreshed. Pass ``None`` to clear the cached + token and force a fresh mint on the next call. + """ self.jwt_data = jwt_data def set_auto_re_register(self, enabled: bool) -> None: + """Choose whether a dropped registration is silently re-established. + + When enabled, a 422 — the service reporting this UUID is not registered — + triggers a re-register and one retry, which re-sends the view key to the + service. + + Parameters + ---------- + enabled: + True to re-register and retry, False to surface the 422 as an error. + """ self.auto_re_register = enabled def set_decrypt_enabled(self, enabled: bool) -> None: + """Choose whether fetched records are decrypted in place. + + Decryption is local, using a stored view key — enabling it sends nothing + extra to the service. :meth:`owned` decrypts opportunistically, silently + leaving records encrypted when no view key is stored for the UUID; + :meth:`find_credits_record` and :meth:`find_credits_records` instead + require this to be on. + + Parameters + ---------- + enabled: + True to decrypt in place. While False, the ``find_credits_record*`` + helpers raise :exc:`DecryptionNotEnabledError` rather than returning + ciphertext they cannot search. + """ self.decrypt_enabled = enabled def add_view_key(self, view_key: Any) -> None: @@ -221,6 +281,18 @@ def add_view_key(self, view_key: Any) -> None: self._view_keys[str(uuid_field)] = view_key def remove_view_key(self, uuid: str) -> None: + """Forget a stored view key, so it can no longer decrypt records. + + Only drops the local copy — a registration already lodged with the hosted + scanner still holds that view key; call ``revoke()`` to withdraw it. + Unknown UUIDs are ignored. + + Parameters + ---------- + uuid: + UUID string the key was stored under, as computed by + :meth:`add_view_key`. + """ self._view_keys.pop(uuid, None) def set_uuid(self, key_material: Any) -> None: diff --git a/sdk/python/aleo/testing/devnode.py b/sdk/python/aleo/testing/devnode.py index b991bcfa..1a139790 100644 --- a/sdk/python/aleo/testing/devnode.py +++ b/sdk/python/aleo/testing/devnode.py @@ -133,10 +133,20 @@ def __init__( @property def socket_addr(self) -> str: + """The node's ``host:port``, as passed to the binary's ``--socket-addr``. + + Loopback only — the devnode is never reachable off this machine. Reads the + resolved port, so it is meaningful only once the node has started. + """ return f"127.0.0.1:{self.port}" @property def base_url(self) -> str: + """The node's REST root, ready to hand to ``HTTPProvider`` or a client. + + Plain HTTP on loopback. Treated as a literal read base rather than the + hosted API, so no delegated prover or scanner is wired up against it. + """ return f"http://{self.socket_addr}" # ── Lifecycle ─────────────────────────────────────────────────────────── diff --git a/sdk/python/tests/test_facade_client.py b/sdk/python/tests/test_facade_client.py index f4a5d739..a5fef9c6 100644 --- a/sdk/python/tests/test_facade_client.py +++ b/sdk/python/tests/test_facade_client.py @@ -4,6 +4,8 @@ """ from __future__ import annotations +from decimal import Decimal + import pytest import responses as resp_lib @@ -312,6 +314,54 @@ def test_unit_conversion_round_trip() -> None: assert a.from_microcredits(a.to_microcredits(original)) == original +# Precision: these amounts silently lost value when the conversion went +# through binary floating point (1.005 truncated to 1_004_999), and a +# microcredit round-trip was not the identity for ~1.4% of values. + + +def test_to_microcredits_does_not_lose_a_microcredit() -> None: + a = Aleo(HTTPProvider(BASE)) + # float * 1e6 lands on 1004999.9999999999; int() then truncates down + assert a.to_microcredits(1.005) == 1_005_000 + assert a.to_microcredits("1.005") == 1_005_000 + assert a.to_microcredits(Decimal("1.005")) == 1_005_000 + + +def test_to_microcredits_rejects_sub_microcredit_precision() -> None: + a = Aleo(HTTPProvider(BASE)) + with pytest.raises(ValueError, match="finer than the chain"): + a.to_microcredits(0.9999999) + # opt in to the old truncating behaviour explicitly + assert a.to_microcredits(0.9999999, allow_rounding=True) == 999_999 + + +def test_to_microcredits_rejects_nonsense() -> None: + a = Aleo(HTTPProvider(BASE)) + for bad in ("abc", float("nan"), float("inf")): + with pytest.raises(ValueError): + a.to_microcredits(bad) + + +def test_from_microcredits_is_exact_past_float_range() -> None: + a = Aleo(HTTPProvider(BASE)) + # microcredits are u64; beyond 2**53 a float cannot hold the integer + for micro in (2**53 + 1, 2**64 - 1): + assert a.to_microcredits(a.from_microcredits(micro)) == micro + + +def test_microcredit_round_trip_is_identity() -> None: + a = Aleo(HTTPProvider(BASE)) + # 2884 of these failed when from_microcredits returned a float + for micro in range(0, 5_000): + assert a.to_microcredits(a.from_microcredits(micro)) == micro + + +def test_from_microcredits_still_compares_equal_to_float() -> None: + a = Aleo(HTTPProvider(BASE)) + assert a.from_microcredits(1_500_000) == 1.5 + assert float(a.from_microcredits(1_500_000)) == 1.5 + + # --------------------------------------------------------------------------- # is_valid_address # --------------------------------------------------------------------------- diff --git a/sdk/python/tests/test_proving.py b/sdk/python/tests/test_proving.py index c54144d4..efc6dbc6 100644 --- a/sdk/python/tests/test_proving.py +++ b/sdk/python/tests/test_proving.py @@ -12,7 +12,7 @@ Run them locally with: python -m pytest python/tests -v -m slow They are excluded from CI via -m "not slow". -Endpoint note (verified empirically): Query.rest() wants the BASE url +Endpoint note (verified empirically): Query.rest() requires the BASE url `https://api.explorer.provable.com/v2` — snarkvm's REST query appends the network path (`/mainnet/stateRoot/latest`) itself; passing `.../v2/mainnet` would double the network segment. diff --git a/shield-swap-sdk/AGENTS.md b/shield-swap-sdk/AGENTS.md index d279720f..483318ae 100644 --- a/shield-swap-sdk/AGENTS.md +++ b/shield-swap-sdk/AGENTS.md @@ -100,7 +100,7 @@ business, not the user's): 1. **Their own playbook.** Ask whether they have instructions of their own — a strategy file, notes, a memory store, output from a previous session. If so, read it and treat it as the plan: their document - decides what to do, the verbs here describe how each step works. + decides what to do, the methods here describe how each step works. 2. **A suggested journey.** Frame the setting first — Shield Swap is a private exchange on Aleo's test network: trading uses test tokens, and @@ -135,7 +135,7 @@ business, not the user's): and the integration checklist. 4. **A free-form prompt.** Whatever they describe, map it onto the - verbs and journeys above before improvising against the SDK. + methods and journeys above before improvising against the SDK. ### While acting @@ -166,21 +166,21 @@ where the signing keys live: | Browser dApp (wallet-signed) | The TypeScript stack: `@provablehq/shield-swap-sdk` + Veil react hooks — not this package | The user's wallet signs and proves. | What every integration must handle (each enforced or automated by the -verbs above — this list is the review checklist for code that bypasses +methods above — this list is the review checklist for code that bypasses them): - **Auth is layered**: a bearer credential (24h session JWT from the challenge/verify handshake, or a durable `ss_…` API token — data/trading endpoints only) AND a one-time invite redemption per account. - **Dynamic-dispatch imports**: every record-spending write must register - the involved token programs with the prover (the verbs resolve this via + the involved token programs with the prover (the methods resolve this via the token registry; pass `imports=`/`token_*_program=` to override). - **Tokens are private records**: spendable balances do not appear in public reads; one covering record funds an amount — no aggregation. - **Amounts are raw native units end to end** (the AMM does no decimal scaling); quote in canonical decimals, transact in raw base units, display human. -- **Wrapped assets route automatically** (swap/claim/LP verbs dispatch to +- **Wrapped assets route automatically** (swap/claim/LP methods dispatch to the routers per token shape) — fund them with UNDERLYING records; never hand wrapper records around. - **A `SwapHandle` is the only key to a swap's output** — persist before @@ -191,13 +191,13 @@ them): Suggested path for a new integrator: (1) `onboard()` a profile — it doubles as a test fixture; (2) walk swap → `collect_all()` once with the -Tier 1 verbs so the mechanics are concrete; (3) read the reference below +Tier 1 methods so the mechanics are concrete; (3) read the reference below for the surface your app needs; (4) `tests/integration/` and `scripts/rehearsal.py` in the repo are working reference implementations of the full journey. -Every write verb returns a prepared `DexCall`: nothing touches the -network until a terminal verb — `.simulate()` (local, free), +Every write method returns a prepared `DexCall`: nothing touches the +network until a terminal method — `.simulate()` (local, free), `.transact()` (local proving, slow), or `.delegate()` (delegated proving — the practical path). @@ -243,10 +243,9 @@ Whether this authenticated account has redeemed an invite code. Redeem a pasted invite — always a REFERRAL code. User-shared invites are referral codes (``/referral/redeem``); -that is the ONLY kind a person pastes. Access codes are a -programmatic self-registration flow — see -:meth:`generate_access_codes` / :meth:`redeem_access_code` — -never routed through here. +that is the ONLY kind a person pastes. Access codes are a separate +programmatic tier — see :meth:`redeem_access_code` — never routed +through here. Sessions moved to the ``/auth/*`` endpoints, so no token comes back — re-authenticate if needed (one is still adopted if the API @@ -275,11 +274,22 @@ management still require a session JWT. ### `api.get_pools(self) -> 'list[PoolEntry]'` +Every pool the DEX lists, each with its two tokens' metadata. +An entry exposes the pool's own fields directly — ``entry.key`` is the +``pool_key`` that ``swap``, ``mint``, and ``collect`` take. Its +``token0_info`` / ``token1_info`` carry that token's ``symbol`` and +``decimals``, but the API does not guarantee them — check for ``None`` +before reading. ### `api.get_tokens(self) -> 'list[models.TokenDoc]'` +Every token the DEX lists, with its id, symbol, and decimals. +``decimals`` converts between the two amount conventions. +The API returns canonical decimal amounts (``"1.5"``), if using this +value to call on-chain methods — ``swap(amount_in=…)``, ``mint``, +``collect`` — conversion to raw base units is necessary. ### `api.get_route(self, *, token_in: 'str', token_out: 'str', amount_in: 'Any' = None) -> 'models.RouteResultDoc'` @@ -311,7 +321,7 @@ Derives at ``start_counter, +1, …`` and probes the program's ``used_blinded_addresses`` mapping until one is free. ``max_scan`` fails fast when something is systematically wrong (e.g. wrong program). -### Chain verbs +### Chain methods ### `swap(self, *, pool_key: 'str', token_in_id: 'str', amount_in: 'int', slippage_bps: 'int' = 50, expected_out: 'Optional[int]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle]'` @@ -323,7 +333,7 @@ with UNDERLYING records — the deposit happens in-transaction. Resolves the intent against live pool state, derives a single-use blinded identity from the signer's view key, selects an unspent token record (or takes *token_record* verbatim), and returns a prepared -call. The terminal verb (``transact``/``delegate``) returns a +call. The terminal method (``transact``/``delegate``) returns a :class:`~aleo_shield_swap.types.SwapHandle` — persist it if the process might die before the claim. @@ -428,9 +438,20 @@ privately). Requires a configured record provider. ### `derive_pool_key(self, token0: 'str', token1: 'str', fee: 'int') -> 'str'` +Compute the pool key for a token pair and fee tier. Local — no network. +Deriving a key never implies the pool exists; pass the result to +:meth:`is_pool_initialized` before quoting or trading against it. The +derivation is sensitive to token order and is network-scoped, so swapping +*token0* and *token1*, or reusing a key across mainnet and testnet, yields +a valid-looking ``field`` that matches nothing on chain. *fee* is the +contract's ``u16`` fee tier. ### `derive_tick_key(self, pool_key: 'str', tick: 'int') -> 'str'` +Compute the key of one tick within a pool. Local — no network. +*tick* is a signed index, and the returned ``field`` is what reads that +tick's on-chain state — the initialized-tick list ``mint`` validates its +hints against. Network-scoped like :meth:`derive_pool_key`. diff --git a/shield-swap-sdk/README.md b/shield-swap-sdk/README.md index 8f8094ca..a570d1df 100644 --- a/shield-swap-sdk/README.md +++ b/shield-swap-sdk/README.md @@ -3,7 +3,7 @@ Typed Python client for the **shield_swap** AMM on Aleo. Sits on top of the Aleo Python SDK's facade (`aleo.Aleo`): signer, record provider, proving configuration, and network all come from the client you bind — this package -adds the DEX verbs, the typed results, and the off-chain DEX API, nothing +adds the DEX methods, the typed results, and the off-chain DEX API, nothing else. ```python @@ -44,7 +44,7 @@ Requires `aleo-sdk>=0.3` (this repo's SDK; imports as `aleo`) and Python 3.10+. ## Agents `AGENTS.md` (generated from the SDK's docstrings — always current) is the -one page an agent needs: the five-verb lifecycle, the conversation pattern, +one page an agent needs: the five-method lifecycle, the conversation pattern, and the building-block reference. It ships in the wheel: ```bash @@ -59,7 +59,7 @@ can run the same lifecycle through `python -m aleo_shield_swap.mcp`. ## How calls work Every read returns a value immediately. Every write returns a prepared -`DexCall` — nothing touches the network until you invoke a terminal verb: +`DexCall` — nothing touches the network until you invoke a terminal method: ```python call = dex.swap(pool_key=key, token_in_id=token, amount_in=10**9) @@ -69,7 +69,7 @@ call.transact(account) # proves locally, broadcasts, pays the fee call.delegate(account) # proves via the delegated proving service ``` -`transact` and `delegate` return the verb's *typed result* (a `SwapHandle`, +`transact` and `delegate` return the method's *typed result* (a `SwapHandle`, `MintResult`, `ClaimResult`, …) built from the transaction's root-transition outputs — not a bare transaction id. Local proving downloads SNARK parameters on first use and takes minutes for the larger entrypoints; `delegate` is the @@ -80,7 +80,7 @@ Chain reads and writes live directly on `ShieldSwap`; the off-chain DEX API is namespaced under `.api`, so a call site always shows whether a value came from the chain or the service. -## The verb surface +## The method surface **Chain reads** (node REST API): @@ -128,8 +128,8 @@ funds required; the session rides as httpOnly cookies + a CSRF header and is short-lived — mint a durable `ss_…` token via `create_api_token` for anything long-running). Accounts additionally need a one-time invite: `redeem_code` takes the **referral code** a human pasted; access codes are -a separate programmatic self-registration tier -(`generate_access_codes` / `redeem_access_code`). +a separate programmatic tier (`redeem_access_code`). Minting invite or access +codes is deliberately not exposed by this SDK — obtain a code out-of-band. ## Privacy @@ -147,11 +147,10 @@ Two conveniences trade secret material for service: - The hosted record scanner behind `get_private_balances` / `aleo.records.register` shares the account's **view key** with the scanning service, which can then see everything the account owns. - Self-host the scanner if that is unacceptable. ## Async -`AsyncShieldSwap` / `AsyncApiClient` mirror the sync surface verb-for-verb on +`AsyncShieldSwap` / `AsyncApiClient` mirror the sync surface method-for-method on `aleo.AsyncAleo` (install the `[async]` extra): ```python @@ -164,7 +163,7 @@ handle = await (await dex.swap(pool_key=key, token_in_id=token, ## Agent tools and MCP -`shield_swap_tools()` returns JSON-schema tool definitions for the whole verb +`shield_swap_tools()` returns JSON-schema tool definitions for the whole method surface; `dispatch_tool(dex, name, args)` executes one. For MCP hosts, the `[mcp]` extra ships a stdio server over the same definitions: diff --git a/shield-swap-sdk/codegen/gen_context.py b/shield-swap-sdk/codegen/gen_context.py index deee2cba..a6415400 100644 --- a/shield-swap-sdk/codegen/gen_context.py +++ b/shield-swap-sdk/codegen/gen_context.py @@ -74,7 +74,7 @@ 1. **Their own playbook.** Ask whether they have instructions of their own — a strategy file, notes, a memory store, output from a previous session. If so, read it and treat it as the plan: their document - decides what to do, the verbs here describe how each step works. + decides what to do, the methods here describe how each step works. 2. **A suggested journey.** Frame the setting first — Shield Swap is a private exchange on Aleo's test network: trading uses test tokens, and @@ -109,7 +109,7 @@ and the integration checklist. 4. **A free-form prompt.** Whatever they describe, map it onto the - verbs and journeys above before improvising against the SDK. + methods and journeys above before improvising against the SDK. ### While acting @@ -140,21 +140,21 @@ | Browser dApp (wallet-signed) | The TypeScript stack: `@provablehq/shield-swap-sdk` + Veil react hooks — not this package | The user's wallet signs and proves. | What every integration must handle (each enforced or automated by the -verbs above — this list is the review checklist for code that bypasses +methods above — this list is the review checklist for code that bypasses them): - **Auth is layered**: a bearer credential (24h session JWT from the challenge/verify handshake, or a durable `ss_…` API token — data/trading endpoints only) AND a one-time invite redemption per account. - **Dynamic-dispatch imports**: every record-spending write must register - the involved token programs with the prover (the verbs resolve this via + the involved token programs with the prover (the methods resolve this via the token registry; pass `imports=`/`token_*_program=` to override). - **Tokens are private records**: spendable balances do not appear in public reads; one covering record funds an amount — no aggregation. - **Amounts are raw native units end to end** (the AMM does no decimal scaling); quote in canonical decimals, transact in raw base units, display human. -- **Wrapped assets route automatically** (swap/claim/LP verbs dispatch to +- **Wrapped assets route automatically** (swap/claim/LP methods dispatch to the routers per token shape) — fund them with UNDERLYING records; never hand wrapper records around. - **A `SwapHandle` is the only key to a swap's output** — persist before @@ -165,7 +165,7 @@ Suggested path for a new integrator: (1) `onboard()` a profile — it doubles as a test fixture; (2) walk swap → `collect_all()` once with the -Tier 1 verbs so the mechanics are concrete; (3) read the reference below +Tier 1 methods so the mechanics are concrete; (3) read the reference below for the surface your app needs; (4) `tests/integration/` and `scripts/rehearsal.py` in the repo are working reference implementations of the full journey.""" @@ -205,8 +205,8 @@ def render() -> str: "", DEVELOPER_OPTIONS, "", - "Every write verb returns a prepared `DexCall`: nothing touches the", - "network until a terminal verb — `.simulate()` (local, free),", + "Every write method returns a prepared `DexCall`: nothing touches the", + "network until a terminal method — `.simulate()` (local, free),", "`.transact()` (local proving, slow), or `.delegate()` (delegated", "proving — the practical path).", "", @@ -236,7 +236,7 @@ def render() -> str: "", ] parts += [_entry(n, getattr(derivations, n)) for n in TIER2_DERIVATIONS] - parts += ["### Chain verbs", ""] + parts += ["### Chain methods", ""] parts += [_entry(n, getattr(ShieldSwap, n)) for n in TIER2_CLIENT] return "\n".join(parts) + "\n" diff --git a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md index d279720f..483318ae 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md +++ b/shield-swap-sdk/python/aleo_shield_swap/AGENTS.md @@ -100,7 +100,7 @@ business, not the user's): 1. **Their own playbook.** Ask whether they have instructions of their own — a strategy file, notes, a memory store, output from a previous session. If so, read it and treat it as the plan: their document - decides what to do, the verbs here describe how each step works. + decides what to do, the methods here describe how each step works. 2. **A suggested journey.** Frame the setting first — Shield Swap is a private exchange on Aleo's test network: trading uses test tokens, and @@ -135,7 +135,7 @@ business, not the user's): and the integration checklist. 4. **A free-form prompt.** Whatever they describe, map it onto the - verbs and journeys above before improvising against the SDK. + methods and journeys above before improvising against the SDK. ### While acting @@ -166,21 +166,21 @@ where the signing keys live: | Browser dApp (wallet-signed) | The TypeScript stack: `@provablehq/shield-swap-sdk` + Veil react hooks — not this package | The user's wallet signs and proves. | What every integration must handle (each enforced or automated by the -verbs above — this list is the review checklist for code that bypasses +methods above — this list is the review checklist for code that bypasses them): - **Auth is layered**: a bearer credential (24h session JWT from the challenge/verify handshake, or a durable `ss_…` API token — data/trading endpoints only) AND a one-time invite redemption per account. - **Dynamic-dispatch imports**: every record-spending write must register - the involved token programs with the prover (the verbs resolve this via + the involved token programs with the prover (the methods resolve this via the token registry; pass `imports=`/`token_*_program=` to override). - **Tokens are private records**: spendable balances do not appear in public reads; one covering record funds an amount — no aggregation. - **Amounts are raw native units end to end** (the AMM does no decimal scaling); quote in canonical decimals, transact in raw base units, display human. -- **Wrapped assets route automatically** (swap/claim/LP verbs dispatch to +- **Wrapped assets route automatically** (swap/claim/LP methods dispatch to the routers per token shape) — fund them with UNDERLYING records; never hand wrapper records around. - **A `SwapHandle` is the only key to a swap's output** — persist before @@ -191,13 +191,13 @@ them): Suggested path for a new integrator: (1) `onboard()` a profile — it doubles as a test fixture; (2) walk swap → `collect_all()` once with the -Tier 1 verbs so the mechanics are concrete; (3) read the reference below +Tier 1 methods so the mechanics are concrete; (3) read the reference below for the surface your app needs; (4) `tests/integration/` and `scripts/rehearsal.py` in the repo are working reference implementations of the full journey. -Every write verb returns a prepared `DexCall`: nothing touches the -network until a terminal verb — `.simulate()` (local, free), +Every write method returns a prepared `DexCall`: nothing touches the +network until a terminal method — `.simulate()` (local, free), `.transact()` (local proving, slow), or `.delegate()` (delegated proving — the practical path). @@ -243,10 +243,9 @@ Whether this authenticated account has redeemed an invite code. Redeem a pasted invite — always a REFERRAL code. User-shared invites are referral codes (``/referral/redeem``); -that is the ONLY kind a person pastes. Access codes are a -programmatic self-registration flow — see -:meth:`generate_access_codes` / :meth:`redeem_access_code` — -never routed through here. +that is the ONLY kind a person pastes. Access codes are a separate +programmatic tier — see :meth:`redeem_access_code` — never routed +through here. Sessions moved to the ``/auth/*`` endpoints, so no token comes back — re-authenticate if needed (one is still adopted if the API @@ -275,11 +274,22 @@ management still require a session JWT. ### `api.get_pools(self) -> 'list[PoolEntry]'` +Every pool the DEX lists, each with its two tokens' metadata. +An entry exposes the pool's own fields directly — ``entry.key`` is the +``pool_key`` that ``swap``, ``mint``, and ``collect`` take. Its +``token0_info`` / ``token1_info`` carry that token's ``symbol`` and +``decimals``, but the API does not guarantee them — check for ``None`` +before reading. ### `api.get_tokens(self) -> 'list[models.TokenDoc]'` +Every token the DEX lists, with its id, symbol, and decimals. +``decimals`` converts between the two amount conventions. +The API returns canonical decimal amounts (``"1.5"``), if using this +value to call on-chain methods — ``swap(amount_in=…)``, ``mint``, +``collect`` — conversion to raw base units is necessary. ### `api.get_route(self, *, token_in: 'str', token_out: 'str', amount_in: 'Any' = None) -> 'models.RouteResultDoc'` @@ -311,7 +321,7 @@ Derives at ``start_counter, +1, …`` and probes the program's ``used_blinded_addresses`` mapping until one is free. ``max_scan`` fails fast when something is systematically wrong (e.g. wrong program). -### Chain verbs +### Chain methods ### `swap(self, *, pool_key: 'str', token_in_id: 'str', amount_in: 'int', slippage_bps: 'int' = 50, expected_out: 'Optional[int]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle]'` @@ -323,7 +333,7 @@ with UNDERLYING records — the deposit happens in-transaction. Resolves the intent against live pool state, derives a single-use blinded identity from the signer's view key, selects an unspent token record (or takes *token_record* verbatim), and returns a prepared -call. The terminal verb (``transact``/``delegate``) returns a +call. The terminal method (``transact``/``delegate``) returns a :class:`~aleo_shield_swap.types.SwapHandle` — persist it if the process might die before the claim. @@ -428,9 +438,20 @@ privately). Requires a configured record provider. ### `derive_pool_key(self, token0: 'str', token1: 'str', fee: 'int') -> 'str'` +Compute the pool key for a token pair and fee tier. Local — no network. +Deriving a key never implies the pool exists; pass the result to +:meth:`is_pool_initialized` before quoting or trading against it. The +derivation is sensitive to token order and is network-scoped, so swapping +*token0* and *token1*, or reusing a key across mainnet and testnet, yields +a valid-looking ``field`` that matches nothing on chain. *fee* is the +contract's ``u16`` fee tier. ### `derive_tick_key(self, pool_key: 'str', tick: 'int') -> 'str'` +Compute the key of one tick within a pool. Local — no network. +*tick* is a signed index, and the returned ``field`` is what reads that +tick's on-chain state — the initialized-tick list ``mint`` validates its +hints against. Network-scoped like :meth:`derive_pool_key`. diff --git a/shield-swap-sdk/python/aleo_shield_swap/_calls.py b/shield-swap-sdk/python/aleo_shield_swap/_calls.py index 84a1dd51..39c48359 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/_calls.py +++ b/shield-swap-sdk/python/aleo_shield_swap/_calls.py @@ -1,6 +1,6 @@ """DexCall — a facade BoundCall plus a typed result builder. -Preserves the facade's verb ladder on every DEX write: the consumer picks +Preserves the facade's call semantics on every DEX write: the consumer picks the proving path (``simulate`` / ``transact`` / ``delegate``) and gets a typed result back instead of a bare transaction id. @@ -71,7 +71,7 @@ def root_outputs(decoded_transitions: list[dict[str, Any]], class DexCall(Generic[R]): """A prepared DEX write. ``build_result(transaction_id, root_outputs) - -> R`` turns the submitted transaction into the verb's typed result.""" + -> R`` turns the submitted transaction into the method's typed result.""" def __init__(self, aleo: Any, bound: Any, build_result: Callable[[str, list[str]], R]) -> None: diff --git a/shield-swap-sdk/python/aleo_shield_swap/_core.py b/shield-swap-sdk/python/aleo_shield_swap/_core.py index 052975fe..c5b2a0c0 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/_core.py +++ b/shield-swap-sdk/python/aleo_shield_swap/_core.py @@ -239,6 +239,12 @@ def register_program_sources(aleo: Any, sources: dict[str, str]) -> None: added: set[str] = set() def add(pid: str) -> None: + """Register *pid* and its imports, dependencies first. + + Skips ``credits.aleo`` (already seeded), programs handled in this pass, + anything absent from *sources*, and programs the process already holds — + so repeated calls are cheap and safe. + """ if pid == "credits.aleo" or pid in added or pid not in sources: return added.add(pid) diff --git a/shield-swap-sdk/python/aleo_shield_swap/_routing.py b/shield-swap-sdk/python/aleo_shield_swap/_routing.py index 42edecf0..815a7917 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/_routing.py +++ b/shield-swap-sdk/python/aleo_shield_swap/_routing.py @@ -16,16 +16,34 @@ class Route(NamedTuple): + """Which program and function a call must go through. + + Dispatch target only — it says nothing about the arguments, which differ + between the core and router entrypoints. + """ + program: str function: str def swap_route(input_wrapped: bool) -> Route: + """Route a swap by whether the INPUT token is wrapped. + + A wrapped input must enter through the router, which unwraps it; a plain + ARC-20 calls the core directly. The output shape does not matter here — it is + settled at claim time by :func:`claim_route`. + """ return (Route(ROUTER_ID, "swap_from_wrapped") if input_wrapped else Route(PROGRAM_ID, "swap")) def claim_route(output_wrapped: bool, refund_wrapped: bool) -> Route: + """Route a claim by the wrapped-ness of its output and refund legs. + + Either leg being wrapped forces the claim through the router, since only it + can wrap on the way out; a claim with both legs plain goes to the core. The + two flags come from the finalized ``SwapOutput``, not from the original swap. + """ if output_wrapped and refund_wrapped: return Route(ROUTER_ID, "claim_to_wrapped_refund_wrapped") if output_wrapped: @@ -46,12 +64,24 @@ def _lp_route(w0: bool, w1: bool, stem: str, core_fn: str) -> Route: def mint_route(w0: bool, w1: bool) -> Route: + """Route a mint by which of the pool's two tokens are wrapped. + + Any wrapped side sends the call through the LP router; both plain goes to the + core. *w0* and *w1* follow the pool's token order, so passing them reversed + silently picks the wrong entrypoint. + """ return _lp_route(w0, w1, "mint_from", "mint") def increase_route(w0: bool, w1: bool) -> Route: + """Route a liquidity increase — same wrapped-ness rule as :func:`mint_route`.""" return _lp_route(w0, w1, "increase_from", "increase_liquidity") def collect_route(w0: bool, w1: bool) -> Route: + """Route a fee collection by which pool tokens are wrapped. + + Mirrors :func:`mint_route`, but the router wraps on the way OUT rather than + unwrapping on the way in. + """ return _lp_route(w0, w1, "collect_to", "collect") diff --git a/shield-swap-sdk/python/aleo_shield_swap/agent.py b/shield-swap-sdk/python/aleo_shield_swap/agent.py index 7607e3e9..30071f69 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/agent.py +++ b/shield-swap-sdk/python/aleo_shield_swap/agent.py @@ -2,11 +2,11 @@ ``shield_swap_tools()`` returns tool definitions in the Claude API ``tools=`` shape (name / description / input_schema) — they plug into any framework -that speaks JSON-schema tools. ``dispatch_tool(dex, name, args)`` executes -one against a :class:`~aleo_shield_swap.client.ShieldSwap` (write verbs run +that accepts JSON-schema tools. ``dispatch_tool(dex, name, args)`` executes +one against a :class:`~aleo_shield_swap.client.ShieldSwap` (write methods run ``.delegate()``) and returns a JSON-serializable result. The surface is the curated lifecycle set — swap handles and counters live in the profile -journal, so agents never carry state between calls; the long tail of verbs +journal, so agents never carry state between calls; the long tail of methods is reachable by writing Python against the client instead. """ from __future__ import annotations diff --git a/shield-swap-sdk/python/aleo_shield_swap/api.py b/shield-swap-sdk/python/aleo_shield_swap/api.py index 96244064..d7cf9075 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/api.py +++ b/shield-swap-sdk/python/aleo_shield_swap/api.py @@ -197,10 +197,9 @@ def redeem_code(self, code: str) -> models.AccessRedeemResponse: """Redeem a pasted invite — always a REFERRAL code. User-shared invites are referral codes (``/referral/redeem``); - that is the ONLY kind a person pastes. Access codes are a - programmatic self-registration flow — see - :meth:`generate_access_codes` / :meth:`redeem_access_code` — - never routed through here. + that is the ONLY kind a person pastes. Access codes are a separate + programmatic tier — see :meth:`redeem_access_code` — never routed + through here. Sessions moved to the ``/auth/*`` endpoints, so no token comes back — re-authenticate if needed (one is still adopted if the API @@ -213,16 +212,13 @@ def redeem_code(self, code: str) -> models.AccessRedeemResponse: self._token = token return out - def generate_access_codes(self, count: int = 1) -> list[str]: - """Mint access codes (``POST /access/generate``) — the - self-registration tier for operators/services; requires an - account with generate rights.""" - return list(self._post("/access/generate", {"count": count})["data"]["codes"]) - def redeem_access_code(self, code: str) -> models.AccessRedeemResponse: """Redeem a programmatically minted access code - (``POST /access/redeem``) — the self-registration counterpart of - :meth:`generate_access_codes`; not for human-pasted invites.""" + (``POST /access/redeem``) — not for human-pasted invites, which are + referral codes and go through :meth:`redeem_code`. + + Minting these is deliberately not exposed by this SDK; obtain a code + out-of-band from an operator.""" data = self._post("/access/redeem", {"code": code})["data"] return _build(models.AccessRedeemResponse, data) @@ -262,6 +258,14 @@ def create_api_token(self, name: str, # ── Pools & tokens ───────────────────────────────────────────────────── def get_pools(self) -> list[PoolEntry]: + """Every pool the DEX lists, each with its two tokens' metadata. + + An entry exposes the pool's own fields directly — ``entry.key`` is the + ``pool_key`` that ``swap``, ``mint``, and ``collect`` take. Its + ``token0_info`` / ``token1_info`` carry that token's ``symbol`` and + ``decimals``, but the API does not guarantee them — check for ``None`` + before reading. + """ entries = self._get("/pools")["data"] return [ PoolEntry( @@ -273,6 +277,13 @@ def get_pools(self) -> list[PoolEntry]: ] def get_tokens(self) -> list[models.TokenDoc]: + """Every token the DEX lists, with its id, symbol, and decimals. + + ``decimals`` converts between the two amount conventions. + The API returns canonical decimal amounts (``"1.5"``), if using this + value to call on-chain methods — ``swap(amount_in=…)``, ``mint``, + ``collect`` — conversion to raw base units is necessary. + """ return [_build(models.TokenDoc, t) for t in self._get("/tokens")["data"]] # ── Trading ──────────────────────────────────────────────────────────── @@ -288,10 +299,24 @@ def get_route(self, *, token_in: str, token_out: str, return _build(models.RouteResultDoc, self._get("/route", params)["data"]) def get_swap(self, swap_id: str) -> models.SwapDoc: + """The indexer's record of one swap, by its id. + + Note: The API may lag slightly behind chain state, so a recently + broadcast swap may not be visible immediately and can be retried if a + caller has confirmed a swap on chain — raises :class:`DexApiError` (404) + until it is. + """ return _build(models.SwapDoc, self._get(f"/swaps/{swap_id}")["data"]) def get_ohlcv(self, pool_key: str, *, granularity: str, from_ts: str, to_ts: str) -> list[models.OhlcvDoc]: + """Candles for one pool over a time window. + + *granularity* is one of ``"1m"``, ``"5m"``, ``"15m"``, ``"30m"``, + ``"1h"``, ``"6h"``, ``"12h"``, ``"1d"``. *from_ts* and *to_ts* are unix + seconds — *from_ts* inclusive, *to_ts* exclusive. Anything else raises + :class:`DexApiError`. + """ data = self._get(f"/pools/{pool_key}/ohlcv", {"granularity": granularity, "from": from_ts, "to": to_ts})["data"] return [_build(models.OhlcvDoc, o) for o in data] @@ -299,6 +324,12 @@ def get_ohlcv(self, pool_key: str, *, granularity: str, # ── Balances ─────────────────────────────────────────────────────────── def get_public_balances(self, user: str) -> list[models.TokenBalanceDoc]: + """Public token balances for an address, as the API sees them. + + Public only — tokens held privately in records are invisible here, so this + understates a shielded account. Use ``ShieldSwap.get_private_balances`` + to get private balances. + """ return [_build(models.TokenBalanceDoc, b) for b in self._get("/balances", {"user": user})["data"]] @@ -327,6 +358,11 @@ def __repr__(self) -> str: @property def is_authenticated(self) -> bool: + """True once a credential is held — a cookie-session CSRF token or a JWT. + + Reflects only that a credential was stored, not that it is still valid; + an expired session shows True here and fails on the next call. + """ return bool(self._token or self._csrf) def _headers(self) -> dict[str, str]: @@ -377,6 +413,7 @@ async def authenticate(self, address: str, sign: Any) -> str: return self._csrf def set_token(self, token: str) -> None: + """Adopt a previously issued JWT — see :meth:`ApiClient.set_token`.""" self._token = token # ── Lifecycle (async mirror of ApiClient) ────────────────────────────── @@ -395,11 +432,6 @@ async def redeem_code(self, code: str) -> models.AccessRedeemResponse: self._token = token return out - async def generate_access_codes(self, count: int = 1) -> list[str]: - """Mint access codes — see :meth:`ApiClient.generate_access_codes`.""" - return list((await self._post("/access/generate", - {"count": count}))["data"]["codes"]) - async def redeem_access_code(self, code: str) -> models.AccessRedeemResponse: """Redeem an access code — see :meth:`ApiClient.redeem_access_code`.""" data = (await self._post("/access/redeem", {"code": code}))["data"] @@ -428,6 +460,7 @@ async def create_api_token(self, name: str, (await self._post("/api-tokens", body))["data"]) async def get_pools(self) -> list[PoolEntry]: + """Every pool with its tokens' metadata — see :meth:`ApiClient.get_pools`.""" entries = (await self._get("/pools"))["data"] return [ PoolEntry( @@ -439,25 +472,34 @@ async def get_pools(self) -> list[PoolEntry]: ] async def get_tokens(self) -> list[models.TokenDoc]: + """Every listed token — see :meth:`ApiClient.get_tokens`.""" return [_build(models.TokenDoc, t) for t in (await self._get("/tokens"))["data"]] async def get_route(self, *, token_in: str, token_out: str, amount_in: int | None = None) -> models.RouteResultDoc: + """Best route between two tokens — see :meth:`ApiClient.get_route`. + + As on the sync client, *amount_in* is stringified onto the query and the + API reads it as a canonical decimal amount, not base units. + """ params: dict[str, Any] = {"token_in": token_in, "token_out": token_out} if amount_in is not None: params["amount_in"] = str(amount_in) return _build(models.RouteResultDoc, (await self._get("/route", params))["data"]) async def get_swap(self, swap_id: str) -> models.SwapDoc: + """One swap by id — see :meth:`ApiClient.get_swap`.""" return _build(models.SwapDoc, (await self._get(f"/swaps/{swap_id}"))["data"]) async def get_ohlcv(self, pool_key: str, *, granularity: str, from_ts: str, to_ts: str) -> list[models.OhlcvDoc]: + """Candles for one pool — see :meth:`ApiClient.get_ohlcv`.""" data = (await self._get(f"/pools/{pool_key}/ohlcv", {"granularity": granularity, "from": from_ts, "to": to_ts}))["data"] return [_build(models.OhlcvDoc, o) for o in data] async def get_public_balances(self, user: str) -> list[models.TokenBalanceDoc]: + """Public balances for *user* — see :meth:`ApiClient.get_public_balances`.""" return [_build(models.TokenBalanceDoc, b) for b in (await self._get("/balances", {"user": user}))["data"]] diff --git a/shield-swap-sdk/python/aleo_shield_swap/async_client.py b/shield-swap-sdk/python/aleo_shield_swap/async_client.py index e1f7a5ae..b1a4208b 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/async_client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/async_client.py @@ -2,7 +2,7 @@ Reads, balances, and the two-transaction private-swap flow of :class:`~aleo_shield_swap.client.ShieldSwap`, with every I/O method -``async``. Liquidity verbs are sync-client-only for now. Pure logic is +``async``. Liquidity methods are sync-client-only for now. Pure logic is shared from ``_core``/``derivations`` — only the I/O differs. """ from __future__ import annotations @@ -53,10 +53,20 @@ def __init__(self, aleo: Any, bound: Any, self._build = build_result def simulate(self, account: Any = None) -> Any: - # AsyncBoundCall.simulate is synchronous (local authorization). + """Local authorization — no proof, no send; inspect before spending. + + Synchronous even on the async client: ``AsyncBoundCall.simulate`` only + authorizes locally, so there is nothing to await. + """ return self._bound.simulate(account) async def transact(self, account: Any = None, **fee_kwargs: Any) -> R: + """Prove locally, broadcast, and build the typed result. + + Root-transition outputs are harvested from the built transaction + before broadcast, so the result is complete without waiting for + confirmation. + """ tx = await self._bound.build_transaction(account, **fee_kwargs) outputs = root_outputs(tx.decoded(), self._bound.program_id, self._bound.function_name) @@ -64,6 +74,14 @@ async def transact(self, account: Any = None, **fee_kwargs: Any) -> R: return self._build(tx.id, outputs) async def delegate(self, account: Any = None, **fee_kwargs: Any) -> R: + """Delegate proving to the DPS (fee master pays by default) and build + the typed result from the root transition. + + Outputs are harvested from the DPS payload itself when it carries + the full transaction, so ``wait=False`` returns as soon as the + broadcast is accepted — callers that read chain state later (e.g. + ``collect_all``) don't need to block on confirmation here. + """ payload = await self._bound.delegate(account, **fee_kwargs) tx_id = extract_tx_id(payload) await self._aleo.network.wait_for_transaction(tx_id) @@ -103,12 +121,18 @@ async def _mapping_value(self, mapping: str, key: str) -> Optional[str]: # ── Chain reads ────────────────────────────────────────────────────────── async def get_pool(self, pool_key: str) -> g.PoolState: + """Static pool configuration (token pair, fee, decimal scales).""" raw = await self._mapping_value("pools", pool_key) if raw is None: raise PoolNotFoundError(pool_key) return g.PoolState.from_plaintext(raw) async def get_slot(self, pool_key: str) -> SlotView: + """Live trading state (sqrt price, tick, in-range liquidity). + + Raises :class:`PoolNotFoundError` when the pool does not exist, or + :class:`PoolNotInitializedError` when it exists but has no slot yet. + """ raw = await self._mapping_value("slots", pool_key) if raw is None: if await self._mapping_value("pools", pool_key) is not None: @@ -117,6 +141,12 @@ async def get_slot(self, pool_key: str) -> SlotView: return SlotView(g.Slot.from_plaintext(raw)) async def get_swap_output(self, swap: "SwapHandle | str") -> g.SwapOutput: + """Chain-computed output of a finalized swap request. + + Accepts the :class:`SwapHandle` from ``swap()`` or a bare swap id. + Raises :class:`SwapOutputNotFinalizedError` when the entry is absent — + not finalized yet (retry after a few blocks) or already claimed. + """ swap_id = swap.swap_id if isinstance(swap, SwapHandle) else swap if not swap_id: raise ValueError("SwapHandle has no swap_id yet — wait for the " @@ -127,15 +157,47 @@ async def get_swap_output(self, swap: "SwapHandle | str") -> g.SwapOutput: return g.SwapOutput.from_plaintext(raw) async def is_pool_initialized(self, pool_key: str) -> bool: + """True once *pool_key* has been initialized on chain. Reads a mapping. + + A pool must be initialized before it will accept swaps or liquidity, so + check this before quoting against a key you derived rather than listed. + An absent mapping entry reads as False, which is also what an unknown key + gives you — this does not distinguish the two. + """ raw = await self._mapping_value("initialized_pools", pool_key) return raw is not None and "true" in raw # ── Pure derivations (sync — no I/O) ───────────────────────────────────── def derive_pool_key(self, token0: str, token1: str, fee: int) -> str: + """Compute the pool key for a token pair and fee tier. Local — no network. + + Deriving a key does not mean the pool exists; pass the result to + :meth:`is_pool_initialized` before trading against it. The token order + matters, and the derivation is network-scoped, so a key computed for one + network will not match the other. + + Args: + token0: First token id of the pair. + token1: Second token id of the pair. + fee: Fee tier in the contract's ``u16`` units. + + Returns: + The pool key as a ``field`` literal. + """ return _derive_pool_key(token0, token1, fee, network=self._aleo.network_name) def derive_tick_key(self, pool_key: str, tick: int) -> str: + """Compute the key of one tick within a pool. Local — no network. + + Args: + pool_key: Pool the tick belongs to. + tick: Signed tick index. + + Returns: + The tick key as a ``field`` literal, usable to read the tick's + on-chain state. + """ return _derive_tick_key(pool_key, tick, network=self._aleo.network_name) # ── Async record/identity/imports helpers ─────────────────────────────── @@ -243,6 +305,9 @@ def _account(self, account: Any = None) -> Any: async def get_private_balances(self, programs: list[str], account: Any = None) -> dict[str, int]: + """Sum of unspent record amounts per wrapper program (spendable + privately). Requires a configured record provider. + """ provider = self._aleo.record_provider out: dict[str, int] = {} for program in programs: @@ -258,6 +323,15 @@ async def get_private_balances(self, programs: list[str], async def get_balances(self, address: Optional[str] = None, account: Any = None) -> dict[str, dict[str, Any]]: + """Public + private + total per token id, joined via the API's + token registry. Defaults to the bound account's address; returns + only tokens actually held. + + Private balances can only be scanned for the bound account's view + key — when *address* names someone else, ``private`` is 0 for every + token (their records are not scannable) rather than silently mixing + in the caller's own private holdings. + """ acct = account if account is not None else self._aleo.default_account addr = address or (str(acct.address) if acct is not None else None) if addr is None: @@ -299,6 +373,26 @@ async def swap(self, *, pool_key: str, token_in_id: str, amount_in: int, wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None) -> AsyncDexCall[SwapHandle]: + """Request a private swap — phase one of the two-transaction flow. + + Wrapped inputs route via the swap router automatically; fund them + with UNDERLYING records — the deposit happens in-transaction. + + Resolves the intent against live pool state, derives a single-use + blinded identity from the signer's view key, selects an unspent token + record (or takes *token_record* verbatim), and returns a prepared + call. The terminal method (``transact``/``delegate``) returns a + :class:`~aleo_shield_swap.types.SwapHandle` — persist it if the + process might die before the claim. + + Quote first (``dex.api.get_route``) and pass *expected_out*: without + it a spot estimate is used, which ignores fees and price impact. + Pass *identity* (from journal-reserved counters) to skip the + on-chain probe — required for concurrent swaps. The default + *deadline_offset_blocks* (~8h at ~3s blocks) absorbs delegated- + proving latency; a tight deadline aborts at finalize when proving + outlives it. + """ acct = self._account(account) pool = await self.get_pool(pool_key) slot = await self.get_slot(pool_key) @@ -347,6 +441,12 @@ async def swap(self, *, pool_key: str, token_in_id: str, amount_in: int, bound = getattr(prog.functions, route.function)(*inputs) def build_result(tx_id: str, outputs: list[Any]) -> SwapHandle: + """Assemble the swap handle, carrying the blinding secret forward. + + The first public ``field`` output is the swap id; it stays ``None`` if + the transition published none, which leaves the handle unclaimable + until the id is recovered from the transaction. + """ swap_id = next((o for o in outputs if isinstance(o, str) and o.endswith("field")), None) return SwapHandle( @@ -363,6 +463,21 @@ async def claim_swap_output(self, handle: SwapHandle, *, wrapper_proofs: Optional[str] = None, imports: Optional[dict[str, str]] = None, account: Any = None) -> AsyncDexCall[ClaimResult]: + """Claim a private swap's output — phase two of the lifecycle. + + Reads the chain-computed result from ``swap_outputs`` (never an + off-chain service — these amounts gate money movement), proves + ownership of the blinded identity, and claims. A wrapped output or + refund routes automatically through the router, which unwraps to + the signer in the same transaction — even for swaps that started + as direct core calls. The output and any refund arrive as private + records owned by the signer (output first, refund second); the + mapping entry is consumed. + + Raises :class:`SwapOutputNotFinalizedError` **at prepare time** when + the output is not readable yet (retry after a few blocks) or was + already claimed. + """ self._account(account) if not handle.swap_id: raise ValueError("handle.swap_id is not set — recover it from the " diff --git a/shield-swap-sdk/python/aleo_shield_swap/client.py b/shield-swap-sdk/python/aleo_shield_swap/client.py index af56af68..1886aa6a 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/client.py +++ b/shield-swap-sdk/python/aleo_shield_swap/client.py @@ -123,7 +123,7 @@ def from_profile(cls, home: Any = None) -> "ShieldSwap": # DPS api key, which the credentials stage provisions. aleo.records.register(aleo.default_account) except Exception: - pass # offline or scanner down — record verbs will surface it + pass # offline or scanner down — record methods will surface it dex = cls(aleo) dex.profile = profile dex.journal = Journal(profile.journal_path) @@ -229,6 +229,13 @@ def get_swap_output(self, swap: "SwapHandle | str") -> g.SwapOutput: return g.SwapOutput.from_plaintext(raw) def is_pool_initialized(self, pool_key: str) -> bool: + """True once *pool_key* has been initialized on chain. Reads a mapping. + + A pool must be initialized before it will accept swaps or liquidity, so + check this before quoting against a key you derived rather than listed. + An absent mapping entry reads as False, which is also what an unknown key + gives you — this does not distinguish the two. + """ raw = self._mapping_value("initialized_pools", pool_key) return raw is not None and "true" in raw @@ -315,10 +322,25 @@ def status(self) -> SessionStatus: # ── Pure derivations (no network) ──────────────────────────────────────── def derive_pool_key(self, token0: str, token1: str, fee: int) -> str: + """Compute the pool key for a token pair and fee tier. Local — no network. + + Deriving a key never implies the pool exists; pass the result to + :meth:`is_pool_initialized` before quoting or trading against it. The + derivation is sensitive to token order and is network-scoped, so swapping + *token0* and *token1*, or reusing a key across mainnet and testnet, yields + a valid-looking ``field`` that matches nothing on chain. *fee* is the + contract's ``u16`` fee tier. + """ return _derive_pool_key(token0, token1, fee, network=self._aleo.network_name) def derive_tick_key(self, pool_key: str, tick: int) -> str: + """Compute the key of one tick within a pool. Local — no network. + + *tick* is a signed index, and the returned ``field`` is what reads that + tick's on-chain state — the initialized-tick list ``mint`` validates its + hints against. Network-scoped like :meth:`derive_pool_key`. + """ return _derive_tick_key(pool_key, tick, network=self._aleo.network_name) def find_tick_predecessor(self, pool_key: str, new_tick: int, @@ -470,7 +492,7 @@ def swap( Resolves the intent against live pool state, derives a single-use blinded identity from the signer's view key, selects an unspent token record (or takes *token_record* verbatim), and returns a prepared - call. The terminal verb (``transact``/``delegate``) returns a + call. The terminal method (``transact``/``delegate``) returns a :class:`~aleo_shield_swap.types.SwapHandle` — persist it if the process might die before the claim. @@ -544,6 +566,12 @@ def swap( route.function)(*inputs) def build_result(tx_id: str, outputs: list[Any]) -> SwapHandle: + """Assemble the swap handle, carrying the blinding secret forward. + + The first public ``field`` output is the swap id; it stays ``None`` if + the transition published none, which leaves the handle unclaimable + until the id is recovered from the transaction. + """ swap_id = next( (o for o in outputs if isinstance(o, str) and o.endswith("field")), None, @@ -635,6 +663,11 @@ def claim_swap_output( route.function)(*inputs) def build_result(tx_id: str, outputs: list[Any]) -> ClaimResult: + """Pair the claim's transaction id with the amounts read pre-flight. + + The amounts come from the finalized swap output fetched before + building, not from *outputs* — the claim transition publishes none. + """ return ClaimResult(tx_id, out.amount_out, out.amount_remaining) return DexCall(self._aleo, bound, build_result) @@ -701,8 +734,8 @@ def _quote_expected_out(self, *, token_in_id: str, token_out_id: str, amount_in: int) -> Optional[int]: """Base-unit expected output for a trade, via the route quote. - The route endpoint speaks canonical decimal amounts, the contract - speaks base units — this converts in both directions using the + The route endpoint returns canonical decimal amounts, the contract + takes base units — this converts in both directions using the token registry's decimals. None (spot fallback) when either token is unknown or no route is quotable. """ @@ -913,6 +946,11 @@ def create_pool( bound = self._aleo.programs.get(self.program).functions.create_pool(*inputs) def build_result(tx_id: str, outputs: list[Any]) -> TxResult: + """Pull the new pool's key out of the transition's public outputs. + + The first ``field`` output is the key; it stays ``None`` if the + transition published none. + """ key = next((o for o in outputs if isinstance(o, str) and o.endswith("field")), None) return TxResult(position_token_id=key, transaction_id=tx_id) @@ -1025,6 +1063,12 @@ def mint( base_build = self._position_result(MintResult) def build_result(tx_id: str, outputs: list[Any]) -> MintResult: + """Build the mint result and journal the new position. + + Journaling is what lets a later session find this position without a + record scan; it is skipped when no journal is configured, or when the + transition published no position id to key it by. + """ result = base_build(tx_id, outputs) if self.journal is not None and result.position_token_id: self.journal.record_position(result.position_token_id, @@ -1185,6 +1229,12 @@ def burn( base_build = self._position_result(TxResult) def build_result(tx_id: str, outputs: list[Any]) -> TxResult: + """Build the burn result and mark the position closed in the journal. + + Uses the id parsed from the spent position record rather than the + transition outputs, so the journal is updated even when the burn + publishes nothing. + """ result = base_build(tx_id, outputs) if self.journal is not None and pid: self.journal.record_position_burned(pid, tx_id) @@ -1196,6 +1246,11 @@ def build_result(tx_id: str, outputs: list[Any]) -> TxResult: def _position_result(result_cls: Any) -> Any: """Result builder: first public ``field`` output is the position id.""" def build(tx_id: str, outputs: list[Any]) -> Any: + """Construct *result_cls* from the position id and transaction id. + + The position id is the first public ``field`` output, or ``None`` if + the transition published none. + """ pid = next((o for o in outputs if isinstance(o, str) and o.endswith("field")), None) return result_cls(pid, tx_id) return build diff --git a/shield-swap-sdk/python/aleo_shield_swap/errors.py b/shield-swap-sdk/python/aleo_shield_swap/errors.py index 4c2263ef..aa23ce51 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/errors.py +++ b/shield-swap-sdk/python/aleo_shield_swap/errors.py @@ -28,12 +28,24 @@ def __init__(self, swap_id: str) -> None: class PoolNotFoundError(ShieldSwapError): + """No pool exists at this key. + + Usually a key derived for the wrong token order, fee tier, or network — the + derivation succeeds regardless, so a bad key only surfaces on the first read. + """ + def __init__(self, pool_key: str) -> None: super().__init__(f"Pool {pool_key} does not exist on-chain.") self.pool_key = pool_key class PoolNotInitializedError(ShieldSwapError): + """The pool exists but has no slot yet, so it cannot quote or trade. + + Distinct from :class:`PoolNotFoundError`: the pool was created but never + initialized. Trading against it only works once someone initializes it. + """ + def __init__(self, pool_key: str) -> None: super().__init__(f"Pool {pool_key} exists but is not initialized.") self.pool_key = pool_key diff --git a/shield-swap-sdk/python/aleo_shield_swap/journal.py b/shield-swap-sdk/python/aleo_shield_swap/journal.py index be81c872..b102ca7e 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/journal.py +++ b/shield-swap-sdk/python/aleo_shield_swap/journal.py @@ -3,7 +3,7 @@ One JSONL file per profile. State (pending claims, open positions, the counter cursor) is always derived by replaying events, so a crash between append and action never corrupts anything; the worst case is an event whose -action never happened, which downstream verbs tolerate (a claim of a swap +action never happened, which downstream methods tolerate (a claim of a swap that never landed just reports not-finalized). Counter reservation is the concurrency-critical piece: blinded identities @@ -27,7 +27,35 @@ class Journal: - """Event log at *path* (created on first append).""" + """A participant's durable record of swaps, positions, and counters. + + Backs the JSONL file at *path* (created on first append). It holds the two + things the chain cannot give back: + + * every swap's ``blinding_factor`` — the secret + :meth:`~aleo_shield_swap.client.ShieldSwap.claim_swap_output` proves + knowledge of. A swap whose handle is lost cannot be claimed by + anyone, which is the point of blinding it. + * which blinding counters this account has spent, so no two swaps derive + the same blinded address. :meth:`reserve_counters` issues each one once + under a file lock, and a failed swap burns its counter rather than + recycling it. + + Nothing is stored as state — every event is appended and the views are + replayed from the log, so a crash between append and action leaves an event + whose action never happened rather than a corrupt file. Read it through + :meth:`pending_claims`, :meth:`open_positions`, and :meth:`counter_cursor` + rather than :meth:`events`. + + ``ShieldSwap.from_profile()`` wires one up per profile; ``swap_many`` and + ``collect_all`` require it and raise without one. Treat the file as key + material — it carries every blinding factor the account has used. + + Args: + path: Where the log lives, usually ``Profile.journal_path``. Its + parent is created on first append, alongside a ``.lock`` sibling + used to serialize writers. + """ def __init__(self, path: "Path | str") -> None: self.path = Path(path) @@ -50,12 +78,34 @@ def _locked(self) -> Iterator[None]: # ── Raw events ─────────────────────────────────────────────────────────── def append(self, type: str, **fields: Any) -> None: + """Write one event to the log, stamped and under the writer lock. + + Creates the file (and its parent) on first use. Fields are JSON-encoded + as given, so pass only JSON-safe values. Appending is not the action — + an event whose action never happened is expected and tolerated on replay. + + Args: + type: Event type, matched by name when state is derived. + **fields: Event payload; a ``ts`` wall-clock stamp is added. + """ event = {"type": type, "ts": time.time(), **fields} with self._locked(): with self.path.open("a") as f: f.write(json.dumps(event) + "\n") def events(self) -> list[dict[str, Any]]: + """Replay the whole log in append order. + + Reads without taking the lock, so a concurrent append may or may not be + included. An absent file reads as no events rather than raising. + + Returns: + Every event recorded so far. + + Raises: + json.JSONDecodeError: If a line is not valid JSON — a truncated write + from a crash mid-append. + """ if not self.path.exists(): return [] return [json.loads(line) @@ -89,28 +139,76 @@ def counter_cursor(self) -> int: # ── Typed events ───────────────────────────────────────────────────────── def record_swap(self, handle: SwapHandle, counter: int) -> None: + """Log a submitted swap so a later session can claim it. + + Persists the handle's blinding factor — the secret needed to claim — so + the journal file is sensitive. A handle with no ``swap_id`` is still + recorded, but :meth:`pending_claims` skips it as needing manual recovery. + + Args: + handle: The swap handle to persist. + counter: The counter this swap's blinded identity consumed, so it is + never reissued. + """ self.append("swap", counter=counter, **{k: getattr(handle, k) for k in _HANDLE_FIELDS}) def record_swap_failed(self, counter: int, error: str) -> None: + """Burn a counter whose swap never landed. + + The counter stays spent — reusing it would risk a blinded-identity + collision — so this advances the cursor without producing a claimable + swap. + + Args: + counter: The counter to retire. + error: Why the swap failed, kept for diagnosis. + """ self.append("swap_failed", counter=counter, error=error) def record_claim(self, swap_id: str, transaction_id: str, amount_out: int) -> None: + """Mark a swap claimed, dropping it from :meth:`pending_claims`. + + Args: + swap_id: The claimed swap. + transaction_id: Transaction that settled the claim. + amount_out: Amount received, in base units. + """ self.append("claim", swap_id=swap_id, transaction_id=transaction_id, amount_out=amount_out) def record_position(self, position_token_id: str, pool_key: str, transaction_id: str) -> None: + """Log a minted position so it is found without a record scan. + + Args: + position_token_id: The position's token id. + pool_key: Pool the position belongs to. + transaction_id: Transaction that minted it. + """ self.append("position", position_token_id=position_token_id, pool_key=pool_key, transaction_id=transaction_id) def record_position_burned(self, position_token_id: str, transaction_id: str) -> None: + """Mark a position closed, dropping it from :meth:`open_positions`. + + Args: + position_token_id: The burned position's token id. + transaction_id: Transaction that burned it. + """ self.append("position_burned", position_token_id=position_token_id, transaction_id=transaction_id) def record_stage(self, name: str, action: str, detail: str = "") -> None: + """Log progress through a registration stage, for resumable onboarding. + + Args: + name: Stage name. + action: What happened at that stage. + detail: Optional extra context. + """ self.append("stage", name=name, action=action, detail=detail) # ── Derived state ──────────────────────────────────────────────────────── diff --git a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py index 439707f3..0ff122a1 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py +++ b/shield-swap-sdk/python/aleo_shield_swap/lifecycle.py @@ -46,12 +46,24 @@ def wrapper_programs(self) -> list[str]: return self._wrappers def funded(self) -> bool: + """True once any wrapper-underlying program holds a private balance. + + Reads private balances, so it needs the account's view key and costs a + record scan per wrapper program. Any non-zero balance counts as funded. + """ balances = self.dex.get_private_balances(self.wrapper_programs()) return any(v > 0 for v in balances.values()) @dataclass class Stage: + """One resumable step of registration: how to tell it is done, and how to do it. + + ``is_done`` is checked before ``run``, so a stage already satisfied is skipped + — that is what makes onboarding idempotent across sessions. Both receive the + shared context; ``run`` returns a one-line detail for the journal. + """ + name: str is_done: Callable[[_Ctx], bool] run: Callable[[_Ctx], str] # returns a one-line detail diff --git a/shield-swap-sdk/python/aleo_shield_swap/mcp.py b/shield-swap-sdk/python/aleo_shield_swap/mcp.py index 36540754..5e87adca 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/mcp.py +++ b/shield-swap-sdk/python/aleo_shield_swap/mcp.py @@ -6,7 +6,7 @@ advertises the exact JSON schema from :func:`~aleo_shield_swap.agent .shield_swap_tools` — FastMCP infers schemas from handler signatures, which would collapse every tool to one opaque ``args`` object. Tools run against -the synchronous :class:`~aleo_shield_swap.client.ShieldSwap` (the full verb +the synchronous :class:`~aleo_shield_swap.client.ShieldSwap` (its full method surface) in a worker thread, keeping the event loop free. Environment: @@ -90,6 +90,12 @@ def _build_dex() -> Any: def main() -> None: + """Serve the shield_swap MCP tools over stdio until the client disconnects. + + Builds a DEX client first, which binds a key from ``ALEO_PRIVATE_KEY`` or + else creates/loads the local participant profile on disk. Blocks for the + lifetime of the server; requires the ``[mcp]`` extra. + """ import anyio from mcp.server.stdio import stdio_server diff --git a/shield-swap-sdk/python/aleo_shield_swap/profile.py b/shield-swap-sdk/python/aleo_shield_swap/profile.py index 9141521f..bd39bc71 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/profile.py +++ b/shield-swap-sdk/python/aleo_shield_swap/profile.py @@ -47,8 +47,33 @@ def _initial_key(network: str) -> tuple[str, str]: class Profile: """A participant's persistent identity and credentials. + Holds exactly one Aleo address, generated on first use and reused every + session after. For several addresses, create a profile per address — each + needs its own home directory (``SHIELD_SWAP_HOME``, or *home* on + :meth:`load_or_create`), since the journal and credentials are per-profile + too. + Load with :meth:`load_or_create`; the profile is created (with fresh key - material) when the home directory has none yet. + material) when the home directory has none yet. The same call does both, + so callers never branch on whether one exists:: + + from pathlib import Path + from aleo_shield_swap import Profile + + # First run: generates a key and writes it owner-only. + profile = Profile.load_or_create() + print(profile.address) # aleo1… + + # Every run after: the same call returns that key, unchanged. + assert Profile.load_or_create().address == profile.address + + # A second address needs its own home. Pass a resolved path — ``~`` + # is not expanded, so a "~/..." string creates a literal ``~`` dir. + other = Profile.load_or_create(Path.home() / ".shield-swap-alt") + + That last call generates a fresh key only when no key is being imported; + with ``SHIELD_SWAP_PRIVATE_KEY`` set, every new home adopts that one key + instead, so all of them share an address. """ def __init__(self, home: Path, data: dict[str, Any]) -> None: @@ -62,6 +87,10 @@ def __repr__(self) -> str: @staticmethod def default_home() -> Path: + """Where profiles live by default: ``$SHIELD_SWAP_HOME`` or ``~/.shield-swap``. + + Local only — returns the path whether or not it exists. + """ env = os.environ.get("SHIELD_SWAP_HOME") return Path(env) if env else Path.home() / ".shield-swap" @@ -69,6 +98,25 @@ def default_home() -> Path: def load_or_create(cls, home: "Path | str | None" = None, *, network: str = "testnet", endpoint: str = DEFAULT_ENDPOINT) -> "Profile": + """Load the profile at *home*, creating one with fresh keys if absent. + + Creating a profile writes a private key to disk at mode 600; an existing + profile file has its mode tightened to 600 on load, healing a loose one. + The key comes from ``SHIELD_SWAP_PRIVATE_KEY`` (or the file named by + ``SHIELD_SWAP_PRIVATE_KEY_FILE``) when set, so a user with an existing + account supplies it out-of-band rather than pasting it into a chat. + + *network* and *endpoint* apply only when creating — they are ignored for an + existing profile, which keeps the values it was created with. + + Args: + home: Profile directory; defaults to :meth:`default_home`. + network: Network to bind a NEW profile to. + endpoint: API endpoint to record on a NEW profile. + + Returns: + The loaded or newly created profile. + """ home = Path(home) if home is not None else cls.default_home() path = home / _PROFILE if path.exists(): @@ -85,24 +133,44 @@ def load_or_create(cls, home: "Path | str | None" = None, *, @property def address(self) -> str: + """The profile's Aleo address (``aleo1…``) — the public half of its key.""" return self._data["address"] @property def private_key(self) -> str: + """The profile's private key, read from disk. + + Whoever holds this controls the account and can decrypt its records — do + not log it, echo it into a conversation, or send it to a service. + """ return self._data["private_key"] @property def network(self) -> str: + """Network this profile is bound to; fixed when the profile was created. + + Key derivations are network-scoped, so reusing a profile against the other + network yields keys that do not match anything on chain. + """ return self._data["network"] @property def endpoint(self) -> str: + """API endpoint recorded for this profile, or the package default. + + Older profiles predate the stored field and fall back to the default. + """ return self._data.get("endpoint", DEFAULT_ENDPOINT) # ── Credentials ────────────────────────────────────────────────────────── @property def credentials(self) -> dict[str, str]: + """DEX credentials saved for this profile — API tokens and session data. + + Re-read from disk on every access, so a value written by another process + is picked up. A missing file reads as an empty dict rather than raising. + """ path = self.home / _CREDENTIALS return json.loads(path.read_text()) if path.exists() else {} @@ -113,4 +181,9 @@ def save_credentials(self, **kv: Optional[str]) -> None: @property def journal_path(self) -> Path: + """Where this profile's :class:`~aleo_shield_swap.journal.Journal` lives. + + Returns the path whether or not the file exists — the journal creates it + on first append. + """ return self.home / "journal.jsonl" diff --git a/shield-swap-sdk/python/aleo_shield_swap/skills/SKILL.md b/shield-swap-sdk/python/aleo_shield_swap/skills/SKILL.md index 7801f397..a4e238fe 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/skills/SKILL.md +++ b/shield-swap-sdk/python/aleo_shield_swap/skills/SKILL.md @@ -9,9 +9,9 @@ installed version): python -m aleo_shield_swap Follow its Tier 1 lifecycle and conversation pattern. Write Python against -the SDK; don't re-implement flows the verbs already provide, and don't read +the SDK; don't re-implement flows the methods already provide, and don't read SDK source unless the guide genuinely lacks the answer. Preconditions are -enforced in code — on error, read the exception message; it names the verb +enforced in code — on error, read the exception message; it names the method that fixes it. To install this skill into a Claude Code project, copy this directory to diff --git a/shield-swap-sdk/python/aleo_shield_swap/types.py b/shield-swap-sdk/python/aleo_shield_swap/types.py index 89bc8948..f6ded0d8 100644 --- a/shield-swap-sdk/python/aleo_shield_swap/types.py +++ b/shield-swap-sdk/python/aleo_shield_swap/types.py @@ -1,7 +1,7 @@ """Semantic layer over the generated wire classes. The generated ``_generated.py`` classes carry the wire shapes; the classes -here carry meaning: the persistable swap handle, typed verb results, and a +here carry meaning: the persistable swap handle, typed method results, and a ``Slot`` view with Q128.128 price math and range helpers. """ from __future__ import annotations @@ -36,10 +36,29 @@ class SwapHandle: program: str def to_json(self) -> str: + """Serialize the handle to JSON for storage or hand-off. + + Includes the blinding factor, so the output is secret-bearing — treat it + like a key. Round-trips through :meth:`from_json`. + """ return json.dumps(asdict(self)) @classmethod def from_json(cls, s: str) -> "SwapHandle": + """Rebuild a handle from :meth:`to_json` output. + + Args: + s: JSON produced by :meth:`to_json`. + + Returns: + The restored handle, ready to claim. + + Raises: + json.JSONDecodeError: If *s* is not valid JSON. + TypeError: If the JSON omits a field or carries an unknown one — the + handle is rebuilt strictly, so a partial object fails loudly + rather than producing an unclaimable handle. + """ return cls(**json.loads(s)) @@ -54,13 +73,19 @@ class ClaimResult: @dataclass(frozen=True) class MintResult: + """Outcome of a mint: the new position's id and the transaction that made it. + + ``position_token_id`` is ``None`` when the transition published no id, which + leaves the position discoverable only by a record scan. + """ + position_token_id: Optional[str] transaction_id: str @dataclass(frozen=True) class TxResult: - """Result of a liquidity verb; ``position_token_id`` when the verb + """Result of a liquidity method; ``position_token_id`` when the method re-issues/identifies a position, else ``None``.""" position_token_id: Optional[str] @@ -85,6 +110,11 @@ def __repr__(self) -> str: @property def raw(self) -> Slot: + """The wrapped slot (escape hatch), with no fixed-point interpretation. + + Prefer :meth:`price` and the other helpers — reading ``sqrt_price`` off + this directly means re-deriving the Q128.128 conversion yourself. + """ return self._slot def price(self, decimals0: int, decimals1: int) -> Decimal: diff --git a/shield-swap-sdk/scripts/rehearsal.py b/shield-swap-sdk/scripts/rehearsal.py index 2a52b357..284c3901 100644 --- a/shield-swap-sdk/scripts/rehearsal.py +++ b/shield-swap-sdk/scripts/rehearsal.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Stress-test rehearsal: the four flows, end to end, via the tier-1 verbs. +"""Stress-test rehearsal: the four flows, end to end, via the tier-1 methods. Usage: python scripts/rehearsal.py [--code INVITE] [--home DIR] Needs: network access. ``--code`` takes a REFERRAL code (human-pasted by diff --git a/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py b/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py index 57295658..b89fef55 100644 --- a/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py +++ b/shield-swap-sdk/tests/integration/test_devnode_lifecycle.py @@ -1,4 +1,4 @@ -"""Full AMM lifecycle on a devnode, through the ShieldSwap verbs. +"""Full AMM lifecycle on a devnode, through the ShieldSwap methods. Python analog of the TS suite's ``devnodeLifecycle.actions.e2e.test.ts``: a non-admin user creates two pools (same pair, two fee tiers), mints and diff --git a/shield-swap-sdk/tests/test_api_client.py b/shield-swap-sdk/tests/test_api_client.py index 8f6a3da7..94f4eae8 100644 --- a/shield-swap-sdk/tests/test_api_client.py +++ b/shield-swap-sdk/tests/test_api_client.py @@ -3,7 +3,7 @@ import pytest -from aleo_shield_swap.api import ApiClient +from aleo_shield_swap.api import ApiClient, AsyncApiClient from aleo_shield_swap.errors import DexApiError POOLS = json.loads((Path(__file__).parent / "fixtures" / "pools_response.json").read_text()) @@ -207,19 +207,22 @@ async def test_async_lifecycle_endpoints(): await api.request_airdrop("aleo1a") -def test_access_code_self_registration_flow(): - # Operators mint access codes and redeem them programmatically — - # a separate surface from the human referral-paste path. +def test_access_code_redeem_flow(): + # Access codes are redeemed programmatically — a separate surface from the + # human referral-paste path. Minting is deliberately not exposed by the + # SDK, so a code arrives out-of-band from an operator. api, s = _lifecycle_client( - _Resp(200, {"data": {"codes": ["ACODE12CHARS"]}}), _Resp(200, {"data": {"code": "ACODE12CHARS", "status": "redeemed"}}), ) - codes = api.generate_access_codes() - assert codes == ["ACODE12CHARS"] - out = api.redeem_access_code(codes[0]) + out = api.redeem_access_code("ACODE12CHARS") assert out.status == "redeemed" - assert [c[1] for c in s.calls] == ["https://x/access/generate", - "https://x/access/redeem"] + assert [c[1] for c in s.calls] == ["https://x/access/redeem"] + + +def test_minting_access_codes_is_not_exposed(): + # Guard the removal: the SDK must not offer a way to mint invites. + for cls in (ApiClient, AsyncApiClient): + assert not hasattr(cls, "generate_access_codes"), cls.__name__ def test_cookie_session_outranks_bearer(): diff --git a/shield-swap-sdk/tests/test_gen_context.py b/shield-swap-sdk/tests/test_gen_context.py index 64ead9dc..24d2c7e1 100644 --- a/shield-swap-sdk/tests/test_gen_context.py +++ b/shield-swap-sdk/tests/test_gen_context.py @@ -23,11 +23,11 @@ def test_tier1_lifecycle_and_conversation_pattern(): def test_tier2_covers_building_blocks_and_stages(): page = _render() - for verb in ("swap_many", "claim_swap_output", "collect_all", + for method in ("swap_many", "claim_swap_output", "collect_all", "increase_liquidity", "decrease_liquidity", "derive_pool_key", "simulate", "blinded_identity_at", "redeem_code", "request_airdrop"): - assert verb in page, verb + assert method in page, method # stages rendered FROM the list, not hand-written from aleo_shield_swap.lifecycle import REGISTRATION_STAGES for stage in REGISTRATION_STAGES: @@ -42,6 +42,8 @@ def test_committed_page_is_current(): def test_page_stays_compact(): - # ~5k tokens — cheap context, enforced. Raised 20k → 22k with the - # router-dispatch surface (wrapper_proofs / withdrawal params). - assert len(_render()) < 22_000 + # ~6k tokens — cheap context, enforced. Raised 20k → 22k with the + # router-dispatch surface (wrapper_proofs / withdrawal params); 22k → 24k + # when get_pools/get_tokens/derive_pool_key/derive_tick_key picked up full + # docstrings (they rendered blank before). + assert len(_render()) < 24_000 diff --git a/shield-swap-sdk/tests/test_liquidity.py b/shield-swap-sdk/tests/test_liquidity.py index 5b136b22..8fde02ee 100644 --- a/shield-swap-sdk/tests/test_liquidity.py +++ b/shield-swap-sdk/tests/test_liquidity.py @@ -1,4 +1,4 @@ -"""Liquidity verbs — exact input orders per the deployed shield_swap.aleo: +"""Liquidity methods — exact input orders per the deployed shield_swap.aleo: create_pool: [token0, token1, fee u16, sqrt_price U256, spacing u32, tick i32] mint: [nonce field, record0, record1, recipient, withdrawal, MintPositionRequest, token0, token1, signer_proofs,