// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImFontAtlasBuildFinish(ImFontAtlas*)
void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
{
    // Render into our custom data blocks
    IM_ASSERT(atlas->TexPixelsAlpha8 != NULL);
    ImFontAtlasBuildRenderDefaultTexData(atlas);
    ImFontAtlasBuildRenderLinesTexData(atlas);

    // Register custom rectangle glyphs
    for (int i = 0; i < atlas->CustomRects.Size; i++)
    {
        const ImFontAtlasCustomRect* r = &atlas->CustomRects[i];
        if (r->Font == NULL || r->GlyphID == 0)
            continue;

        // Will ignore ImFontConfig settings: GlyphMinAdvanceX, GlyphMinAdvanceY, GlyphExtraSpacing, PixelSnapH
        IM_ASSERT(r->Font->ContainerAtlas == atlas);
        ImVec2 uv0, uv1;
        atlas->CalcCustomRectUV(r, &uv0, &uv1);
        r->Font->AddGlyph(NULL, (ImWchar)r->GlyphID, r->GlyphOffset.x, r->GlyphOffset.y, r->GlyphOffset.x + r->Width, r->GlyphOffset.y + r->Height, uv0.x, uv0.y, uv1.x, uv1.y, r->GlyphAdvanceX);
    }

    // Build all fonts lookup tables
    for (int i = 0; i < atlas->Fonts.Size; i++)
        if (atlas->Fonts[i]->DirtyLookupTables)
            atlas->Fonts[i]->BuildLookupTable();

    // Ellipsis character is required for rendering elided text. We prefer using U+2026 (horizontal ellipsis).
    // However some old fonts may contain ellipsis at U+0085. Here we auto-detect most suitable ellipsis character.
    // FIXME: Also note that 0x2026 is currently seldom included in our font ranges. Because of this we are more likely to use three individual dots.
    for (int i = 0; i < atlas->Fonts.size(); i++)
    {
        ImFont* font = atlas->Fonts[i];
        if (font->EllipsisChar != (ImWchar)-1)
            continue;
        const ImWchar ellipsis_variants[] = { (ImWchar)0x2026, (ImWchar)0x0085 };
        for (int j = 0; j < IM_ARRAYSIZE(ellipsis_variants); j++)
            if (font->FindGlyphNoFallback(ellipsis_variants[j]) != NULL) // Verify glyph exists
            {
                font->EllipsisChar = ellipsis_variants[j];
                break;
            }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpq $0x0, 0x18(%rdi)
je 0x8259d
movq %rdi, %rbx
movl 0x470(%rdi), %esi
callq 0x87c1e
movzwl 0x4(%rax), %esi
cmpl $0xffff, %esi           # imm = 0xFFFF
je 0x825bc
movq %rax, %r14
movq %rbx, -0x30(%rbp)
testb $0x2, 0x4(%rbx)
movzwl (%rax), %eax
jne 0x821d7
movzwl %ax, %eax
cmpl $0xd9, %eax
jne 0x825db
cmpw $0x1b, 0x2(%r14)
jne 0x825db
leal 0x6d(%rsi), %ebx
movzwl 0x6(%r14), %edx
movl $0xff, %r12d
leaq 0x495b2(%rip), %r15     # 0xcb740
movq -0x30(%rbp), %r13
movq %r13, %rdi
movl $0x6c, %ecx
movl $0x1b, %r8d
movq %r15, %r9
pushq %r12
pushq $0x2e
callq 0x826b3
addq $0x10, %rsp
movzwl 0x6(%r14), %edx
movq %r13, %rdi
movl %ebx, %esi
movl $0x6c, %ecx
movl $0x1b, %r8d
movq %r15, %r9
pushq %r12
pushq $0x58
callq 0x826b3
addq $0x10, %rsp
jmp 0x8222b
cmpw $0x2, %ax
jne 0x825fa
cmpw $0x2, 0x2(%r14)
jne 0x825fa
movq -0x30(%rbp), %r13
movl 0x28(%r13), %eax
movzwl 0x6(%r14), %ecx
imull %eax, %ecx
addl %esi, %ecx
movq 0x18(%r13), %rdx
addl %ecx, %eax
cltq
movb $-0x1, %sil
movb %sil, 0x1(%rdx,%rax)
movq 0x18(%r13), %rdx
movb %sil, (%rdx,%rax)
movq 0x18(%r13), %rax
movslq %ecx, %rcx
movb %sil, 0x1(%rax,%rcx)
movq 0x18(%r13), %rax
movb %sil, (%rax,%rcx)
movzwl 0x4(%r14), %eax
cvtsi2ss %eax, %xmm0
movss 0x34dc8(%rip), %xmm2    # 0xb7004
addss %xmm2, %xmm0
mulss 0x30(%r13), %xmm0
movzwl 0x6(%r14), %eax
cvtsi2ss %eax, %xmm1
addss %xmm2, %xmm1
mulss 0x34(%r13), %xmm1
movss %xmm0, 0x38(%r13)
movss %xmm1, 0x3c(%r13)
testb $0x4, 0x4(%r13)
movq %r13, %r14
jne 0x823c5
movl 0x474(%r14), %esi
movq %r14, %rdi
callq 0x87c1e
cmpw $-0x1, 0x4(%rax)
je 0x82619
movq %rax, %rsi
leaq 0x7c(%r14), %rax
xorl %ecx, %ecx
xorl %r15d, %r15d
movq %rsi, -0x50(%rbp)
movq %rax, -0x68(%rbp)
movzwl 0x2(%rsi), %eax
cmpq %rax, %r15
jae 0x8255f
movzwl (%rsi), %eax
leal (%rcx,%rax), %r12d
shrl %r12d
subl %r12d, %eax
addl %ecx, %eax
movq %rax, -0x58(%rbp)
movq 0x18(%r14), %rbx
movzwl 0x4(%rsi), %edx
movl %edx, -0x38(%rbp)
movzwl 0x6(%rsi), %r13d
leal (%r15,%r13), %r14d
movq -0x30(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x34(%rbp)
imull %eax, %r14d
addl %edx, %r14d
addq %rbx, %r14
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rcx, -0x60(%rbp)
callq 0xc260
addq %r12, %r14
movq %r14, %rdi
movq -0x30(%rbp), %r14
movl $0xff, %esi
movq %r15, %rdx
callq 0xc260
addl %r15d, %r13d
imull -0x34(%rbp), %r13d
addl -0x38(%rbp), %r13d
addq %r12, %rbx
addq %r15, %rbx
addq %r13, %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq -0x58(%rbp), %rdx
callq 0xc260
movq -0x50(%rbp), %rsi
movzwl 0x4(%rsi), %eax
leal (%r12,%rax), %ecx
decl %ecx
cvtsi2ss %rcx, %xmm0
movzwl 0x6(%rsi), %ecx
leal (%r15,%rcx), %edx
cvtsi2ss %edx, %xmm1
addl %eax, %r12d
movss 0x30(%r14), %xmm2
movss 0x34(%r14), %xmm3
mulss %xmm2, %xmm0
mulss %xmm3, %xmm1
leal 0x1(%r15,%r12), %eax
addl %r15d, %ecx
incl %ecx
movq %r15, %rdx
cvtsi2ss %rax, %xmm4
incq %rdx
cvtsi2ss %ecx, %xmm5
movq -0x60(%rbp), %rcx
mulss %xmm2, %xmm4
mulss %xmm3, %xmm5
addss %xmm1, %xmm5
mulss 0x34c69(%rip), %xmm5    # 0xb7004
movq -0x68(%rbp), %rax
movss %xmm0, -0xc(%rax)
movss %xmm5, -0x8(%rax)
movss %xmm4, -0x4(%rax)
movss %xmm5, (%rax)
addq $0x10, %rax
decl %ecx
movq %rdx, %r15
cmpq $0x40, %rdx
jne 0x8229d
cmpl $0x0, 0x50(%r14)
jle 0x824a0
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %r14, %r15
movq 0x58(%r14), %r14
movq 0x18(%r14,%r12), %rax
testq %rax, %rax
je 0x82489
cmpl $0x0, 0x8(%r14,%r12)
je 0x82489
cmpq %r15, 0x40(%rax)
jne 0x8257e
leaq (%r14,%r12), %rsi
movq %rbx, -0x48(%rbp)
movq %rbx, -0x40(%rbp)
movq %r15, %rdi
leaq -0x48(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x7db9a
movq 0x18(%r14,%r12), %rdi
movzwl 0x8(%r14,%r12), %edx
movss 0xc(%r14,%r12), %xmm8
movzwl (%r14,%r12), %eax
xorps %xmm2, %xmm2
cvtsi2ss %eax, %xmm2
movss 0x10(%r14,%r12), %xmm0
movss 0x14(%r14,%r12), %xmm1
addss %xmm0, %xmm2
movzwl 0x2(%r14,%r12), %eax
xorps %xmm3, %xmm3
cvtsi2ss %eax, %xmm3
addss %xmm1, %xmm3
movss -0x48(%rbp), %xmm4
movss -0x44(%rbp), %xmm5
movss -0x40(%rbp), %xmm6
movss -0x3c(%rbp), %xmm7
subq $0x10, %rsp
movss %xmm8, (%rsp)
xorl %esi, %esi
callq 0x81e9a
addq $0x10, %rsp
incq %r13
movslq 0x50(%r15), %rax
addq $0x20, %r12
cmpq %rax, %r13
movq %r15, %r14
jl 0x823d8
movl 0x40(%r14), %eax
testl %eax, %eax
jle 0x824c9
xorl %ebx, %ebx
movq 0x48(%r14), %rax
movq (%rax,%rbx,8), %rdi
cmpb $0x1, 0x56(%rdi)
jne 0x824bd
callq 0x82786
incq %rbx
movslq 0x40(%r14), %rax
cmpq %rax, %rbx
jl 0x824aa
testl %eax, %eax
jle 0x82531
movl %eax, %eax
xorl %ecx, %ecx
leaq 0x464dc(%rip), %rdx     # 0xc89b4
movslq 0x40(%r14), %rsi
cmpq %rsi, %rcx
jge 0x82540
movq 0x48(%r14), %rsi
movq (%rsi,%rcx,8), %rsi
cmpw $-0x1, 0x54(%rsi)
jne 0x82529
movslq 0x18(%rsi), %rdi
xorl %r8d, %r8d
movzwl (%r8,%rdx), %r9d
movzwl %r9w, %r10d
cmpq %rdi, %r10
jae 0x82518
movq 0x20(%rsi), %r11
cmpw $-0x1, (%r11,%r10,2)
je 0x82518
cmpq $0x0, 0x30(%rsi)
jne 0x82524
addq $0x2, %r8
cmpq $0x2, %r8
je 0x824f7
jmp 0x82529
movw %r9w, 0x54(%rsi)
incq %rcx
cmpq %rax, %rcx
jne 0x824d8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x39131(%rip), %rdi     # 0xbb678
leaq 0x3913d(%rip), %rsi     # 0xbb68b
leaq 0x3914c(%rip), %rcx     # 0xbb6a1
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140
leaq 0x4e262(%rip), %rdi     # 0xd07c8
leaq 0x4cc69(%rip), %rsi     # 0xcf1d6
leaq 0x4e21d(%rip), %rcx     # 0xd0791
movl $0x9b8, %edx            # imm = 0x9B8
callq 0xc140
leaq 0x4d74c(%rip), %rdi     # 0xcfcd1
leaq 0x4cc4a(%rip), %rsi     # 0xcf1d6
leaq 0x4d713(%rip), %rcx     # 0xcfca6
movl $0x9eb, %edx            # imm = 0x9EB
callq 0xc140
leaq 0x4d6e1(%rip), %rdi     # 0xcfc85
leaq 0x4cc2b(%rip), %rsi     # 0xcf1d6
leaq 0x4d6f4(%rip), %rcx     # 0xcfca6
movl $0x9df, %edx            # imm = 0x9DF
callq 0xc140
leaq 0x4e107(%rip), %rdi     # 0xd06ca
leaq 0x4cc0c(%rip), %rsi     # 0xcf1d6
leaq 0x4e107(%rip), %rcx     # 0xd06d8
movl $0x991, %edx            # imm = 0x991
callq 0xc140
leaq 0x4e12f(%rip), %rdi     # 0xd0711
leaq 0x4cbed(%rip), %rsi     # 0xcf1d6
leaq 0x4e0e8(%rip), %rcx     # 0xd06d8
movl $0x997, %edx            # imm = 0x997
callq 0xc140
leaq 0x4e170(%rip), %rdi     # 0xd0771
leaq 0x4cbce(%rip), %rsi     # 0xcf1d6
leaq 0x4e0c9(%rip), %rcx     # 0xd06d8
movl $0x9a0, %edx            # imm = 0x9A0
callq 0xc140
leaq 0x4e0aa(%rip), %rdi     # 0xd06ca
leaq 0x4cbaf(%rip), %rsi     # 0xcf1d6
leaq 0x4e163(%rip), %rcx     # 0xd0791
movl $0x9ae, %edx            # imm = 0x9AE
callq 0xc140