// File: /workspace/github_c_makefile_star2_O2/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, %r9d
movq %rdi, %rbx
movl %esi, %eax
movzwl 0x2(%rdi,%rax), %ecx
movzwl 0x4(%rdi,%rax), %eax
rolw $0x8, %cx
movzwl %cx, %ecx
rolw $0x8, %ax
movzwl %ax, %eax
addl %esi, %eax
addl $0x6, %r9d
cltq
addq %rdi, %rax
movq %rax, -0x58(%rbp)
movq %rcx, -0x60(%rbp)
movq %rcx, %rdi
negq %rdi
pushq $0x1
popq %r15
movl %r8d, -0x34(%rbp)
movq %rdi, -0x50(%rbp)
leaq (%rdi,%r15), %rax
cmpq $0x1, %rax
je 0xbba6
movl %r9d, %r14d
movzwl 0x6(%rbx,%r14), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %r8d, %eax
jne 0xbb9a
movzwl (%rbx,%r14), %r13d
movzwl 0x2(%rbx,%r14), %r12d
rolw $0x8, %r13w
rolw $0x8, %r12w
movzwl 0x4(%rbx,%r14), %eax
movw %ax, -0x2e(%rbp)
testw %r13w, %r13w
je 0xba9c
cmpw $0x1, %r12w
sete %al
cmpw $0xa, %r12w
sete %cl
cmpw $0x3, %r13w
jne 0xbb9a
orb %cl, %al
je 0xbb9a
movzwl 0x8(%rbx,%r14), %eax
movzwl 0xa(%rbx,%r14), %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
movl %r9d, -0x38(%rbp)
callq 0xbbbc
movq -0x50(%rbp), %rdi
movl -0x38(%rbp), %r9d
movl -0x34(%rbp), %r8d
testl %eax, %eax
js 0xbb9a
cmpq -0x60(%rbp), %r15
jae 0xbb95
movzwl 0x12(%rbx,%r14), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
cmpl -0x44(%rbp), %ecx
jne 0xbb95
movzwl 0xc(%rbx,%r14), %ecx
rolw $0x8, %cx
cmpw %r13w, %cx
jne 0xbb95
movzwl 0xe(%rbx,%r14), %ecx
rolw $0x8, %cx
cmpw %r12w, %cx
jne 0xbb95
movzwl -0x2e(%rbp), %edx
rolw $0x8, %dx
movzwl 0x10(%rbx,%r14), %ecx
rolw $0x8, %cx
cmpw %dx, %cx
jne 0xbb95
movzwl 0x14(%rbx,%r14), %ecx
rolw $0x8, %cx
testw %cx, %cx
je 0xbb95
cmpl -0x2c(%rbp), %eax
jge 0xbb9a
movl %eax, %esi
movq -0x40(%rbp), %rdx
cmpb $0x20, (%rdx,%rsi)
jne 0xbb9a
movzwl 0x16(%rbx,%r14), %edx
movzwl %cx, %ecx
rolw $0x8, %dx
movzwl %dx, %edx
movq -0x40(%rbp), %rdi
addq %rsi, %rdi
incq %rdi
notl %eax
addl -0x2c(%rbp), %eax
addq -0x58(%rbp), %rdx
movl %eax, %esi
callq 0x8efd
movq -0x50(%rbp), %rdi
movl -0x38(%rbp), %r9d
movl -0x34(%rbp), %r8d
testl %eax, %eax
je 0xbb9a
jmp 0xbbb7
cmpl -0x2c(%rbp), %eax
je 0xbbb7
addl $0xc, %r9d
incq %r15
jmp 0xba2d
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rax
jmp 0xbba8