// File: /workspace/github_cpp_makefile_star2_O1/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFont::BuildLookupTable()
void ImFont::BuildLookupTable()
{
    int max_codepoint = 0;
    for (int i = 0; i != Glyphs.Size; i++)
        max_codepoint = ImMax(max_codepoint, (int)Glyphs[i].Codepoint);

    IndexXAdvance.clear();
    IndexXAdvance.resize(max_codepoint + 1);
    IndexLookup.clear();
    IndexLookup.resize(max_codepoint + 1);
    for (int i = 0; i < max_codepoint + 1; i++)
    {
        IndexXAdvance[i] = -1.0f;
        IndexLookup[i] = -1;
    }
    for (int i = 0; i < Glyphs.Size; i++)
    {
        int codepoint = (int)Glyphs[i].Codepoint;
        IndexXAdvance[codepoint] = Glyphs[i].XAdvance;
        IndexLookup[codepoint] = i;
    }

    // Create a glyph to handle TAB
    // FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at "column 0" ?)
    if (FindGlyph((unsigned short)' '))
    {
        if (Glyphs.back().Codepoint != '\t')   // So we can call this function multiple times
            Glyphs.resize(Glyphs.Size + 1);
        ImFont::Glyph& tab_glyph = Glyphs.back();
        tab_glyph = *FindGlyph((unsigned short)' ');
        tab_glyph.Codepoint = '\t';
        tab_glyph.XAdvance *= 4;
        IndexXAdvance[(int)tab_glyph.Codepoint] = (float)tab_glyph.XAdvance;
        IndexLookup[(int)tab_glyph.Codepoint] = (int)(Glyphs.Size-1);
    }

    FallbackGlyph = NULL;
    FallbackGlyph = FindGlyph(FallbackChar);
    FallbackXAdvance = FallbackGlyph ? FallbackGlyph->XAdvance : 0.0f;
    for (int i = 0; i < max_codepoint + 1; i++)
        if (IndexXAdvance[i] < 0.0f)
            IndexXAdvance[i] = FallbackXAdvance;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x38(%rdi), %edi
testq %rdi, %rdi
je 0x35633
movq 0x40(%rbx), %rax
xorl %ecx, %ecx
testl %edi, %edi
movl $0x0, %edx
cmovgl %edi, %edx
leal -0x1(%rdi), %esi
shlq $0x3, %rdi
leaq (%rdi,%rdi,4), %rdi
xorl %r8d, %r8d
cmpl %esi, %edx
jbe 0x35986
movzwl (%rax,%rcx), %r12d
cmpl %r12d, %r8d
cmovgl %r8d, %r12d
addq $0x28, %rcx
movl %r12d, %r8d
cmpq %rcx, %rdi
jne 0x35611
jmp 0x35636
xorl %r12d, %r12d
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x3564f
xorl %r14d, %r14d
movq %r14, 0x58(%rbx)
callq 0x9065
movq %r14, 0x60(%rbx)
leal 0x1(%r12), %r15d
movl 0x5c(%rbx), %eax
cmpl %r12d, %eax
jg 0x356b8
testl %eax, %eax
je 0x35672
movl %eax, %r13d
shrl $0x1f, %r13d
addl %eax, %r13d
sarl %r13d
addl %eax, %r13d
jmp 0x35678
movl $0x8, %r13d
cmpl %r15d, %r13d
cmovlel %r15d, %r13d
cmpl %r13d, %eax
jge 0x356b8
movl %r13d, %edi
shlq $0x2, %rdi
callq 0x85d9
movq %rax, %r14
movq 0x60(%rbx), %rsi
movslq 0x58(%rbx), %rdx
shlq $0x2, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x60(%rbx), %rdi
callq 0x9065
movq %r14, 0x60(%rbx)
movl %r13d, 0x5c(%rbx)
movl %r15d, 0x58(%rbx)
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x356d5
xorl %r14d, %r14d
movq %r14, 0x68(%rbx)
callq 0x9065
movq %r14, 0x70(%rbx)
movl 0x6c(%rbx), %eax
cmpl %r12d, %eax
jg 0x35739
testl %eax, %eax
je 0x356f3
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl %eax, %r12d
jmp 0x356f9
movl $0x8, %r12d
cmpl %r15d, %r12d
cmovlel %r15d, %r12d
cmpl %r12d, %eax
jge 0x35739
movl %r12d, %edi
shlq $0x2, %rdi
callq 0x85d9
movq %rax, %r14
movq 0x70(%rbx), %rsi
movslq 0x68(%rbx), %rdx
shlq $0x2, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x70(%rbx), %rdi
callq 0x9065
movq %r14, 0x70(%rbx)
movl %r12d, 0x6c(%rbx)
movl %r15d, 0x68(%rbx)
movq 0x60(%rbx), %rax
movq 0x70(%rbx), %rcx
xorl %edx, %edx
movslq 0x58(%rbx), %rsi
cmpq %rsi, %rdx
jge 0x35958
movl $0xbf800000, (%rax,%rdx,4) # imm = 0xBF800000
movslq 0x68(%rbx), %rsi
cmpq %rsi, %rdx
jge 0x3596f
movl $0xffffffff, (%rcx,%rdx,4) # imm = 0xFFFFFFFF
incq %rdx
cmpq %rdx, %r15
jne 0x35747
cmpl $0x0, 0x38(%rbx)
jle 0x357c6
movq 0x40(%rbx), %rax
movq 0x60(%rbx), %rcx
movq 0x70(%rbx), %rdx
addq $0x4, %rax
xorl %esi, %esi
movzwl -0x4(%rax), %edi
cmpl %edi, 0x58(%rbx)
jle 0x35958
movss (%rax), %xmm0
movl %edi, %r8d
movss %xmm0, (%rcx,%r8,4)
cmpl %edi, 0x68(%rbx)
jle 0x3596f
movl %esi, (%rdx,%r8,4)
incq %rsi
movslq 0x38(%rbx), %rdi
addq $0x28, %rax
cmpq %rdi, %rsi
jl 0x3578f
movq %rbx, %rdi
movl $0x20, %esi
callq 0x35582
testq %rax, %rax
je 0x358f1
movslq 0x38(%rbx), %rcx
testq %rcx, %rcx
jle 0x359a5
movq 0x40(%rbx), %rax
leaq (%rcx,%rcx,4), %rdx
cmpw $0x9, -0x28(%rax,%rdx,8)
je 0x3586c
leal 0x1(%rcx), %r12d
movl 0x3c(%rbx), %eax
cmpl %ecx, %eax
jg 0x35868
testl %eax, %eax
je 0x3581a
movl %eax, %r13d
shrl $0x1f, %r13d
addl %eax, %r13d
sarl %r13d
addl %eax, %r13d
jmp 0x35820
movl $0x8, %r13d
cmpl %r12d, %r13d
cmovlel %r12d, %r13d
cmpl %r13d, %eax
jge 0x35868
movl %r13d, %eax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdi
callq 0x85d9
movq %rax, %r14
movq 0x40(%rbx), %rsi
movslq 0x38(%rbx), %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdx
movq %r14, %rdi
callq 0x7080
movq 0x40(%rbx), %rdi
callq 0x9065
movq %r14, 0x40(%rbx)
movl %r13d, 0x3c(%rbx)
movl %r12d, 0x38(%rbx)
movslq 0x38(%rbx), %rax
testq %rax, %rax
jle 0x359a5
movq 0x40(%rbx), %r14
leaq (%rax,%rax,4), %r12
movq %rbx, %rdi
movl $0x20, %esi
callq 0x35582
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm0, -0x28(%r14,%r12,8)
movups %xmm1, -0x18(%r14,%r12,8)
movq 0x20(%rax), %rax
movq %rax, -0x8(%r14,%r12,8)
movw $0x9, -0x28(%r14,%r12,8)
movss -0x24(%r14,%r12,8), %xmm0
mulss 0x7ae3(%rip), %xmm0     # 0x3d3a4
movss %xmm0, -0x24(%r14,%r12,8)
cmpl $0x9, 0x58(%rbx)
jle 0x35958
movq 0x60(%rbx), %rax
movss %xmm0, 0x24(%rax)
cmpl $0x9, 0x68(%rbx)
jle 0x3596f
movl 0x38(%rbx), %eax
decl %eax
movq 0x70(%rbx), %rcx
movl %eax, 0x24(%rcx)
movq $0x0, 0x48(%rbx)
movzwl 0x10(%rbx), %esi
movq %rbx, %rdi
callq 0x35582
movq %rax, 0x48(%rbx)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
testq %rax, %rax
je 0x35919
movss 0x4(%rax), %xmm1
movss %xmm1, 0x50(%rbx)
movl 0x58(%rbx), %eax
movq 0x60(%rbx), %rcx
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
cmpq %rdx, %rax
je 0x35958
ucomiss (%rcx,%rdx,4), %xmm0
jbe 0x35941
movss 0x50(%rbx), %xmm1
movss %xmm1, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %r15
jne 0x3592c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9451(%rip), %rdi      # 0x3edb0
leaq 0x912d(%rip), %rsi      # 0x3ea93
leaq 0x9db4(%rip), %rcx      # 0x3f721
jmp 0x3599b
leaq 0x943a(%rip), %rdi      # 0x3edb0
leaq 0x9116(%rip), %rsi      # 0x3ea93
leaq 0x11ba8(%rip), %rcx     # 0x4752c
jmp 0x3599b
leaq 0x9423(%rip), %rdi      # 0x3edb0
leaq 0x90ff(%rip), %rsi      # 0x3ea93
leaq 0x11b48(%rip), %rcx     # 0x474e3
movl $0x31c, %edx            # imm = 0x31C
callq 0x7140
leaq 0x11209(%rip), %rdi     # 0x46bb5
leaq 0x90e0(%rip), %rsi      # 0x3ea93
leaq 0x11ae9(%rip), %rcx     # 0x474a3
movl $0x326, %edx            # imm = 0x326
callq 0x7140