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

    address_t from = AddressFromHex42("0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1");
    uint64_t gas = 0x18397;
    val_t value;
    data_t input;

    // tst/in/exp.evm
    op_t program[] = {
        PUSH0, PUSH1, 3, EXP, MSIZE, MSTORE,
        PUSH1, 3, PUSH1, 3, EXP, MSIZE, MSTORE,
        PUSH1, 3, PUSH1, 4, EXP, MSIZE, MSTORE,
        PUSH1, 4, PUSH1, 3, EXP, MSIZE, MSTORE,
        PUSH1, 32, PUSH1, 2, EXP, MSIZE, MSTORE,
        PUSH1, 160, PUSH1, 3, EXP, MSIZE, MSTORE,
        PUSH3, 0x0f, 0xff, 0xff, PUSH1, 0x1b, EXP, MSIZE, MSTORE,
        MSIZE, PUSH0, RETURN
    };

    input.content = program;
    input.size = sizeof(program);

    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);

    op_t expected[] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x30, 0x4d, 0x37, 0xf1, 0x20, 0xd6, 0x96, 0xc8, 0x34, 0x55, 0x0e, 0x63, 0xd9, 0xbb, 0x9c, 0x14,
        0xb4, 0xf9, 0x16, 0x5c, 0x9e, 0xde, 0x43, 0x4e, 0x46, 0x44, 0xe3, 0x99, 0x8d, 0x6d, 0xb8, 0x81,
        0xe1, 0xd0, 0xa3, 0xc6, 0xc0, 0x81, 0xea, 0x84, 0xc0, 0xfd, 0x20, 0xd5, 0x50, 0x42, 0x77, 0xc2,
        0xff, 0x1b, 0x79, 0xb5, 0xc2, 0xae, 0x76, 0xe4, 0x6b, 0xbb, 0xbd, 0xc2, 0xcd, 0x8b, 0xda, 0x13
    };
    assert(result.returnData.size == 7 * 32);
    for (size_t i = 0; i < result.returnData.size; i++) {
        if (result.returnData.content[i] != expected[i]) {
            fprintf(stderr, "%zu: %02x %02x\n", i, result.returnData.content[i], expected[i]);
        }
    }
    assert(memcmp(result.returnData.content, expected, 7 * 32) == 0);
    assert(result.gasRemaining == 0);

    evmFinalize();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
xorl %eax, %eax
callq 0xca7b
movq $-0x2, %r14
leaq 0x60(%rsp), %r12
leaq 0xeef2(%rip), %r13      # 0x14050
movq 0x18e93(%rip), %r15     # 0x1dff8
leaq 0x11f51(%rip), %rbx     # 0x170bd
movzbl 0x4(%r14,%r13), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x5193
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x5187
addb $-0x57, %cl
jmp 0x5191
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x51d2
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r13), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x51b8
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x51ac
addb $-0x57, %cl
jmp 0x51b6
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x51e6
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r12)
addq $0x2, %r14
incq %r12
cmpq $0x26, %r14
jb 0x516c
jmp 0x51f9
movq (%r15), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x5193
movq (%r15), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x51b8
movaps 0x12c30(%rip), %xmm0    # 0x17e30
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x20(%r8)
movaps 0x12c0c(%rip), %xmm0    # 0x17e20
movaps %xmm0, 0x10(%r8)
movaps 0x12bf0(%rip), %xmm0    # 0x17e10
movaps %xmm0, (%r8)
movabsq $-0xca0a6ada6f5e4a0, %rax # imm = 0xF35F5952590A1B60
movq %rax, 0x2d(%r8)
movl 0x70(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rbx
leaq 0x74(%rsp), %rdx
movl $0x18397, %esi          # imm = 0x18397
movl $0x35, %ecx
movq %rbx, %rdi
callq 0xd845
cmpq $0x0, 0x10(%rbx)
jne 0x5341
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x38(%rsp)
jne 0x5360
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x40(%rsp)
jne 0x537f
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x48(%rsp)
jne 0x539e
cmpq $0xe0, 0x20(%rsp)
jne 0x53bd
cmpq $0x0, 0x20(%rsp)
je 0x52fe
leaq 0x12b8e(%rip), %r12     # 0x17e50
leaq 0xf274(%rip), %rbx      # 0x1453d
xorl %r14d, %r14d
movq 0x28(%rsp), %rax
movzbl (%rax,%r14), %ecx
movzbl (%r14,%r12), %r8d
cmpb %r8b, %cl
jne 0x52ec
incq %r14
cmpq 0x20(%rsp), %r14
jb 0x52cc
jmp 0x52fe
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30a0
jmp 0x52e0
movq 0x28(%rsp), %rdi
leaq 0x12b46(%rip), %rsi     # 0x17e50
movl $0xe0, %edx
callq 0x30d0
testl %eax, %eax
jne 0x53dc
cmpq $0x0, 0x50(%rsp)
jne 0x53fb
xorl %eax, %eax
callq 0xcf29
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xed33(%rip), %rdi      # 0x1407b
leaq 0xed4d(%rip), %rsi      # 0x1409c
leaq 0xf1b6(%rip), %rcx      # 0x1450c
movl $0x26e, %edx            # imm = 0x26E
callq 0x3040
leaq 0xed50(%rip), %rdi      # 0x140b7
leaq 0xed2e(%rip), %rsi      # 0x1409c
leaq 0xf197(%rip), %rcx      # 0x1450c
movl $0x26f, %edx            # imm = 0x26F
callq 0x3040
leaq 0xed5b(%rip), %rdi      # 0x140e1
leaq 0xed0f(%rip), %rsi      # 0x1409c
leaq 0xf178(%rip), %rcx      # 0x1450c
movl $0x270, %edx            # imm = 0x270
callq 0x3040
leaq 0xed6e(%rip), %rdi      # 0x14113
leaq 0xecf0(%rip), %rsi      # 0x1409c
leaq 0xf159(%rip), %rcx      # 0x1450c
movl $0x271, %edx            # imm = 0x271
callq 0x3040
leaq 0xf158(%rip), %rdi      # 0x1451c
leaq 0xecd1(%rip), %rsi      # 0x1409c
leaq 0xf13a(%rip), %rcx      # 0x1450c
movl $0x283, %edx            # imm = 0x283
callq 0x3040
leaq 0xf16a(%rip), %rdi      # 0x1454d
leaq 0xecb2(%rip), %rsi      # 0x1409c
leaq 0xf11b(%rip), %rcx      # 0x1450c
movl $0x289, %edx            # imm = 0x289
callq 0x3040
leaq 0xed5f(%rip), %rdi      # 0x14161
leaq 0xec93(%rip), %rsi      # 0x1409c
leaq 0xf0fc(%rip), %rcx      # 0x1450c
movl $0x28a, %edx            # imm = 0x28A
callq 0x3040