// File: /workspace/github_c_makefile_star2_O1/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 0xca7b
movq $-0x2, %r14
leaq 0x20(%rsp), %r15
leaq 0xec0b(%rip), %r12      # 0x14050
movq 0x18bac(%rip), %r13     # 0x1dff8
leaq 0x11c6a(%rip), %rbx     # 0x170bd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x547a
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x546e
addb $-0x57, %cl
jmp 0x5478
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x54b8
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x549f
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x5493
addb $-0x57, %cl
jmp 0x549d
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x54cd
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x5453
jmp 0x54e1
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x547a
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x549f
movaps 0x12a68(%rip), %xmm0    # 0x17f50
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x20(%r8)
movaps 0x12a44(%rip), %xmm0    # 0x17f40
movaps %xmm0, 0x10(%r8)
movaps 0x12a28(%rip), %xmm0    # 0x17f30
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 0xd845
cmpq $0x420, (%rbx)          # imm = 0x420
jne 0x558b
movq 0x48(%rsp), %rdi
leaq 0x12a14(%rip), %rsi     # 0x17f70
movl $0x420, %edx            # imm = 0x420
callq 0x30d0
testl %eax, %eax
jne 0x55aa
cmpq $0x0, 0x70(%rsp)
jne 0x55b4
xorl %eax, %eax
callq 0xcf29
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xede3(%rip), %rdi      # 0x14375
leaq 0xeb03(%rip), %rsi      # 0x1409c
leaq 0xefe6(%rip), %rcx      # 0x14586
movl $0x2cb, %edx            # imm = 0x2CB
callq 0x3040
leaq 0x48(%rsp), %rdi
callq 0x3270
leaq 0xeba6(%rip), %rdi      # 0x14161
leaq 0xeada(%rip), %rsi      # 0x1409c
leaq 0xefbd(%rip), %rcx      # 0x14586
movl $0x2d6, %edx            # imm = 0x2D6
callq 0x3040