solidity/test/cmdlineTests/evm_to_wasm_break/output

638 lines
25 KiB
Plaintext
Raw Normal View History

2020-05-12 19:01:39 +00:00
======= evm_to_wasm_break/input.yul (Ewasm) =======
2020-05-12 19:01:39 +00:00
Pretty printed source:
object "object" {
code {
{
let x := calldataload(0)
for { } lt(x, 10) { x := add(x, 1) }
{
if eq(x, 2) { break }
if eq(x, 4) { continue }
}
sstore(0, x)
}
}
}
==========================
Translated source:
object "object" {
code {
function main()
{
let _1 := 0
let x, x_1, x_2, x_3 := calldataload(_1, _1, _1, _1)
let x_4 := x
let x_5 := x_1
let x_6 := x_2
let x_7 := x_3
let _2 := 1
let _3:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(i64.or(_1, _1), i64.or(_1, _2)))))
2020-05-12 19:01:39 +00:00
for { }
i32.eqz(_3)
2020-05-12 19:01:39 +00:00
{
let x_8, x_9, x_10, x_11 := add(x_4, x_5, x_6, x_7, _1, _1, _1, _2)
x_4 := x_8
x_5 := x_9
x_6 := x_10
x_7 := x_11
}
{
let _4, _5, _6, _7 := iszero_200_868_1493(_1, _1, _1, lt_202(x_4, x_5, x_6, x_7, _1, _1, _1, 10))
if i32.eqz(i64.eqz(i64.or(i64.or(_4, _5), i64.or(_6, _7)))) { break }
let _8, _9, _10, _11 := eq_201_869_1494(x_4, x_5, x_6, x_7, _1, _1, _1, 2)
if i32.eqz(i64.eqz(i64.or(i64.or(_8, _9), i64.or(_10, _11)))) { break }
let _12, _13, _14, _15 := eq_201_869_1494(x_4, x_5, x_6, x_7, _1, _1, _1, 4)
if i32.eqz(i64.eqz(i64.or(i64.or(_12, _13), i64.or(_14, _15)))) { continue }
2020-05-12 19:01:39 +00:00
}
sstore(_1, _1, _1, _1, x_4, x_5, x_6, x_7)
}
function add_carry(x, y, c) -> r, r_c
{
let t := i64.add(x, y)
r := i64.add(t, c)
r_c := i64.extend_i32_u(i32.or(i64.lt_u(t, x), i64.lt_u(r, t)))
}
function add(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4
{
let t := i64.add(x4, y4)
r4 := i64.add(t, 0)
let r3_1, carry := add_carry(x3, y3, i64.extend_i32_u(i32.or(i64.lt_u(t, x4), i64.lt_u(r4, t))))
r3 := r3_1
let r2_1, carry_1 := add_carry(x2, y2, carry)
r2 := r2_1
let r1_1, carry_2 := add_carry(x1, y1, carry_1)
r1 := r1_1
}
function iszero_200_868_1493(x1, x2, x3, x4) -> r1, r2, r3, r4
2020-05-12 19:01:39 +00:00
{
r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(x1, x2), i64.or(x3, x4))))
}
function eq_201_869_1494(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4
2020-05-12 19:01:39 +00:00
{
r4 := i64.extend_i32_u(i32.and(i64.eq(x1, y1), i32.and(i64.eq(x2, y2), i32.and(i64.eq(x3, y3), i64.eq(x4, y4)))))
2020-05-12 19:01:39 +00:00
}
function cmp(a, b) -> r:i32
{
switch i64.lt_u(a, b)
case 1:i32 { r := 0xffffffff:i32 }
default { r := i64.ne(a, b) }
}
function lt_202(x1, x2, x3, x4, y1, y2, y3, y4) -> z4
2020-05-12 19:01:39 +00:00
{
let z:i32 := false
switch cmp(x1, y1)
case 0:i32 {
switch cmp(x2, y2)
case 0:i32 {
switch cmp(x3, y3)
case 0:i32 { z := i64.lt_u(x4, y4) }
case 1:i32 { z := 0:i32 }
default { z := 1:i32 }
}
case 1:i32 { z := 0:i32 }
default { z := 1:i32 }
}
case 1:i32 { z := 0:i32 }
default { z := 1:i32 }
z4 := i64.extend_i32_u(z)
}
function u256_to_i32(x1, x2, x3, x4) -> v:i32
{
if i64.ne(0, i64.or(i64.or(x1, x2), x3)) { unreachable() }
if i64.ne(0, i64.shr_u(x4, 32)) { unreachable() }
v := i32.wrap_i64(x4)
}
function bswap16(x) -> y
2020-05-12 19:01:39 +00:00
{
y := i64.or(i64.and(i64.shl(x, 8), 0xff00), i64.and(i64.shr_u(x, 8), 0xff))
}
function bswap32(x) -> y
2020-05-12 19:01:39 +00:00
{
let hi := i64.shl(bswap16(x), 16)
y := i64.or(hi, bswap16(i64.shr_u(x, 16)))
2020-05-12 19:01:39 +00:00
}
function bswap64(x) -> y
2020-05-12 19:01:39 +00:00
{
let hi := i64.shl(bswap32(x), 32)
y := i64.or(hi, bswap32(i64.shr_u(x, 32)))
2020-05-12 19:01:39 +00:00
}
function calldataload(x1, x2, x3, x4) -> z1, z2, z3, z4
{
let cds:i32 := eth.getCallDataSize()
let _1 := 0
let destination:i32 := u256_to_i32(_1, _1, _1, _1)
let offset:i32 := u256_to_i32(x1, x2, x3, x4)
let requested_size:i32 := u256_to_i32(_1, _1, _1, 32)
if i32.gt_u(offset, i32.sub(0xffffffff:i32, requested_size)) { eth.revert(0:i32, 0:i32) }
let available_size:i32 := i32.sub(cds, offset)
if i32.gt_u(offset, cds) { available_size := 0:i32 }
let _2:i32 := 0:i32
if i32.gt_u(available_size, _2)
{
eth.callDataCopy(destination, offset, available_size)
}
if i32.gt_u(requested_size, available_size)
{
let _3:i32 := i32.sub(requested_size, available_size)
let _4:i32 := i32.add(destination, available_size)
let i:i32 := _2
for { } i32.lt_u(i, _3) { i := i32.add(i, 1:i32) }
{
i32.store8(i32.add(_4, i), _2)
}
}
let z1_1 := bswap64(i64.load(_2))
let z2_1 := bswap64(i64.load(i32.add(_2, 8:i32)))
let z3_1 := bswap64(i64.load(i32.add(_2, 16:i32)))
let z4_1 := bswap64(i64.load(i32.add(_2, 24:i32)))
z1 := z1_1
z2 := z2_1
z3 := z3_1
z4 := z4_1
}
2020-05-12 19:01:39 +00:00
function mstore_internal(pos:i32, y1, y2, y3, y4)
{
i64.store(pos, bswap64(y1))
i64.store(i32.add(pos, 8:i32), bswap64(y2))
i64.store(i32.add(pos, 16:i32), bswap64(y3))
i64.store(i32.add(pos, 24:i32), bswap64(y4))
2020-05-12 19:01:39 +00:00
}
function sstore(x1, x2, x3, x4, y1, y2, y3, y4)
{
mstore_internal(0:i32, x1, x2, x3, x4)
mstore_internal(32:i32, y1, y2, y3, y4)
eth.storageStore(0:i32, 32:i32)
}
}
}
Binary representation:
0061736d0100000001540c6000006000017f60017e017e60027e7e017f60037e7e7e017e60047e7e7e7e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60057f7e7e7e7e0060027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000a08657468657265756d06726576657274000a08657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000b030f0e000408050803080602020205090705030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00040acb090ecb02030a7e017f107e02404200210002402000200020002000100f21012300210223012103230221040b20012105200221062003210720042108420121092000200084200020098484504545210a02400340200a45450d01024002402000200020002005200620072008200020002000420a100a1007210b2300210c2301210d2302210e0b200b200c84200d200e8484504504400c030b0240200520062007200820002000200042021008210f2300211023012111230221120b200f201084201120128484504504400c030b024020052006200720082000200020004204100821132300211423012115230221160b2013201484201520168484504504400c010b0b0240200520062007200820002000200020091006211723002118230121192302211a0b201721052018210620192107201a21080c000b0b2000200020002000200520062007200810110b0b2901037e0240200020017c2105200520027c21032005200054200320055472ad21040b2004240020030b6c010b7e0240200320077c210c200c42007c210b024020022006200c200354200b200c5472ad1005210d2300210e0b200d210a024020012005200e1005210f230021100b200f2109024020002004201010052111230021120b201121080b20092400200a2401200b240220080b2401047e0240200020018420022003848450ad21070b20052400200624012007240220040b2f01047e02402000200451200120055120022006512003200751717171ad210b0b20092400200a2401200b240220080b2701027f024002402000200154210320034101460440417f210205200020015221020b0b0b20020b8a0102017e047f0240410021090240200020041009210a200a41004604400240200120051009210b200b41004604400240200220061009210c200c41004604402003200754210905200c41014604404100210905410121090b0b0b05200b41014604404100210905410121090b0b0b05200a41014604404100210905410121090b0b0b2009ad21080b20080b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100c421086210220022000421088100c8421010b20010b1e01027e02402000100d422086210220022000422088100d8421010b20010bfc0105047e017f017e087f047e024010022108420021092009200920092009100b210a2000200120022003100b210b2009200920094220100b210c200b417f200c6b4b04404100410010010b2008200b6b210d200b20084b04404100210d0b4100210e200d200e4b0440200a200b200d10030b200c200d4b0440200c200d6b210f200a200d6a2110200e2111024003402011200f49450d010240201020116a200e3a00000b201141016a21110c000b0b0b200e290000100e2112200e41086a290000100e2113200e41106a290000100e2114200e41186a290000100e2115201221042013210520142106201521070b20052400200624012007240220040b3200024020002001100e370000200041086a2002100e370000200041106a2003100e370000200041186a2004100e3700000b0b230002404100200020012002200310104120200420052006200710104100412010000b0b
2020-05-12 19:01:39 +00:00
Text representation:
(module
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
(import "ethereum" "revert" (func $eth.revert (param i32 i32)))
(import "ethereum" "getCallDataSize" (func $eth.getCallDataSize (result i32)))
2020-05-12 19:01:39 +00:00
(import "ethereum" "callDataCopy" (func $eth.callDataCopy (param i32 i32 i32)))
(memory $memory (export "memory") 1)
(export "main" (func $main))
(global $global_ (mut i64) (i64.const 0))
(global $global__1 (mut i64) (i64.const 0))
(global $global__2 (mut i64) (i64.const 0))
(func $main
(local $_1 i64)
(local $x i64)
(local $x_1 i64)
(local $x_2 i64)
(local $x_3 i64)
(local $x_4 i64)
(local $x_5 i64)
(local $x_6 i64)
(local $x_7 i64)
(local $_2 i64)
(local $_3 i32)
(local $_4 i64)
2020-05-12 19:01:39 +00:00
(local $_5 i64)
(local $_6 i64)
(local $_7 i64)
(local $_8 i64)
(local $_9 i64)
(local $_10 i64)
(local $_11 i64)
(local $_12 i64)
(local $_13 i64)
(local $_14 i64)
(local $_15 i64)
2020-05-12 19:01:39 +00:00
(local $x_8 i64)
(local $x_9 i64)
(local $x_10 i64)
(local $x_11 i64)
(block $label_
2020-05-25 21:33:59 +00:00
(local.set $_1 (i64.const 0))
(block
(local.set $x (call $calldataload (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))
(local.set $x_1 (global.get $global_))
(local.set $x_2 (global.get $global__1))
(local.set $x_3 (global.get $global__2))
2020-05-12 19:01:39 +00:00
2020-05-25 21:33:59 +00:00
)
(local.set $x_4 (local.get $x))
(local.set $x_5 (local.get $x_1))
(local.set $x_6 (local.get $x_2))
(local.set $x_7 (local.get $x_3))
(local.set $_2 (i64.const 1))
(local.set $_3 (i32.eqz (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2)))))))
2020-05-25 21:33:59 +00:00
(block $label__3
(loop $label__5
(br_if $label__3 (i32.eqz (i32.eqz (local.get $_3))))
2020-05-25 21:33:59 +00:00
(block $label__4
(block
(local.set $_4 (call $iszero_200_868_1493 (local.get $_1) (local.get $_1) (local.get $_1) (call $lt_202 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10))))
(local.set $_5 (global.get $global_))
(local.set $_6 (global.get $global__1))
(local.set $_7 (global.get $global__2))
2020-05-12 19:01:39 +00:00
2020-05-25 21:33:59 +00:00
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_4) (local.get $_5)) (i64.or (local.get $_6) (local.get $_7))))) (then
2020-05-25 21:33:59 +00:00
(br $label__3)
))
(block
(local.set $_8 (call $eq_201_869_1494 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2)))
(local.set $_9 (global.get $global_))
(local.set $_10 (global.get $global__1))
(local.set $_11 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_8) (local.get $_9)) (i64.or (local.get $_10) (local.get $_11))))) (then
2020-05-25 21:33:59 +00:00
(br $label__3)
))
(block
(local.set $_12 (call $eq_201_869_1494 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4)))
(local.set $_13 (global.get $global_))
(local.set $_14 (global.get $global__1))
(local.set $_15 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_12) (local.get $_13)) (i64.or (local.get $_14) (local.get $_15))))) (then
2020-05-25 21:33:59 +00:00
(br $label__4)
))
2020-05-12 19:01:39 +00:00
)
(block
2020-05-25 21:33:59 +00:00
(local.set $x_8 (call $add (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2)))
(local.set $x_9 (global.get $global_))
(local.set $x_10 (global.get $global__1))
(local.set $x_11 (global.get $global__2))
2020-05-12 19:01:39 +00:00
)
2020-05-25 21:33:59 +00:00
(local.set $x_4 (local.get $x_8))
(local.set $x_5 (local.get $x_9))
(local.set $x_6 (local.get $x_10))
(local.set $x_7 (local.get $x_11))
(br $label__5)
2020-05-12 19:01:39 +00:00
)
)
2020-05-25 21:33:59 +00:00
(call $sstore (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))
2020-05-12 19:01:39 +00:00
)
)
(func $add_carry
(param $x i64)
(param $y i64)
(param $c i64)
(result i64)
(local $r i64)
(local $r_c i64)
(local $t i64)
2020-05-25 21:33:59 +00:00
(block $label__6
(local.set $t (i64.add (local.get $x) (local.get $y)))
(local.set $r (i64.add (local.get $t) (local.get $c)))
(local.set $r_c (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x)) (i64.lt_u (local.get $r) (local.get $t)))))
2020-05-25 21:33:59 +00:00
)
2020-05-12 19:01:39 +00:00
(global.set $global_ (local.get $r_c))
(local.get $r)
)
(func $add
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
(local $t i64)
(local $r3_1 i64)
(local $carry i64)
(local $r2_1 i64)
(local $carry_1 i64)
(local $r1_1 i64)
(local $carry_2 i64)
2020-05-25 21:33:59 +00:00
(block $label__7
(local.set $t (i64.add (local.get $x4) (local.get $y4)))
(local.set $r4 (i64.add (local.get $t) (i64.const 0)))
(block
(local.set $r3_1 (call $add_carry (local.get $x3) (local.get $y3) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x4)) (i64.lt_u (local.get $r4) (local.get $t))))))
2020-05-25 21:33:59 +00:00
(local.set $carry (global.get $global_))
2020-05-12 19:01:39 +00:00
2020-05-25 21:33:59 +00:00
)
(local.set $r3 (local.get $r3_1))
(block
(local.set $r2_1 (call $add_carry (local.get $x2) (local.get $y2) (local.get $carry)))
(local.set $carry_1 (global.get $global_))
2020-05-12 19:01:39 +00:00
2020-05-25 21:33:59 +00:00
)
(local.set $r2 (local.get $r2_1))
(block
(local.set $r1_1 (call $add_carry (local.get $x1) (local.get $y1) (local.get $carry_1)))
(local.set $carry_2 (global.get $global_))
)
(local.set $r1 (local.get $r1_1))
2020-05-12 19:01:39 +00:00
)
(global.set $global_ (local.get $r2))
(global.set $global__1 (local.get $r3))
(global.set $global__2 (local.get $r4))
(local.get $r1)
)
(func $iszero_200_868_1493
2020-05-12 19:01:39 +00:00
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
2020-05-25 21:33:59 +00:00
(block $label__8
(local.set $r4 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (local.get $x1) (local.get $x2)) (i64.or (local.get $x3) (local.get $x4))))))
2020-05-25 21:33:59 +00:00
)
2020-05-12 19:01:39 +00:00
(global.set $global_ (local.get $r2))
(global.set $global__1 (local.get $r3))
(global.set $global__2 (local.get $r4))
(local.get $r1)
)
(func $eq_201_869_1494
2020-05-12 19:01:39 +00:00
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
2020-05-12 19:01:39 +00:00
(local $r4 i64)
2020-05-25 21:33:59 +00:00
(block $label__9
(local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (local.get $y1)) (i32.and (i64.eq (local.get $x2) (local.get $y2)) (i32.and (i64.eq (local.get $x3) (local.get $y3)) (i64.eq (local.get $x4) (local.get $y4)))))))
2020-05-25 21:33:59 +00:00
)
(global.set $global_ (local.get $r2))
(global.set $global__1 (local.get $r3))
(global.set $global__2 (local.get $r4))
(local.get $r1)
2020-05-12 19:01:39 +00:00
)
(func $cmp
(param $a i64)
(param $b i64)
(result i32)
(local $r i32)
(local $condition i32)
2020-05-25 21:33:59 +00:00
(block $label__10
(block
(local.set $condition (i64.lt_u (local.get $a) (local.get $b)))
(if (i32.eq (local.get $condition) (i32.const 1)) (then
(local.set $r (i32.const 4294967295))
2020-05-25 21:33:59 +00:00
)(else
(local.set $r (i64.ne (local.get $a) (local.get $b)))
2020-05-25 21:33:59 +00:00
))
)
2020-05-12 19:01:39 +00:00
)
(local.get $r)
)
(func $lt_202
2020-05-12 19:01:39 +00:00
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $z4 i64)
(local $z i32)
(local $condition_12 i32)
(local $condition_13 i32)
(local $condition_14 i32)
2020-05-25 21:33:59 +00:00
(block $label__11
(local.set $z (i32.const 0))
2020-05-25 21:33:59 +00:00
(block
(local.set $condition_12 (call $cmp (local.get $x1) (local.get $y1)))
(if (i32.eq (local.get $condition_12) (i32.const 0)) (then
2020-05-25 21:33:59 +00:00
(block
(local.set $condition_13 (call $cmp (local.get $x2) (local.get $y2)))
(if (i32.eq (local.get $condition_13) (i32.const 0)) (then
2020-05-25 21:33:59 +00:00
(block
(local.set $condition_14 (call $cmp (local.get $x3) (local.get $y3)))
(if (i32.eq (local.get $condition_14) (i32.const 0)) (then
(local.set $z (i64.lt_u (local.get $x4) (local.get $y4)))
2020-05-12 19:01:39 +00:00
)(else
(if (i32.eq (local.get $condition_14) (i32.const 1)) (then
(local.set $z (i32.const 0))
2020-05-25 21:33:59 +00:00
)(else
(local.set $z (i32.const 1))
2020-05-25 21:33:59 +00:00
))
2020-05-12 19:01:39 +00:00
))
2020-05-25 21:33:59 +00:00
)
2020-05-12 19:01:39 +00:00
)(else
(if (i32.eq (local.get $condition_13) (i32.const 1)) (then
(local.set $z (i32.const 0))
2020-05-25 21:33:59 +00:00
)(else
(local.set $z (i32.const 1))
2020-05-25 21:33:59 +00:00
))
2020-05-12 19:01:39 +00:00
))
2020-05-25 21:33:59 +00:00
)
2020-05-12 19:01:39 +00:00
)(else
(if (i32.eq (local.get $condition_12) (i32.const 1)) (then
(local.set $z (i32.const 0))
2020-05-25 21:33:59 +00:00
)(else
(local.set $z (i32.const 1))
2020-05-25 21:33:59 +00:00
))
2020-05-12 19:01:39 +00:00
))
2020-05-25 21:33:59 +00:00
)
(local.set $z4 (i64.extend_i32_u (local.get $z)))
2020-05-12 19:01:39 +00:00
)
2020-08-20 14:56:25 +00:00
(local.get $z4)
2020-05-12 19:01:39 +00:00
)
(func $u256_to_i32
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(result i32)
(local $v i32)
(block $label__15
(if (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3))) (then
(unreachable)))
(if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then
(unreachable)))
(local.set $v (i32.wrap_i64 (local.get $x4)))
)
(local.get $v)
)
(func $bswap16
(param $x i64)
(result i64)
(local $y i64)
(block $label__16
(local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255))))
)
(local.get $y)
)
(func $bswap32
(param $x i64)
(result i64)
(local $y i64)
(local $hi i64)
(block $label__17
(local.set $hi (i64.shl (call $bswap16 (local.get $x)) (i64.const 16)))
(local.set $y (i64.or (local.get $hi) (call $bswap16 (i64.shr_u (local.get $x) (i64.const 16)))))
)
(local.get $y)
)
(func $bswap64
(param $x i64)
(result i64)
(local $y i64)
(local $hi i64)
(block $label__18
(local.set $hi (i64.shl (call $bswap32 (local.get $x)) (i64.const 32)))
(local.set $y (i64.or (local.get $hi) (call $bswap32 (i64.shr_u (local.get $x) (i64.const 32)))))
)
(local.get $y)
)
2020-05-12 19:01:39 +00:00
(func $calldataload
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(result i64)
(local $z1 i64)
(local $z2 i64)
(local $z3 i64)
(local $z4 i64)
(local $cds i32)
(local $_1 i64)
(local $destination i32)
(local $offset i32)
(local $requested_size i32)
(local $available_size i32)
(local $_2 i32)
(local $_3 i32)
(local $_4 i32)
(local $i i32)
2020-05-12 19:01:39 +00:00
(local $z1_1 i64)
(local $z2_1 i64)
(local $z3_1 i64)
(local $z4_1 i64)
(block $label__19
(local.set $cds (call $eth.getCallDataSize))
(local.set $_1 (i64.const 0))
(local.set $destination (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))
(local.set $offset (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)))
(local.set $requested_size (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 32)))
(if (i32.gt_u (local.get $offset) (i32.sub (i32.const 4294967295) (local.get $requested_size))) (then
(call $eth.revert (i32.const 0) (i32.const 0))))
(local.set $available_size (i32.sub (local.get $cds) (local.get $offset)))
(if (i32.gt_u (local.get $offset) (local.get $cds)) (then
(local.set $available_size (i32.const 0))
))
(local.set $_2 (i32.const 0))
(if (i32.gt_u (local.get $available_size) (local.get $_2)) (then
(call $eth.callDataCopy (local.get $destination) (local.get $offset) (local.get $available_size))))
(if (i32.gt_u (local.get $requested_size) (local.get $available_size)) (then
(local.set $_3 (i32.sub (local.get $requested_size) (local.get $available_size)))
(local.set $_4 (i32.add (local.get $destination) (local.get $available_size)))
(local.set $i (local.get $_2))
(block $label__20
(loop $label__22
(br_if $label__20 (i32.eqz (i32.lt_u (local.get $i) (local.get $_3))))
(block $label__21
(i32.store8 (i32.add (local.get $_4) (local.get $i)) (local.get $_2))
)
(local.set $i (i32.add (local.get $i) (i32.const 1)))
(br $label__22)
)
)
))
(local.set $z1_1 (call $bswap64 (i64.load (local.get $_2))))
(local.set $z2_1 (call $bswap64 (i64.load (i32.add (local.get $_2) (i32.const 8)))))
(local.set $z3_1 (call $bswap64 (i64.load (i32.add (local.get $_2) (i32.const 16)))))
(local.set $z4_1 (call $bswap64 (i64.load (i32.add (local.get $_2) (i32.const 24)))))
2020-05-25 21:33:59 +00:00
(local.set $z1 (local.get $z1_1))
(local.set $z2 (local.get $z2_1))
(local.set $z3 (local.get $z3_1))
(local.set $z4 (local.get $z4_1))
)
2020-05-12 19:01:39 +00:00
(global.set $global_ (local.get $z2))
(global.set $global__1 (local.get $z3))
(global.set $global__2 (local.get $z4))
(local.get $z1)
)
(func $mstore_internal
(param $pos i32)
2020-05-12 19:01:39 +00:00
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(block $label__23
(i64.store (local.get $pos) (call $bswap64 (local.get $y1)))
(i64.store (i32.add (local.get $pos) (i32.const 8)) (call $bswap64 (local.get $y2)))
(i64.store (i32.add (local.get $pos) (i32.const 16)) (call $bswap64 (local.get $y3)))
(i64.store (i32.add (local.get $pos) (i32.const 24)) (call $bswap64 (local.get $y4)))
2020-05-25 21:33:59 +00:00
)
2020-05-12 19:01:39 +00:00
)
(func $sstore
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
(param $x4 i64)
(param $y1 i64)
(param $y2 i64)
(param $y3 i64)
(param $y4 i64)
(block $label__24
(call $mstore_internal (i32.const 0) (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4))
(call $mstore_internal (i32.const 32) (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4))
(call $eth.storageStore (i32.const 0) (i32.const 32))
2020-05-25 21:33:59 +00:00
)
2020-05-12 19:01:39 +00:00
)
)