// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movb $0x0, %al
callq 0xcfc0
leaq -0x18(%rbp), %rdi
leaq 0x16877(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0x18397, -0x20(%rbp)   # imm = 0x18397
leaq -0x80(%rbp), %rdi
leaq 0x1a627(%rip), %rsi     # 0x1edd0
movl $0x35, %edx
callq 0x30c0
leaq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x35, -0x40(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %r8
leaq -0xc0(%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, -0xb0(%rbp)
jne 0x4806
jmp 0x4825
leaq 0x16822(%rip), %rdi     # 0x1b02f
leaq 0x1683c(%rip), %rsi     # 0x1b050
movl $0x26e, %edx            # imm = 0x26E
leaq 0x16ca0(%rip), %rcx     # 0x1b4c0
callq 0x3040
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, -0xa8(%rbp)
jne 0x4835
jmp 0x4854
leaq 0x1682f(%rip), %rdi     # 0x1b06b
leaq 0x1680d(%rip), %rsi     # 0x1b050
movl $0x26f, %edx            # imm = 0x26F
leaq 0x16c71(%rip), %rcx     # 0x1b4c0
callq 0x3040
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, -0xa0(%rbp)
jne 0x4869
jmp 0x4888
leaq 0x16825(%rip), %rdi     # 0x1b095
leaq 0x167d9(%rip), %rsi     # 0x1b050
movl $0x270, %edx            # imm = 0x270
leaq 0x16c3d(%rip), %rcx     # 0x1b4c0
callq 0x3040
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, -0x98(%rbp)
jne 0x489d
jmp 0x48bc
leaq 0x16823(%rip), %rdi     # 0x1b0c7
leaq 0x167a5(%rip), %rsi     # 0x1b050
movl $0x271, %edx            # imm = 0x271
leaq 0x16c09(%rip), %rcx     # 0x1b4c0
callq 0x3040
leaq -0x1a0(%rbp), %rdi
leaq 0x1a546(%rip), %rsi     # 0x1ee10
movl $0xe0, %edx
callq 0x30c0
cmpq $0xe0, -0xc0(%rbp)
jne 0x48e3
jmp 0x4902
leaq 0x16be6(%rip), %rdi     # 0x1b4d0
leaq 0x1675f(%rip), %rsi     # 0x1b050
movl $0x283, %edx            # imm = 0x283
leaq 0x16bc3(%rip), %rcx     # 0x1b4c0
callq 0x3040
movq $0x0, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jae 0x499c
movq -0xb8(%rbp), %rax
movq -0x1a8(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x1a8(%rbp), %rcx
movzbl -0x1a0(%rbp,%rcx), %ecx
cmpl %ecx, %eax
je 0x4983
movq 0x206af(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0x1a8(%rbp), %rdx
movq -0xb8(%rbp), %rax
movq -0x1a8(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movq -0x1a8(%rbp), %rax
movzbl -0x1a0(%rbp,%rax), %r8d
leaq 0x16b75(%rip), %rsi     # 0x1b4f1
movb $0x0, %al
callq 0x30b0
jmp 0x4985
movq -0x1a8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1a8(%rbp)
jmp 0x490d
movq -0xb8(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
movl $0xe0, %edx
callq 0x3090
cmpl $0x0, %eax
jne 0x49bb
jmp 0x49da
leaq 0x16b3f(%rip), %rdi     # 0x1b501
leaq 0x16687(%rip), %rsi     # 0x1b050
movl $0x289, %edx            # imm = 0x289
leaq 0x16aeb(%rip), %rcx     # 0x1b4c0
callq 0x3040
cmpq $0x0, -0x90(%rbp)
jne 0x49e6
jmp 0x4a05
leaq 0x16728(%rip), %rdi     # 0x1b115
leaq 0x1665c(%rip), %rsi     # 0x1b050
movl $0x28a, %edx            # imm = 0x28A
leaq 0x16ac0(%rip), %rcx     # 0x1b4c0
callq 0x3040
movb $0x0, %al
callq 0xd4d0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nopw %cs:(%rax,%rax)