// File: /workspace/github_c_makefile_star2_O3/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 0xca4d
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xf659(%rip), %r12      # 0x14070
movq 0x195da(%rip), %r13     # 0x1dff8
leaq 0x126b8(%rip), %rbx     # 0x170dd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x4a4c
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x4a40
addb $-0x57, %cl
jmp 0x4a4a
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x4a8a
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x4a71
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x4a65
addb $-0x57, %cl
jmp 0x4a6f
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x4a9f
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x4a25
jmp 0x4ab3
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x4a4c
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x4a71
leaq 0x12b56(%rip), %rsi     # 0x17610
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 0xd683
cmpq $0xe0, (%r14)
jne 0x4bf7
movl $0xe0, %eax
leaq 0x38(%rsp), %rbx
leaq 0x12c61(%rip), %rbp     # 0x17780
leaq 0xf9c3(%rip), %r14      # 0x144e9
xorl %r15d, %r15d
movq 0x38(%rsp), %rcx
movdqu (%rcx,%r15), %xmm0
movdqu 0x10(%rcx,%r15), %xmm1
movdqu (%r15,%rbp), %xmm2
pcmpeqb %xmm0, %xmm2
movdqu 0x10(%r15,%rbp), %xmm0
pcmpeqb %xmm1, %xmm0
pand %xmm2, %xmm0
pmovmskb %xmm0, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
jne 0x4b6e
addq $0x20, %r15
movq %r15, %r12
cmpq %rax, %r12
jb 0x4b29
jmp 0x4bbc
movq (%r13), %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x30a0
leaq 0x20(%r15), %r12
cmpq $-0x20, %r15
jae 0x4b9f
setb %al
movzbl %al, %ecx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x311c
jmp 0x4ba4
callq 0x3100
movq (%r13), %rsi
movl $0xa, %edi
callq 0x3080
movq 0x30(%rsp), %rax
movq %r12, %r15
jmp 0x4b67
movq 0x38(%rsp), %rdi
leaq 0x12bb8(%rip), %rsi     # 0x17780
movl $0xe0, %edx
callq 0x30d0
testl %eax, %eax
jne 0x4c16
cmpq $0x0, 0x60(%rsp)
jne 0x4c35
xorl %eax, %eax
callq 0xcd49
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf797(%rip), %rdi      # 0x14395
leaq 0xf4b7(%rip), %rsi      # 0x140bc
leaq 0xf8cc(%rip), %rcx      # 0x144d8
movl $0x197, %edx            # imm = 0x197
callq 0x3040
leaq 0xf7b3(%rip), %rdi      # 0x143d0
leaq 0xf498(%rip), %rsi      # 0x140bc
leaq 0xf8ad(%rip), %rcx      # 0x144d8
movl $0x1a5, %edx            # imm = 0x1A5
callq 0x3040
leaq 0xf545(%rip), %rdi      # 0x14181
leaq 0xf479(%rip), %rsi      # 0x140bc
leaq 0xf88e(%rip), %rcx      # 0x144d8
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x3040