// File: /workspace/github_c_makefile_star2_O1/ggerganov[P]font-rasterizer/./stb_truetype.h
// Function: stbtt__GetGlyphClass
static stbtt_int32  stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph)
{
    stbtt_uint16 classDefFormat = ttUSHORT(classDefTable);
    switch(classDefFormat)
    {
        case 1: {
            stbtt_uint16 startGlyphID = ttUSHORT(classDefTable + 2);
            stbtt_uint16 glyphCount = ttUSHORT(classDefTable + 4);
            stbtt_uint8 *classDef1ValueArray = classDefTable + 6;

            if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount)
                return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID));

            classDefTable = classDef1ValueArray + 2 * glyphCount;
        } break;

        case 2: {
            stbtt_uint16 classRangeCount = ttUSHORT(classDefTable + 2);
            stbtt_uint8 *classRangeRecords = classDefTable + 4;

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

            classDefTable = classRangeRecords + 6 * classRangeCount;
        } break;

        default: {
            // There are no other cases.
            STBTT_assert(0);
        } break;
    }

    return -1;
}

// Assembly:
movzwl (%rdi), %eax
rolw $0x8, %ax
cmpw $0x2, %ax
je 0xc1ef
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0xc2ad
movzwl 0x2(%rdi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movb $0x1, %cl
movl %esi, %edx
subl %eax, %edx
jge 0xc280
jmp 0xc2a7
movzwl 0x2(%rdi), %eax
rolw $0x8, %ax
movzwl %ax, %r8d
decl %r8d
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r8d, %edx
cmpl %r8d, %r9d
jg 0xc276
leal (%rcx,%rdx), %r8d
sarl %r8d
movslq %r8d, %r9
addq %r9, %r9
leaq (%r9,%r9,2), %r9
movzwl 0x4(%rdi,%r9), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
cmpl %esi, %r10d
jle 0xc239
decl %r8d
movb $0x1, %r10b
jmp 0xc26e
movzwl 0x6(%rdi,%r9), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
cmpl %esi, %r10d
jge 0xc25b
movl %r8d, %r9d
incl %r9d
movb $0x1, %r10b
movl %edx, %r8d
jmp 0xc271
movzwl 0x8(%rdi,%r9), %eax
rolw $0x8, %ax
movzwl %ax, %eax
xorl %r10d, %r10d
movl %edx, %r8d
movl %ecx, %r9d
testb %r10b, %r10b
jne 0xc201
cmpl %edx, %ecx
jle 0xc27f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movzwl 0x4(%rdi), %r8d
rolw $0x8, %r8w
movzwl %r8w, %r8d
addl %eax, %r8d
cmpl %esi, %r8d
jle 0xc2a7
movslq %edx, %rax
movzwl 0x6(%rdi,%rax,2), %eax
rolw $0x8, %ax
movzwl %ax, %eax
xorl %ecx, %ecx
testb %cl, %cl
jne 0xc27a
jmp 0xc27f
pushq %rbp
movq %rsp, %rbp
leaq 0x2aae(%rip), %rdi      # 0xed66
leaq 0x29a9(%rip), %rsi      # 0xec68
leaq 0x2ffa(%rip), %rcx      # 0xf2c0
movl $0x95f, %edx            # imm = 0x95F
callq 0x10c0