solidity/test/cmdlineTests/optimizer_array_sload/output
2021-01-20 18:25:27 +01:00

80 lines
2.8 KiB
Plaintext

Optimized IR:
/*******************************************************
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "Arraysum_34" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("Arraysum_34_deployed")
codecopy(0, dataoffset("Arraysum_34_deployed"), _1)
return(0, _1)
}
}
object "Arraysum_34_deployed" {
code {
{
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x81d73423, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
let vloc_sum := _1
let vloc_i := _1
let _2 := sload(_1)
for { }
lt(vloc_i, _2)
{
if eq(vloc_i, not(0)) { panic_error_0x11() }
vloc_i := add(vloc_i, 1)
}
{
mstore(_1, _1)
vloc_sum := checked_add_t_uint256(vloc_sum, sload(add(keccak256(_1, 0x20), vloc_i)))
}
let memPos := allocate_memory(_1)
return(memPos, sub(abi_encode_uint(memPos, vloc_sum), memPos))
}
}
revert(0, 0)
}
function abi_encode_uint(headStart, value0) -> tail
{
tail := add(headStart, 32)
mstore(headStart, value0)
}
function allocate_memory(size) -> memPtr
{
memPtr := mload(64)
let newFreePtr := add(memPtr, and(add(size, 31), not(31)))
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr))
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 0x41)
revert(0, 0x24)
}
mstore(64, newFreePtr)
}
function checked_add_t_uint256(x, y) -> sum
{
if gt(x, not(y)) { panic_error_0x11() }
sum := add(x, y)
}
function panic_error_0x11()
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 0x11)
revert(0, 0x24)
}
}
}
}