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

    // 30315952475952595ff3
    op_t program[] = {
        ADDRESS, BALANCE, MSIZE, MSTORE,
        SELFBALANCE, MSIZE, MSTORE,
        MSIZE, PUSH0, RETURN,
    };
    address_t from = AddressFromHex42("0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1");
    uint64_t gas = 66089;
    val_t value;
    value[0] = 0xdd;
    value[1] = 0xee;
    value[2] = 0xff;
    data_t input;
    input.content = program;
    input.size = sizeof(program);


    evmMockBalance(from, value);
    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 == 64);
    for (int i = 0; i < 63; i++) {
        if (i % 32 == 31) {
            assert(result.returnData.content[i] == 0xff);
        } else if (i % 32 == 27) {
            assert(result.returnData.content[i] == 0xee);
        } else if (i % 32 == 23) {
            assert(result.returnData.content[i] == 0xdd);
        } else {
            assert(result.returnData.content[i] == 0x00);
        }
    }
    assert(result.gasRemaining == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movb $0x0, %al
callq 0xcfc0
movq 0x19f51(%rip), %rax     # 0x1f35a
movq %rax, -0xa(%rbp)
movw 0x19f4e(%rip), %ax      # 0x1f362
movw %ax, -0x2(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x15be1(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0x10229, -0x28(%rbp)   # imm = 0x10229
movl $0xdd, -0x34(%rbp)
movl $0xee, -0x30(%rbp)
movl $0xff, -0x2c(%rbp)
leaq -0xa(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0xa, -0x48(%rbp)
leaq -0x34(%rbp), %rdi
leaq -0x20(%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
movq -0x28(%rbp), %rsi
leaq -0x34(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %r8
leaq -0x88(%rbp), %rdi
leaq -0x20(%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, -0x78(%rbp)
jne 0x54c4
jmp 0x54e3
leaq 0x15b64(%rip), %rdi     # 0x1b02f
leaq 0x15b7e(%rip), %rsi     # 0x1b050
movl $0x376, %edx            # imm = 0x376
leaq 0x16209(%rip), %rcx     # 0x1b6e7
callq 0x3040
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, -0x70(%rbp)
jne 0x54f0
jmp 0x550f
leaq 0x15b74(%rip), %rdi     # 0x1b06b
leaq 0x15b52(%rip), %rsi     # 0x1b050
movl $0x377, %edx            # imm = 0x377
leaq 0x161dd(%rip), %rcx     # 0x1b6e7
callq 0x3040
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, -0x68(%rbp)
jne 0x5521
jmp 0x5540
leaq 0x15b6d(%rip), %rdi     # 0x1b095
leaq 0x15b21(%rip), %rsi     # 0x1b050
movl $0x378, %edx            # imm = 0x378
leaq 0x161ac(%rip), %rcx     # 0x1b6e7
callq 0x3040
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, -0x60(%rbp)
jne 0x5552
jmp 0x5571
leaq 0x15b6e(%rip), %rdi     # 0x1b0c7
leaq 0x15af0(%rip), %rsi     # 0x1b050
movl $0x379, %edx            # imm = 0x379
leaq 0x1617b(%rip), %rcx     # 0x1b6e7
callq 0x3040
cmpq $0x40, -0x88(%rbp)
jne 0x557d
jmp 0x559c
leaq 0x15e37(%rip), %rdi     # 0x1b3bb
leaq 0x15ac5(%rip), %rsi     # 0x1b050
movl $0x37a, %edx            # imm = 0x37A
leaq 0x16150(%rip), %rcx     # 0x1b6e7
callq 0x3040
movl $0x0, -0x8c(%rbp)
cmpl $0x3f, -0x8c(%rbp)
jge 0x56ee
movl -0x8c(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
cmpl $0x1f, %edx
jne 0x5602
movq -0x80(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xff, %eax
jne 0x55de
jmp 0x55fd
leaq 0x15bfd(%rip), %rdi     # 0x1b1e2
leaq 0x15a64(%rip), %rsi     # 0x1b050
movl $0x37d, %edx            # imm = 0x37D
leaq 0x160ef(%rip), %rcx     # 0x1b6e7
callq 0x3040
jmp 0x56d8
movl -0x8c(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
cmpl $0x1b, %edx
jne 0x5651
movq -0x80(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xee, %eax
jne 0x562d
jmp 0x564c
leaq 0x160cb(%rip), %rdi     # 0x1b6ff
leaq 0x15a15(%rip), %rsi     # 0x1b050
movl $0x37f, %edx            # imm = 0x37F
leaq 0x160a0(%rip), %rcx     # 0x1b6e7
callq 0x3040
jmp 0x56d6
movl -0x8c(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
cmpl $0x17, %edx
jne 0x569d
movq -0x80(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xdd, %eax
jne 0x567c
jmp 0x569b
leaq 0x160a1(%rip), %rdi     # 0x1b724
leaq 0x159c6(%rip), %rsi     # 0x1b050
movl $0x381, %edx            # imm = 0x381
leaq 0x16051(%rip), %rcx     # 0x1b6e7
callq 0x3040
jmp 0x56d4
movq -0x80(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x56b3
jmp 0x56d2
leaq 0x15b73(%rip), %rdi     # 0x1b22d
leaq 0x1598f(%rip), %rsi     # 0x1b050
movl $0x383, %edx            # imm = 0x383
leaq 0x1601a(%rip), %rcx     # 0x1b6e7
callq 0x3040
jmp 0x56d4
jmp 0x56d6
jmp 0x56d8
jmp 0x56da
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x55a6
cmpq $0x0, -0x58(%rbp)
jne 0x56f7
jmp 0x5716
leaq 0x15a17(%rip), %rdi     # 0x1b115
leaq 0x1594b(%rip), %rsi     # 0x1b050
movl $0x386, %edx            # imm = 0x386
leaq 0x15fd6(%rip), %rcx     # 0x1b6e7
callq 0x3040
addq $0xb0, %rsp
popq %rbp
retq
nop