2020-08-06 19:44:50 +00:00
|
|
|
Optimized IR:
|
|
|
|
/*******************************************************
|
|
|
|
* WARNING *
|
|
|
|
* Solidity to Yul compilation is still EXPERIMENTAL *
|
|
|
|
* It can result in LOSS OF FUNDS or worse *
|
|
|
|
* !USE AT YOUR OWN RISK! *
|
|
|
|
*******************************************************/
|
|
|
|
|
2020-08-11 09:18:22 +00:00
|
|
|
object "C_59" {
|
2020-08-06 19:44:50 +00:00
|
|
|
code {
|
|
|
|
{
|
2020-10-15 14:25:15 +00:00
|
|
|
mstore(64, 128)
|
2020-08-06 19:44:50 +00:00
|
|
|
if callvalue() { revert(0, 0) }
|
2020-08-11 09:18:22 +00:00
|
|
|
let _1 := datasize("C_59_deployed")
|
|
|
|
codecopy(0, dataoffset("C_59_deployed"), _1)
|
2020-08-06 19:44:50 +00:00
|
|
|
return(0, _1)
|
|
|
|
}
|
|
|
|
}
|
2020-08-11 09:18:22 +00:00
|
|
|
object "C_59_deployed" {
|
2020-08-06 19:44:50 +00:00
|
|
|
code {
|
|
|
|
{
|
2021-01-14 18:42:07 +00:00
|
|
|
mstore(64, 128)
|
2020-08-06 19:44:50 +00:00
|
|
|
if iszero(lt(calldatasize(), 4))
|
|
|
|
{
|
2021-01-14 18:42:07 +00:00
|
|
|
let _1 := 0
|
|
|
|
if eq(0xf8eddcc6, shr(224, calldataload(_1)))
|
2020-08-06 19:44:50 +00:00
|
|
|
{
|
2021-01-14 18:42:07 +00:00
|
|
|
if callvalue() { revert(_1, _1) }
|
|
|
|
let _2 := 32
|
|
|
|
if slt(add(calldatasize(), not(3)), _2) { revert(_1, _1) }
|
2020-08-06 19:44:50 +00:00
|
|
|
let offset := calldataload(4)
|
2021-01-14 18:42:07 +00:00
|
|
|
let _3 := 0xffffffffffffffff
|
|
|
|
if gt(offset, _3) { revert(_1, _1) }
|
|
|
|
if iszero(slt(add(offset, 35), calldatasize())) { revert(_1, _1) }
|
|
|
|
let _4 := calldataload(add(4, offset))
|
|
|
|
if gt(_4, _3) { panic_error_0x41() }
|
2021-03-11 11:17:50 +00:00
|
|
|
let _5 := shl(5, _4)
|
2021-01-14 16:27:55 +00:00
|
|
|
let dst := allocate_memory(add(_5, _2))
|
2020-07-06 11:55:09 +00:00
|
|
|
let dst_1 := dst
|
2021-01-14 18:42:07 +00:00
|
|
|
mstore(dst, _4)
|
|
|
|
dst := add(dst, _2)
|
2020-07-06 11:55:09 +00:00
|
|
|
let src := add(offset, 36)
|
2021-01-14 18:42:07 +00:00
|
|
|
if gt(add(add(offset, _5), 36), calldatasize()) { revert(_1, _1) }
|
|
|
|
let i := _1
|
|
|
|
for { } lt(i, _4) { i := add(i, 1) }
|
2020-07-06 11:55:09 +00:00
|
|
|
{
|
2021-01-14 18:42:07 +00:00
|
|
|
if slt(sub(calldatasize(), src), _2) { revert(_1, _1) }
|
2020-11-26 17:52:25 +00:00
|
|
|
let value := allocate_memory_1246()
|
2021-01-14 18:42:07 +00:00
|
|
|
mstore(value, calldataload(src))
|
|
|
|
mstore(dst, value)
|
|
|
|
dst := add(dst, _2)
|
|
|
|
src := add(src, _2)
|
2020-07-06 11:55:09 +00:00
|
|
|
}
|
2021-01-25 15:57:25 +00:00
|
|
|
let ret, ret_1 := fun_sumArray(dst_1)
|
2020-11-26 17:52:25 +00:00
|
|
|
let memPos := allocate_memory_1247()
|
2021-01-25 15:57:25 +00:00
|
|
|
return(memPos, sub(abi_encode_uint256_string(memPos, ret, ret_1), memPos))
|
2020-08-06 19:44:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
revert(0, 0)
|
|
|
|
}
|
2021-01-25 15:57:25 +00:00
|
|
|
function abi_encode_uint256_string(headStart, value0, value1) -> tail
|
2020-08-06 19:44:50 +00:00
|
|
|
{
|
|
|
|
mstore(headStart, value0)
|
|
|
|
let _1 := 32
|
|
|
|
mstore(add(headStart, _1), 64)
|
|
|
|
let length := mload(value1)
|
|
|
|
mstore(add(headStart, 64), length)
|
|
|
|
let i := tail
|
|
|
|
for { } lt(i, length) { i := add(i, _1) }
|
|
|
|
{
|
|
|
|
mstore(add(add(headStart, i), 96), mload(add(add(value1, i), _1)))
|
|
|
|
}
|
|
|
|
if gt(i, length)
|
|
|
|
{
|
|
|
|
mstore(add(add(headStart, length), 96), tail)
|
|
|
|
}
|
|
|
|
tail := add(add(headStart, and(add(length, 31), not(31))), 96)
|
|
|
|
}
|
2020-11-26 17:52:25 +00:00
|
|
|
function allocate_memory_1246() -> memPtr
|
|
|
|
{
|
|
|
|
memPtr := mload(64)
|
|
|
|
let newFreePtr := add(memPtr, 32)
|
|
|
|
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
|
|
|
|
mstore(64, newFreePtr)
|
|
|
|
}
|
|
|
|
function allocate_memory_1247() -> memPtr
|
|
|
|
{
|
|
|
|
memPtr := mload(64)
|
|
|
|
if gt(memPtr, 0xffffffffffffffff) { panic_error_0x41() }
|
|
|
|
mstore(64, memPtr)
|
|
|
|
}
|
2021-01-14 16:27:55 +00:00
|
|
|
function allocate_memory(size) -> memPtr
|
2020-08-06 19:44:50 +00:00
|
|
|
{
|
|
|
|
memPtr := mload(64)
|
2021-01-14 18:42:07 +00:00
|
|
|
let newFreePtr := add(memPtr, and(add(size, 31), not(31)))
|
2020-10-13 11:28:39 +00:00
|
|
|
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
|
2020-08-06 19:44:50 +00:00
|
|
|
mstore(64, newFreePtr)
|
|
|
|
}
|
2020-12-22 22:11:53 +00:00
|
|
|
function copy_literal_to_memory_64902fd228f7ef267f3b474dd6ef84bae434cf5546eee948e7ca26df3eda1927() -> memPtr
|
2020-08-06 19:44:50 +00:00
|
|
|
{
|
2020-11-26 17:52:25 +00:00
|
|
|
let memPtr_1 := mload(64)
|
|
|
|
let newFreePtr := add(memPtr_1, 160)
|
|
|
|
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr_1)) { panic_error_0x41() }
|
|
|
|
mstore(64, newFreePtr)
|
2020-12-22 22:11:53 +00:00
|
|
|
mstore(memPtr_1, 100)
|
|
|
|
memPtr := memPtr_1
|
|
|
|
mstore(add(memPtr_1, 0x20), "longstringlongstringlongstringlo")
|
|
|
|
mstore(add(memPtr_1, 64), "ngstringlongstringlongstringlong")
|
|
|
|
mstore(add(memPtr_1, 96), "stringlongstringlongstringlongst")
|
|
|
|
mstore(add(memPtr_1, 128), "ring")
|
2020-08-06 19:44:50 +00:00
|
|
|
}
|
|
|
|
function extract_from_storage_value_dynamict_uint256(slot_value, offset) -> value
|
|
|
|
{
|
2021-03-11 11:17:50 +00:00
|
|
|
value := shr(shl(3, offset), slot_value)
|
2020-08-06 19:44:50 +00:00
|
|
|
}
|
2021-01-25 15:57:25 +00:00
|
|
|
function fun_sumArray(var_s_mpos) -> var, var_mpos
|
2020-08-06 19:44:50 +00:00
|
|
|
{
|
2021-01-25 15:57:25 +00:00
|
|
|
if iszero(lt(var_mpos, mload(var_s_mpos))) { panic_error_0x32() }
|
2021-03-11 11:17:50 +00:00
|
|
|
let _1 := mload(mload(add(add(var_s_mpos, shl(5, var_mpos)), 32)))
|
2020-11-26 17:52:25 +00:00
|
|
|
let _2, _3 := storage_array_index_access_struct_S_1254()
|
2020-10-13 11:28:39 +00:00
|
|
|
sstore(_2, _1)
|
2021-01-25 15:57:25 +00:00
|
|
|
if iszero(lt(0x01, mload(var_s_mpos))) { panic_error_0x32() }
|
|
|
|
let _4 := mload(mload(add(var_s_mpos, 64)))
|
|
|
|
if iszero(lt(var_mpos, 0x02)) { panic_error_0x32() }
|
|
|
|
let slot := add(0x02, var_mpos)
|
2020-10-13 11:28:39 +00:00
|
|
|
let _5 := sload(slot)
|
2021-03-11 11:17:50 +00:00
|
|
|
let shiftBits := shl(3, var_mpos)
|
2020-07-06 11:55:09 +00:00
|
|
|
let mask := shl(shiftBits, not(0))
|
2020-10-13 11:28:39 +00:00
|
|
|
sstore(slot, or(and(_5, not(mask)), and(shl(shiftBits, _4), mask)))
|
2020-11-26 17:52:25 +00:00
|
|
|
let _6, _7 := storage_array_index_access_struct_S()
|
2021-01-25 15:57:25 +00:00
|
|
|
var := extract_from_storage_value_dynamict_uint256(sload(_6), _7)
|
|
|
|
var_mpos := copy_literal_to_memory_64902fd228f7ef267f3b474dd6ef84bae434cf5546eee948e7ca26df3eda1927()
|
2020-08-06 19:44:50 +00:00
|
|
|
}
|
2020-10-13 11:28:39 +00:00
|
|
|
function panic_error_0x32()
|
|
|
|
{
|
|
|
|
mstore(0, shl(224, 0x4e487b71))
|
|
|
|
mstore(4, 0x32)
|
|
|
|
revert(0, 0x24)
|
|
|
|
}
|
|
|
|
function panic_error_0x41()
|
|
|
|
{
|
|
|
|
mstore(0, shl(224, 0x4e487b71))
|
|
|
|
mstore(4, 0x41)
|
|
|
|
revert(0, 0x24)
|
|
|
|
}
|
2020-11-26 17:52:25 +00:00
|
|
|
function storage_array_index_access_struct_S_1254() -> slot, offset
|
|
|
|
{
|
|
|
|
if iszero(lt(slot, 0x02)) { panic_error_0x32() }
|
|
|
|
slot := add(slot, slot)
|
|
|
|
offset := offset
|
|
|
|
}
|
|
|
|
function storage_array_index_access_struct_S() -> slot, offset
|
2020-08-06 19:44:50 +00:00
|
|
|
{
|
2020-11-26 17:52:25 +00:00
|
|
|
if iszero(lt(slot, 0x02)) { panic_error_0x32() }
|
|
|
|
slot := add(0x02, slot)
|
2020-08-06 19:44:50 +00:00
|
|
|
offset := offset
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|