// File: /workspace/github_c_makefile_star2_O3/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:
testl %ecx, %ecx
je 0xcb32
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
xorl %r8d, %r8d
movzbl (%rdx), %ebx
movl %ebx, %r9d
shll $0x8, %r9d
movzbl 0x1(%rdx), %r10d
orl %r10d, %r9d
cmpl $0x7f, %r9d
ja 0xc9b1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %esi, %r8d
jge 0xcb2b
movslq %r8d, %r10
movzbl (%rdi,%r10), %r10d
cmpl %r10d, %r9d
jne 0xcb2b
incl %r8d
jmp 0xcb1b
movslq %r8d, %r11
cmpb $0x7, %bl
ja 0xca05
leaq 0x1(%r11), %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %esi, %ebx
jge 0xcb2b
movzbl (%rdi,%r11), %r11d
shrl $0x6, %r9d
orl $0xc0, %r9d
cmpl %r11d, %r9d
jne 0xcb2b
movzbl (%rdi,%rbx), %r9d
andl $0x3f, %r10d
orl $0x80, %r10d
cmpl %r9d, %r10d
jne 0xcb2b
addl $0x2, %r8d
jmp 0xcb1b
movl %ebx, %r14d
andb $-0x4, %r14b
cmpb $-0x28, %r14b
jne 0xcac1
leaq 0x3(%r11), %r10
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %esi, %r10d
jge 0xcb2b
movzbl 0x3(%rdx), %ebx
movzbl 0x2(%rdx), %r14d
shll $0x8, %r14d
orl %ebx, %r14d
shll $0xa, %r9d
addl %r14d, %r9d
addl $0xfca02400, %r9d       # imm = 0xFCA02400
movzbl (%rdi,%r11), %r14d
movl %r9d, %r15d
shrl $0x12, %r15d
addl $0xf0, %r15d
cmpl %r14d, %r15d
jne 0xcb2b
movzbl 0x1(%rdi,%r11), %r14d
movl %r9d, %r15d
shrl $0xc, %r15d
andl $0x3f, %r15d
orl $0x80, %r15d
cmpl %r14d, %r15d
jne 0xcb2b
movzbl 0x2(%rdi,%r11), %r11d
shrl $0x6, %r9d
andl $0x3f, %r9d
orl $0x80, %r9d
cmpl %r11d, %r9d
jne 0xcb2b
movzbl (%rdi,%r10), %r9d
andl $0x3f, %ebx
orl $0x80, %ebx
cmpl %r9d, %ebx
jne 0xcb2b
addq $0x2, %rdx
addl $0x4, %r8d
addl $-0x2, %ecx
jmp 0xcb1b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpb $-0x24, %r14b
je 0xcb2b
leaq 0x2(%r11), %r14
cmpl %esi, %r14d
jge 0xcb2b
movzbl (%rdi,%r11), %r15d
shrl $0x4, %ebx
orl $0xe0, %ebx
cmpl %r15d, %ebx
jne 0xcb2b
movzbl 0x1(%rdi,%r11), %r11d
shrl $0x6, %r9d
andl $0x3f, %r9d
orl $0x80, %r9d
cmpl %r11d, %r9d
jne 0xcb2b
movzbl (%rdi,%r14), %r9d
andl $0x3f, %r10d
orl $0x80, %r10d
cmpl %r9d, %r10d
jne 0xcb2b
addl $0x3, %r8d
addq $0x2, %rdx
movl %r8d, %eax
addl $-0x2, %ecx
jne 0xc972
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq