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_33" { code { { mstore(64, memoryguard(0x80)) if callvalue() { revert(0, 0) } let _1 := datasize("Arraysum_33_deployed") codecopy(0, dataoffset("Arraysum_33_deployed"), _1) return(0, _1) } } object "Arraysum_33_deployed" { code { { mstore(64, memoryguard(0x80)) 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 gt(vloc_i, not(1)) { invalid() } vloc_i := add(vloc_i, 1) } { mstore(_1, _1) let _3 := sload(add(keccak256(_1, 0x20), vloc_i)) if gt(vloc_sum, not(_3)) { invalid() } vloc_sum := add(vloc_sum, _3) } let memPos := allocateMemory(_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 allocateMemory(size) -> memPtr { memPtr := mload(64) let newFreePtr := add(memPtr, size) if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() } mstore(64, newFreePtr) } } } }