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

    address_t from = AddressFromHex42("0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1");
    uint64_t gas = 0xcffc;
    val_t value;
    value[0] = 0;
    value[1] = 0;
    value[2] = 0;

    evmMockBalance(from, value);

    op_t payCoinbase[] = {
        PUSH0, PUSH0, PUSH0, PUSH0, CALLVALUE, COINBASE, GAS, CALL
    };

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

    result_t result = txCreate(from, gas, value, input);
    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 == 0);
    assert(result.gasRemaining == 0);

    gas = 0xf324;
    value[2] = 1;
    evmMockBalance(from, value);

    result = txCreate(from, gas, value, input);
    assert(UPPER(UPPER(result.status)) == 0);
    assert(LOWER(UPPER(result.status)) == 0x47784b21);
    assert(UPPER(LOWER(result.status)) == 0x780d1e1d5efcd005);
    assert(LOWER(LOWER(result.status)) == 0xc5fe542813b6d71e);
    assert(result.returnData.size == 0);
    assert(result.gasRemaining == G_CALLSTIPEND);

    evmFinalize();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
xorl %eax, %eax
callq 0xca7b
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xd6e0(%rip), %r12      # 0x14050
movq 0x17681(%rip), %r13     # 0x1dff8
leaq 0x1073f(%rip), %rbx     # 0x170bd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x69a5
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x6999
addb $-0x57, %cl
jmp 0x69a3
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x69e3
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x69ca
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x69be
addb $-0x57, %cl
jmp 0x69c8
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x69f8
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x697e
jmp 0x6a0c
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x69a5
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x69ca
leaq 0x7c(%rsp), %rbx
movq $0x0, (%rbx)
movl $0x0, 0x8(%rbx)
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0xcf2a
movabsq $-0xea5becba0a0a0a1, %rax # imm = 0xF15A41345F5F5F5F
leaq 0x70(%rsp), %r8
movq %rax, (%r8)
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x30(%rsp), %r14
movl $0xcffc, %esi           # imm = 0xCFFC
movl $0x8, %ecx
movq %r14, %rdi
movq %rbx, %rdx
callq 0xd845
cmpq $0x0, 0x10(%r14)
jne 0x6bca
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x48(%rsp)
jne 0x6be9
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x50(%rsp)
jne 0x6c08
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x58(%rsp)
jne 0x6c27
cmpq $0x0, 0x30(%rsp)
jne 0x6c46
cmpq $0x0, 0x60(%rsp)
jne 0x6c65
leaq 0x7c(%rsp), %rbx
movl $0x1, 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 0x88(%rsp), %r14
leaq 0x70(%rsp), %r8
movl $0xf324, %esi           # imm = 0xF324
movl $0x8, %ecx
movq %r14, %rdi
movq %rbx, %rdx
callq 0xd845
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movaps %xmm3, 0x60(%rsp)
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
cmpq $0x0, 0x40(%rsp)
jne 0x6c84
cmpq $0x47784b21, 0x48(%rsp) # imm = 0x47784B21
jne 0x6ca3
movabsq $0x780d1e1d5efcd005, %rax # imm = 0x780D1E1D5EFCD005
cmpq %rax, 0x50(%rsp)
jne 0x6cc2
movabsq $-0x3a01abd7ec4928e2, %rax # imm = 0xC5FE542813B6D71E
cmpq %rax, 0x58(%rsp)
jne 0x6ce1
cmpq $0x0, 0x30(%rsp)
jne 0x6d00
cmpq $0x8fc, 0x60(%rsp)      # imm = 0x8FC
jne 0x6d1f
xorl %eax, %eax
callq 0xcf29
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd4aa(%rip), %rdi      # 0x1407b
leaq 0xd4c4(%rip), %rsi      # 0x1409c
leaq 0xdc7c(%rip), %rcx      # 0x1485b
movl $0x3eb, %edx            # imm = 0x3EB
callq 0x3040
leaq 0xd4c7(%rip), %rdi      # 0x140b7
leaq 0xd4a5(%rip), %rsi      # 0x1409c
leaq 0xdc5d(%rip), %rcx      # 0x1485b
movl $0x3ec, %edx            # imm = 0x3EC
callq 0x3040
leaq 0xd4d2(%rip), %rdi      # 0x140e1
leaq 0xd486(%rip), %rsi      # 0x1409c
leaq 0xdc3e(%rip), %rcx      # 0x1485b
movl $0x3ed, %edx            # imm = 0x3ED
callq 0x3040
leaq 0xd4e5(%rip), %rdi      # 0x14113
leaq 0xd467(%rip), %rsi      # 0x1409c
leaq 0xdc1f(%rip), %rcx      # 0x1485b
movl $0x3ee, %edx            # imm = 0x3EE
callq 0x3040
leaq 0xd4f8(%rip), %rdi      # 0x14145
leaq 0xd448(%rip), %rsi      # 0x1409c
leaq 0xdc00(%rip), %rcx      # 0x1485b
movl $0x3ef, %edx            # imm = 0x3EF
callq 0x3040
leaq 0xd4f5(%rip), %rdi      # 0x14161
leaq 0xd429(%rip), %rsi      # 0x1409c
leaq 0xdbe1(%rip), %rcx      # 0x1485b
movl $0x3f0, %edx            # imm = 0x3F0
callq 0x3040
leaq 0xd3f0(%rip), %rdi      # 0x1407b
leaq 0xd40a(%rip), %rsi      # 0x1409c
leaq 0xdbc2(%rip), %rcx      # 0x1485b
movl $0x3f7, %edx            # imm = 0x3F7
callq 0x3040
leaq 0xdbc6(%rip), %rdi      # 0x14870
leaq 0xd3eb(%rip), %rsi      # 0x1409c
leaq 0xdba3(%rip), %rcx      # 0x1485b
movl $0x3f8, %edx            # imm = 0x3F8
callq 0x3040
leaq 0xdbd1(%rip), %rdi      # 0x1489a
leaq 0xd3cc(%rip), %rsi      # 0x1409c
leaq 0xdb84(%rip), %rcx      # 0x1485b
movl $0x3f9, %edx            # imm = 0x3F9
callq 0x3040
leaq 0xdbe4(%rip), %rdi      # 0x148cc
leaq 0xd3ad(%rip), %rsi      # 0x1409c
leaq 0xdb65(%rip), %rcx      # 0x1485b
movl $0x3fa, %edx            # imm = 0x3FA
callq 0x3040
leaq 0xd43e(%rip), %rdi      # 0x14145
leaq 0xd38e(%rip), %rsi      # 0x1409c
leaq 0xdb46(%rip), %rcx      # 0x1485b
movl $0x3fb, %edx            # imm = 0x3FB
callq 0x3040
leaq 0xdbd8(%rip), %rdi      # 0x148fe
leaq 0xd36f(%rip), %rsi      # 0x1409c
leaq 0xdb27(%rip), %rcx      # 0x1485b
movl $0x3fc, %edx            # imm = 0x3FC
callq 0x3040