// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/libfort/lib/fort.c
// Function: utf8ncasecmp
int utf8ncasecmp(const void *src1, const void *src2, size_t n)
{
    utf8_int32_t src1_cp, src2_cp, src1_orig_cp, src2_orig_cp;

    do {
        const unsigned char *const s1 = (const unsigned char *)src1;
        const unsigned char *const s2 = (const unsigned char *)src2;

        // first check that we have enough bytes left in n to contain an entire
        // codepoint
        if (0 == n) {
            return 0;
        }

        if ((1 == n) && ((0xc0 == (0xe0 & *s1)) || (0xc0 == (0xe0 & *s2)))) {
            const utf8_int32_t c1 = (0xe0 & *s1);
            const utf8_int32_t c2 = (0xe0 & *s2);

            if (c1 < c2) {
                return -1;
            } else if (c1 > c2) {
                return 1;
            } else {
                return 0;
            }
        }

        if ((2 >= n) && ((0xe0 == (0xf0 & *s1)) || (0xe0 == (0xf0 & *s2)))) {
            const utf8_int32_t c1 = (0xf0 & *s1);
            const utf8_int32_t c2 = (0xf0 & *s2);

            if (c1 < c2) {
                return -1;
            } else if (c1 > c2) {
                return 1;
            } else {
                return 0;
            }
        }

        if ((3 >= n) && ((0xf0 == (0xf8 & *s1)) || (0xf0 == (0xf8 & *s2)))) {
            const utf8_int32_t c1 = (0xf8 & *s1);
            const utf8_int32_t c2 = (0xf8 & *s2);

            if (c1 < c2) {
                return -1;
            } else if (c1 > c2) {
                return 1;
            } else {
                return 0;
            }
        }

        src1 = utf8codepoint(src1, &src1_cp);
        src2 = utf8codepoint(src2, &src2_cp);
        n -= utf8codepointsize(src1_cp);

        // Take a copy of src1 & src2
        src1_orig_cp = src1_cp;
        src2_orig_cp = src2_cp;

        // Lower srcs if required
        src1_cp = utf8lwrcodepoint(src1_cp);
        src2_cp = utf8lwrcodepoint(src2_cp);

        // Check if the lowered codepoints match
        if ((0 == src1_orig_cp) && (0 == src2_orig_cp)) {
            return 0;
        } else if (src1_cp == src2_cp) {
            continue;
        }

        // If they don't match, then we return which of the original's are less
        if (src1_orig_cp < src2_orig_cp) {
            return -1;
        } else if (src1_orig_cp > src2_orig_cp) {
            return 1;
        }
    } while (0 < n);

    // both utf8 strings matched
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
jne 0x11728
movl $0x0, -0x4(%rbp)
jmp 0x11979
movl $0x1, %eax
cmpq -0x20(%rbp), %rax
jne 0x117b1
movq -0x38(%rbp), %rax
movzbl (%rax), %ecx
andl $0xe0, %ecx
movl $0xc0, %eax
cmpl %ecx, %eax
je 0x1175f
movq -0x40(%rbp), %rax
movzbl (%rax), %ecx
andl $0xe0, %ecx
movl $0xc0, %eax
cmpl %ecx, %eax
jne 0x117b1
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
andl $0xe0, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
andl $0xe0, %eax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x11791
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11979
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jle 0x117a5
movl $0x1, -0x4(%rbp)
jmp 0x11979
movl $0x0, -0x4(%rbp)
jmp 0x11979
movl $0x2, %eax
cmpq -0x20(%rbp), %rax
jb 0x1183a
movq -0x38(%rbp), %rax
movzbl (%rax), %ecx
andl $0xf0, %ecx
movl $0xe0, %eax
cmpl %ecx, %eax
je 0x117e8
movq -0x40(%rbp), %rax
movzbl (%rax), %ecx
andl $0xf0, %ecx
movl $0xe0, %eax
cmpl %ecx, %eax
jne 0x1183a
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
andl $0xf0, %eax
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
andl $0xf0, %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0x1181a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11979
movl -0x4c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jle 0x1182e
movl $0x1, -0x4(%rbp)
jmp 0x11979
movl $0x0, -0x4(%rbp)
jmp 0x11979
movl $0x3, %eax
cmpq -0x20(%rbp), %rax
jb 0x118c3
movq -0x38(%rbp), %rax
movzbl (%rax), %ecx
andl $0xf8, %ecx
movl $0xf0, %eax
cmpl %ecx, %eax
je 0x11871
movq -0x40(%rbp), %rax
movzbl (%rax), %ecx
andl $0xf8, %ecx
movl $0xf0, %eax
cmpl %ecx, %eax
jne 0x118c3
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
andl $0xf8, %eax
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
andl $0xf8, %eax
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x118a3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11979
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jle 0x118b7
movl $0x1, -0x4(%rbp)
jmp 0x11979
movl $0x0, -0x4(%rbp)
jmp 0x11979
movq -0x10(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x10440
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x10440
movq %rax, -0x18(%rbp)
movl -0x24(%rbp), %edi
callq 0x11990
movq %rax, %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x24(%rbp), %edi
callq 0x10580
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %edi
callq 0x10580
movl %eax, -0x28(%rbp)
xorl %eax, %eax
cmpl -0x2c(%rbp), %eax
jne 0x11934
xorl %eax, %eax
cmpl -0x30(%rbp), %eax
jne 0x11934
movl $0x0, -0x4(%rbp)
jmp 0x11979
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x1193e
jmp 0x11966
jmp 0x11940
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x11951
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11979
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jle 0x11962
movl $0x1, -0x4(%rbp)
jmp 0x11979
jmp 0x11964
jmp 0x11966
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
jb 0x11704
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)