// File: /workspace/github_cpp_makefile_star2_O3/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), %edx
testq %rdx, %rdx
je 0x34d84
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
leal -0x1(%rdx), %esi
cmpl %esi, %ecx
jbe 0x350c5
movq 0x40(%rbx), %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,4), %rdx
xorl %esi, %esi
movzwl (%rcx,%rsi), %r12d
cmpl %r12d, %eax
cmovgl %eax, %r12d
addq $0x28, %rsi
movl %r12d, %eax
cmpq %rsi, %rdx
jne 0x34d6a
jmp 0x34d87
xorl %r12d, %r12d
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x34da0
xorl %r14d, %r14d
movq %r14, 0x58(%rbx)
callq 0x9019
movq %r14, 0x60(%rbx)
leal 0x1(%r12), %r15d
movl 0x5c(%rbx), %eax
cmpl %r12d, %eax
jg 0x34e05
testl %eax, %eax
je 0x34dc3
movl %eax, %r13d
shrl $0x1f, %r13d
addl %eax, %r13d
sarl %r13d
addl %eax, %r13d
jmp 0x34dc9
movl $0x8, %r13d
cmpl %r15d, %r13d
cmovlel %r15d, %r13d
leaq (,%r13,4), %rdi
callq 0x8589
movq %rax, %r14
movq 0x60(%rbx), %rsi
movslq 0x58(%rbx), %rdx
shlq $0x2, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x60(%rbx), %rdi
callq 0x9019
movq %r14, 0x60(%rbx)
movl %r13d, 0x5c(%rbx)
movl %r15d, 0x58(%rbx)
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x34e22
xorl %r14d, %r14d
movq %r14, 0x68(%rbx)
callq 0x9019
movq %r14, 0x70(%rbx)
movl 0x6c(%rbx), %eax
cmpl %r12d, %eax
jle 0x34e2f
xorl %r14d, %r14d
jmp 0x34e87
testl %eax, %eax
je 0x34e45
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl %eax, %r12d
jmp 0x34e4b
movl $0x8, %r12d
cmpl %r15d, %r12d
cmovlel %r15d, %r12d
leaq (,%r12,4), %rdi
callq 0x8589
movq %rax, %r14
movq 0x70(%rbx), %rsi
movslq 0x68(%rbx), %rdx
shlq $0x2, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x70(%rbx), %rdi
callq 0x9019
movq %r14, 0x70(%rbx)
movl %r12d, 0x6c(%rbx)
movl %r15d, 0x68(%rbx)
movq 0x60(%rbx), %rax
movl %r15d, %r15d
xorl %ecx, %ecx
movslq 0x58(%rbx), %rdx
cmpq %rdx, %rcx
jge 0x3508f
movl $0xbf800000, (%rax,%rcx,4) # imm = 0xBF800000
movslq 0x68(%rbx), %rdx
cmpq %rdx, %rcx
jge 0x350a6
movl $0xffffffff, (%r14,%rcx,4) # imm = 0xFFFFFFFF
incq %rcx
cmpq %rcx, %r15
jne 0x34e94
cmpl $0x0, 0x38(%rbx)
jle 0x34f14
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 0x3508f
movss (%rax), %xmm0
movl %edi, %r8d
movss %xmm0, (%rcx,%r8,4)
cmpl %edi, 0x68(%rbx)
jle 0x350a6
movl %esi, (%rdx,%r8,4)
incq %rsi
movslq 0x38(%rbx), %rdi
addq $0x28, %rax
cmpq %rdi, %rsi
jl 0x34edd
movq %rbx, %rdi
movl $0x20, %esi
callq 0x34cdc
testq %rax, %rax
je 0x3502d
movl 0x38(%rbx), %r12d
testl %r12d, %r12d
jle 0x350dc
movq 0x40(%rbx), %r14
leaq (%r12,%r12,4), %rax
cmpw $0x9, -0x28(%r14,%rax,8)
je 0x34fb9
movl %r12d, %ecx
incq %r12
movl 0x3c(%rbx), %eax
cmpl %ecx, %eax
jg 0x34fb5
testl %eax, %eax
je 0x34f6b
movl %eax, %r13d
shrl $0x1f, %r13d
addl %eax, %r13d
sarl %r13d
addl %eax, %r13d
jmp 0x34f71
movl $0x8, %r13d
cmpl %r12d, %r13d
cmovlel %r12d, %r13d
leaq (,%r13,8), %rax
leaq (%rax,%rax,4), %rdi
callq 0x8589
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 0x9019
movq %r14, 0x40(%rbx)
movl %r13d, 0x3c(%rbx)
movl %r12d, 0x38(%rbx)
leaq (%r12,%r12,4), %r12
movq %rbx, %rdi
movl $0x20, %esi
callq 0x34cdc
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 0x83b3(%rip), %xmm0     # 0x3d3b0
movss %xmm0, -0x24(%r14,%r12,8)
cmpl $0x9, 0x58(%rbx)
jle 0x3508f
movq 0x60(%rbx), %rax
movss %xmm0, 0x24(%rax)
cmpl $0x9, 0x68(%rbx)
jle 0x350a6
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 0x34cdc
movq %rax, 0x48(%rbx)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
testq %rax, %rax
je 0x35055
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 0x3508f
ucomiss (%rcx,%rdx,4), %xmm0
jbe 0x35078
movss %xmm1, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %r15
jne 0x35068
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9d4a(%rip), %rdi      # 0x3ede0
leaq 0x9a26(%rip), %rsi      # 0x3eac3
leaq 0xa5e1(%rip), %rcx      # 0x3f685
jmp 0x350bb
leaq 0x9d33(%rip), %rdi      # 0x3ede0
leaq 0x9a0f(%rip), %rsi      # 0x3eac3
leaq 0x12427(%rip), %rcx     # 0x474e2
movl $0x31c, %edx            # imm = 0x31C
callq 0x7140
leaq 0x9d14(%rip), %rdi      # 0x3ede0
leaq 0x99f0(%rip), %rsi      # 0x3eac3
leaq 0x123bf(%rip), %rcx     # 0x47499
jmp 0x350bb
leaq 0x11a52(%rip), %rdi     # 0x46b35
leaq 0x99d9(%rip), %rsi      # 0x3eac3
leaq 0x12368(%rip), %rcx     # 0x47459
movl $0x326, %edx            # imm = 0x326
callq 0x7140
nop