// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x500, %rsp            # imm = 0x500
movb $0x0, %al
callq 0xcfc0
leaq -0x18(%rbp), %rdi
leaq 0x165c7(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0x41197, -0x20(%rbp)   # imm = 0x41197
leaq -0x80(%rbp), %rdi
leaq 0x1a497(%rip), %rsi     # 0x1eef0
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
leaq -0x4e0(%rbp), %rdi
leaq 0x1a478(%rip), %rsi     # 0x1ef30
movl $0x420, %edx            # imm = 0x420
callq 0x30c0
cmpq $0x420, -0xc0(%rbp) # imm = 0x420
jne 0x4ad1
jmp 0x4af0
leaq 0x16851(%rip), %rdi     # 0x1b329
leaq 0x16571(%rip), %rsi     # 0x1b050
movl $0x2cb, %edx            # imm = 0x2CB
leaq 0x16a4f(%rip), %rcx     # 0x1b53a
callq 0x3040
movq -0xb8(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
movl $0x420, %edx            # imm = 0x420
callq 0x3090
cmpl $0x0, %eax
je 0x4bc9
movq $0x0, -0x4e8(%rbp)
cmpq $0x420, -0x4e8(%rbp) # imm = 0x420
jae 0x4b96
cmpq $0x0, -0x4e8(%rbp)
je 0x4b58
movq -0x4e8(%rbp), %rax
andq $0x1f, %rax
cmpq $0x0, %rax
jne 0x4b58
movq 0x204ad(%rip), %rax     # 0x24ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x3080
movq 0x20499(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0xb8(%rbp), %rax
movq -0x4e8(%rbp), %rcx
movzbl (%rax,%rcx), %edx
leaq 0x1c619(%rip), %rsi     # 0x21194
movb $0x0, %al
callq 0x30b0
movq -0x4e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4e8(%rbp)
jmp 0x4b1c
movq 0x2045b(%rip), %rax     # 0x24ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x3080
leaq 0x169a0(%rip), %rdi     # 0x1b551
leaq 0x16498(%rip), %rsi     # 0x1b050
movl $0x2d4, %edx            # imm = 0x2D4
leaq 0x16976(%rip), %rcx     # 0x1b53a
callq 0x3040
cmpq $0x0, -0x90(%rbp)
jne 0x4bd5
jmp 0x4bf4
leaq 0x16539(%rip), %rdi     # 0x1b115
leaq 0x1646d(%rip), %rsi     # 0x1b050
movl $0x2d6, %edx            # imm = 0x2D6
leaq 0x1694b(%rip), %rcx     # 0x1b53a
callq 0x3040
movb $0x0, %al
callq 0xd4d0
addq $0x500, %rsp            # imm = 0x500
popq %rbp
retq
nopw %cs:(%rax,%rax)