// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
xorl %eax, %eax
callq 0xca4d
movq $-0x2, %r14
leaq 0x20(%rsp), %r15
leaq 0xeb38(%rip), %r12      # 0x14070
movq 0x18ab9(%rip), %r13     # 0x1dff8
leaq 0x11b97(%rip), %rbx     # 0x170dd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x556d
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x5561
addb $-0x57, %cl
jmp 0x556b
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x55ab
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x5592
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x5586
addb $-0x57, %cl
jmp 0x5590
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x55c0
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x5546
jmp 0x55d4
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x556d
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x5592
movaps 0x12995(%rip), %xmm0    # 0x17f70
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x20(%r8)
movaps 0x12971(%rip), %xmm0    # 0x17f60
movaps %xmm0, 0x10(%r8)
movaps 0x12955(%rip), %xmm0    # 0x17f50
movaps %xmm0, (%r8)
movabsq $-0xca0a6a8dd9fef7f, %rax # imm = 0xF35F595722601081
movq %rax, 0x2d(%r8)
movl 0x30(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x40(%rsp), %rbx
leaq 0x34(%rsp), %rdx
movl $0x41197, %esi          # imm = 0x41197
movl $0x35, %ecx
movq %rbx, %rdi
callq 0xd683
cmpq $0x420, (%rbx)          # imm = 0x420
jne 0x567e
movq 0x48(%rsp), %rdi
leaq 0x12941(%rip), %rsi     # 0x17f90
movl $0x420, %edx            # imm = 0x420
callq 0x30d0
testl %eax, %eax
jne 0x569d
cmpq $0x0, 0x70(%rsp)
jne 0x56a7
xorl %eax, %eax
callq 0xcd49
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xed10(%rip), %rdi      # 0x14395
leaq 0xea30(%rip), %rsi      # 0x140bc
leaq 0xef13(%rip), %rcx      # 0x145a6
movl $0x2cb, %edx            # imm = 0x2CB
callq 0x3040
leaq 0x48(%rsp), %rdi
callq 0x3266
leaq 0xead3(%rip), %rdi      # 0x14181
leaq 0xea07(%rip), %rsi      # 0x140bc
leaq 0xeeea(%rip), %rcx      # 0x145a6
movl $0x2d6, %edx            # imm = 0x2D6
callq 0x3040