// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
xorl %eax, %eax
callq 0xca4d
movabsq $0x5952594752593130, %rax # imm = 0x5952594752593130
movq %rax, 0x20(%rsp)
movw $0xf35f, 0x28(%rsp)     # imm = 0xF35F
movq $-0x2, %r14
leaq 0x30(%rsp), %r15
leaq 0xdf88(%rip), %r12      # 0x14070
movq 0x17f09(%rip), %r13     # 0x1dff8
leaq 0x10fe7(%rip), %rbx     # 0x170dd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x611d
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x6111
addb $-0x57, %cl
jmp 0x611b
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x615b
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x6142
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x6136
addb $-0x57, %cl
jmp 0x6140
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x6170
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x60f6
jmp 0x6184
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x611d
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x6142
movabsq $0xee000000dd, %rax     # imm = 0xEE000000DD
leaq 0x8c(%rsp), %rbx
movq %rax, (%rbx)
movl $0xff, 0x8(%rbx)
movl 0x40(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0xcd4a
movl 0x40(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x48(%rsp), %r14
leaq 0x20(%rsp), %r8
movl $0x10229, %esi          # imm = 0x10229
movl $0xa, %ecx
movq %r14, %rdi
movq %rbx, %rdx
callq 0xd683
xorl %eax, %eax
callq 0xcd49
cmpq $0x0, 0x10(%r14)
jne 0x631e
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x60(%rsp)
jne 0x633d
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x68(%rsp)
jne 0x635c
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x70(%rsp)
jne 0x637b
cmpq $0x40, 0x48(%rsp)
jne 0x639a
movq 0x50(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %esi
andl $0x1f, %esi
movb (%rax,%rcx), %dl
cmpl $0x17, %esi
je 0x626d
cmpl $0x1b, %esi
je 0x6266
cmpl $0x1f, %esi
jne 0x6277
cmpb $-0x1, %dl
je 0x627b
jmp 0x62c1
cmpb $-0x12, %dl
je 0x627b
jmp 0x62e0
cmpb $-0x23, %dl
je 0x627b
jmp 0x62ff
testb %dl, %dl
jne 0x62a2
incq %rcx
cmpq $0x3f, %rcx
jne 0x6248
cmpq $0x0, 0x78(%rsp)
jne 0x63b9
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdff0(%rip), %rdi      # 0x14299
leaq 0xde0c(%rip), %rsi      # 0x140bc
leaq 0xe49c(%rip), %rcx      # 0x14753
movl $0x383, %edx            # imm = 0x383
callq 0x3040
leaq 0xdf86(%rip), %rdi      # 0x1424e
leaq 0xdded(%rip), %rsi      # 0x140bc
leaq 0xe47d(%rip), %rcx      # 0x14753
movl $0x37d, %edx            # imm = 0x37D
callq 0x3040
leaq 0xe484(%rip), %rdi      # 0x1476b
leaq 0xddce(%rip), %rsi      # 0x140bc
leaq 0xe45e(%rip), %rcx      # 0x14753
movl $0x37f, %edx            # imm = 0x37F
callq 0x3040
leaq 0xe48a(%rip), %rdi      # 0x14790
leaq 0xddaf(%rip), %rsi      # 0x140bc
leaq 0xe43f(%rip), %rcx      # 0x14753
movl $0x381, %edx            # imm = 0x381
callq 0x3040
leaq 0xdd76(%rip), %rdi      # 0x1409b
leaq 0xdd90(%rip), %rsi      # 0x140bc
leaq 0xe420(%rip), %rcx      # 0x14753
movl $0x376, %edx            # imm = 0x376
callq 0x3040
leaq 0xdd93(%rip), %rdi      # 0x140d7
leaq 0xdd71(%rip), %rsi      # 0x140bc
leaq 0xe401(%rip), %rcx      # 0x14753
movl $0x377, %edx            # imm = 0x377
callq 0x3040
leaq 0xdd9e(%rip), %rdi      # 0x14101
leaq 0xdd52(%rip), %rsi      # 0x140bc
leaq 0xe3e2(%rip), %rcx      # 0x14753
movl $0x378, %edx            # imm = 0x378
callq 0x3040
leaq 0xddb1(%rip), %rdi      # 0x14133
leaq 0xdd33(%rip), %rsi      # 0x140bc
leaq 0xe3c3(%rip), %rcx      # 0x14753
movl $0x379, %edx            # imm = 0x379
callq 0x3040
leaq 0xe086(%rip), %rdi      # 0x14427
leaq 0xdd14(%rip), %rsi      # 0x140bc
leaq 0xe3a4(%rip), %rcx      # 0x14753
movl $0x37a, %edx            # imm = 0x37A
callq 0x3040
leaq 0xddc1(%rip), %rdi      # 0x14181
leaq 0xdcf5(%rip), %rsi      # 0x140bc
leaq 0xe385(%rip), %rcx      # 0x14753
movl $0x386, %edx            # imm = 0x386
callq 0x3040