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

    // 385f5f394759525959595f34335af16015573d5ffd5b475952595ff3
    op_t program[] = {
        CODESIZE, PUSH0, PUSH0, CODECOPY,
        SELFBALANCE, MSIZE, MSTORE,
        MSIZE, MSIZE, MSIZE, PUSH0, CALLVALUE, CALLER, GAS, CALL,
        PUSH1, 0x15, JUMPI,
        RETURNDATASIZE, PUSH0, REVERT,
        JUMPDEST,
        SELFBALANCE, MSIZE, MSTORE,
        MSIZE, PUSH0, RETURN,
    };
    address_t from = AddressFromHex42("0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1");
    uint64_t gas = 92329;
    val_t value;
    value[0] = 0;
    value[1] = 0;
    value[2] = 0xff;

    evmMockBalance(from, value);

    data_t input;
    input.content = program;
    input.size = sizeof(program);

    result_t result = txCreate(from, gas, value, input);
    evmFinalize();
    assert(UPPER(UPPER(result.status)) == 0);
    assert(LOWER(UPPER(result.status)) == 0x80d9b122);
    assert(UPPER(LOWER(result.status)) == 0xdc3a16fdc41f96cf);
    assert(LOWER(LOWER(result.status)) == 0x010ffe7e38d227c3);
    assert(result.returnData.size == 160);
    assert(memcmp(result.returnData.content, program, 28) == 0);
    for (int i = 28; i < 63; i++) {
        assert(result.returnData.content[i] == 0x00);
    }
    assert(result.returnData.content[63] == 0xff);
    for (int i = 64; i < 160; i++) {
        assert(result.returnData.content[i] == 0x00);
    }
    assert(result.gasRemaining == 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
xorl %eax, %eax
callq 0xca7b
movups 0x11ddd(%rip), %xmm0    # 0x183ec
movups %xmm0, 0x3c(%rsp)
movaps 0x11dc5(%rip), %xmm0    # 0x183e0
movaps %xmm0, 0x30(%rsp)
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xda1d(%rip), %r12      # 0x14050
movq 0x179be(%rip), %r13     # 0x1dff8
leaq 0x10a7c(%rip), %rbx     # 0x170bd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x6668
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x665c
addb $-0x57, %cl
jmp 0x6666
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x66a6
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x668d
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x6681
addb $-0x57, %cl
jmp 0x668b
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x66bb
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x6641
jmp 0x66cf
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x6668
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x668d
leaq 0x9c(%rsp), %rbx
movq $0x0, (%rbx)
movl $0xff, 0x8(%rbx)
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0xcf2a
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %r14
leaq 0x30(%rsp), %r8
movl $0x168a9, %esi          # imm = 0x168A9
movl $0x1c, %ecx
movq %r14, %rdi
movq %rbx, %rdx
callq 0xd845
xorl %eax, %eax
callq 0xcf29
cmpq $0x0, 0x10(%r14)
jne 0x684d
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x70(%rsp)
jne 0x686c
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x78(%rsp)
jne 0x688b
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x80(%rsp)
jne 0x68aa
cmpq $0xa0, 0x58(%rsp)
jne 0x68c9
movq 0x60(%rsp), %rax
movdqu (%rax), %xmm0
movdqu 0xc(%rax), %xmm1
movdqu 0x3c(%rsp), %xmm2
pcmpeqb 0x30(%rsp), %xmm0
pcmpeqb %xmm1, %xmm2
pand %xmm2, %xmm0
pmovmskb %xmm0, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
jne 0x68e8
movl $0x1c, %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x680f
incq %rcx
cmpq $0x3f, %rcx
jne 0x67c3
cmpb $-0x1, 0x3f(%rax)
jne 0x6907
xorl %ecx, %ecx
cmpb $0x0, 0x40(%rax,%rcx)
jne 0x682e
incq %rcx
cmpq $0x60, %rcx
jne 0x67de
cmpq $0x0, 0x88(%rsp)
jne 0x6926
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xda63(%rip), %rdi      # 0x14279
leaq 0xd87f(%rip), %rsi      # 0x1409c
leaq 0xdfa8(%rip), %rcx      # 0x147cc
movl $0x3cd, %edx            # imm = 0x3CD
callq 0x3040
leaq 0xda44(%rip), %rdi      # 0x14279
leaq 0xd860(%rip), %rsi      # 0x1409c
leaq 0xdf89(%rip), %rcx      # 0x147cc
movl $0x3d1, %edx            # imm = 0x3D1
callq 0x3040
leaq 0xd827(%rip), %rdi      # 0x1407b
leaq 0xd841(%rip), %rsi      # 0x1409c
leaq 0xdf6a(%rip), %rcx      # 0x147cc
movl $0x3c6, %edx            # imm = 0x3C6
callq 0x3040
leaq 0xd844(%rip), %rdi      # 0x140b7
leaq 0xd822(%rip), %rsi      # 0x1409c
leaq 0xdf4b(%rip), %rcx      # 0x147cc
movl $0x3c7, %edx            # imm = 0x3C7
callq 0x3040
leaq 0xd84f(%rip), %rdi      # 0x140e1
leaq 0xd803(%rip), %rsi      # 0x1409c
leaq 0xdf2c(%rip), %rcx      # 0x147cc
movl $0x3c8, %edx            # imm = 0x3C8
callq 0x3040
leaq 0xd862(%rip), %rdi      # 0x14113
leaq 0xd7e4(%rip), %rsi      # 0x1409c
leaq 0xdf0d(%rip), %rcx      # 0x147cc
movl $0x3c9, %edx            # imm = 0x3C9
callq 0x3040
leaq 0xdf13(%rip), %rdi      # 0x147e3
leaq 0xd7c5(%rip), %rsi      # 0x1409c
leaq 0xdeee(%rip), %rcx      # 0x147cc
movl $0x3ca, %edx            # imm = 0x3CA
callq 0x3040
leaq 0xdf12(%rip), %rdi      # 0x14801
leaq 0xd7a6(%rip), %rsi      # 0x1409c
leaq 0xdecf(%rip), %rcx      # 0x147cc
movl $0x3cb, %edx            # imm = 0x3CB
callq 0x3040
leaq 0xdf27(%rip), %rdi      # 0x14835
leaq 0xd787(%rip), %rsi      # 0x1409c
leaq 0xdeb0(%rip), %rcx      # 0x147cc
movl $0x3cf, %edx            # imm = 0x3CF
callq 0x3040
leaq 0xd834(%rip), %rdi      # 0x14161
leaq 0xd768(%rip), %rsi      # 0x1409c
leaq 0xde91(%rip), %rcx      # 0x147cc
movl $0x3d3, %edx            # imm = 0x3D3
callq 0x3040