Skip to content

Instantly share code, notes, and snippets.

@chriseth
Created April 17, 2019 14:27
Show Gist options
  • Save chriseth/ac6378e73f2efe89967f192ad8481496 to your computer and use it in GitHub Desktop.
Save chriseth/ac6378e73f2efe89967f192ad8481496 to your computer and use it in GitHub Desktop.
Sol to Yul compiler
contract C {
function f() public pure returns (uint x) { x = 7; }
}
object "C_11" {
code {
{
mstore(64, 128)
let _1 := datasize("C_11_deployed")
codecopy(0, dataoffset("C_11_deployed"), _1)
return(0, _1)
}
}
object "C_11_deployed" {
code {
{
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue()
{
revert(_1, _1)
}
if slt(add(calldatasize(), 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc), _1)
{
revert(_1, _1)
}
let memPtr := mload(64)
if gt(memPtr, 0xffffffffffffffff)
{
revert(_1, _1)
}
mstore(64, memPtr)
mstore(memPtr, 0x7)
return(memPtr, 32)
}
}
revert(0, 0)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment