diff --git a/404.html b/404.html index 9518ad369..e824661ba 100644 --- a/404.html +++ b/404.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - +
diff --git a/abi-decode/index.html b/abi-decode/index.html index 9518ad369..e824661ba 100644 --- a/abi-decode/index.html +++ b/abi-decode/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/abi-encode/index.html b/abi-encode/index.html index 9518ad369..e824661ba 100644 --- a/abi-encode/index.html +++ b/abi-encode/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/assembly-bin-exp/index.html b/app/assembly-bin-exp/index.html index 9518ad369..e824661ba 100644 --- a/app/assembly-bin-exp/index.html +++ b/app/assembly-bin-exp/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/bi-directional-payment-channel/index.html b/app/bi-directional-payment-channel/index.html index 9518ad369..e824661ba 100644 --- a/app/bi-directional-payment-channel/index.html +++ b/app/bi-directional-payment-channel/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/create2/index.html b/app/create2/index.html index 9518ad369..e824661ba 100644 --- a/app/create2/index.html +++ b/app/create2/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/crowd-fund/index.html b/app/crowd-fund/index.html index 9518ad369..e824661ba 100644 --- a/app/crowd-fund/index.html +++ b/app/crowd-fund/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/deploy-any-contract/index.html b/app/deploy-any-contract/index.html index 9518ad369..e824661ba 100644 --- a/app/deploy-any-contract/index.html +++ b/app/deploy-any-contract/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/dutch-auction/index.html b/app/dutch-auction/index.html index 9518ad369..e824661ba 100644 --- a/app/dutch-auction/index.html +++ b/app/dutch-auction/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/english-auction/index.html b/app/english-auction/index.html index 9518ad369..e824661ba 100644 --- a/app/english-auction/index.html +++ b/app/english-auction/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/erc1155/index.html b/app/erc1155/index.html index 9518ad369..e824661ba 100644 --- a/app/erc1155/index.html +++ b/app/erc1155/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/erc20/index.html b/app/erc20/index.html index 9518ad369..e824661ba 100644 --- a/app/erc20/index.html +++ b/app/erc20/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/erc721/index.html b/app/erc721/index.html index 9518ad369..e824661ba 100644 --- a/app/erc721/index.html +++ b/app/erc721/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/ether-wallet/index.html b/app/ether-wallet/index.html index 9518ad369..e824661ba 100644 --- a/app/ether-wallet/index.html +++ b/app/ether-wallet/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/gasless-token-transfer/index.html b/app/gasless-token-transfer/index.html index 9518ad369..e824661ba 100644 --- a/app/gasless-token-transfer/index.html +++ b/app/gasless-token-transfer/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/iterable-mapping/index.html b/app/iterable-mapping/index.html index 9518ad369..e824661ba 100644 --- a/app/iterable-mapping/index.html +++ b/app/iterable-mapping/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/merkle-tree/index.html b/app/merkle-tree/index.html index 9518ad369..e824661ba 100644 --- a/app/merkle-tree/index.html +++ b/app/merkle-tree/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/minimal-proxy/index.html b/app/minimal-proxy/index.html index 9518ad369..e824661ba 100644 --- a/app/minimal-proxy/index.html +++ b/app/minimal-proxy/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/multi-call/index.html b/app/multi-call/index.html index 9518ad369..e824661ba 100644 --- a/app/multi-call/index.html +++ b/app/multi-call/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/multi-delegatecall/index.html b/app/multi-delegatecall/index.html index 9518ad369..e824661ba 100644 --- a/app/multi-delegatecall/index.html +++ b/app/multi-delegatecall/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/multi-sig-wallet/index.html b/app/multi-sig-wallet/index.html index 9518ad369..e824661ba 100644 --- a/app/multi-sig-wallet/index.html +++ b/app/multi-sig-wallet/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/simple-bytecode-contract/index.html b/app/simple-bytecode-contract/index.html index 9518ad369..e824661ba 100644 --- a/app/simple-bytecode-contract/index.html +++ b/app/simple-bytecode-contract/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/time-lock/index.html b/app/time-lock/index.html index 9518ad369..e824661ba 100644 --- a/app/time-lock/index.html +++ b/app/time-lock/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/uni-directional-payment-channel/index.html b/app/uni-directional-payment-channel/index.html index 9518ad369..e824661ba 100644 --- a/app/uni-directional-payment-channel/index.html +++ b/app/uni-directional-payment-channel/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/upgradeable-proxy/index.html b/app/upgradeable-proxy/index.html index 9518ad369..e824661ba 100644 --- a/app/upgradeable-proxy/index.html +++ b/app/upgradeable-proxy/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/app/write-to-any-slot/index.html b/app/write-to-any-slot/index.html index 9518ad369..e824661ba 100644 --- a/app/write-to-any-slot/index.html +++ b/app/write-to-any-slot/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/array/index.html b/array/index.html index 9518ad369..e824661ba 100644 --- a/array/index.html +++ b/array/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/assembly-error/index.html b/assembly-error/index.html index 9518ad369..e824661ba 100644 --- a/assembly-error/index.html +++ b/assembly-error/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/assembly-if/index.html b/assembly-if/index.html index 9518ad369..e824661ba 100644 --- a/assembly-if/index.html +++ b/assembly-if/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/assembly-loop/index.html b/assembly-loop/index.html index 9518ad369..e824661ba 100644 --- a/assembly-loop/index.html +++ b/assembly-loop/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/assembly-math/index.html b/assembly-math/index.html index 9518ad369..e824661ba 100644 --- a/assembly-math/index.html +++ b/assembly-math/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/assembly-variable/index.html b/assembly-variable/index.html index 9518ad369..e824661ba 100644 --- a/assembly-variable/index.html +++ b/assembly-variable/index.html @@ -28,7 +28,7 @@ gtag("config", "UA-133759045-1") - + diff --git a/assets/index-CQB5aJUy.js b/assets/index-TYdfHI_G.js similarity index 98% rename from assets/index-CQB5aJUy.js rename to assets/index-TYdfHI_G.js index 431b734ca..c72c5b8a5 100644 --- a/assets/index-CQB5aJUy.js +++ b/assets/index-TYdfHI_G.js @@ -7261,7 +7261,7 @@ assertion probably means that there is a bug. emit AnotherLog(); } } -`,tw=({prev:s,next:a})=>r.jsx(A,{version:nw,title:lw,description:pw,html:cw,prev:s,next:a,codes:ew}),ow="0.8.24",rw="EVM Memory Layout in Solidity",iw="Example of EVM memory in Solidity",gw=[{fileName:"YulMem.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI0OwoKLy8gTWVtb3J5IGxheW91dAovLyBhcnJheSBvZiBsZW5ndGggMioqMjU2ICgzMiBieXRlcyksIGVhY2ggZWxl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AzMiA9IDB4YTApCiAgICAgICAgICAgIHkgOj0gbWxvYWQoMHhhMCkKICAgICAgICAgICAgLy8gbG9hZCAzMiBieXRlcyBzdGFydGluZyBmcm9tIDB4YzAgKDB4YTAgKyAzMiA9IDB4YzApCiAgICAgICAgICAgIHogOj0gbWxvYWQoMHhjMCkKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF93cml0ZSgpCiAgICAgICAgcHVibGljCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKGJ5dGVzMzIgZnJlZV9tZW1fcHRyLCB1aW50MjU2IHgsIHVpbnQyNTYgeSwgdWludDI1NiB6KQogICAgewogICAgICAgIC8vIEFsbG9jYXRlcyBtZW1vcnkgMHg4MCB0byAweGRmIHRvIFBvaW50CiAgICAgICAgLy8gRnJlZSBtZW1vcnkgcG9pbnRlciA9IDB4ZGYgKyAxID0gMHhlMAogICAgICAgIFBvaW50IG1lbW9yeSBwOwoKICAgICAgICAvLyBXcml0ZQogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gc3RvcmUgdG8gMHg4MAogICAgICAgICAgICBtc3RvcmUocCwgMTEpCiAgICAgICAgICAgIC8vIHN0b3JlIHRvIDB4YTAKICAgICAgICAgICAgbXN0b3JlKGFkZChwLCAweDIwKSwgMjIpCiAgICAgICAgICAgIC8vIHN0b3JlIHRvIDB4YzAKICAgICAgICAgICAgbXN0b3JlKGFkZChwLCAweDQwKSwgMzMpCiAgICAgICAgICAgIC8vIDB4ZTAKICAgICAgICAgICAgZnJlZV9tZW1fcHRyIDo9IG1sb2FkKDB4NDApCiAgICAgICAgfQoKICAgICAgICB4ID0gcC54OwogICAgICAgIHkgPSBwLnk7CiAgICAgICAgeiA9IHAuejsKICAgIH0KfQoKY29udHJhY3QgTWVtRml4ZWRBcnJheSB7CiAgICBmdW5jdGlvbiB0ZXN0X3JlYWQoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGEwLCB1aW50MjU2IGExLCB1aW50MjU2IGEyKQogICAgewogICAgICAgIC8vIGFyciBpcyBsb2FkZWQgdG8gbWVtb3J5IHN0YXJ0aW5nIGF0IDB4ODAKICAgICAgICAvLyBFYWNoIGFycmF5IGVsZW1lbnQgaXMgc3RvcmVkIGFzIDMyIGJ5dGVzCiAgICAgICAgdWludDMyWzNdIG1lbW9yeSBhcnIgPSBbdWludDMyKDEpLCB1aW50MzIoMiksIHVpbnQzMigzKV07CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgYTAgOj0gbWxvYWQoMHg4MCkKICAgICAgICAgICAgYTEgOj0gbWxvYWQoMHhhMCkKICAgICAgICAgICAgYTIgOj0gbWxvYWQoMHhjMCkKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF93cml0ZSgpCiAgICAgICAgcHVibGljCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYgYTAsIHVpbnQyNTYgYTEsIHVpbnQyNTYgYTIpCiAgICB7CiAgICAgICAgdWludDMyWzNdIG1lbW9yeSBhcnI7CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gMHg4MAogICAgICAgICAgICBtc3RvcmUoYXJyLCAxMSkKICAgICAgICAgICAgLy8gMHhhMAogICAgICAgICAgICBtc3RvcmUoYWRkKGFyciwgMHgyMCksIDIyKQogICAgICAgICAgICAvLyAweGMwCiAgICAgICAgICAgIG1zdG9yZShhZGQoYXJyLCAweDQwKSwgMzMpCiAgICAgICAgfQoKICAgICAgICBhMCA9IGFyclswXTsKICAgICAgICBhMSA9IGFyclsxXTsKICAgICAgICBhMiA9IGFyclsyXTsKICAgIH0KfQoKY29udHJhY3QgTWVtRHluYW1pY0FycmF5IHsKICAgIGZ1bmN0aW9uIHRlc3RfcmVhZCgpCiAgICAgICAgcHVibGljCiAgICAgICAgcHVyZQogICAgICAgIHJldHVybnMgKHVpbnQyNTYgbGVuLCB1aW50MjU2IGEwLCB1aW50MjU2IGExLCB1aW50MjU2IGEyKQogICAgewogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYXJyID0gbmV3IHVpbnQyNTZbXSg1KTsKICAgICAgICBhcnJbMF0gPSB1aW50MjU2KDExKTsKICAgICAgICBhcnJbMV0gPSB1aW50MjU2KDIyKTsKICAgICAgICBhcnJbMl0gPSB1aW50MjU2KDMzKTsKICAgICAgICBhcnJbM10gPSB1aW50MjU2KDQ0KTsKICAgICAgICBhcnJbNF0gPSB1aW50MjU2KDU1KTsKCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyAweDgwCiAgICAgICAgICAgIGxlbiA6PSBtbG9hZChhcnIpCiAgICAgICAgICAgIC8vIDB4YTAKICAgICAgICAgICAgYTAgOj0gbWxvYWQoYWRkKGFyciwgMHgyMCkpCiAgICAgICAgICAgIC8vIDB4YzAKICAgICAgICAgICAgYTEgOj0gbWxvYWQoYWRkKGFyciwgMHg0MCkpCiAgICAgICAgICAgIC8vIDB4ZTAKICAgICAgICAgICAgYTIgOj0gbWxvYWQoYWRkKGFyciwgMHg2MCkpCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2W10gbWVtb3J5KSB7CiAgICAgICAgdWludDI1NltdIG1lbW9yeSBhcnI7CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gU3RvcmUgbGVuZ3RoIG9mIGFycgogICAgICAgICAgICBtc3RvcmUoYXJyLCAzKQogICAgICAgICAgICAvLyBTdG9yZSAxLCAyLCAzCiAgICAgICAgICAgIG1zdG9yZShhZGQoYXJyLCAweDIwKSwgMTEpCiAgICAgICAgICAgIG1zdG9yZShhZGQoYXJyLCAweDQwKSwgMjIpCiAgICAgICAgICAgIG1zdG9yZShhZGQoYXJyLCAweDYwKSwgMzMpCiAgICAgICAgICAgIC8vIFVwZGF0ZS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LZWNjYWsgewogICAgZnVuY3Rpb24gdGVzdF9rZWNjYWsoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlczMyKSB7CiAgICAgICAgLy8ga2VjY2FrMjU2KHN0YXJ0LCBsZW4pIC0gS2VjY2FrMjU2IGZyb20gZGF0YSBpbiBtZW1vcnkgZnJvbSBzdGFydCB0byBzdGFydCArIGxlbgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgbXN0b3JlKDB4ODAsIDEpCiAgICAgICAgICAgIG1zdG9yZSgweGEwLCAyKQoKICAgICAgICAgICAgbGV0IGggOj0ga2VjY2FrMjU2KDB4ODAsIDB4NDApCiAgICAgICAgICAgIG1zdG9yZSgweGMwLCBoKQoKICAgICAgICAgICAgcmV0dXJuKDB4YzAsIDB4MjApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIGtlY2NhaygpIHB1YmxpYyBwdXJlIHJldHVybnMgKGJ5dGVzMzIpIHsKICAgICAgICByZXR1cm4ga2VjY2FrMjU2KGFiaS5lbmNvZGVQYWNrZWQodWludDI1NigxKSwgdWludDI1NigyKSkpOwogICAgfQp9Cgpjb250cmFjdCBUYXJnZXQgewogICAgZnVuY3Rpb24gcmV0dXJuX3VpbnQyNTYodWludDI1NiB4KSBwdWJsaWMgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIHg7CiAgICB9CgogICAgZnVuY3Rpb24gcmV0dXJuX2J5dGVzKHVpbnQyNTYgbikgcHVibGljIHB1cmUgcmV0dXJucyAoYnl0ZXMgbWVtb3J5KSB7CiAgICAgICAgYnl0ZXMgbWVtb3J5IG91dCA9IG5ldyBieXRlcyhuKTsKICAgICAgICBmb3IgKHVpbnQyNTYgaTsgaSA8IG47IGkrKykgewogICAgICAgICAgICBvdXRbaV0gPSAweGFiOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb3V0OwogICAgfQoKICAgIGZ1bmN0aW9uIHJldHVybl91aW50MjU2X2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lbmd0aCkpCgogICAgICAgICAgICBsZXQgb2sgOj0gc3RhdGljY2FsbChnYXMoKSwgYWRkciwgcCwgZGF0YS5sZW5ndGgsIDAsIDApCgogICAgICAgICAgICBpZiBpc3plcm8ob2spIHsgcmV2ZXJ0KDAsIDApIH0KCiAgICAgICAgICAgIC8vIHJldHVybl9kYXRhX3NpemUgPSAzMiAgZm9yIGNhbGxpbmcgVGFyZ2V0LmYgLT4gdWludDI1NgogICAgICAgICAgICAvLyAgICAgICAgICAgICAgICAgID0gOTYgIGZvciBjYWxsaW5nIFRhcmdldC5nIC0+IGJ5dGVzW10gKDMyIG9mZnNldCwgMzIgbGVuZ3RoLCAzIGJ5dGVzIHBhZGRlZCB0byAzMikKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICA9IDE2MCBmb3IgY2FsbGluZyBUYXJnZXQuaCAtPiB1aW50MjU2W10gKDMyIG9mZnNldCwgMzIgbGVuZ3RoLCAzMiB4IDMgZWxlbWVudHMpCiAgICAgICAgICAgIHJldHVybl9kYXRhX3NpemUgOj0gcmV0dXJuZGF0YXNpemUoKQogICAgICAgICAgICAvLyBTdG9yZSBsZW5ndGggb2YgcmV0dXJuIGRhdGEgdG8gb3V0CiAgICAgICAgICAgIC8vIHBvaW50ZXIgdG8gb3V0ID0gMHg2MCAoemVybyBzbG90KQogICAgICAgICAgICAvLyBUT0RPOiBzYWZlIHRvIHdyaXRlIHRvIHplcm8gc2xvdD8KICAgICAgICAgICAgbXN0b3JlKG91dCwgcmV0dXJuX2RhdGFfc2l6ZSkKICAgICAgICAgICAgLy8gQ29weSByZXR1cm4gZGF0YSB0byBvdXQKICAgICAgICAgICAgcmV0dXJuZGF0YWNvcHkoYWRkKG91dCwgMHgyMCksIDAsIHJldHVybl9kYXRhX3NpemUpCiAgICAgICAgICAgIC8vIFVwZGF0ZSBmcmVlIG1lbW9yeSBwb2ludGVyCiAgICAgICAgICAgIG1zdG9yZSgweDQwLCBhZGQob3V0LCBhZGQoMHgyMCwgcmV0dXJuX2RhdGFfc2l6ZSkpKQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgQ291bnRlciB7CiAgICB1aW50MjU2IHB1YmxpYyBjb3VudDsKCiAgICBmdW5jdGlvbiBpbmMoKSBwdWJsaWMgcmV0dXJucyAodWludDI1NikgewogICAgICAgIGNvdW50ICs9IDE7CiAgICAgICAgcmV0dXJuIGNvdW50OwogICAgfQp9Cgpjb250cmFjdCBZdWxDYWxsIHsKICAgIGZ1bmN0aW9uIHRlc3RfY2FsbChhZGRyZXNzIGEsIGJ5dGVzIG1lbW9yeSBkYXRhKQogICAgICAgIHB1YmxpYwogICAgICAgIHBheWFibGUKICAgICAgICByZXR1cm5zIChieXRlcyBtZW1vcnkgb3V0KQogICAgewogICAgICAgIGJ5dGVzMzIgZGF0YV9wdHI7CiAgICAgICAgYnl0ZXMzMiBvdXRfcHRyOwogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gMHg4MAogICAgICAgICAgICBkYXRhX3B0ciA6PSBkYXRhCiAgICAgICAgICAgIC8vIDB4NjAKICAgICAgICAgICAgb3V0X3B0ciA6PSBvdXQKCiAgICAgICAgICAgIGxldCBkYXRhX3NpemUgOj0gbWxvYWQoZGF0YSkKICAgICAgICAgICAgbGV0IGRhdGFfc3RhcnQgOj0gYWRkKGRhdGEsIDB4MjApCiAgICAgICAgICAgIGxldCBvayA6PSBjYWxsKGdhcygpLCBhLCBjYWxsdmFsdWUoKSwgZGF0YV9zdGFydCwgZGF0YV9zaXplLCAwLCAwKQoKICAgICAgICAgICAgaWYgaXN6ZXJvKG9rKSB7IHJldmVydCgwLCAwKSB9CgogICAgICAgICAgICBsZXQgcmV0dXJuX2RhdGFfc2l6ZSA6PSByZXR1cm5kYXRhc2l6ZSgpCiAgICAgICAgICAgIC8vIFN0b3JlIGxlbmd0aCBvZiByZXR1cm4gZGF0YSB0byBvdXQKICAgICAgICAgICAgbXN0b3JlKG91dCwgcmV0dXJuX2RhdGFfc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xMgo="}],hw=`Examples of
+`,tw=({prev:s,next:a})=>r.jsx(A,{version:nw,title:lw,description:pw,html:cw,prev:s,next:a,codes:ew}),ow="0.8.24",rw="EVM Memory Layout in Solidity",iw="Example of EVM memory in Solidity",gw=[{fileName:"YulMem.sol",code:"Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgMC44LjI0OwoKLy8gTWVtb3J5IGxheW91dAovLyBhcnJheSBvZiBsZW5ndGggMioqMjU2ICgzMiBieXRlcyksIGVhY2ggZWxlbWVudCBzdG9yZXMgMSBieXRlICgweDAwIHRvIDB4ZmYpCi8vIGluZGV4ICAgICAwICAgIDEgICAgMiAgIC4uLiAgIDB4ZmZmLi4uZmZmID0gMioqMjU2IC0gMQovLyBtZW1vcnkgfCAwMCB8IDAwIHwgMDAgfCAuLi4gfCAwMCB8CgovLyBSZXNlcnZlZCBzbG90cwovLyAweDAwIC0gMHgzZiAoNjQgYnl0ZXMpOiBzY3JhdGNoIHNwYWNlIGZvciBoYXNoaW5nIG1ldGhvZHMKLy8gMHg0MCAtIDB4NWYgKDMyIGJ5dGVzKTogZnJlZSBtZW1vcnkgcG9pbnRlciAtIHBvaW50ZXIgdG8gbmV4dCBhdmFpbGFibGUgbG9jYXRpb24gaW4gbWVtb3J5IHRvIHN0b3JlIGRhdGEKLy8gMHg2MCAtIDB4N2YgKDMyIGJ5dGVzKTogemVybyBzbG90IC0gdXNlZCBhcyBpbml0aWFsIHZhbHVlIGZvciBkeW5hbWljIG1lbW9yeSBhcnJheXMgYW5kIHNob3VsZCBuZXZlciBiZSB3cml0dGVuIHRvCgovLyBGcmVlIG1lbW9yeSBwb2ludGVyICgweDQwKQovLyAweDgwID0gRnJlZSBtZW1vcnkgcG9pbnRlciBpbml0aWFsbHkgcG9pbnRzIGhlcmUKY29udHJhY3QgTWVtQmFzaWMgewogICAgLy8gbXN0b3JlKHAsIHYpID0gc3RvcmUgMzIgYnl0ZXMgdG8g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Hg4MAogICAgICAgIC8vIDB4ODAgPSBpbml0aWFsIGZyZWUgbWVtb3J5CiAgICAgICAgUG9pbnQgbWVtb3J5IHAgPSBQb2ludCgxLCAyLCAzKTsKCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBsb2FkIDMyIGJ5dGVzIHN0YXJ0aW5nIGZyb20gMHg4MAogICAgICAgICAgICB4IDo9IG1sb2FkKDB4ODApCiAgICAgICAgICAgIC8vIGxvYWQgMzIgYnl0ZXMgc3RhcnRpbmcgZnJvbSAweGEwICgweDgwICsgMzIgPSAweGEwKQogICAgICAgICAgICB5IDo9IG1sb2FkKDB4YTApCiAgICAgICAgICAgIC8vIGxvYWQgMzIgYnl0ZXMgc3RhcnRpbmcgZnJvbSAweGMwICgweGEwICsgMzIgPSAweGMwKQogICAgICAgICAgICB6IDo9IG1sb2FkKDB4YzApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zIChieXRlczMyIGZyZWVfbWVtX3B0ciwgdWludDI1NiB4LCB1aW50MjU2IHksIHVpbnQyNTYgeikKICAgIHsKICAgICAgICAvLyBBbGxvY2F0ZXMgbWVtb3J5IDB4ODAgdG8gMHhkZiB0byBQb2ludAogICAgICAgIC8vIEZyZWUgbWVtb3J5IHBvaW50ZXIgPSAweGRmICsgMSA9IDB4ZTAKICAgICAgICBQb2ludCBtZW1vcnkgcDsKCiAgICAgICAgLy8gV3JpdGUKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIHN0b3JlIHRvIDB4ODAKICAgICAgICAgICAgbXN0b3JlKHAsIDExKQogICAgICAgICAgICAvLyBzdG9yZSB0byAweGEwCiAgICAgICAgICAgIG1zdG9yZShhZGQocCwgMHgyMCksIDIyKQogICAgICAgICAgICAvLyBzdG9yZSB0byAweGMwCiAgICAgICAgICAgIG1zdG9yZShhZGQocCwgMHg0MCksIDMzKQogICAgICAgICAgICAvLyAweGUwCiAgICAgICAgICAgIGZyZWVfbWVtX3B0ciA6PSBtbG9hZCgweDQwKQogICAgICAgIH0KCiAgICAgICAgeCA9IHAueDsKICAgICAgICB5ID0gcC55OwogICAgICAgIHogPSBwLno7CiAgICB9Cn0KCmNvbnRyYWN0IE1lbUZpeGVkQXJyYXkgewogICAgZnVuY3Rpb24gdGVzdF9yZWFkKCkKICAgICAgICBwdWJsaWMKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAodWludDI1NiBhMCwgdWludDI1NiBhMSwgdWludDI1NiBhMikKICAgIHsKICAgICAgICAvLyBhcnIgaXMgbG9hZGVkIHRvIG1lbW9yeSBzdGFydGluZyBhdCAweDgwCiAgICAgICAgLy8gRWFjaCBhcnJheSBlbGVtZW50IGlzIHN0b3JlZCBhcyAzMiBieXRlcwogICAgICAgIHVpbnQzMlszXSBtZW1vcnkgYXJyID0gW3VpbnQzMigxKSwgdWludDMyKDIpLCB1aW50MzIoMyldOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIGEwIDo9IG1sb2FkKDB4ODApCiAgICAgICAgICAgIGExIDo9IG1sb2FkKDB4YTApCiAgICAgICAgICAgIGEyIDo9IG1sb2FkKDB4YzApCiAgICAgICAgfQogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3Rfd3JpdGUoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGEwLCB1aW50MjU2IGExLCB1aW50MjU2IGEyKQogICAgewogICAgICAgIHVpbnQzMlszXSBtZW1vcnkgYXJyOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIDB4ODAKICAgICAgICAgICAgbXN0b3JlKGFyciwgMTEpCiAgICAgICAgICAgIC8vIDB4YTAKICAgICAgICAgICAgbXN0b3JlKGFkZChhcnIsIDB4MjApLCAyMikKICAgICAgICAgICAgLy8gMHhjMAogICAgICAgICAgICBtc3RvcmUoYWRkKGFyciwgMHg0MCksIDMzKQogICAgICAgIH0KCiAgICAgICAgYTAgPSBhcnJbMF07CiAgICAgICAgYTEgPSBhcnJbMV07CiAgICAgICAgYTIgPSBhcnJbMl07CiAgICB9Cn0KCmNvbnRyYWN0IE1lbUR5bmFtaWNBcnJheSB7CiAgICBmdW5jdGlvbiB0ZXN0X3JlYWQoKQogICAgICAgIHB1YmxpYwogICAgICAgIHB1cmUKICAgICAgICByZXR1cm5zICh1aW50MjU2IGxlbiwgdWludDI1NiBhMCwgdWludDI1NiBhMSwgdWludDI1NiBhMikKICAgIHsKICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFyciA9IG5ldyB1aW50MjU2W10oNSk7CiAgICAgICAgYXJyWzBdID0gdWludDI1NigxMSk7CiAgICAgICAgYXJyWzFdID0gdWludDI1NigyMik7CiAgICAgICAgYXJyWzJdID0gdWludDI1NigzMyk7CiAgICAgICAgYXJyWzNdID0gdWludDI1Nig0NCk7CiAgICAgICAgYXJyWzRdID0gdWludDI1Nig1NSk7CgogICAgICAgIGFzc2VtYmx5IHsKICAgICAgICAgICAgLy8gMHg4MAogICAgICAgICAgICBsZW4gOj0gbWxvYWQoYXJyKQogICAgICAgICAgICAvLyAweGEwCiAgICAgICAgICAgIGEwIDo9IG1sb2FkKGFkZChhcnIsIDB4MjApKQogICAgICAgICAgICAvLyAweGMwCiAgICAgICAgICAgIGExIDo9IG1sb2FkKGFkZChhcnIsIDB4NDApKQogICAgICAgICAgICAvLyAweGUwCiAgICAgICAgICAgIGEyIDo9IG1sb2FkKGFkZChhcnIsIDB4NjApKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0X3dyaXRlKCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NltdIG1lbW9yeSkgewogICAgICAgIHVpbnQyNTZbXSBtZW1vcnkgYXJyOwoKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIFN0b3JlIGxlbmd0aCBvZiBhcnIKICAgICAgICAgICAgbXN0b3JlKGFyciwgMykKICAgICAgICAgICAgLy8gU3RvcmUgMSwgMiwgMwogICAgICAgICAgICBtc3RvcmUoYWRkKGFyciwgMHgyMCksIDExKQogICAgICAgICAgICBtc3RvcmUoYWRkKGFyciwgMHg0MCksIDIyKQogICAgICAgICAgICBtc3RvcmUoYWRkKGFyciwgMHg2MCksIDMzKQogICAgICAgICAgICAvLyBVcGRhdGUgZnJlZSBtZW1vcnkgcG9pbnRlcgogICAgICAgICAgICBtc3RvcmUoMHg0MCwgYWRkKGFyciwgMHg4MCkpCiAgICAgICAgfQoKICAgICAgICAvLyBEYXRhIHdpbGwgYmUgQUJJIGVuY29kZWQgd2hlbiBhcnIgaXMgcmV0dXJuZWQgdG8gY2FsbGVyCiAgICAgICAgcmV0dXJuIGFycjsKICAgIH0KfQoKY29udHJhY3QgTWVtSW50ZXJuYWxGdW5jUmV0dXJuIHsKICAgIGZ1bmN0aW9uIGludGVybmFsX2Z1bmNfcmV0dXJuX3ZhbCgpIHByaXZhdGUgcHVyZSByZXR1cm5zICh1aW50MjU2KSB7CiAgICAgICAgcmV0dXJuIHVpbnQyNTYoMHhhYmFiYWIpOwogICAgfQoKICAgIGZ1bmN0aW9uIHRlc3RfdmFsKCkgcHVibGljIHB1cmUgewogICAgICAgIC8vIDB4YWJhYmFiIHdpbGwgYmUgc3RvcmVkIGluIHRvcCBvZiB0aGUgc3RhY2sKICAgICAgICBpbnRlcm5hbF9mdW5jX3JldHVybl92YWwoKTsKICAgIH0KCiAgICBmdW5jdGlvbiBpbnRlcm5hbF9mdW5jX3JldHVybl9tZW0oKQogICAgICAgIHByaXZhdGUKICAgICAgICBwdXJlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMzMltdIG1lbW9yeSkKICAgIHsKICAgICAgICBieXRlczMyW10gbWVtb3J5IGFyciA9IG5ldyBieXRlczMyW10oMyk7CiAgICAgICAgYXJyWzBdID0gYnl0ZXMzMih1aW50MjU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X3JldHVybl9keW5fYXJyKCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NltdIG1lbW9yeSkgewogICAgICAgIC8vIEFCSSBlbmNvZGUgdWludDI1NltdIGFycmF5IHdpdGggMyBlbGVtZW50cyAxMSwgMjIgYW5kIDMzCiAgICAgICAgYXNzZW1ibHkgewogICAgICAgICAgICAvLyBvZmZzZXQKICAgICAgICAgICAgbXN0b3JlKDB4ODAsIDB4MjApCiAgICAgICAgICAgIC8vIGxlbmd0aAogICAgICAgICAgICBtc3RvcmUoYWRkKDB4ODAsIDB4MjApLCAzKQogICAgICAgICAgICAvLyBhcnJheSBlbGVtZW50cwogICAgICAgICAgICBtc3RvcmUoYWRkKDB4ODAsIDB4NDApLCAxMSkKICAgICAgICAgICAgbXN0b3JlKGFkZCgweDgwLCAweDYwKSwgMjIpCiAgICAgICAgICAgIG1zdG9yZShhZGQoMHg4MCwgMHg4MCksIDMzKQogICAgICAgICAgICAvLyBObyBuZWVkIHRvIHVwZGF0ZSBmcmVlIG1lbW9yeSBwb2ludGVyIC0gZnVuY3Rpb24gZXhlY3V0aW9uIGVuZHMgaGVyZQogICAgICAgICAgICByZXR1cm4oMHg4MCwgbXVsKDUsIDB4MjApKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiB0ZXN0X3JldHVybigpIHB1YmxpYyBwdXJlIHJldHVybnMgKHVpbnQyNTYsIHVpbnQyNTYpIHsKICAgICAgICAvLyBSZXR1cm5zICgxMSwgMjIpCiAgICAgICAgdGVzdF9yZXR1cm5fdmFscygpOwogICAgICAgIC8vIFRoaXMgY29kZSB3aWxsIG5ldmVyIGV4ZWN1dGUKICAgICAgICByZXR1cm4gKDMzMywgNDQ0KTsKICAgIH0KfQoKY29udHJhY3QgTWVtUmV2ZXJ0IHsKICAgIGZ1bmN0aW9uIHRlc3RfcmV2ZXJ0KCkgcHVibGljIHB1cmUgewogICAgICAgIC8vIHJldmVydChzdGFydCwgbGVuKSAtIFJldmVydCBleGVjdXRpbiBhbmQgcmV0dXJuIGRhdGEgc3RvcmUgaW4gbWVtb3J5IGZyb20gc3RhcnQgdG8gc3RhcnQgKyBsZW4KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIG1zdG9yZSgweDgwLCAiRVJST1IgSEVSRSIpCiAgICAgICAgICAgIHJldmVydCgweDgwLCAweDIwKQogICAgICAgIH0KICAgIH0KfQoKY29udHJhY3QgTWVtS2VjY2FrIHsKICAgIGZ1bmN0aW9uIHRlc3Rfa2VjY2FrKCkgcHVibGljIHB1cmUgcmV0dXJucyAoYnl0ZXMzMikgewogICAgICAgIC8vIGtlY2NhazI1NihzdGFydCwgbGVuKSAtIEtlY2NhazI1NiBmcm9tIGRhdGEgaW4gbWVtb3J5IGZyb20gc3RhcnQgdG8gc3RhcnQgKyBsZW4KICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIG1zdG9yZSgweDgwLCAxKQogICAgICAgICAgICBtc3RvcmUoMHhhMCwgMikKCiAgICAgICAgICAgIGxldCBoIDo9IGtlY2NhazI1NigweDgwLCAweDQwKQogICAgICAgICAgICBtc3RvcmUoMHhjMCwgaCkKCiAgICAgICAgICAgIHJldHVybigweGMwLCAweDIwKQogICAgICAgIH0KICAgIH0KCiAgICBmdW5jdGlvbiBrZWNjYWsoKSBwdWJsaWMgcHVyZSByZXR1cm5zIChieXRlczMyKSB7CiAgICAgICAgcmV0dXJuIGtlY2NhazI1NihhYmkuZW5jb2RlUGFja2VkKHVpbnQyNTYoMSksIHVpbnQyNTYoMikpKTsKICAgIH0KfQoKY29udHJhY3QgVGFyZ2V0IHsKICAgIGZ1bmN0aW9uIHJldHVybl91aW50MjU2KHVpbnQyNTYgeCkgcHVibGljIHB1cmUgcmV0dXJucyAodWludDI1NikgewogICAgICAgIHJldHVybiB4OwogICAgfQoKICAgIGZ1bmN0aW9uIHJldHVybl9ieXRlcyh1aW50MjU2IG4pIHB1YmxpYyBwdXJlIHJldHVybnMgKGJ5dGVzIG1lb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2FkKDB4NDApCiAgICAgICAgICAgIC8vIENvcHkgY2FsbGRhdGEgdG8gbWVtb3J5CiAgICAgICAgICAgIGNhbGxkYXRhY29weShwLCBkYXRhLm9mZnNldCwgZGF0YS5sZW5ndGgpCiAgICAgICAgICAgIC8vIFVwZGF0ZSBmcmVlIG1lbW9yeSBwb2ludGVyCiAgICAgICAgICAgIG1zdG9yZSgweDQwLCBhZGQocCwgZGF0YS5sZW5ndGgpKQoKICAgICAgICAgICAgbGV0IG9rIDo9IHN0YXRpY2NhbGwoZ2FzKCksIGFkZHIsIHAsIGRhdGEubGVuZ3RoLCAwLCAwKQoKICAgICAgICAgICAgaWYgaXN6ZXJvKG9rKSB7IHJldmVydCgwLCAwKSB9CgogICAgICAgICAgICAvLyByZXR1cm5fZGF0YV9zaXplID0gMzIgIGZvciBjYWxsaW5nIFRhcmdldC5mIC0+IHVpbnQyNTYKICAgICAgICAgICAgLy8gICAgICAgICAgICAgICAgICA9IDk2ICBmb3IgY2FsbGluZyBUYXJnZXQuZyAtPiBieXRlc1tdICgzMiBvZmZzZXQsIDMyIGxlbmd0aCwgMyBieXRlcyBwYWRkZWQgdG8gMzIpCiAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgPSAxNjAgZm9yIGNhbGxpbmcgVGFyZ2V0LmggLT4gdWludDI1NltdICgzMiBvZmZzZXQsIDMyIGxlbmd0aCwgMzIgeCAzIGVsZW1lbnRzKQogICAgICAgICAgICByZXR1cm5fZGF0YV9zaXplIDo9IHJldHVybmRhdGFzaXplKCkKICAgICAgICAgICAgLy8gU3RvcmUgbGVuZ3RoIG9mIHJldHVybiBkYXRhIHRvIG91dAogICAgICAgICAgICAvLyBwb2ludGVyIHRvIG91dCA9IDB4NjAgKHplcm8gc2xvdCkKICAgICAgICAgICAgLy8gVE9ETzogc2FmZSB0byB3cml0ZSB0byB6ZXJvIHNsb3Q/CiAgICAgICAgICAgIG1zdG9yZShvdXQsIHJldHVybl9kYXRhX3NpemUpCiAgICAgICAgICAgIC8vIENvcHkgcmV0dXJuIGRhdGEgdG8gb3V0CiAgICAgICAgICAgIHJldHVybmRhdGFjb3B5KGFkZChvdXQsIDB4MjApLCAwLCByZXR1cm5fZGF0YV9zaXplKQogICAgICAgICAgICAvLyBVcGRhdGUgZnJlZSBtZW1vcnkgcG9pbnRlcgogICAgICAgICAgICBtc3RvcmUoMHg0MCwgYWRkKG91dCwgYWRkKDB4MjAsIHJldHVybl9kYXRhX3NpemUpKSkKICAgICAgICB9CiAgICB9Cn0KCmNvbnRyYWN0IENvdW50ZXIgewogICAgdWludDI1NiBwdWJsaWMgY291bnQ7CgogICAgZnVuY3Rpb24gaW5jKCkgcHVibGljIHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICBjb3VudCArPSAxOwogICAgICAgIHJldHVybiBjb3VudDsKICAgIH0KfQoKY29udHJhY3QgWXVsQ2FsbCB7CiAgICBmdW5jdGlvbiB0ZXN0X2NhbGwoYWRkcmVzcyBhLCBieXRlcyBtZW1vcnkgZGF0YSkKICAgICAgICBwdWJsaWMKICAgICAgICBwYXlhYmxlCiAgICAgICAgcmV0dXJucyAoYnl0ZXMgbWVtb3J5IG91dCkKICAgIHsKICAgICAgICBieXRlczMyIGRhdGFfcHRyOwogICAgICAgIGJ5dGVzMzIgb3V0X3B0cjsKICAgICAgICBhc3NlbWJseSB7CiAgICAgICAgICAgIC8vIDB4ODAKICAgICAgICAgICAgZGF0YV9wdHIgOj0gZGF0YQogICAgICAgICAgICAvLyAweDYwCiAgICAgICAgICAgIG91dF9wdHIgOj0gb3V0CgogICAgICAgICAgICBsZXQgZGF0YV9zaXplIDo9IG1sb2FkKGRhdGEpCiAgICAgICAgICAgIGxldCBkYXRhX3N0YXJ0IDo9IGFkZChkYXRhLCAweDIwKQogICAgICAgICAgICBsZXQgb2sgOj0gY2FsbChnYXMoKSwgYSwgY2FsbHZhbHVlKCksIGRhdGFfc3RhcnQsIGRhdGFfc2l6ZSwgMCwgMCkKCiAgICAgICAgICAgIGlmIGlzemVybyhvaykgeyByZXZlcnQoMCwgMCkgfQoKICAgICAgICAgICAgbGV0IHJldHVybl9kYXRhX3NpemUgOj0gcmV0dXJuZGF0YXNpemUoKQogICAgICAgICAgICAvLyBTdG9yZSBsZW5ndGggb2YgcmV0dXJuIGRhdGEgdG8gb3V0CiAgICAgICAgICAgIG1zdG9yZShvdXQsIHJldHVybl9kYXRhX3NpemUpCiAgICAgICAgICAgIC8vIENvcHkgcmV0dXJuIGRhdGEgdG8gb3V0CiAgICAgICAgICAgIHJldHVybmRhdGFjb3B5KGFkZChvdXQsIDB4MjApLCAwLCByZXR1cm5fZGF0YV9zaXplKQogICAgICAgICAgICAvLyBVcGRhdGUgZnJlZSBtZW1vcnkgcG9pbnRlcgogICAgICAgICAgICBtc3RvcmUoMHg0MCwgYWRkKG91dCwgYWRkKDB4MjAsIHJldHVybl9kYXRhX3NpemUpKSkKICAgICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdGVzdF9pbmMoYWRkcmVzcyBjb3VudGVyKSBwdWJsaWMgcmV0dXJucyAodWludDI1NiBjb3VudCkgewogICAgICAgIGJ5dGVzIG1lbW9yeSByZXMgPSB0ZXN0X2NhbGwoY291bnRlciwgYWJpLmVuY29kZUNhbGwoQ291bnRlci5pbmMsICgpKSk7CiAgICAgICAgY291bnQgPSBhYmkuZGVjb2RlKHJlcywgKHVpbnQyNTYpKTsKICAgIH0KfQoKLy8gTWVtb3J5IGV4cGFuc2lvbiBnYXMgY29zdAovLyBHYXMgY29zdCBpcyBxdWFkcmF0aWMgdG8gbWVtb3J5IGFsbG9jYXRpb24uCmNvbnRyYWN0IE1lbUV4cCB7CiAgICBmdW5jdGlvbiBhbGxvY19tZW0odWludDI1NiBuKSBleHRlcm5hbCB2aWV3IHJldHVybnMgKHVpbnQyNTYpIHsKICAgICAgICB1aW50MjU2IGdhc19zdGFydCA9IGdhc2xlZnQoKTsKICAgICAgICB1aW50MjU2W10gbWVtb3J5IGFyciA9IG5ldy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