// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xc0, %rsp
movb $0x0, %al
callq 0xcfc0
movq 0x19a77(%rip), %rax     # 0x1f3a0
movq %rax, -0x20(%rbp)
movq 0x19a74(%rip), %rax     # 0x1f3a8
movq %rax, -0x18(%rbp)
movq 0x19a71(%rip), %rax     # 0x1f3b0
movq %rax, -0x10(%rbp)
movl 0x19a6f(%rip), %eax     # 0x1f3b8
movl %eax, -0x8(%rbp)
leaq -0x38(%rbp), %rdi
leaq 0x156ad(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0x168a9, -0x40(%rbp)   # imm = 0x168A9
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
movl $0xff, -0x44(%rbp)
leaq -0x4c(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xd4e0
leaq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x1c, -0x60(%rbp)
movq -0x40(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x58(%rbp), %r8
leaq -0xa0(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xe270
movb $0x0, %al
callq 0xd4d0
cmpq $0x0, -0x90(%rbp)
jne 0x59fb
jmp 0x5a1a
leaq 0x1562d(%rip), %rdi     # 0x1b02f
leaq 0x15647(%rip), %rsi     # 0x1b050
movl $0x3c6, %edx            # imm = 0x3C6
leaq 0x15d6b(%rip), %rcx     # 0x1b780
callq 0x3040
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, -0x88(%rbp)
jne 0x5a2a
jmp 0x5a49
leaq 0x1563a(%rip), %rdi     # 0x1b06b
leaq 0x15618(%rip), %rsi     # 0x1b050
movl $0x3c7, %edx            # imm = 0x3C7
leaq 0x15d3c(%rip), %rcx     # 0x1b780
callq 0x3040
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, -0x80(%rbp)
jne 0x5a5b
jmp 0x5a7a
leaq 0x15633(%rip), %rdi     # 0x1b095
leaq 0x155e7(%rip), %rsi     # 0x1b050
movl $0x3c8, %edx            # imm = 0x3C8
leaq 0x15d0b(%rip), %rcx     # 0x1b780
callq 0x3040
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, -0x78(%rbp)
jne 0x5a8c
jmp 0x5aab
leaq 0x15634(%rip), %rdi     # 0x1b0c7
leaq 0x155b6(%rip), %rsi     # 0x1b050
movl $0x3c9, %edx            # imm = 0x3C9
leaq 0x15cda(%rip), %rcx     # 0x1b780
callq 0x3040
cmpq $0xa0, -0xa0(%rbp)
jne 0x5aba
jmp 0x5ad9
leaq 0x15cd6(%rip), %rdi     # 0x1b797
leaq 0x15588(%rip), %rsi     # 0x1b050
movl $0x3ca, %edx            # imm = 0x3CA
leaq 0x15cac(%rip), %rcx     # 0x1b780
callq 0x3040
movq -0x98(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movl $0x1c, %edx
callq 0x3090
cmpl $0x0, %eax
jne 0x5af5
jmp 0x5b14
leaq 0x15cb9(%rip), %rdi     # 0x1b7b5
leaq 0x1554d(%rip), %rsi     # 0x1b050
movl $0x3cb, %edx            # imm = 0x3CB
leaq 0x15c71(%rip), %rcx     # 0x1b780
callq 0x3040
movl $0x1c, -0xa4(%rbp)
cmpl $0x3f, -0xa4(%rbp)
jge 0x5b72
movq -0x98(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x5b40
jmp 0x5b5f
leaq 0x156e6(%rip), %rdi     # 0x1b22d
leaq 0x15502(%rip), %rsi     # 0x1b050
movl $0x3cd, %edx            # imm = 0x3CD
leaq 0x15c26(%rip), %rcx     # 0x1b780
callq 0x3040
jmp 0x5b61
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x5b1e
movq -0x98(%rbp), %rax
movzbl 0x3f(%rax), %eax
cmpl $0xff, %eax
jne 0x5b86
jmp 0x5ba5
leaq 0x15c5c(%rip), %rdi     # 0x1b7e9
leaq 0x154bc(%rip), %rsi     # 0x1b050
movl $0x3cf, %edx            # imm = 0x3CF
leaq 0x15be0(%rip), %rcx     # 0x1b780
callq 0x3040
movl $0x40, -0xa8(%rbp)
cmpl $0xa0, -0xa8(%rbp)
jge 0x5c06
movq -0x98(%rbp), %rax
movslq -0xa8(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x5bd4
jmp 0x5bf3
leaq 0x15652(%rip), %rdi     # 0x1b22d
leaq 0x1546e(%rip), %rsi     # 0x1b050
movl $0x3d1, %edx            # imm = 0x3D1
leaq 0x15b92(%rip), %rcx     # 0x1b780
callq 0x3040
jmp 0x5bf5
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x5baf
cmpq $0x0, -0x70(%rbp)
jne 0x5c0f
jmp 0x5c2e
leaq 0x154ff(%rip), %rdi     # 0x1b115
leaq 0x15433(%rip), %rsi     # 0x1b050
movl $0x3d3, %edx            # imm = 0x3D3
leaq 0x15b57(%rip), %rcx     # 0x1b780
callq 0x3040
addq $0xc0, %rsp
popq %rbp
retq
nopw (%rax,%rax)