// File: /workspace/github_c_makefile_star2_O3/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__matchpair
static int stbtt__matchpair(stbtt_uint8 *fc, stbtt_uint32 nm, stbtt_uint8 *name, stbtt_int32 nlen, stbtt_int32 target_id, stbtt_int32 next_id)
{
   stbtt_int32 i;
   stbtt_int32 count = ttUSHORT(fc+nm+2);
   stbtt_int32 stringOffset = nm + ttUSHORT(fc+nm+4);

   for (i=0; i < count; ++i) {
      stbtt_uint32 loc = nm + 6 + 12 * i;
      stbtt_int32 id = ttUSHORT(fc+loc+6);
      if (id == target_id) {
         // find the encoding
         stbtt_int32 platform = ttUSHORT(fc+loc+0), encoding = ttUSHORT(fc+loc+2), language = ttUSHORT(fc+loc+4);

         // is this a Unicode encoding?
         if (platform == 0 || (platform == 3 && encoding == 1) || (platform == 3 && encoding == 10)) {
            stbtt_int32 slen = ttUSHORT(fc+loc+8);
            stbtt_int32 off = ttUSHORT(fc+loc+10);

            // check if there's a prefix match
            stbtt_int32 matchlen = stbtt__CompareUTF8toUTF16_bigendian_prefix(name, nlen, fc+stringOffset+off,slen);
            if (matchlen >= 0) {
               // check for target_id+1 immediately following, with same encoding & language
               if (i+1 < count && ttUSHORT(fc+loc+12+6) == next_id && ttUSHORT(fc+loc+12) == platform && ttUSHORT(fc+loc+12+2) == encoding && ttUSHORT(fc+loc+12+4) == language) {
                  slen = ttUSHORT(fc+loc+12+8);
                  off = ttUSHORT(fc+loc+12+10);
                  if (slen == 0) {
                     if (matchlen == nlen)
                        return 1;
                  } else if (matchlen < nlen && name[matchlen] == ' ') {
                     ++matchlen;
                     if (stbtt_CompareUTF8toUTF16_bigendian_internal((char*) (name+matchlen), nlen-matchlen, (char*)(fc+stringOffset+off),slen))
                        return 1;
                  }
               } else {
                  // if nothing immediately following
                  if (matchlen == nlen)
                     return 1;
               }
            }
         }

         // @TODO handle other encodings
      }
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, -0x44(%rbp)
movl %ecx, -0x2c(%rbp)
movq %rdx, -0x40(%rbp)
movl %esi, %edx
movzwl 0x2(%rdi,%rdx), %ecx
rolw $0x8, %cx
xorl %eax, %eax
testw %cx, %cx
je 0xc948
movl %esi, %ebx
movq %rdi, %r14
movzwl %cx, %ecx
movzwl 0x4(%rdi,%rdx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
addl %esi, %eax
addl $0x6, %ebx
cltq
addq %rdi, %rax
movq %rax, -0x58(%rbp)
movl %ecx, %eax
movq %rax, -0x60(%rbp)
movq %rax, %rdx
negq %rdx
movl $0x1, %r15d
movl %r8d, -0x34(%rbp)
movq %rdx, -0x50(%rbp)
movl %ebx, %ebx
movzwl 0x6(%r14,%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %r8d, %eax
jne 0xc92f
movzwl (%r14,%rbx), %r13d
movzwl 0x2(%r14,%rbx), %r12d
rolw $0x8, %r13w
rolw $0x8, %r12w
movzwl 0x4(%r14,%rbx), %eax
movw %ax, -0x2e(%rbp)
testw %r13w, %r13w
je 0xc82f
cmpw $0x1, %r12w
sete %al
cmpw $0xa, %r12w
sete %cl
cmpw $0x3, %r13w
jne 0xc92f
orb %cl, %al
je 0xc92f
movzwl 0x8(%r14,%rbx), %eax
movzwl 0xa(%r14,%rbx), %edx
rolw $0x8, %ax
movzwl %ax, %ecx
rolw $0x8, %dx
movzwl %dx, %edx
addq -0x58(%rbp), %rdx
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xc95e
movq -0x50(%rbp), %rdx
movl -0x34(%rbp), %r8d
testl %eax, %eax
js 0xc92f
movl %eax, %r9d
cmpq -0x60(%rbp), %r15
jae 0xc929
movzwl 0x12(%r14,%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl -0x44(%rbp), %eax
jne 0xc929
movzwl 0xc(%r14,%rbx), %eax
rolw $0x8, %ax
cmpw %r13w, %ax
jne 0xc929
movzwl 0xe(%r14,%rbx), %eax
rolw $0x8, %ax
cmpw %r12w, %ax
jne 0xc929
movzwl -0x2e(%rbp), %ecx
rolw $0x8, %cx
movzwl 0x10(%r14,%rbx), %eax
rolw $0x8, %ax
cmpw %cx, %ax
jne 0xc929
movzwl 0x14(%r14,%rbx), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0xc929
cmpl -0x2c(%rbp), %r9d
jge 0xc92f
movl %r9d, %esi
movq -0x40(%rbp), %rcx
cmpb $0x20, (%rcx,%rsi)
jne 0xc92f
movzwl 0x16(%r14,%rbx), %edx
movzwl %ax, %ecx
rolw $0x8, %dx
movzwl %dx, %edx
movq -0x40(%rbp), %rax
leaq (%rsi,%rax), %rdi
incq %rdi
notl %r9d
addl -0x2c(%rbp), %r9d
addq -0x58(%rbp), %rdx
movl %r9d, %esi
movl %r9d, %r12d
callq 0xc95e
movq -0x50(%rbp), %rdx
movl -0x34(%rbp), %r8d
cmpl %r12d, %eax
jne 0xc92f
jmp 0xc957
cmpl -0x2c(%rbp), %r9d
je 0xc957
addl $0xc, %ebx
leaq (%rdx,%r15), %rax
incq %rax
incq %r15
cmpq $0x1, %rax
jne 0xc7cf
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0xc948