// File: /workspace/github_c_makefile_star2_O3/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 0xca4d
movq $-0x2, %r14
leaq 0x18(%rsp), %r12
leaq 0xee1f(%rip), %r13      # 0x14070
movq 0x18da0(%rip), %r15     # 0x1dff8
leaq 0x11e7e(%rip), %rbx     # 0x170dd
movzbl 0x4(%r14,%r13), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x5286
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x527a
addb $-0x57, %cl
jmp 0x5284
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x52c5
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r13), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x52ab
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x529f
addb $-0x57, %cl
jmp 0x52a9
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x52d9
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r12)
addq $0x2, %r14
incq %r12
cmpq $0x26, %r14
jb 0x525f
jmp 0x52ec
movq (%r15), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x5286
movq (%r15), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x52ab
movaps 0x12b5d(%rip), %xmm0    # 0x17e50
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x20(%r8)
movaps 0x12b39(%rip), %xmm0    # 0x17e40
movaps %xmm0, 0x10(%r8)
movaps 0x12b1d(%rip), %xmm0    # 0x17e30
movaps %xmm0, (%r8)
movabsq $-0xca0a6ada6f5e4a0, %rax # imm = 0xF35F5952590A1B60
movq %rax, 0x2d(%r8)
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x30(%rsp), %rbx
leaq 0x74(%rsp), %rdx
movl $0x18397, %esi          # imm = 0x18397
movl $0x35, %ecx
movq %rbx, %rdi
callq 0xd683
cmpq $0x0, 0x10(%rbx)
jne 0x5434
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x48(%rsp)
jne 0x5453
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x50(%rsp)
jne 0x5472
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x58(%rsp)
jne 0x5491
cmpq $0xe0, 0x30(%rsp)
jne 0x54b0
movl $0xe0, %eax
leaq 0x12abe(%rip), %r12     # 0x17e70
leaq 0xf1a4(%rip), %rbx      # 0x1455d
xorl %r14d, %r14d
movq 0x38(%rsp), %rcx
movzbl (%rcx,%r14), %ecx
movzbl (%r14,%r12), %r8d
cmpb %r8b, %cl
jne 0x53da
incq %r14
cmpq %rax, %r14
jb 0x53bc
jmp 0x53f1
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30a0
movq 0x30(%rsp), %rax
jmp 0x53d0
movq 0x38(%rsp), %rdi
leaq 0x12a73(%rip), %rsi     # 0x17e70
movl $0xe0, %edx
callq 0x30d0
testl %eax, %eax
jne 0x54cf
cmpq $0x0, 0x60(%rsp)
jne 0x54ee
xorl %eax, %eax
callq 0xcd49
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xec60(%rip), %rdi      # 0x1409b
leaq 0xec7a(%rip), %rsi      # 0x140bc
leaq 0xf0e3(%rip), %rcx      # 0x1452c
movl $0x26e, %edx            # imm = 0x26E
callq 0x3040
leaq 0xec7d(%rip), %rdi      # 0x140d7
leaq 0xec5b(%rip), %rsi      # 0x140bc
leaq 0xf0c4(%rip), %rcx      # 0x1452c
movl $0x26f, %edx            # imm = 0x26F
callq 0x3040
leaq 0xec88(%rip), %rdi      # 0x14101
leaq 0xec3c(%rip), %rsi      # 0x140bc
leaq 0xf0a5(%rip), %rcx      # 0x1452c
movl $0x270, %edx            # imm = 0x270
callq 0x3040
leaq 0xec9b(%rip), %rdi      # 0x14133
leaq 0xec1d(%rip), %rsi      # 0x140bc
leaq 0xf086(%rip), %rcx      # 0x1452c
movl $0x271, %edx            # imm = 0x271
callq 0x3040
leaq 0xf085(%rip), %rdi      # 0x1453c
leaq 0xebfe(%rip), %rsi      # 0x140bc
leaq 0xf067(%rip), %rcx      # 0x1452c
movl $0x283, %edx            # imm = 0x283
callq 0x3040
leaq 0xf097(%rip), %rdi      # 0x1456d
leaq 0xebdf(%rip), %rsi      # 0x140bc
leaq 0xf048(%rip), %rcx      # 0x1452c
movl $0x289, %edx            # imm = 0x289
callq 0x3040
leaq 0xec8c(%rip), %rdi      # 0x14181
leaq 0xebc0(%rip), %rsi      # 0x140bc
leaq 0xf029(%rip), %rcx      # 0x1452c
movl $0x28a, %edx            # imm = 0x28A
callq 0x3040