// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0xc8, %rsp
xorl %eax, %eax
callq 0xaa8d
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x332c
leaq 0x7c(%rsp), %r14
andq $0x0, (%r14)
andl $0x0, 0x8(%r14)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0xada9
movabsq $-0xea5becba0a0a0a1, %rax # imm = 0xF15A41345F5F5F5F
leaq 0x60(%rsp), %r8
movq %rax, (%r8)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rbx
pushq $0x8
popq %rcx
movl $0xcffc, %esi           # imm = 0xCFFC
movq %rbx, %rdi
movq %r14, %rdx
callq 0xb68f
cmpq $0x0, 0x10(%rbx)
jne 0x555e
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x38(%rsp)
jne 0x557d
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x40(%rsp)
jne 0x559c
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x48(%rsp)
jne 0x55bb
cmpq $0x0, 0x20(%rsp)
jne 0x55da
cmpq $0x0, 0x50(%rsp)
jne 0x55f9
leaq 0x7c(%rsp), %rbx
movl $0x1, 0x8(%rbx)
movl 0x78(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0xada9
movl 0x78(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x88(%rsp), %r14
pushq $0x8
popq %rcx
leaq 0x60(%rsp), %r8
movl $0xf324, %esi           # imm = 0xF324
movq %r14, %rdi
movq %rbx, %rdx
callq 0xb68f
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movaps %xmm3, 0x50(%rsp)
movaps %xmm2, 0x40(%rsp)
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x5618
cmpq $0x47784b21, 0x38(%rsp) # imm = 0x47784B21
jne 0x5637
movabsq $0x780d1e1d5efcd005, %rax # imm = 0x780D1E1D5EFCD005
cmpq %rax, 0x40(%rsp)
jne 0x5656
movabsq $-0x3a01abd7ec4928e2, %rax # imm = 0xC5FE542813B6D71E
cmpq %rax, 0x48(%rsp)
jne 0x5675
cmpq $0x0, 0x20(%rsp)
jne 0x5694
cmpq $0x8fc, 0x50(%rsp)      # imm = 0x8FC
jne 0x56b3
xorl %eax, %eax
callq 0xada8
addq $0xc8, %rsp
popq %rbx
popq %r14
retq
leaq 0xbaca(%rip), %rdi      # 0x1102f
leaq 0xbae4(%rip), %rsi      # 0x11050
leaq 0xc29c(%rip), %rcx      # 0x1180f
movl $0x3eb, %edx            # imm = 0x3EB
callq 0x3040
leaq 0xbae7(%rip), %rdi      # 0x1106b
leaq 0xbac5(%rip), %rsi      # 0x11050
leaq 0xc27d(%rip), %rcx      # 0x1180f
movl $0x3ec, %edx            # imm = 0x3EC
callq 0x3040
leaq 0xbaf2(%rip), %rdi      # 0x11095
leaq 0xbaa6(%rip), %rsi      # 0x11050
leaq 0xc25e(%rip), %rcx      # 0x1180f
movl $0x3ed, %edx            # imm = 0x3ED
callq 0x3040
leaq 0xbb05(%rip), %rdi      # 0x110c7
leaq 0xba87(%rip), %rsi      # 0x11050
leaq 0xc23f(%rip), %rcx      # 0x1180f
movl $0x3ee, %edx            # imm = 0x3EE
callq 0x3040
leaq 0xbb18(%rip), %rdi      # 0x110f9
leaq 0xba68(%rip), %rsi      # 0x11050
leaq 0xc220(%rip), %rcx      # 0x1180f
movl $0x3ef, %edx            # imm = 0x3EF
callq 0x3040
leaq 0xbb15(%rip), %rdi      # 0x11115
leaq 0xba49(%rip), %rsi      # 0x11050
leaq 0xc201(%rip), %rcx      # 0x1180f
movl $0x3f0, %edx            # imm = 0x3F0
callq 0x3040
leaq 0xba10(%rip), %rdi      # 0x1102f
leaq 0xba2a(%rip), %rsi      # 0x11050
leaq 0xc1e2(%rip), %rcx      # 0x1180f
movl $0x3f7, %edx            # imm = 0x3F7
callq 0x3040
leaq 0xc1e6(%rip), %rdi      # 0x11824
leaq 0xba0b(%rip), %rsi      # 0x11050
leaq 0xc1c3(%rip), %rcx      # 0x1180f
movl $0x3f8, %edx            # imm = 0x3F8
callq 0x3040
leaq 0xc1f1(%rip), %rdi      # 0x1184e
leaq 0xb9ec(%rip), %rsi      # 0x11050
leaq 0xc1a4(%rip), %rcx      # 0x1180f
movl $0x3f9, %edx            # imm = 0x3F9
callq 0x3040
leaq 0xc204(%rip), %rdi      # 0x11880
leaq 0xb9cd(%rip), %rsi      # 0x11050
leaq 0xc185(%rip), %rcx      # 0x1180f
movl $0x3fa, %edx            # imm = 0x3FA
callq 0x3040
leaq 0xba5e(%rip), %rdi      # 0x110f9
leaq 0xb9ae(%rip), %rsi      # 0x11050
leaq 0xc166(%rip), %rcx      # 0x1180f
movl $0x3fb, %edx            # imm = 0x3FB
callq 0x3040
leaq 0xc1f8(%rip), %rdi      # 0x118b2
leaq 0xb98f(%rip), %rsi      # 0x11050
leaq 0xc147(%rip), %rcx      # 0x1180f
movl $0x3fc, %edx            # imm = 0x3FC
callq 0x3040