Skip to content

Instantly share code, notes, and snippets.

@hrkrshnn
Last active March 26, 2021 10:53
Show Gist options
  • Save hrkrshnn/9cc0707d226c0733b70c46d178a8ae63 to your computer and use it in GitHub Desktop.
Save hrkrshnn/9cc0707d226c0733b70c46d178a8ae63 to your computer and use it in GitHub Desktop.
diff -u /tmp/old.txt /tmp/new.txt
--- /tmp/old.txt 2021-03-26 11:50:28.707345655 +0100
+++ /tmp/new.txt 2021-03-26 11:50:03.290450403 +0100
@@ -3,7 +3,7 @@
======= <stdin>:Test =======
EVM assembly:
- /* "<stdin>":0:210 contract Test {... */
+ /* "<stdin>":0:233 contract Test {... */
mstore(0x40, 0x80)
callvalue
dup1
@@ -25,7 +25,7 @@
stop
sub_0: assembly {
- /* "<stdin>":0:210 contract Test {... */
+ /* "<stdin>":0:233 contract Test {... */
mstore(0x40, 0x80)
callvalue
dup1
@@ -92,7 +92,7 @@
jump // in
tag_10:
stop
- /* "<stdin>":154:208 function act() public {... */
+ /* "<stdin>":154:231 function act() public {... */
tag_5:
tag_10
tag_15
@@ -115,20 +115,18 @@
/* "<stdin>":87:150 function takeValue(uint256 a) public {... */
pop
jump // out
- /* "<stdin>":154:208 function act() public {... */
+ /* "<stdin>":154:231 function act() public {... */
tag_15:
- /* "<stdin>":182:203 takeValue(getValue()) */
- tag_20
/* "<stdin>":77:78 7 */
0x07
- /* "<stdin>":192:202 getValue() */
- tag_11
- /* "<stdin>":19:83 function getValue() public returns (uint256) {... */
- jump
- /* "<stdin>":182:203 takeValue(getValue()) */
- tag_20:
- /* "<stdin>":154:208 function act() public {... */
- jump // out
+ /* "<stdin>":212:226 takeValue(val) */
+ tag_18
+ /* "<stdin>":77:78 7 */
+ dup2
+ /* "<stdin>":212:221 takeValue */
+ tag_13
+ /* "<stdin>":212:226 takeValue(val) */
+ jump // in
/* "#utility.yul":14:204 */
tag_12:
0x00
@@ -163,7 +161,7 @@
pop
jump // out
- auxdata: 0xa2646970667358221220746589d933c75882320d9d6edad0eaa72943c7b1f575cba1c58fa5e4443ac61364736f6c637827302e382e332d646576656c6f702e323032312e332e32322b636f6d6d69742e30636266353265300058
+ auxdata: 0xa2646970667358221220bab6c5d7e01bc59d73df4463d3d60f783615dd31f51b7d3af898815a449d559a64736f6c637827302e382e332d646576656c6f702e323032312e332e32322b636f6d6d69742e30636266353265300058
}
#+end_example
Diff finished. Fri Mar 26 11:50:42 2021
#+RESULTS:
#+begin_example
======= <stdin>:Test =======
EVM assembly:
/* "<stdin>":0:233 contract Test {... */
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>":0:233 contract Test {... */
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
0x20965255
eq
tag_3
jumpi
dup1
0xed11cf21
eq
tag_4
jumpi
dup1
0xee42b10b
eq
tag_5
jumpi
tag_2:
0x00
dup1
revert
/* "<stdin>":19:83 function getValue() public returns (uint256) {... */
tag_3:
/* "<stdin>":77:78 7 */
0x07
/* "<stdin>":19:83 function getValue() public returns (uint256) {... */
mload(0x40)
/* "#utility.yul":355:380 */
swap1
dup2
mstore
/* "#utility.yul":343:345 */
0x20
/* "#utility.yul":328:346 */
add
/* "<stdin>":19:83 function getValue() public returns (uint256) {... */
mload(0x40)
dup1
swap2
sub
swap1
return
/* "<stdin>":87:150 function takeValue(uint256 a) public {... */
tag_4:
tag_10
tag_11
calldatasize
0x04
tag_12
jump // in
tag_11:
tag_13
jump // in
tag_10:
stop
/* "<stdin>":154:231 function act() public {... */
tag_5:
tag_10
tag_15
jump // in
/* "<stdin>":87:150 function takeValue(uint256 a) public {... */
tag_13:
/* "<stdin>":142:144 10 */
0x0a
/* "<stdin>":138:139 a */
dup2
/* "<stdin>":138:144 a > 10 */
gt
/* "<stdin>":130:145 require(a > 10) */
tag_18
jumpi
0x00
dup1
revert
tag_18:
/* "<stdin>":87:150 function takeValue(uint256 a) public {... */
pop
jump // out
/* "<stdin>":154:231 function act() public {... */
tag_15:
/* "<stdin>":77:78 7 */
0x07
/* "<stdin>":212:226 takeValue(val) */
tag_18
/* "<stdin>":77:78 7 */
dup2
/* "<stdin>":212:221 takeValue */
tag_13
/* "<stdin>":212:226 takeValue(val) */
jump // in
/* "#utility.yul":14:204 */
tag_12:
0x00
/* "#utility.yul":126:128 */
0x20
/* "#utility.yul":114:123 */
dup3
/* "#utility.yul":105:112 */
dup5
/* "#utility.yul":101:124 */
sub
/* "#utility.yul":97:129 */
slt
/* "#utility.yul":94:96 */
iszero
tag_24
jumpi
/* "#utility.yul":147:153 */
dup1
/* "#utility.yul":139:145 */
dup2
/* "#utility.yul":132:154 */
revert
/* "#utility.yul":94:96 */
tag_24:
pop
/* "#utility.yul":175:198 */
calldataload
swap2
/* "#utility.yul":84:204 */
swap1
pop
jump // out
auxdata: 0xa2646970667358221220bab6c5d7e01bc59d73df4463d3d60f783615dd31f51b7d3af898815a449d559a64736f6c637827302e382e332d646576656c6f702e323032312e332e32322b636f6d6d69742e30636266353265300058
}
#+end_example
#+RESULTS:
#+begin_example
======= <stdin>:Test =======
EVM assembly:
/* "<stdin>":0:210 contract Test {... */
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>":0:210 contract Test {... */
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
0x20965255
eq
tag_3
jumpi
dup1
0xed11cf21
eq
tag_4
jumpi
dup1
0xee42b10b
eq
tag_5
jumpi
tag_2:
0x00
dup1
revert
/* "<stdin>":19:83 function getValue() public returns (uint256) {... */
tag_3:
/* "<stdin>":77:78 7 */
0x07
/* "<stdin>":19:83 function getValue() public returns (uint256) {... */
mload(0x40)
/* "#utility.yul":355:380 */
swap1
dup2
mstore
/* "#utility.yul":343:345 */
0x20
/* "#utility.yul":328:346 */
add
/* "<stdin>":19:83 function getValue() public returns (uint256) {... */
mload(0x40)
dup1
swap2
sub
swap1
return
/* "<stdin>":87:150 function takeValue(uint256 a) public {... */
tag_4:
tag_10
tag_11
calldatasize
0x04
tag_12
jump // in
tag_11:
tag_13
jump // in
tag_10:
stop
/* "<stdin>":154:208 function act() public {... */
tag_5:
tag_10
tag_15
jump // in
/* "<stdin>":87:150 function takeValue(uint256 a) public {... */
tag_13:
/* "<stdin>":142:144 10 */
0x0a
/* "<stdin>":138:139 a */
dup2
/* "<stdin>":138:144 a > 10 */
gt
/* "<stdin>":130:145 require(a > 10) */
tag_18
jumpi
0x00
dup1
revert
tag_18:
/* "<stdin>":87:150 function takeValue(uint256 a) public {... */
pop
jump // out
/* "<stdin>":154:208 function act() public {... */
tag_15:
/* "<stdin>":182:203 takeValue(getValue()) */
tag_20
/* "<stdin>":77:78 7 */
0x07
/* "<stdin>":192:202 getValue() */
tag_11
/* "<stdin>":19:83 function getValue() public returns (uint256) {... */
jump
/* "<stdin>":182:203 takeValue(getValue()) */
tag_20:
/* "<stdin>":154:208 function act() public {... */
jump // out
/* "#utility.yul":14:204 */
tag_12:
0x00
/* "#utility.yul":126:128 */
0x20
/* "#utility.yul":114:123 */
dup3
/* "#utility.yul":105:112 */
dup5
/* "#utility.yul":101:124 */
sub
/* "#utility.yul":97:129 */
slt
/* "#utility.yul":94:96 */
iszero
tag_24
jumpi
/* "#utility.yul":147:153 */
dup1
/* "#utility.yul":139:145 */
dup2
/* "#utility.yul":132:154 */
revert
/* "#utility.yul":94:96 */
tag_24:
pop
/* "#utility.yul":175:198 */
calldataload
swap2
/* "#utility.yul":84:204 */
swap1
pop
jump // out
auxdata: 0xa2646970667358221220746589d933c75882320d9d6edad0eaa72943c7b1f575cba1c58fa5e4443ac61364736f6c637827302e382e332d646576656c6f702e323032312e332e32322b636f6d6d69742e30636266353265300058
}
#+end_example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment