// File: /workspace/github_cpp_makefile_star2_O2/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 0x6aae0
movq %rdi, %r15
movl 0x470(%rdi), %esi
callq 0x6f7f4
movzwl 0x4(%rax), %esi
cmpl $0xffff, %esi           # imm = 0xFFFF
je 0x6aaff
movq %rax, %r14
testb $0x2, 0x4(%r15)
movzwl (%rax), %eax
movq %r15, -0x30(%rbp)
jne 0x6a72d
cmpw $0xd9, %ax
jne 0x6ab1e
cmpw $0x1b, 0x2(%r14)
jne 0x6ab1e
leal 0x6d(%rsi), %ebx
movzwl 0x6(%r14), %edx
movl $0xff, %eax
leaq 0x4635a(%rip), %r9      # 0xb0a40
pushq $0x6c
popq %r13
pushq $0x1b
popq %r12
movq -0x30(%rbp), %r15
movq %r15, %rdi
movl %r13d, %ecx
movl %r12d, %r8d
pushq %rax
pushq $0x2e
callq 0x6abbf
popq %rax
popq %rcx
movzwl 0x6(%r14), %edx
movq %r15, %rdi
movl %ebx, %esi
movl %r13d, %ecx
movl %r12d, %r8d
leaq 0x46324(%rip), %r9      # 0xb0a40
movl $0xff, %eax
pushq %rax
pushq $0x58
callq 0x6abbf
popq %rax
popq %rcx
jmp 0x6a77d
cmpw $0x2, %ax
jne 0x6ab3d
cmpw $0x2, 0x2(%r14)
jne 0x6ab3d
movl 0x28(%r15), %eax
movzwl 0x6(%r14), %ecx
imull %eax, %ecx
addl %esi, %ecx
movq 0x18(%r15), %rdx
addl %ecx, %eax
cltq
movb $-0x1, %sil
movb %sil, 0x1(%rdx,%rax)
movq 0x18(%r15), %rdx
movb %sil, (%rdx,%rax)
movq 0x18(%r15), %rax
movslq %ecx, %rcx
movb %sil, 0x1(%rax,%rcx)
movq 0x18(%r15), %rax
movb %sil, (%rax,%rcx)
movzwl 0x4(%r14), %eax
cvtsi2ss %eax, %xmm0
movss 0x3188a(%rip), %xmm2    # 0x9c018
addss %xmm2, %xmm0
mulss 0x30(%r15), %xmm0
movzwl 0x6(%r14), %eax
cvtsi2ss %eax, %xmm1
addss %xmm2, %xmm1
mulss 0x34(%r15), %xmm1
movss %xmm0, 0x38(%r15)
movss %xmm1, 0x3c(%r15)
testb $0x4, 0x4(%r15)
jne 0x6a928
movl 0x474(%r15), %esi
movq %r15, %rdi
callq 0x6f7f4
movq %rax, %rdi
movzwl 0x4(%rax), %eax
cmpw $-0x1, %ax
je 0x6ab5c
leaq 0x7c(%r15), %rcx
xorl %edx, %edx
xorl %r8d, %r8d
xorl %esi, %esi
movq %rdi, -0x58(%rbp)
cmpq $0x40, %rsi
je 0x6a928
movq %rcx, -0x70(%rbp)
movzwl 0x2(%rdi), %ecx
cmpq %rcx, %rsi
movq %rdx, -0x50(%rbp)
jae 0x6aaa2
movzwl (%rdi), %r13d
leal (%r8,%r13), %r12d
shrl %r12d
subl %r12d, %r13d
addl %r8d, %r13d
movq 0x18(%r15), %r14
movzwl %ax, %ecx
movl %ecx, -0x38(%rbp)
movzwl 0x6(%rdi), %r15d
leal (%rsi,%r15), %ebx
movq -0x30(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x34(%rbp)
imull %eax, %ebx
addl %ecx, %ebx
addq %r14, %rbx
movq %rbx, %rdi
movq %rsi, -0x60(%rbp)
xorl %esi, %esi
movq %r12, %rdx
movq %r8, -0x68(%rbp)
callq 0xc270
addq %r12, %rbx
movq %rbx, %rdi
movl $0xff, %esi
movq -0x60(%rbp), %rbx
movq %rbx, %rdx
callq 0xc270
addl -0x50(%rbp), %r15d
imull -0x34(%rbp), %r15d
addl -0x38(%rbp), %r15d
addq %r12, %r14
addq %rbx, %r14
addq %r15, %r14
movq -0x30(%rbp), %r15
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0xc270
movq -0x68(%rbp), %r8
movq -0x58(%rbp), %rdi
movzwl 0x4(%rdi), %eax
leal (%r12,%rax), %ecx
decl %ecx
cvtsi2ss %rcx, %xmm0
movzwl 0x6(%rdi), %ecx
leal (%rbx,%rcx), %edx
cvtsi2ss %edx, %xmm1
addl %eax, %r12d
movss 0x30(%r15), %xmm2
movss 0x34(%r15), %xmm3
mulss %xmm2, %xmm0
mulss %xmm3, %xmm1
leal (%rbx,%r12), %edx
incl %edx
addl %ebx, %ecx
incl %ecx
cvtsi2ss %rdx, %xmm4
incq %rbx
cvtsi2ss %ecx, %xmm5
mulss %xmm2, %xmm4
mulss %xmm3, %xmm5
addss %xmm1, %xmm5
mulss 0x3171c(%rip), %xmm5    # 0x9c018
movq -0x70(%rbp), %rcx
movss %xmm0, -0xc(%rcx)
movss %xmm5, -0x8(%rcx)
movss %xmm4, -0x4(%rcx)
movss %xmm5, (%rcx)
addq $0x10, %rcx
decl %r8d
movq -0x50(%rbp), %rdx
incl %edx
movq %rbx, %rsi
jmp 0x6a7f1
leaq 0x50(%r15), %r14
xorl %r15d, %r15d
leaq -0x48(%rbp), %rbx
leaq -0x40(%rbp), %r13
cmpl (%r14), %r15d
jge 0x6a9f7
movq %r14, %rdi
movl %r15d, %esi
callq 0x6fb92
movq %rax, %r12
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x6a9ef
cmpl $0x0, 0x8(%r12)
je 0x6a9ef
movq -0x30(%rbp), %rdi
cmpq %rdi, 0x40(%rax)
jne 0x6aac1
andq $0x0, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
movq %r12, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x66b2c
movq 0x18(%r12), %rdi
movzwl 0x8(%r12), %edx
movss 0xc(%r12), %xmm8
movzwl (%r12), %eax
cvtsi2ss %eax, %xmm2
movss 0x10(%r12), %xmm0
movss 0x14(%r12), %xmm1
addss %xmm0, %xmm2
movzwl 0x2(%r12), %eax
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 0x6a4d6
popq %rax
popq %rcx
incl %r15d
jmp 0x6a937
movq -0x30(%rbp), %r15
addq $0x40, %r15
xorl %r14d, %r14d
movl (%r15), %eax
cmpl %eax, %r14d
jge 0x6aa36
movq %r15, %rdi
movl %r14d, %esi
callq 0x4c056
movq (%rax), %rax
cmpb $0x1, 0x56(%rax)
jne 0x6aa31
movq %r15, %rdi
movl %r14d, %esi
callq 0x4c056
movq (%rax), %rdi
callq 0x6ac86
incl %r14d
jmp 0x6aa02
xorl %r14d, %r14d
leaq 0x43274(%rip), %rbx     # 0xadcb4
movq %r15, -0x30(%rbp)
cmpl %eax, %r14d
jge 0x6aa93
movq %r15, %rdi
movl %r14d, %esi
callq 0x4c056
movq (%rax), %r15
cmpw $-0x1, 0x54(%r15)
jne 0x6aa87
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x6aa87
movzwl (%r12,%rbx), %r13d
movzwl %r13w, %esi
movq %r15, %rdi
callq 0x6aef2
addq $0x2, %r12
testq %rax, %rax
je 0x6aa62
movw %r13w, 0x54(%r15)
incl %r14d
movq -0x30(%rbp), %r15
movl (%r15), %eax
jmp 0x6aa44
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4afeb(%rip), %rdi     # 0xb5a94
leaq 0x49a26(%rip), %rsi     # 0xb44d6
leaq 0x4afa6(%rip), %rcx     # 0xb5a5d
movl $0x9b8, %edx            # imm = 0x9B8
callq 0xc140
leaq 0x4a509(%rip), %rdi     # 0xb4fd1
leaq 0x49a07(%rip), %rsi     # 0xb44d6
leaq 0x4a4d0(%rip), %rcx     # 0xb4fa6
movl $0x9eb, %edx            # imm = 0x9EB
callq 0xc140
leaq 0x4a49e(%rip), %rdi     # 0xb4f85
leaq 0x499e8(%rip), %rsi     # 0xb44d6
leaq 0x4a4b1(%rip), %rcx     # 0xb4fa6
movl $0x9df, %edx            # imm = 0x9DF
callq 0xc140
leaq 0x4ae90(%rip), %rdi     # 0xb5996
leaq 0x499c9(%rip), %rsi     # 0xb44d6
leaq 0x4ae90(%rip), %rcx     # 0xb59a4
movl $0x991, %edx            # imm = 0x991
callq 0xc140
leaq 0x4aeb8(%rip), %rdi     # 0xb59dd
leaq 0x499aa(%rip), %rsi     # 0xb44d6
leaq 0x4ae71(%rip), %rcx     # 0xb59a4
movl $0x997, %edx            # imm = 0x997
callq 0xc140
leaq 0x4aef9(%rip), %rdi     # 0xb5a3d
leaq 0x4998b(%rip), %rsi     # 0xb44d6
leaq 0x4ae52(%rip), %rcx     # 0xb59a4
movl $0x9a0, %edx            # imm = 0x9A0
callq 0xc140
leaq 0x4ae33(%rip), %rdi     # 0xb5996
leaq 0x4996c(%rip), %rsi     # 0xb44d6
leaq 0x4aeec(%rip), %rcx     # 0xb5a5d
movl $0x9ae, %edx            # imm = 0x9AE
callq 0xc140
nop