// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: stbtt__GetCoverageIndex
static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyph)
{
   stbtt_uint16 coverageFormat = ttUSHORT(coverageTable);
   switch (coverageFormat) {
      case 1: {
         stbtt_uint16 glyphCount = ttUSHORT(coverageTable + 2);

         /*  Binary search. */
         stbtt_int32 l=0, r=glyphCount-1, m;
         int straw, needle=glyph;
         while (l <= r) {
            stbtt_uint8 *glyphArray = coverageTable + 4;
            stbtt_uint16 glyphID;
            m = (l + r) >> 1;
            glyphID = ttUSHORT(glyphArray + 2 * m);
            straw = glyphID;
            if (needle < straw)
               r = m - 1;
            else if (needle > straw)
               l = m + 1;
            else {
               return m;
            }
         }
         break;
      }

      case 2: {
         stbtt_uint16 rangeCount = ttUSHORT(coverageTable + 2);
         stbtt_uint8 *rangeArray = coverageTable + 4;

         /*  Binary search. */
         stbtt_int32 l=0, r=rangeCount-1, m;
         int strawStart, strawEnd, needle=glyph;
         while (l <= r) {
            stbtt_uint8 *rangeRecord;
            m = (l + r) >> 1;
            rangeRecord = rangeArray + 6 * m;
            strawStart = ttUSHORT(rangeRecord);
            strawEnd = ttUSHORT(rangeRecord + 2);
            if (needle < strawStart)
               r = m - 1;
            else if (needle > strawEnd)
               l = m + 1;
            else {
               stbtt_uint16 startCoverageIndex = ttUSHORT(rangeRecord + 4);
               return startCoverageIndex + glyph - strawStart;
            }
         }
         break;
      }

      default: return -1; /*  unsupported */
   }

   return -1;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movl %esi, 0x64(%rsp)
movq 0x68(%rsp), %rdi
callq 0x3cf00
movw %ax, 0x62(%rsp)
movzwl 0x62(%rsp), %eax
movl %eax, 0x8(%rsp)
subl $0x1, %eax
je 0x80a9e
jmp 0x80a8c
movl 0x8(%rsp), %eax
subl $0x2, %eax
je 0x80b61
jmp 0x80c52
movq 0x68(%rsp), %rdi
addq $0x2, %rdi
callq 0x3cf00
movw %ax, 0x60(%rsp)
movl $0x0, 0x5c(%rsp)
movzwl 0x60(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x58(%rsp)
movl 0x64(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl 0x5c(%rsp), %eax
cmpl 0x58(%rsp), %eax
jg 0x80b5c
movq 0x68(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x40(%rsp)
movl 0x5c(%rsp), %eax
addl 0x58(%rsp), %eax
sarl %eax
movl %eax, 0x54(%rsp)
movq 0x40(%rsp), %rdi
movl 0x54(%rsp), %eax
shll %eax
cltq
addq %rax, %rdi
callq 0x3cf00
movw %ax, 0x3e(%rsp)
movzwl 0x3e(%rsp), %eax
movl %eax, 0x50(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x80b31
movl 0x54(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x80b57
movl 0x4c(%rsp), %eax
cmpl 0x50(%rsp), %eax
jle 0x80b48
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x80b55
movl 0x54(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x80c64
jmp 0x80b57
jmp 0x80acd
jmp 0x80c5c
movq 0x68(%rsp), %rdi
addq $0x2, %rdi
callq 0x3cf00
movw %ax, 0x3c(%rsp)
movq 0x68(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movzwl 0x3c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x28(%rsp)
movl 0x64(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jg 0x80c50
movl 0x2c(%rsp), %eax
addl 0x28(%rsp), %eax
sarl %eax
movl %eax, 0x24(%rsp)
movq 0x30(%rsp), %rax
imull $0x6, 0x24(%rsp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0x3cf00
movzwl %ax, %eax
movl %eax, 0x20(%rsp)
movq 0x10(%rsp), %rdi
addq $0x2, %rdi
callq 0x3cf00
movzwl %ax, %eax
movl %eax, 0x1c(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x20(%rsp), %eax
jge 0x80c0c
movl 0x24(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x80c4b
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jle 0x80c23
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x80c49
movq 0x10(%rsp), %rdi
addq $0x4, %rdi
callq 0x3cf00
movw %ax, 0xe(%rsp)
movzwl 0xe(%rsp), %eax
addl 0x64(%rsp), %eax
subl 0x20(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x80c64
jmp 0x80c4b
jmp 0x80b9e
jmp 0x80c5c
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x80c64
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax)