// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xe0, %rsp
movb $0x0, %al
callq 0xcfc0
leaq -0x18(%rbp), %rdi
leaq 0x153a7(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0xcffc, -0x20(%rbp)    # imm = 0xCFFC
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x2c(%rbp), %rdi
leaq -0x18(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xd4e0
movq 0x19b73(%rip), %rax     # 0x1f821
movq %rax, -0x34(%rbp)
leaq -0x34(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x8, -0x48(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %r8
leaq -0x88(%rbp), %rdi
leaq -0x18(%rbp), %rax
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xe270
cmpq $0x0, -0x78(%rbp)
jne 0x5d02
jmp 0x5d21
leaq 0x15326(%rip), %rdi     # 0x1b02f
leaq 0x15340(%rip), %rsi     # 0x1b050
movl $0x3eb, %edx            # imm = 0x3EB
leaq 0x15af3(%rip), %rcx     # 0x1b80f
callq 0x3040
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, -0x70(%rbp)
jne 0x5d2e
jmp 0x5d4d
leaq 0x15336(%rip), %rdi     # 0x1b06b
leaq 0x15314(%rip), %rsi     # 0x1b050
movl $0x3ec, %edx            # imm = 0x3EC
leaq 0x15ac7(%rip), %rcx     # 0x1b80f
callq 0x3040
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, -0x68(%rbp)
jne 0x5d5f
jmp 0x5d7e
leaq 0x1532f(%rip), %rdi     # 0x1b095
leaq 0x152e3(%rip), %rsi     # 0x1b050
movl $0x3ed, %edx            # imm = 0x3ED
leaq 0x15a96(%rip), %rcx     # 0x1b80f
callq 0x3040
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, -0x60(%rbp)
jne 0x5d90
jmp 0x5daf
leaq 0x15330(%rip), %rdi     # 0x1b0c7
leaq 0x152b2(%rip), %rsi     # 0x1b050
movl $0x3ee, %edx            # imm = 0x3EE
leaq 0x15a65(%rip), %rcx     # 0x1b80f
callq 0x3040
cmpq $0x0, -0x88(%rbp)
jne 0x5dbb
jmp 0x5dda
leaq 0x15337(%rip), %rdi     # 0x1b0f9
leaq 0x15287(%rip), %rsi     # 0x1b050
movl $0x3ef, %edx            # imm = 0x3EF
leaq 0x15a3a(%rip), %rcx     # 0x1b80f
callq 0x3040
cmpq $0x0, -0x58(%rbp)
jne 0x5de3
jmp 0x5e02
leaq 0x1532b(%rip), %rdi     # 0x1b115
leaq 0x1525f(%rip), %rsi     # 0x1b050
movl $0x3f0, %edx            # imm = 0x3F0
leaq 0x15a12(%rip), %rcx     # 0x1b80f
callq 0x3040
movq $0xf324, -0x20(%rbp)    # imm = 0xF324
movl $0x1, -0x24(%rbp)
leaq -0x2c(%rbp), %rdi
leaq -0x18(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xd4e0
movq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %r8
leaq -0xc8(%rbp), %rdi
leaq -0x18(%rbp), %rax
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xe270
leaq -0x88(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
movl $0x40, %edx
callq 0x30c0
cmpq $0x0, -0x78(%rbp)
jne 0x5e8d
jmp 0x5eac
leaq 0x1519b(%rip), %rdi     # 0x1b02f
leaq 0x151b5(%rip), %rsi     # 0x1b050
movl $0x3f7, %edx            # imm = 0x3F7
leaq 0x15968(%rip), %rcx     # 0x1b80f
callq 0x3040
cmpq $0x47784b21, -0x70(%rbp) # imm = 0x47784B21
jne 0x5eb8
jmp 0x5ed7
leaq 0x15965(%rip), %rdi     # 0x1b824
leaq 0x1518a(%rip), %rsi     # 0x1b050
movl $0x3f8, %edx            # imm = 0x3F8
leaq 0x1593d(%rip), %rcx     # 0x1b80f
callq 0x3040
movabsq $0x780d1e1d5efcd005, %rax # imm = 0x780D1E1D5EFCD005
cmpq %rax, -0x68(%rbp)
jne 0x5ee9
jmp 0x5f08
leaq 0x1595e(%rip), %rdi     # 0x1b84e
leaq 0x15159(%rip), %rsi     # 0x1b050
movl $0x3f9, %edx            # imm = 0x3F9
leaq 0x1590c(%rip), %rcx     # 0x1b80f
callq 0x3040
movabsq $-0x3a01abd7ec4928e2, %rax # imm = 0xC5FE542813B6D71E
cmpq %rax, -0x60(%rbp)
jne 0x5f1a
jmp 0x5f39
leaq 0x1595f(%rip), %rdi     # 0x1b880
leaq 0x15128(%rip), %rsi     # 0x1b050
movl $0x3fa, %edx            # imm = 0x3FA
leaq 0x158db(%rip), %rcx     # 0x1b80f
callq 0x3040
cmpq $0x0, -0x88(%rbp)
jne 0x5f45
jmp 0x5f64
leaq 0x151ad(%rip), %rdi     # 0x1b0f9
leaq 0x150fd(%rip), %rsi     # 0x1b050
movl $0x3fb, %edx            # imm = 0x3FB
leaq 0x158b0(%rip), %rcx     # 0x1b80f
callq 0x3040
cmpq $0x8fc, -0x58(%rbp)     # imm = 0x8FC
jne 0x5f70
jmp 0x5f8f
leaq 0x1593b(%rip), %rdi     # 0x1b8b2
leaq 0x150d2(%rip), %rsi     # 0x1b050
movl $0x3fc, %edx            # imm = 0x3FC
leaq 0x15885(%rip), %rcx     # 0x1b80f
callq 0x3040
movb $0x0, %al
callq 0xd4d0
addq $0xe0, %rsp
popq %rbp
retq
nop