// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb8, %rsp
xorl %eax, %eax
callq 0xaa8d
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x332c
movaps 0x10b89(%rip), %xmm0    # 0x14df0
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x20(%r8)
movaps 0x10b65(%rip), %xmm0    # 0x14de0
movaps %xmm0, 0x10(%r8)
movaps 0x10b49(%rip), %xmm0    # 0x14dd0
movaps %xmm0, (%r8)
movabsq $-0xca0a6ada6f5e4a0, %rax # imm = 0xF35F5952590A1B60
movq %rax, 0x2d(%r8)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0x18(%rsp), %rbx
leaq 0x5c(%rsp), %rdx
pushq $0x35
popq %rcx
movl $0x18397, %esi          # imm = 0x18397
movq %rbx, %rdi
callq 0xb68f
cmpq $0x0, 0x10(%rbx)
jne 0x43a3
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x30(%rsp)
jne 0x43c2
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x38(%rsp)
jne 0x43e1
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x40(%rsp)
jne 0x4400
cmpq $0xe0, 0x18(%rsp)
jne 0x441f
movl $0xe0, %eax
leaq 0x10aef(%rip), %r15     # 0x14e10
movq 0x16cd0(%rip), %r12     # 0x1aff8
leaq 0xd1c2(%rip), %rbx      # 0x114f1
xorl %r14d, %r14d
movq 0x20(%rsp), %rdi
cmpq %rax, %r14
jae 0x4368
movzbl (%rdi,%r14), %ecx
movzbl (%r14,%r15), %r8d
cmpb %r8b, %cl
jne 0x4350
incq %r14
jmp 0x4332
movq (%r12), %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30a0
movq 0x18(%rsp), %rax
jmp 0x434b
leaq 0x10aa1(%rip), %rsi     # 0x14e10
movl $0xe0, %edx
callq 0x30d0
testl %eax, %eax
jne 0x443e
cmpq $0x0, 0x48(%rsp)
jne 0x445d
xorl %eax, %eax
callq 0xada8
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xcc85(%rip), %rdi      # 0x1102f
leaq 0xcc9f(%rip), %rsi      # 0x11050
leaq 0xd108(%rip), %rcx      # 0x114c0
movl $0x26e, %edx            # imm = 0x26E
callq 0x3040
leaq 0xcca2(%rip), %rdi      # 0x1106b
leaq 0xcc80(%rip), %rsi      # 0x11050
leaq 0xd0e9(%rip), %rcx      # 0x114c0
movl $0x26f, %edx            # imm = 0x26F
callq 0x3040
leaq 0xccad(%rip), %rdi      # 0x11095
leaq 0xcc61(%rip), %rsi      # 0x11050
leaq 0xd0ca(%rip), %rcx      # 0x114c0
movl $0x270, %edx            # imm = 0x270
callq 0x3040
leaq 0xccc0(%rip), %rdi      # 0x110c7
leaq 0xcc42(%rip), %rsi      # 0x11050
leaq 0xd0ab(%rip), %rcx      # 0x114c0
movl $0x271, %edx            # imm = 0x271
callq 0x3040
leaq 0xd0aa(%rip), %rdi      # 0x114d0
leaq 0xcc23(%rip), %rsi      # 0x11050
leaq 0xd08c(%rip), %rcx      # 0x114c0
movl $0x283, %edx            # imm = 0x283
callq 0x3040
leaq 0xd0bc(%rip), %rdi      # 0x11501
leaq 0xcc04(%rip), %rsi      # 0x11050
leaq 0xd06d(%rip), %rcx      # 0x114c0
movl $0x289, %edx            # imm = 0x289
callq 0x3040
leaq 0xccb1(%rip), %rdi      # 0x11115
leaq 0xcbe5(%rip), %rsi      # 0x11050
leaq 0xd04e(%rip), %rcx      # 0x114c0
movl $0x28a, %edx            # imm = 0x28A
callq 0x3040