// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__CompareUTF8toUTF16_bigendian_prefix
static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2) 
{
   stbtt_int32 i=0;

   // convert utf16 to utf8 and compare the results while converting
   while (len2) {
      stbtt_uint16 ch = s2[0]*256 + s2[1];
      if (ch < 0x80) {
         if (i >= len1) return -1;
         if (s1[i++] != ch) return -1;
      } else if (ch < 0x800) {
         if (i+1 >= len1) return -1;
         if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
         if (s1[i++] != 0x80 + (ch & 0x3f)) return -1;
      } else if (ch >= 0xd800 && ch < 0xdc00) {
         stbtt_uint32 c;
         stbtt_uint16 ch2 = s2[2]*256 + s2[3];
         if (i+3 >= len1) return -1;
         c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
         if (s1[i++] != 0xf0 + (c >> 18)) return -1;
         if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
         if (s1[i++] != 0x80 + ((c >>  6) & 0x3f)) return -1;
         if (s1[i++] != 0x80 + ((c      ) & 0x3f)) return -1;
         s2 += 2; // plus another 2 below
         len2 -= 2;
      } else if (ch >= 0xdc00 && ch < 0xe000) {
         return -1;
      } else {
         if (i+2 >= len1) return -1;
         if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
         if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
         if (s1[i++] != 0x80 + ((ch     ) & 0x3f)) return -1;
      }
      s2 += 2;
      len2 -= 2;
   }
   return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
xorl %eax, %eax
testl %ecx, %ecx
je 0xcf6b
movzbl (%rdx), %ebx
movl %ebx, %r9d
shll $0x8, %r9d
movzbl 0x1(%rdx), %r11d
orl %r11d, %r9d
cmpl $0x7f, %r9d
ja 0xcdb4
cmpl %esi, %eax
jge 0xcdf9
movslq %eax, %r8
incl %eax
movzbl (%rdi,%r8), %r8d
cmpl %r8d, %r9d
jne 0xcdf9
jmp 0xcf53
movslq %eax, %r10
cmpb $0x7, %bl
ja 0xce01
leaq 0x1(%r10), %rbx
cmpl %esi, %ebx
jge 0xcdf9
movzbl (%rdi,%r10), %r8d
shrl $0x6, %r9d
orl $0xc0, %r9d
cmpl %r8d, %r9d
jne 0xcf1e
addl $0x2, %eax
movzbl (%rdi,%rbx), %r8d
andl $0x3f, %r11d
orl $0x80, %r11d
cmpl %r8d, %r11d
je 0xcf53
xorl %r8d, %r8d
jmp 0xcf5d
movl %ebx, %r14d
andb $-0x4, %r14b
cmpb $-0x28, %r14b
jne 0xcec3
leaq 0x3(%r10), %r8
cmpl %esi, %r8d
jge 0xcf19
movzbl 0x3(%rdx), %r11d
movzbl 0x2(%rdx), %ebx
shll $0x8, %ebx
orl %r11d, %ebx
shll $0xa, %r9d
addl %ebx, %r9d
addl $0xfca02400, %r9d       # imm = 0xFCA02400
leaq 0x1(%r10), %rbx
movzbl (%rdi,%r10), %r14d
movl %r9d, %r15d
shrl $0x12, %r15d
addl $0xf0, %r15d
cmpl %r14d, %r15d
jne 0xcf25
addq $0x2, %r10
movzbl (%rdi,%rbx), %ebx
movl %r9d, %r14d
shrl $0xc, %r14d
andl $0x3f, %r14d
orl $0x80, %r14d
cmpl %ebx, %r14d
jne 0xcf34
movzbl (%rdi,%r10), %r10d
shrl $0x6, %r9d
andl $0x3f, %r9d
orl $0x80, %r9d
cmpl %r10d, %r9d
jne 0xcf44
addl $0x4, %eax
movzbl (%rdi,%r8), %r8d
andl $0x3f, %r11d
orl $0x80, %r11d
cmpl %r8d, %r11d
jne 0xcf19
addq $0x2, %rdx
addl $-0x2, %ecx
movb $0x1, %r9b
jmp 0xcf4a
xorl %r8d, %r8d
cmpb $-0x24, %r14b
je 0xcf5d
leaq 0x2(%r10), %r14
cmpl %esi, %r14d
jge 0xcf5d
movzbl (%rdi,%r10), %r8d
incq %r10
shrl $0x4, %ebx
orl $0xe0, %ebx
cmpl %r8d, %ebx
jne 0xcf2c
movzbl (%rdi,%r10), %r8d
shrl $0x6, %r9d
andl $0x3f, %r9d
orl $0x80, %r9d
cmpl %r8d, %r9d
jne 0xcf3c
addl $0x3, %eax
movzbl (%rdi,%r14), %r8d
jmp 0xcde5
xorl %r9d, %r9d
jmp 0xcf4a
xorl %r8d, %r8d
movl %ebx, %eax
jmp 0xcf5d
xorl %r9d, %r9d
movl %ebx, %eax
jmp 0xcf4a
xorl %r8d, %r8d
movl %r10d, %eax
jmp 0xcf5d
xorl %r9d, %r9d
movl %r10d, %eax
jmp 0xcf4a
xorl %r8d, %r8d
movl %r14d, %eax
jmp 0xcf5d
xorl %r9d, %r9d
movl %r8d, %eax
testb %r9b, %r9b
je 0xcdf9
addq $0x2, %rdx
addl $-0x2, %ecx
movb $0x1, %r8b
testb %r8b, %r8b
jne 0xcd7c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
popq %rbp
retq