// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
xorl %eax, %eax
callq 0xaa8d
movabsq $0x5952594752593130, %rax # imm = 0x5952594752593130
leaq 0x60(%rsp), %rbx
movq %rax, (%rbx)
movw $0xf35f, 0x8(%rbx)      # imm = 0xF35F
leaq 0x78(%rsp), %r14
movq %r14, %rdi
callq 0x332c
movabsq $0xee000000dd, %rax     # imm = 0xEE000000DD
leaq 0x6c(%rsp), %r15
movq %rax, (%r15)
movl $0xff, 0x8(%r15)
movl 0x10(%r14), %eax
movl %eax, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0xada9
movl 0x10(%r14), %eax
movl %eax, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %r14
pushq $0xa
popq %rcx
movl $0x10229, %esi          # imm = 0x10229
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %r8
callq 0xb68f
xorl %eax, %eax
callq 0xada8
cmpq $0x0, 0x10(%r14)
jne 0x4ea8
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x38(%rsp)
jne 0x4ec7
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x40(%rsp)
jne 0x4ee6
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x48(%rsp)
jne 0x4f05
cmpq $0x40, 0x20(%rsp)
jne 0x4f24
movq 0x28(%rsp), %rax
xorl %ecx, %ecx
cmpq $0x3f, %rcx
je 0x4e13
movl %ecx, %esi
andl $0x1f, %esi
movb (%rax,%rcx), %dl
cmpl $0x17, %esi
je 0x4e03
cmpl $0x1b, %esi
je 0x4dfc
cmpl $0x1f, %esi
jne 0x4e0a
cmpb $-0x1, %dl
je 0x4e0e
jmp 0x4e4b
cmpb $-0x12, %dl
je 0x4e0e
jmp 0x4e6a
cmpb $-0x23, %dl
je 0x4e0e
jmp 0x4e89
testb %dl, %dl
jne 0x4e2c
incq %rcx
jmp 0x4dd8
cmpq $0x0, 0x50(%rsp)
jne 0x4f43
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0xc3fa(%rip), %rdi      # 0x1122d
leaq 0xc216(%rip), %rsi      # 0x11050
leaq 0xc8a6(%rip), %rcx      # 0x116e7
movl $0x383, %edx            # imm = 0x383
callq 0x3040
leaq 0xc390(%rip), %rdi      # 0x111e2
leaq 0xc1f7(%rip), %rsi      # 0x11050
leaq 0xc887(%rip), %rcx      # 0x116e7
movl $0x37d, %edx            # imm = 0x37D
callq 0x3040
leaq 0xc88e(%rip), %rdi      # 0x116ff
leaq 0xc1d8(%rip), %rsi      # 0x11050
leaq 0xc868(%rip), %rcx      # 0x116e7
movl $0x37f, %edx            # imm = 0x37F
callq 0x3040
leaq 0xc894(%rip), %rdi      # 0x11724
leaq 0xc1b9(%rip), %rsi      # 0x11050
leaq 0xc849(%rip), %rcx      # 0x116e7
movl $0x381, %edx            # imm = 0x381
callq 0x3040
leaq 0xc180(%rip), %rdi      # 0x1102f
leaq 0xc19a(%rip), %rsi      # 0x11050
leaq 0xc82a(%rip), %rcx      # 0x116e7
movl $0x376, %edx            # imm = 0x376
callq 0x3040
leaq 0xc19d(%rip), %rdi      # 0x1106b
leaq 0xc17b(%rip), %rsi      # 0x11050
leaq 0xc80b(%rip), %rcx      # 0x116e7
movl $0x377, %edx            # imm = 0x377
callq 0x3040
leaq 0xc1a8(%rip), %rdi      # 0x11095
leaq 0xc15c(%rip), %rsi      # 0x11050
leaq 0xc7ec(%rip), %rcx      # 0x116e7
movl $0x378, %edx            # imm = 0x378
callq 0x3040
leaq 0xc1bb(%rip), %rdi      # 0x110c7
leaq 0xc13d(%rip), %rsi      # 0x11050
leaq 0xc7cd(%rip), %rcx      # 0x116e7
movl $0x379, %edx            # imm = 0x379
callq 0x3040
leaq 0xc490(%rip), %rdi      # 0x113bb
leaq 0xc11e(%rip), %rsi      # 0x11050
leaq 0xc7ae(%rip), %rcx      # 0x116e7
movl $0x37a, %edx            # imm = 0x37A
callq 0x3040
leaq 0xc1cb(%rip), %rdi      # 0x11115
leaq 0xc0ff(%rip), %rsi      # 0x11050
leaq 0xc78f(%rip), %rcx      # 0x116e7
movl $0x386, %edx            # imm = 0x386
callq 0x3040