2019-07-03 07:59:36 +00:00
|
|
|
{"contracts":{"A":{"C":{"ewasm":{"wast":"(module
|
2019-10-31 16:27:52 +00:00
|
|
|
;; sub-module \"C_2_deployed\" will be encoded as custom section in binary here, but is skipped in text mode.
|
2019-07-09 13:19:50 +00:00
|
|
|
(import \"ethereum\" \"codeCopy\" (func $eth.codeCopy (param i32 i32 i32)))
|
2020-04-06 15:26:59 +00:00
|
|
|
(import \"ethereum\" \"revert\" (func $eth.revert (param i32 i32)))
|
|
|
|
(import \"ethereum\" \"getCallValue\" (func $eth.getCallValue (param i32)))
|
2019-07-09 13:19:50 +00:00
|
|
|
(import \"ethereum\" \"finish\" (func $eth.finish (param i32 i32)))
|
2019-07-03 07:59:36 +00:00
|
|
|
(memory $memory (export \"memory\") 1)
|
|
|
|
(export \"main\" (func $main))
|
|
|
|
|
|
|
|
(func $main
|
2019-07-09 13:19:50 +00:00
|
|
|
(local $_1 i64)
|
2020-06-05 19:36:44 +00:00
|
|
|
(local $p i32)
|
|
|
|
(local $r i32)
|
2020-01-08 09:08:26 +00:00
|
|
|
(local $_2 i64)
|
2020-04-06 15:26:59 +00:00
|
|
|
(local $z1 i64)
|
|
|
|
(local $z2 i64)
|
|
|
|
(local $z3 i64)
|
|
|
|
(local $_3 i64)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label_
|
|
|
|
(local.set $_1 (i64.const 0))
|
|
|
|
(local.set $p (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64)))
|
2020-06-05 19:36:44 +00:00
|
|
|
(local.set $r (i32.add (local.get $p) (i32.const 64)))
|
|
|
|
(if (i32.lt_u (local.get $r) (local.get $p)) (then
|
2020-05-25 21:33:59 +00:00
|
|
|
(unreachable)))
|
|
|
|
(local.set $_2 (call $endian_swap (local.get $_1)))
|
2020-06-05 19:36:44 +00:00
|
|
|
(i64.store (local.get $r) (local.get $_2))
|
|
|
|
(i64.store (i32.add (local.get $r) (i32.const 8)) (local.get $_2))
|
|
|
|
(i64.store (i32.add (local.get $r) (i32.const 16)) (local.get $_2))
|
|
|
|
(i64.store (i32.add (local.get $r) (i32.const 24)) (call $endian_swap (i64.const 128)))
|
|
|
|
(call $eth.getCallValue (i32.const 0))
|
|
|
|
(local.set $z1 (call $endian_swap (i64.load (i32.const 0))))
|
|
|
|
(local.set $z2 (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 8)))))
|
|
|
|
(local.set $z3 (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 16)))))
|
|
|
|
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $z1) (local.get $z2)) (i64.or (local.get $z3) (call $endian_swap (i64.load (i32.add (i32.const 0) (i32.const 24)))))))) (then
|
2020-05-25 21:33:59 +00:00
|
|
|
(call $revert (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))))
|
|
|
|
(local.set $_3 (datasize \"C_2_deployed\"))
|
|
|
|
(call $codecopy (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\") (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3))
|
|
|
|
(call $return (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3))
|
|
|
|
)
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(func $u256_to_i32
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
2020-06-05 19:36:44 +00:00
|
|
|
(result i32)
|
|
|
|
(local $v i32)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__1
|
2020-06-05 19:36:44 +00:00
|
|
|
(if (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3))) (then
|
2020-05-25 21:33:59 +00:00
|
|
|
(unreachable)))
|
2020-06-05 19:36:44 +00:00
|
|
|
(if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then
|
2020-05-25 21:33:59 +00:00
|
|
|
(unreachable)))
|
2020-06-05 19:36:44 +00:00
|
|
|
(local.set $v (i32.wrap_i64 (local.get $x4)))
|
2020-05-25 21:33:59 +00:00
|
|
|
|
|
|
|
)
|
2019-10-31 16:29:21 +00:00
|
|
|
(local.get $v)
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
2020-01-08 09:08:26 +00:00
|
|
|
(func $to_internal_i32ptr
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
2020-06-05 19:36:44 +00:00
|
|
|
(result i32)
|
|
|
|
(local $r i32)
|
|
|
|
(local $p i32)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__2
|
|
|
|
(local.set $p (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)))
|
2020-06-05 19:36:44 +00:00
|
|
|
(local.set $r (i32.add (local.get $p) (i32.const 64)))
|
|
|
|
(if (i32.lt_u (local.get $r) (local.get $p)) (then
|
2020-05-25 21:33:59 +00:00
|
|
|
(unreachable)))
|
|
|
|
|
|
|
|
)
|
2020-01-08 09:08:26 +00:00
|
|
|
(local.get $r)
|
|
|
|
)
|
|
|
|
|
2020-04-06 15:26:59 +00:00
|
|
|
(func $codecopy
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
|
|
|
(param $y1 i64)
|
|
|
|
(param $y2 i64)
|
|
|
|
(param $y3 i64)
|
|
|
|
(param $y4 i64)
|
|
|
|
(param $z1 i64)
|
|
|
|
(param $z2 i64)
|
|
|
|
(param $z3 i64)
|
|
|
|
(param $z4 i64)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__3
|
2020-06-05 19:36:44 +00:00
|
|
|
(call $eth.codeCopy (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) (call $u256_to_i32 (local.get $z1) (local.get $z2) (local.get $z3) (local.get $z4)))
|
2020-05-25 21:33:59 +00:00
|
|
|
)
|
2020-04-06 15:26:59 +00:00
|
|
|
)
|
|
|
|
|
2019-07-09 13:19:50 +00:00
|
|
|
(func $endian_swap_16
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__4
|
|
|
|
(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))))
|
|
|
|
|
|
|
|
)
|
2019-10-31 16:29:21 +00:00
|
|
|
(local.get $y)
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(func $endian_swap_32
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
|
|
|
(local $hi i64)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__5
|
|
|
|
(local.set $hi (i64.shl (call $endian_swap_16 (local.get $x)) (i64.const 16)))
|
|
|
|
(local.set $y (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $x) (i64.const 16)))))
|
|
|
|
|
|
|
|
)
|
2019-10-31 16:29:21 +00:00
|
|
|
(local.get $y)
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
2020-04-06 15:26:59 +00:00
|
|
|
(func $endian_swap
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
|
|
|
(local $hi i64)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__6
|
|
|
|
(local.set $hi (i64.shl (call $endian_swap_32 (local.get $x)) (i64.const 32)))
|
|
|
|
(local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $x) (i64.const 32)))))
|
|
|
|
|
|
|
|
)
|
2020-04-06 15:26:59 +00:00
|
|
|
(local.get $y)
|
|
|
|
)
|
|
|
|
|
|
|
|
(func $return
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
|
|
|
(param $y1 i64)
|
|
|
|
(param $y2 i64)
|
|
|
|
(param $y3 i64)
|
|
|
|
(param $y4 i64)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__7
|
2020-06-05 19:36:44 +00:00
|
|
|
(call $eth.finish (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))
|
2020-05-25 21:33:59 +00:00
|
|
|
)
|
2020-04-06 15:26:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(func $revert
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
|
|
|
(param $y1 i64)
|
|
|
|
(param $y2 i64)
|
|
|
|
(param $y3 i64)
|
|
|
|
(param $y4 i64)
|
2020-05-25 21:33:59 +00:00
|
|
|
(block $label__8
|
2020-06-05 19:36:44 +00:00
|
|
|
(call $eth.revert (call $to_internal_i32ptr (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $u256_to_i32 (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)))
|
2020-05-25 21:33:59 +00:00
|
|
|
)
|
2020-04-06 15:26:59 +00:00
|
|
|
)
|
|
|
|
|
2019-07-03 07:59:36 +00:00
|
|
|
)
|
2019-11-26 15:41:58 +00:00
|
|
|
"}}}},"sources":{"A":{"id":0}}}
|