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)))
|
|
|
|
(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-01-08 09:08:26 +00:00
|
|
|
(local $p i64)
|
|
|
|
(local $r i64)
|
2019-07-09 13:19:50 +00:00
|
|
|
(local $hi i64)
|
2020-02-04 17:27:01 +00:00
|
|
|
(local $hi_1 i64)
|
2020-02-04 21:43:40 +00:00
|
|
|
(local $y i64)
|
|
|
|
(local $hi_2 i64)
|
2020-01-08 09:08:26 +00:00
|
|
|
(local $_2 i64)
|
2019-10-31 16:29:21 +00:00
|
|
|
(local.set $_1 (i64.const 0))
|
2020-01-08 09:08:26 +00:00
|
|
|
(local.set $p (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64)))
|
2020-02-04 21:43:40 +00:00
|
|
|
(local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64)))))
|
|
|
|
(if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then
|
2020-01-08 09:08:26 +00:00
|
|
|
(unreachable)))
|
2020-02-04 21:43:40 +00:00
|
|
|
(local.set $hi (i64.shl (call $endian_swap_16 (local.get $_1)) (i64.const 16)))
|
|
|
|
(local.set $hi_1 (i64.shl (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $_1) (i64.const 16)))) (i64.const 32)))
|
|
|
|
(local.set $y (i64.or (local.get $hi_1) (call $endian_swap_32 (i64.shr_u (local.get $_1) (i64.const 32)))))
|
2020-01-08 09:08:26 +00:00
|
|
|
(i64.store (i32.wrap_i64 (local.get $r)) (local.get $y))
|
2020-02-04 21:43:40 +00:00
|
|
|
(i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 8))))) (local.get $y))
|
|
|
|
(i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 16))))) (local.get $y))
|
|
|
|
(local.set $hi_2 (i64.shl (call $endian_swap_32 (i64.const 128)) (i64.const 32)))
|
|
|
|
(i64.store (i32.wrap_i64 (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (i64.const 24))))) (i64.or (local.get $hi_2) (call $endian_swap_32 (i64.shr_u (i64.const 128) (i64.const 32)))))
|
2020-01-08 09:08:26 +00:00
|
|
|
(local.set $_2 (datasize \"C_2_deployed\"))
|
|
|
|
(call $eth.codeCopy (i32.wrap_i64 (call $to_internal_i32ptr (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\"))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2))))
|
|
|
|
(call $eth.finish (i32.wrap_i64 (call $to_internal_i32ptr (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2))))
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(func $u256_to_i32
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
|
|
|
(result i64)
|
|
|
|
(local $v i64)
|
2020-01-16 19:35:42 +00:00
|
|
|
(if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.or (i64.or (local.get $x1) (local.get $x2)) (local.get $x3)))) (i64.const 0)) (then
|
2019-07-11 15:02:53 +00:00
|
|
|
(unreachable)))
|
2020-01-16 19:35:42 +00:00
|
|
|
(if (i64.ne (i64.extend_i32_u (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32)))) (i64.const 0)) (then
|
2019-07-11 15:02:53 +00:00
|
|
|
(unreachable)))
|
2020-02-04 21:43:40 +00:00
|
|
|
(local.set $v (i64.extend_i32_u (i32.wrap_i64 (local.get $x4))))
|
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)
|
|
|
|
(result i64)
|
|
|
|
(local $r i64)
|
|
|
|
(local $p i64)
|
|
|
|
(local.set $p (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)))
|
2020-02-04 21:43:40 +00:00
|
|
|
(local.set $r (i64.extend_i32_u (i32.add (i32.wrap_i64 (local.get $p)) (i32.wrap_i64 (i64.const 64)))))
|
|
|
|
(if (i64.ne (i64.extend_i32_u (i32.lt_u (i32.wrap_i64 (local.get $r)) (i32.wrap_i64 (local.get $p)))) (i64.const 0)) (then
|
2020-01-08 09:08:26 +00:00
|
|
|
(unreachable)))
|
|
|
|
(local.get $r)
|
|
|
|
)
|
|
|
|
|
2019-07-09 13:19:50 +00:00
|
|
|
(func $endian_swap_16
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
2019-10-31 16:29:21 +00:00
|
|
|
(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)
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(func $endian_swap_32
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
|
|
|
(local $hi i64)
|
2019-10-31 16:29:21 +00:00
|
|
|
(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)))))
|
|
|
|
(local.get $y)
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
2019-07-03 07:59:36 +00:00
|
|
|
)
|
2019-11-26 15:41:58 +00:00
|
|
|
"}}}},"sources":{"A":{"id":0}}}
|