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

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

    // 600460090559527ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc600905595260047ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70559527ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70559527f40000000000000000000000000000000000000000000000000000000000000007f80000000000000000000000000000000000000000000000000000000000000000559527f40000000000000000000000000000000000000000000000000000000000000007fc0000000000000000000000000000000000000000000000000000000000000000559527fc0000000000000000000000000000000000000000000000000000000000000007f8000000000000000000000000000000000000000000000000000000000000000055952595ff3
    op_t program[] = {
        PUSH1, 4, PUSH1, 9, SDIV, MSIZE, MSTORE,
        PUSH32,
        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, 0xfc,
        PUSH1, 9, SDIV, MSIZE, MSTORE,
        PUSH1, 4,
        PUSH32,
        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, 0xf7,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        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, 0xfc,
        PUSH32,
        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, 0xf7,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        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,
        PUSH32,
        0x80, 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,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        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,
        PUSH32,
        0xc0, 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,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        0xc0, 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,
        PUSH32,
        0x80, 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,
        SDIV, MSIZE, MSTORE,
        MSIZE, PUSH0, RETURN
    };
    input.size = sizeof(program);
    input.content = program;

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

    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, 0x02,
        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, 0xfe,
        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, 0xfe,
        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, 0x02,
        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, 0xfe,
        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, 0xff,
        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, 0x02,
    };
    assert(result.returnData.size == sizeof(expected));
    for (size_t i = 0; i < result.returnData.size; i+=32) {
        if (memcmp(result.returnData.content+i, expected+i, 32)) {
            fprintf(stderr, "%zu:\n< ", i);
            for (size_t j = i; j < i + 32; j++) {
                fprintf(stderr, "%02x", result.returnData.content[j]);
            }
            fputs("\n> ", stderr);
            for (size_t j = i; j < i + 32; j++) {
                fprintf(stderr, "%02x", expected[j]);
            }
            fputc('\n', stderr);
        }
    }
    assert(memcmp(result.returnData.content, expected, sizeof(expected)) == 0);
    assert(result.gasRemaining == 0);

    evmFinalize();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
xorl %eax, %eax
callq 0xca7b
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xf69e(%rip), %r12      # 0x14050
movq 0x1963f(%rip), %r13     # 0x1dff8
leaq 0x126fd(%rip), %rbx     # 0x170bd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x49e7
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x49db
addb $-0x57, %cl
jmp 0x49e5
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x4a25
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x4a0c
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x4a00
addb $-0x57, %cl
jmp 0x4a0a
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x4a3a
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x49c0
jmp 0x4a4e
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x49e7
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x4a0c
leaq 0x12b9b(%rip), %rsi     # 0x175f0
leaq 0x80(%rsp), %rbx
movl $0x16a, %edx            # imm = 0x16A
movq %rbx, %rdi
callq 0x30b0
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movdqu 0x18(%rsp), %xmm0
movdqu %xmm0, (%rsp)
leaq 0x30(%rsp), %r14
leaq 0x74(%rsp), %rdx
movl $0x18c91, %esi          # imm = 0x18C91
movl $0x16a, %ecx            # imm = 0x16A
movq %r14, %rdi
movq %rbx, %r8
callq 0xd845
cmpq $0xe0, (%r14)
jne 0x4b4b
cmpq $0x0, 0x30(%rsp)
je 0x4b10
leaq 0x38(%rsp), %rbx
xorl %r14d, %r14d
leaq 0x12ca0(%rip), %r15     # 0x17760
movq 0x38(%rsp), %rax
movdqu (%rax,%r14), %xmm0
movdqu 0x10(%rax,%r14), %xmm1
movdqu (%r14,%r15), %xmm2
pcmpeqb %xmm0, %xmm2
movdqu 0x10(%r14,%r15), %xmm0
pcmpeqb %xmm1, %xmm0
pand %xmm2, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x4b03
addq $0x20, %r14
cmpq 0x30(%rsp), %r14
jb 0x4ac0
jmp 0x4b10
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3100
jmp 0x4af6
movq 0x38(%rsp), %rdi
leaq 0x12c44(%rip), %rsi     # 0x17760
movl $0xe0, %edx
callq 0x30d0
testl %eax, %eax
jne 0x4b6a
cmpq $0x0, 0x60(%rsp)
jne 0x4b89
xorl %eax, %eax
callq 0xcf29
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf823(%rip), %rdi      # 0x14375
leaq 0xf543(%rip), %rsi      # 0x1409c
leaq 0xf958(%rip), %rcx      # 0x144b8
movl $0x197, %edx            # imm = 0x197
callq 0x3040
leaq 0xf83f(%rip), %rdi      # 0x143b0
leaq 0xf524(%rip), %rsi      # 0x1409c
leaq 0xf939(%rip), %rcx      # 0x144b8
movl $0x1a5, %edx            # imm = 0x1A5
callq 0x3040
leaq 0xf5d1(%rip), %rdi      # 0x14161
leaq 0xf505(%rip), %rsi      # 0x1409c
leaq 0xf91a(%rip), %rcx      # 0x144b8
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x3040