Skip to content

Instantly share code, notes, and snippets.

@jacqueswww
Created May 16, 2019 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacqueswww/57e01074845821f0eaccb7f547a56189 to your computer and use it in GitHub Desktop.
Save jacqueswww/57e01074845821f0eaccb7f547a56189 to your computer and use it in GitHub Desktop.
Return 1234 as uint256 on ewasm
(module
(type (;0;) (func (param i32 i32)))
(type (;1;) (func))
(import "ethereum" "finish" (func (;0;) (type 0)))
(func (;1;) (type 1))
(func (;2;) (type 0) (param i32 i32)
(local i32 i32 i32)
local.get 1
i64.const 0
i64.store align=1
local.get 1
i32.const 24
i32.add
local.tee 2
i64.const 0
i64.store align=1
local.get 1
i32.const 16
i32.add
local.tee 3
i64.const 0
i64.store align=1
local.get 1
i32.const 8
i32.add
local.tee 4
i64.const 0
i64.store align=1
local.get 1
local.get 0
i32.load8_u
i32.store8 offset=31
local.get 1
local.get 0
i32.load8_u offset=1
i32.store8 offset=30
local.get 1
local.get 0
i32.load8_u offset=2
i32.store8 offset=29
local.get 1
local.get 0
i32.load8_u offset=3
i32.store8 offset=28
local.get 1
local.get 0
i32.load8_u offset=4
i32.store8 offset=27
local.get 1
local.get 0
i32.load8_u offset=5
i32.store8 offset=26
local.get 1
local.get 0
i32.load8_u offset=6
i32.store8 offset=25
local.get 2
local.get 0
i32.load8_u offset=7
i32.store8
local.get 1
local.get 0
i32.load8_u offset=8
i32.store8 offset=23
local.get 1
local.get 0
i32.load8_u offset=9
i32.store8 offset=22
local.get 1
local.get 0
i32.load8_u offset=10
i32.store8 offset=21
local.get 1
local.get 0
i32.load8_u offset=11
i32.store8 offset=20
local.get 1
local.get 0
i32.load8_u offset=12
i32.store8 offset=19
local.get 1
local.get 0
i32.load8_u offset=13
i32.store8 offset=18
local.get 1
local.get 0
i32.load8_u offset=14
i32.store8 offset=17
local.get 3
local.get 0
i32.load8_u offset=15
i32.store8
local.get 1
local.get 0
i32.load8_u offset=16
i32.store8 offset=15
local.get 1
local.get 0
i32.load8_u offset=17
i32.store8 offset=14
local.get 1
local.get 0
i32.load8_u offset=18
i32.store8 offset=13
local.get 1
local.get 0
i32.load8_u offset=19
i32.store8 offset=12
local.get 1
local.get 0
i32.load8_u offset=20
i32.store8 offset=11
local.get 1
local.get 0
i32.load8_u offset=21
i32.store8 offset=10
local.get 1
local.get 0
i32.load8_u offset=22
i32.store8 offset=9
local.get 4
local.get 0
i32.load8_u offset=23
i32.store8
local.get 1
local.get 0
i32.const 24
i32.add
i32.load8_u
i32.store8 offset=7
local.get 1
local.get 0
i32.load8_u offset=25
i32.store8 offset=6
local.get 1
local.get 0
i32.load8_u offset=26
i32.store8 offset=5
local.get 1
local.get 0
i32.load8_u offset=27
i32.store8 offset=4
local.get 1
local.get 0
i32.load8_u offset=28
i32.store8 offset=3
local.get 1
local.get 0
i32.load8_u offset=29
i32.store8 offset=2
local.get 1
local.get 0
i32.load8_u offset=30
i32.store8 offset=1
local.get 1
local.get 0
i32.load8_u offset=31
i32.store8)
(func (;3;) (type 1)
(local i32)
global.get 0
i32.const 64
i32.sub
local.tee 0
global.set 0
local.get 0
i32.const 32
i32.add
i32.const 24
i32.add
i64.const 0
i64.store
local.get 0
i32.const 32
i32.add
i32.const 16
i32.add
i64.const 0
i64.store
local.get 0
i32.const 24
i32.add
i64.const 0
i64.store
local.get 0
i32.const 16
i32.add
i64.const 0
i64.store
local.get 0
i64.const 0
i64.store offset=40
local.get 0
i64.const 0
i64.store offset=32
local.get 0
i64.const 1234
i64.store
local.get 0
i64.const 0
i64.store offset=8
local.get 0
local.get 0
i32.const 32
i32.add
call 2
local.get 0
i32.const 32
i32.add
i32.const 32
call 0
unreachable)
(table (;0;) 1 1 anyfunc)
(memory (;0;) 2)
(global (;0;) (mut i32) (i32.const 66560))
(global (;1;) i32 (i32.const 66560))
(global (;2;) i32 (i32.const 1024))
(export "memory" (memory 0))
(export "main" (func 3)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment