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

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

    // 7f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f7f8f5f5b81810b595260010160218110602257595ff3
    op_t program[] = {
        PUSH32,
        0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        PUSH0,
        JUMPDEST,
        DUP2, DUP2, SIGNEXTEND, MSIZE, MSTORE,
        PUSH1, 1, ADD,
        PUSH1, 33, DUP2, LT, PUSH1, 34, JUMPI,
        MSIZE, PUSH0, RETURN
    };

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

    result_t result = txCreate(from, gas, value, input);

    op_t expected[] = {
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f,
        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, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f,
        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, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        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, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff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, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f,
        0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f, 0x7f, 0x8f
    };
    assert(result.returnData.size == sizeof(expected));
    if (memcmp(result.returnData.content, expected, sizeof(expected))) {
        for (size_t i = 0; i < sizeof(expected); i++) {
            if (i && i % 32 == 0) {
                fputc('\n', stderr);
            }
            fprintf(stderr, "%02x", result.returnData.content[i]);
        }
        fputc('\n', stderr);
        assert(false);
    }
    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 0x10a6b(%rip), %xmm0    # 0x14f10
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x20(%r8)
movaps 0x10a47(%rip), %xmm0    # 0x14f00
movaps %xmm0, 0x10(%r8)
movaps 0x10a2b(%rip), %xmm0    # 0x14ef0
movaps %xmm0, (%r8)
movabsq $-0xca0a6a8dd9fef7f, %rax # imm = 0xF35F595722601081
movq %rax, 0x2d(%r8)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0x28(%rsp), %rbx
leaq 0x1c(%rsp), %rdx
pushq $0x35
popq %rcx
movl $0x41197, %esi          # imm = 0x41197
movq %rbx, %rdi
callq 0xb68f
cmpq $0x420, (%rbx)          # imm = 0x420
jne 0x4544
movq 0x30(%rsp), %rdi
leaq 0x10a1c(%rip), %rsi     # 0x14f30
movl $0x420, %edx            # imm = 0x420
callq 0x30d0
testl %eax, %eax
jne 0x4563
cmpq $0x0, 0x58(%rsp)
jne 0x45e1
xorl %eax, %eax
callq 0xada8
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xcdde(%rip), %rdi      # 0x11329
leaq 0xcafe(%rip), %rsi      # 0x11050
leaq 0xcfe1(%rip), %rcx      # 0x1153a
movl $0x2cb, %edx            # imm = 0x2CB
callq 0x3040
movq 0x16a8e(%rip), %r15     # 0x1aff8
pushq $0xa
popq %rbx
leaq 0x12b10(%rip), %r14     # 0x17084
xorl %r12d, %r12d
cmpq $0x420, %r12            # imm = 0x420
je 0x45b7
testq %r12, %r12
sete %al
testb $0x1f, %r12b
setne %cl
orb %al, %cl
jne 0x459b
movq (%r15), %rsi
movl %ebx, %edi
callq 0x3080
movq (%r15), %rdi
movq 0x30(%rsp), %rax
movzbl (%rax,%r12), %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x30a0
incq %r12
jmp 0x4577
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x3080
leaq 0xcf88(%rip), %rdi      # 0x11551
leaq 0xca80(%rip), %rsi      # 0x11050
leaq 0xcf63(%rip), %rcx      # 0x1153a
movl $0x2d4, %edx            # imm = 0x2D4
callq 0x3040
leaq 0xcb2d(%rip), %rdi      # 0x11115
leaq 0xca61(%rip), %rsi      # 0x11050
leaq 0xcf44(%rip), %rcx      # 0x1153a
movl $0x2d6, %edx            # imm = 0x2D6
callq 0x3040