// File: /workspace/github_c_makefile_star2_O3/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 0xca4d
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xd617(%rip), %r12      # 0x14070
movq 0x17598(%rip), %r13     # 0x1dff8
leaq 0x10676(%rip), %rbx     # 0x170dd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x6a8e
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x6a82
addb $-0x57, %cl
jmp 0x6a8c
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x6acc
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x6ab3
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x6aa7
addb $-0x57, %cl
jmp 0x6ab1
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x6ae1
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x6a67
jmp 0x6af5
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x6a8e
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x6ab3
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 0xcd4a
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 0xd683
cmpq $0x0, 0x10(%r14)
jne 0x6cb3
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x48(%rsp)
jne 0x6cd2
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x50(%rsp)
jne 0x6cf1
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x58(%rsp)
jne 0x6d10
cmpq $0x0, 0x30(%rsp)
jne 0x6d2f
cmpq $0x0, 0x60(%rsp)
jne 0x6d4e
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 0xcd4a
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 0xd683
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 0x6d6d
cmpq $0x47784b21, 0x48(%rsp) # imm = 0x47784B21
jne 0x6d8c
movabsq $0x780d1e1d5efcd005, %rax # imm = 0x780D1E1D5EFCD005
cmpq %rax, 0x50(%rsp)
jne 0x6dab
movabsq $-0x3a01abd7ec4928e2, %rax # imm = 0xC5FE542813B6D71E
cmpq %rax, 0x58(%rsp)
jne 0x6dca
cmpq $0x0, 0x30(%rsp)
jne 0x6de9
cmpq $0x8fc, 0x60(%rsp)      # imm = 0x8FC
jne 0x6e08
xorl %eax, %eax
callq 0xcd49
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd3e1(%rip), %rdi      # 0x1409b
leaq 0xd3fb(%rip), %rsi      # 0x140bc
leaq 0xdbb3(%rip), %rcx      # 0x1487b
movl $0x3eb, %edx            # imm = 0x3EB
callq 0x3040
leaq 0xd3fe(%rip), %rdi      # 0x140d7
leaq 0xd3dc(%rip), %rsi      # 0x140bc
leaq 0xdb94(%rip), %rcx      # 0x1487b
movl $0x3ec, %edx            # imm = 0x3EC
callq 0x3040
leaq 0xd409(%rip), %rdi      # 0x14101
leaq 0xd3bd(%rip), %rsi      # 0x140bc
leaq 0xdb75(%rip), %rcx      # 0x1487b
movl $0x3ed, %edx            # imm = 0x3ED
callq 0x3040
leaq 0xd41c(%rip), %rdi      # 0x14133
leaq 0xd39e(%rip), %rsi      # 0x140bc
leaq 0xdb56(%rip), %rcx      # 0x1487b
movl $0x3ee, %edx            # imm = 0x3EE
callq 0x3040
leaq 0xd42f(%rip), %rdi      # 0x14165
leaq 0xd37f(%rip), %rsi      # 0x140bc
leaq 0xdb37(%rip), %rcx      # 0x1487b
movl $0x3ef, %edx            # imm = 0x3EF
callq 0x3040
leaq 0xd42c(%rip), %rdi      # 0x14181
leaq 0xd360(%rip), %rsi      # 0x140bc
leaq 0xdb18(%rip), %rcx      # 0x1487b
movl $0x3f0, %edx            # imm = 0x3F0
callq 0x3040
leaq 0xd327(%rip), %rdi      # 0x1409b
leaq 0xd341(%rip), %rsi      # 0x140bc
leaq 0xdaf9(%rip), %rcx      # 0x1487b
movl $0x3f7, %edx            # imm = 0x3F7
callq 0x3040
leaq 0xdafd(%rip), %rdi      # 0x14890
leaq 0xd322(%rip), %rsi      # 0x140bc
leaq 0xdada(%rip), %rcx      # 0x1487b
movl $0x3f8, %edx            # imm = 0x3F8
callq 0x3040
leaq 0xdb08(%rip), %rdi      # 0x148ba
leaq 0xd303(%rip), %rsi      # 0x140bc
leaq 0xdabb(%rip), %rcx      # 0x1487b
movl $0x3f9, %edx            # imm = 0x3F9
callq 0x3040
leaq 0xdb1b(%rip), %rdi      # 0x148ec
leaq 0xd2e4(%rip), %rsi      # 0x140bc
leaq 0xda9c(%rip), %rcx      # 0x1487b
movl $0x3fa, %edx            # imm = 0x3FA
callq 0x3040
leaq 0xd375(%rip), %rdi      # 0x14165
leaq 0xd2c5(%rip), %rsi      # 0x140bc
leaq 0xda7d(%rip), %rcx      # 0x1487b
movl $0x3fb, %edx            # imm = 0x3FB
callq 0x3040
leaq 0xdb0f(%rip), %rdi      # 0x1491e
leaq 0xd2a6(%rip), %rsi      # 0x140bc
leaq 0xda5e(%rip), %rcx      # 0x1487b
movl $0x3fc, %edx            # imm = 0x3FC
callq 0x3040