Skip to content

Instantly share code, notes, and snippets.

@hrkrshnn
Last active March 24, 2021 12:25
Show Gist options
  • Save hrkrshnn/c0be59d40a918fc6a6a2d977b0dea5b3 to your computer and use it in GitHub Desktop.
Save hrkrshnn/c0be59d40a918fc6a6a2d977b0dea5b3 to your computer and use it in GitHub Desktop.
diff -u /tmp/jumpold.txt /tmp/jumpnew.txt
--- /tmp/jumpold.txt 2021-03-24 13:23:56.931683183 +0100
+++ /tmp/jumpnew.txt 2021-03-24 13:23:41.046763769 +0100
@@ -97,16 +97,18 @@
iszero
tag_11
jumpi
- /* "<stdin>":128:133 leave */
- jump(tag_10)
+ /* "<stdin>":119:144 { if x { leave } y := 8 } */
+ swap2
+ swap1
+ pop
+ jump // out
/* "<stdin>":121:123 if */
tag_11:
pop
/* "<stdin>":141:142 8 */
0x08
- /* "<stdin>":119:144 { if x { leave } y := 8 } */
- tag_10:
swap2
+ /* "<stdin>":119:144 { if x { leave } y := 8 } */
swap1
pop
jump // out
@@ -127,7 +129,7 @@
pop
jump // out
- auxdata: 0xa2646970667358221220424d26f2025a2cbd05db0870ec2d64370b59008b2d76f0aba3e527aaa42cba6a64736f6c637827302e382e332d646576656c6f702e323032312e332e32322b636f6d6d69742e30636266353265300058
+ auxdata: 0xa26469706673582212209a76079741326aeae33771ded22846ad7d8f71778800a333e1ed3a996955191664736f6c63782b302e382e332d646576656c6f702e323032312e332e32342b636f6d6d69742e37373337346636312e6d6f64005c
}
#+end_example
Diff finished. Wed Mar 24 13:24:02 2021
#+begin_example
======= <stdin>:C =======
EVM assembly:
/* "<stdin>":20:166 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "<stdin>":20:166 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0xb3de648b
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "<stdin>":34:164 function f(uint a) public pure returns (uint t) {... */
tag_3:
tag_4
0x04
dup1
calldatasize
sub
0x20
dup2
lt
iszero
tag_5
jumpi
0x00
dup1
revert
tag_5:
pop
calldataload
tag_6
jump // in
tag_4:
0x40
dup1
mload
swap2
dup3
mstore
mload
swap1
dup2
swap1
sub
0x20
add
swap1
return
tag_6:
/* "<stdin>":74:80 uint t */
0x00
/* "<stdin>":100:144 function g(x) -> y { if x { leave } y := 8 } */
jump(tag_8)
tag_9:
0x00
/* "<stdin>":124:125 x */
dup2
/* "<stdin>":121:123 if */
iszero
tag_11
jumpi
/* "<stdin>":119:144 { if x { leave } y := 8 } */
swap2
swap1
pop
jump // out
/* "<stdin>":121:123 if */
tag_11:
pop
/* "<stdin>":141:142 8 */
0x08
swap2
/* "<stdin>":119:144 { if x { leave } y := 8 } */
swap1
pop
jump // out
tag_8:
/* "<stdin>":153:157 g(a) */
tag_12
/* "<stdin>":155:156 a */
dup3
/* "<stdin>":153:157 g(a) */
tag_9
jump // in
tag_12:
/* "<stdin>":148:157 t := g(a) */
swap3
/* "<stdin>":95:161 {... */
swap2
pop
pop
jump // out
auxdata: 0xa26469706673582212209a76079741326aeae33771ded22846ad7d8f71778800a333e1ed3a996955191664736f6c63782b302e382e332d646576656c6f702e323032312e332e32342b636f6d6d69742e37373337346636312e6d6f64005c
}
#+end_example
#+begin_example
======= <stdin>:C =======
EVM assembly:
/* "<stdin>":20:166 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "<stdin>":20:166 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0xb3de648b
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "<stdin>":34:164 function f(uint a) public pure returns (uint t) {... */
tag_3:
tag_4
0x04
dup1
calldatasize
sub
0x20
dup2
lt
iszero
tag_5
jumpi
0x00
dup1
revert
tag_5:
pop
calldataload
tag_6
jump // in
tag_4:
0x40
dup1
mload
swap2
dup3
mstore
mload
swap1
dup2
swap1
sub
0x20
add
swap1
return
tag_6:
/* "<stdin>":74:80 uint t */
0x00
/* "<stdin>":100:144 function g(x) -> y { if x { leave } y := 8 } */
jump(tag_8)
tag_9:
0x00
/* "<stdin>":124:125 x */
dup2
/* "<stdin>":121:123 if */
iszero
tag_11
jumpi
/* "<stdin>":128:133 leave */
jump(tag_10)
/* "<stdin>":121:123 if */
tag_11:
pop
/* "<stdin>":141:142 8 */
0x08
/* "<stdin>":119:144 { if x { leave } y := 8 } */
tag_10:
swap2
swap1
pop
jump // out
tag_8:
/* "<stdin>":153:157 g(a) */
tag_12
/* "<stdin>":155:156 a */
dup3
/* "<stdin>":153:157 g(a) */
tag_9
jump // in
tag_12:
/* "<stdin>":148:157 t := g(a) */
swap3
/* "<stdin>":95:161 {... */
swap2
pop
pop
jump // out
auxdata: 0xa2646970667358221220424d26f2025a2cbd05db0870ec2d64370b59008b2d76f0aba3e527aaa42cba6a64736f6c637827302e382e332d646576656c6f702e323032312e332e32322b636f6d6d69742e30636266353265300058
}
#+end_example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment