2020-07-03 14:20:27 +00:00
|
|
|
Optimized IR:
|
2021-08-31 10:57:13 +00:00
|
|
|
/// @use-src 0:"optimizer_array_sload/input.sol"
|
2020-11-26 21:33:36 +00:00
|
|
|
object "Arraysum_34" {
|
2020-07-03 14:20:27 +00:00
|
|
|
code {
|
|
|
|
{
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:80:429 "contract Arraysum {..."
|
2021-09-15 15:01:40 +00:00
|
|
|
let _1 := memoryguard(0x80)
|
|
|
|
mstore(64, _1)
|
2020-07-03 14:20:27 +00:00
|
|
|
if callvalue() { revert(0, 0) }
|
2021-09-15 15:01:40 +00:00
|
|
|
let _2 := datasize("Arraysum_34_deployed")
|
|
|
|
codecopy(_1, dataoffset("Arraysum_34_deployed"), _2)
|
|
|
|
return(_1, _2)
|
2020-07-03 14:20:27 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-31 10:57:13 +00:00
|
|
|
/// @use-src 0:"optimizer_array_sload/input.sol"
|
2020-11-26 21:33:36 +00:00
|
|
|
object "Arraysum_34_deployed" {
|
2020-07-03 14:20:27 +00:00
|
|
|
code {
|
|
|
|
{
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:80:429 "contract Arraysum {..."
|
2021-09-15 15:01:40 +00:00
|
|
|
mstore(64, memoryguard(0x80))
|
2022-05-23 10:54:18 +00:00
|
|
|
let _1 := 4
|
|
|
|
if iszero(lt(calldatasize(), _1))
|
2020-07-03 14:20:27 +00:00
|
|
|
{
|
2022-05-23 10:54:18 +00:00
|
|
|
let _2 := 0
|
|
|
|
if eq(0x81d73423, shr(224, calldataload(_2)))
|
2020-07-03 14:20:27 +00:00
|
|
|
{
|
2022-05-23 10:54:18 +00:00
|
|
|
if callvalue() { revert(_2, _2) }
|
|
|
|
if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) }
|
|
|
|
let var_sum := _2
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:368:378 "uint i = 0"
|
2022-05-23 10:54:18 +00:00
|
|
|
let var_i := /** @src 0:80:429 "contract Arraysum {..." */ _2
|
|
|
|
let _3 := sload(_2)
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:364:423 "for(uint i = 0; i < values.length; i++)..."
|
2020-07-03 14:20:27 +00:00
|
|
|
for { }
|
2022-05-23 10:54:18 +00:00
|
|
|
/** @src 0:380:397 "i < values.length" */ lt(var_i, _3)
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:368:378 "uint i = 0"
|
2020-07-03 14:20:27 +00:00
|
|
|
{
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:80:429 "contract Arraysum {..."
|
2022-05-23 10:54:18 +00:00
|
|
|
if eq(var_i, not(0))
|
|
|
|
{
|
|
|
|
mstore(_2, shl(224, 0x4e487b71))
|
|
|
|
mstore(_1, 0x11)
|
|
|
|
revert(_2, 0x24)
|
|
|
|
}
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:399:402 "i++"
|
|
|
|
var_i := /** @src 0:80:429 "contract Arraysum {..." */ add(var_i, 1)
|
2020-07-03 14:20:27 +00:00
|
|
|
}
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:399:402 "i++"
|
2020-07-03 14:20:27 +00:00
|
|
|
{
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:80:429 "contract Arraysum {..."
|
2022-05-23 10:54:18 +00:00
|
|
|
mstore(_2, _2)
|
|
|
|
let _4 := sload(add(18569430475105882587588266137607568536673111973893317399460219858819262702947, var_i))
|
|
|
|
if gt(var_sum, not(_4))
|
|
|
|
{
|
|
|
|
mstore(_2, shl(224, 0x4e487b71))
|
|
|
|
mstore(_1, 0x11)
|
|
|
|
revert(_2, 0x24)
|
|
|
|
}
|
2021-08-31 13:10:40 +00:00
|
|
|
/// @src 0:407:423 "sum += values[i]"
|
2022-05-23 10:54:18 +00:00
|
|
|
var_sum := /** @src 0:80:429 "contract Arraysum {..." */ add(var_sum, _4)
|
2020-07-03 14:20:27 +00:00
|
|
|
}
|
2021-04-08 12:57:18 +00:00
|
|
|
let memPos := mload(64)
|
2022-05-23 10:54:18 +00:00
|
|
|
mstore(memPos, var_sum)
|
|
|
|
return(memPos, 32)
|
2020-07-03 14:20:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
revert(0, 0)
|
|
|
|
}
|
|
|
|
}
|
2021-06-08 14:35:37 +00:00
|
|
|
data ".metadata" hex"<BYTECODE REMOVED>"
|
2020-07-03 14:20:27 +00:00
|
|
|
}
|
|
|
|
}
|