// File: /workspace/github_c_makefile_star2_O1/wjmelements[P]evm/tst/evm.c
// Function: test_revertSload
void test_revertSload() {
    evmInit();

    address_t from = AddressFromHex42("0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1");
    uint64_t gas = 62464;
    val_t value;
    value[0] = 0;
    value[1] = 0;
    value[2] = 0;

#define PROGRAM_REVERTSLOAD \
        CALLER, ADDRESS, XOR, PUSH1, 13, JUMPI, \
        PUSH0, SLOAD, MSIZE, MSTORE, \
        MSIZE, PUSH0, REVERT, \
        JUMPDEST, \
        PUSH1, 32, MSIZE, PUSH0, PUSH0, PUSH0, ADDRESS, GAS, CALL, MSIZE, MSTORE, \
        PUSH1, 32, MSIZE, PUSH0, PUSH0, PUSH0, ADDRESS, GAS, CALL, MSIZE, MSTORE, \
        PUSH0, SLOAD, MSIZE, MSTORE, \
        MSIZE, PUSH0, RETURN
    // 333018600d575f545952595ffd5b6020595f5f5f305af159526020595f5f5f305af159525f545952595ff3
    op_t revertTest[] = {
        PROGRAM_REVERTSLOAD
    };
    // 602b8060093d393df3333018600d575f545952595ffd5b6020595f5f5f305af159526020595f5f5f305af159525f545952595ff3
    op_t createRevertTest[] = {
        PUSH1, 43, DUP1, PUSH1, 0x09, RETURNDATASIZE, CODECOPY, RETURNDATASIZE, RETURN,
        PROGRAM_REVERTSLOAD
    };
#undef PROGRAM_REVERTSLOAD
    data_t input;
    input.content = createRevertTest;
    input.size = sizeof(createRevertTest);
    result_t createResult = txCreate(from, gas, value, input);
    assert(UPPER(UPPER(createResult.status)) == 0);
    assert(LOWER(UPPER(createResult.status)) == 0x80d9b122);
    assert(UPPER(LOWER(createResult.status)) == 0xdc3a16fdc41f96cf);
    assert(LOWER(LOWER(createResult.status)) == 0x010ffe7e38d227c3);
    assert(createResult.returnData.size == sizeof(revertTest));
    assert(memcmp(createResult.returnData.content, revertTest, sizeof(revertTest)) == 0);
    assert(createResult.gasRemaining == 0);

    input.size = 0;

    gas = 27655;
    address_t to = AddressFromUint256(&createResult.status);

    result_t sloadRevertResult = txCall(from, gas, to, value, input, NULL);
    assert(UPPER(UPPER(sloadRevertResult.status)) == 0);
    assert(LOWER(UPPER(sloadRevertResult.status)) == 0);
    assert(UPPER(LOWER(sloadRevertResult.status)) == 0);
    assert(LOWER(LOWER(sloadRevertResult.status)) == 1);
    assert(sloadRevertResult.returnData.size == 160);
    for (int i = 0; i < 160; i++) {
        assert(sloadRevertResult.returnData.content[i] == 0);
    }
    assert(sloadRevertResult.gasRemaining == 0);

    evmFinalize();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
xorl %eax, %eax
callq 0xca7b
movq $-0x2, %r14
leaq 0x50(%rsp), %r15
leaq 0xbbc7(%rip), %r12      # 0x14050
movq 0x15b68(%rip), %r13     # 0x1dff8
leaq 0xec26(%rip), %rbx      # 0x170bd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x84be
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x84b2
addb $-0x57, %cl
jmp 0x84bc
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x84fc
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x84e3
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x84d7
addb $-0x57, %cl
jmp 0x84e1
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x8511
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x8497
jmp 0x8525
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x84be
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x84e3
leaq 0x64(%rsp), %rdx
movq $0x0, (%rdx)
movl $0x0, 0x8(%rdx)
movaps 0x100a1(%rip), %xmm0    # 0x185e0
leaq 0xf0(%rsp), %r8
movaps %xmm0, 0x20(%r8)
movaps 0x1007d(%rip), %xmm0    # 0x185d0
movaps %xmm0, 0x10(%r8)
movaps 0x10061(%rip), %xmm0    # 0x185c0
movaps %xmm0, (%r8)
movl $0xf35f5952, 0x30(%r8)  # imm = 0xF35F5952
movl 0x60(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x70(%rsp), %rbx
movl $0xf400, %esi           # imm = 0xF400
movl $0x34, %ecx
movq %rbx, %rdi
callq 0xd845
cmpq $0x0, 0x10(%rbx)
jne 0x873e
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x88(%rsp)
jne 0x875d
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x90(%rsp)
jne 0x877c
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x98(%rsp)
jne 0x879b
cmpq $0x2b, 0x70(%rsp)
jne 0x87ba
movq 0x78(%rsp), %rdi
leaq 0xff97(%rip), %rsi      # 0x18590
movl $0x2b, %edx
callq 0x30d0
testl %eax, %eax
jne 0x87d9
cmpq $0x0, 0xa0(%rsp)
jne 0x87f8
movl 0x88(%rsp), %eax
bswapl %eax
movl %eax, 0x38(%rsp)
movq 0x90(%rsp), %rax
bswapq %rax
movq %rax, 0x3c(%rsp)
movq 0x98(%rsp), %rax
bswapq %rax
movq %rax, 0x44(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x28(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movl 0x60(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xb0(%rsp), %rbx
leaq 0x64(%rsp), %rdx
leaq 0xf0(%rsp), %r8
movl $0x6c07, %esi           # imm = 0x6C07
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0xd30c
cmpq $0x0, 0x10(%rbx)
jne 0x8817
cmpq $0x0, 0xc8(%rsp)
jne 0x8836
cmpq $0x0, 0xd0(%rsp)
jne 0x8855
cmpq $0x1, 0xd8(%rsp)
jne 0x8874
cmpq $0xa0, 0xb0(%rsp)
jne 0x8893
movq 0xb8(%rsp), %rax
xorl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x871f
incq %rcx
cmpq $0xa0, %rcx
jne 0x86e5
cmpq $0x0, 0xe0(%rsp)
jne 0x88b2
xorl %eax, %eax
callq 0xcf29
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xce6b(%rip), %rdi      # 0x15591
leaq 0xb96f(%rip), %rsi      # 0x1409c
leaq 0xcd6c(%rip), %rcx      # 0x154a0
movl $0x556, %edx            # imm = 0x556
callq 0x3040
leaq 0xc1de(%rip), %rdi      # 0x14923
leaq 0xb950(%rip), %rsi      # 0x1409c
leaq 0xcd4d(%rip), %rcx      # 0x154a0
movl $0x542, %edx            # imm = 0x542
callq 0x3040
leaq 0xc1fe(%rip), %rdi      # 0x14962
leaq 0xb931(%rip), %rsi      # 0x1409c
leaq 0xcd2e(%rip), %rcx      # 0x154a0
movl $0x543, %edx            # imm = 0x543
callq 0x3040
leaq 0xc20f(%rip), %rdi      # 0x14992
leaq 0xb912(%rip), %rsi      # 0x1409c
leaq 0xcd0f(%rip), %rcx      # 0x154a0
movl $0x544, %edx            # imm = 0x544
callq 0x3040
leaq 0xc228(%rip), %rdi      # 0x149ca
leaq 0xb8f3(%rip), %rsi      # 0x1409c
leaq 0xccf0(%rip), %rcx      # 0x154a0
movl $0x545, %edx            # imm = 0x545
callq 0x3040
leaq 0xca14(%rip), %rdi      # 0x151d5
leaq 0xb8d4(%rip), %rsi      # 0x1409c
leaq 0xccd1(%rip), %rcx      # 0x154a0
movl $0x546, %edx            # imm = 0x546
callq 0x3040
leaq 0xca28(%rip), %rdi      # 0x15208
leaq 0xb8b5(%rip), %rsi      # 0x1409c
leaq 0xccb2(%rip), %rcx      # 0x154a0
movl $0x547, %edx            # imm = 0x547
callq 0x3040
leaq 0xc271(%rip), %rdi      # 0x14a70
leaq 0xb896(%rip), %rsi      # 0x1409c
leaq 0xcc93(%rip), %rcx      # 0x154a0
movl $0x548, %edx            # imm = 0x548
callq 0x3040
leaq 0xcc9a(%rip), %rdi      # 0x154b8
leaq 0xb877(%rip), %rsi      # 0x1409c
leaq 0xcc74(%rip), %rcx      # 0x154a0
movl $0x550, %edx            # imm = 0x550
callq 0x3040
leaq 0xcca7(%rip), %rdi      # 0x154e4
leaq 0xb858(%rip), %rsi      # 0x1409c
leaq 0xcc55(%rip), %rcx      # 0x154a0
movl $0x551, %edx            # imm = 0x551
callq 0x3040
leaq 0xccb4(%rip), %rdi      # 0x15510
leaq 0xb839(%rip), %rsi      # 0x1409c
leaq 0xcc36(%rip), %rcx      # 0x154a0
movl $0x552, %edx            # imm = 0x552
callq 0x3040
leaq 0xccc1(%rip), %rdi      # 0x1553c
leaq 0xb81a(%rip), %rsi      # 0x1409c
leaq 0xcc17(%rip), %rcx      # 0x154a0
movl $0x553, %edx            # imm = 0x553
callq 0x3040
leaq 0xccce(%rip), %rdi      # 0x15568
leaq 0xb7fb(%rip), %rsi      # 0x1409c
leaq 0xcbf8(%rip), %rcx      # 0x154a0
movl $0x554, %edx            # imm = 0x554
callq 0x3040
leaq 0xcd05(%rip), %rdi      # 0x155be
leaq 0xb7dc(%rip), %rsi      # 0x1409c
leaq 0xcbd9(%rip), %rcx      # 0x154a0
movl $0x558, %edx            # imm = 0x558
callq 0x3040