// File: /workspace/github_cpp_makefile_star2_O3/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 0x80ab8
movl 0x470(%rdi), %esi
movq %rdi, %rbx
callq 0x85f1e
movzwl 0x4(%rax), %esi
cmpl $0xffff, %esi           # imm = 0xFFFF
je 0x80ad7
movq %rax, %r14
testb $0x2, 0x4(%rbx)
movzwl (%rax), %eax
movq %rbx, %r8
movq %rbx, -0x30(%rbp)
jne 0x806c5
movzwl %ax, %eax
cmpl $0xd9, %eax
jne 0x80af6
cmpw $0x1b, 0x2(%r14)
jne 0x80af6
leal 0x6d(%rsi), %ebx
movzwl 0x6(%r14), %edx
movl $0xff, %r12d
leaq 0x49095(%rip), %r15     # 0xc9710
movq %r8, %rdi
movl $0x6c, %ecx
movl $0x1b, %r8d
movq %r15, %r9
pushq %r12
pushq $0x2e
callq 0x80bcf
addq $0x10, %rsp
movzwl 0x6(%r14), %edx
movq -0x30(%rbp), %rdi
movl %ebx, %esi
movl $0x6c, %ecx
movl $0x1b, %r8d
movq %r15, %r9
pushq %r12
pushq $0x58
callq 0x80bcf
movq -0x30(%rbp), %r8
addq $0x10, %rsp
jmp 0x80715
cmpw $0x2, %ax
jne 0x80b15
cmpw $0x2, 0x2(%r14)
jne 0x80b15
movl 0x28(%r8), %eax
movzwl 0x6(%r14), %ecx
imull %eax, %ecx
addl %esi, %ecx
movq 0x18(%r8), %rdx
addl %ecx, %eax
cltq
movb $-0x1, %sil
movb %sil, 0x1(%rdx,%rax)
movq 0x18(%r8), %rdx
movb %sil, (%rdx,%rax)
movq 0x18(%r8), %rax
movslq %ecx, %rcx
movb %sil, 0x1(%rax,%rcx)
movq 0x18(%r8), %rax
movb %sil, (%rax,%rcx)
movzwl 0x4(%r14), %eax
cvtsi2ss %eax, %xmm0
movss 0x348de(%rip), %xmm2    # 0xb5004
addss %xmm2, %xmm0
mulss 0x30(%r8), %xmm0
movzwl 0x6(%r14), %eax
cvtsi2ss %eax, %xmm1
addss %xmm2, %xmm1
mulss 0x34(%r8), %xmm1
movss %xmm0, 0x38(%r8)
movss %xmm1, 0x3c(%r8)
testb $0x4, 0x4(%r8)
jne 0x808bd
movl 0x474(%r8), %esi
movq %r8, %rdi
movq %r8, %rbx
callq 0x85f1e
movzwl 0x4(%rax), %edi
cmpw $-0x1, %di
je 0x80b34
leaq 0x7c(%rbx), %rcx
xorl %r14d, %r14d
xorl %edx, %edx
xorl %r9d, %r9d
movq %rbx, %r8
movq %rax, -0x50(%rbp)
movq %r14, -0x68(%rbp)
movq %rcx, -0x70(%rbp)
movzwl 0x2(%rax), %ecx
cmpq %rcx, %r9
jae 0x80a5b
movzwl (%rax), %ecx
leal (%rdx,%rcx), %r12d
shrl %r12d
subl %r12d, %ecx
addl %edx, %ecx
movq %rcx, -0x58(%rbp)
movq 0x18(%r8), %rbx
movzwl %di, %ecx
movl %ecx, -0x38(%rbp)
movzwl 0x6(%rax), %r15d
leal (%r9,%r15), %r14d
movl 0x28(%r8), %esi
movl %esi, -0x34(%rbp)
imull %esi, %r14d
addl %ecx, %r14d
addq %rbx, %r14
movq %r14, %rdi
xorl %esi, %esi
movq %rdx, -0x60(%rbp)
movq %r12, %rdx
movq %r9, %r13
callq 0xc260
addq %r12, %r14
movq %r14, %rdi
movl $0xff, %esi
movq %r13, %rdx
callq 0xc260
movq -0x68(%rbp), %r14
addl %r14d, %r15d
imull -0x34(%rbp), %r15d
addl -0x38(%rbp), %r15d
addq %r12, %rbx
addq %r13, %rbx
addq %r15, %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq -0x58(%rbp), %rdx
callq 0xc260
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %r8
movzwl 0x4(%rax), %edi
movl %r12d, %ecx
leal -0x1(%r12,%rdi), %edx
cvtsi2ss %rdx, %xmm0
movzwl 0x6(%rax), %edx
leal (%rdx,%r13), %esi
cvtsi2ss %esi, %xmm1
addl %edi, %ecx
movss 0x30(%r8), %xmm2
movss 0x34(%r8), %xmm3
mulss %xmm2, %xmm0
mulss %xmm3, %xmm1
addl %r13d, %ecx
incl %ecx
addl %r13d, %edx
incl %edx
incq %r13
cvtsi2ss %rcx, %xmm4
cvtsi2ss %edx, %xmm5
movq -0x60(%rbp), %rdx
mulss %xmm2, %xmm4
mulss %xmm3, %xmm5
addss %xmm1, %xmm5
mulss 0x34774(%rip), %xmm5    # 0xb5004
movq -0x70(%rbp), %rcx
movss %xmm0, -0xc(%rcx)
movss %xmm5, -0x8(%rcx)
movss %xmm4, -0x4(%rcx)
movss %xmm5, (%rcx)
addq $0x10, %rcx
decl %edx
incl %r14d
movq %r13, %r9
cmpq $0x40, %r13
jne 0x8078d
movl 0x50(%r8), %eax
testl %eax, %eax
jle 0x8099d
xorl %ebx, %ebx
leaq -0x40(%rbp), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x58(%r8), %r14
movq 0x18(%r14,%r12), %rcx
testq %rcx, %rcx
je 0x8098a
cmpl $0x0, 0x8(%r14,%r12)
je 0x8098a
cmpq %r8, 0x40(%rcx)
jne 0x80a99
leaq (%r14,%r12), %rsi
movq %rbx, -0x48(%rbp)
movq %rbx, -0x40(%rbp)
movq %r8, %rdi
leaq -0x48(%rbp), %rdx
movq %r15, %rcx
callq 0x7c25a
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 0x8038e
movq -0x30(%rbp), %r8
addq $0x10, %rsp
movl 0x50(%r8), %eax
incq %r13
movslq %eax, %rcx
addq $0x20, %r12
cmpq %rcx, %r13
jl 0x808d5
movl 0x40(%r8), %eax
testl %eax, %eax
jle 0x80a4c
xorl %ebx, %ebx
movq 0x48(%r8), %rcx
movq (%rcx,%rbx,8), %rdi
cmpb $0x1, 0x56(%rdi)
jne 0x809c6
callq 0x80ca4
movq -0x30(%rbp), %r8
movl 0x40(%r8), %eax
incq %rbx
movslq %eax, %rcx
cmpq %rcx, %rbx
jl 0x809ab
testl %eax, %eax
jle 0x80a4c
movl %eax, %eax
xorl %ecx, %ecx
leaq 0x45fa4(%rip), %rdx     # 0xc6984
movslq 0x40(%r8), %rsi
cmpq %rsi, %rcx
jge 0x80a7a
movq 0x48(%r8), %rsi
movq (%rsi,%rcx,8), %rsi
cmpw $-0x1, 0x54(%rsi)
jne 0x80a40
movslq 0x18(%rsi), %rdi
movb $0x1, %r8b
xorl %r9d, %r9d
movzwl (%rdx,%r9,2), %r9d
movzwl %r9w, %r10d
cmpq %rdi, %r10
jae 0x80a27
movq 0x20(%rsi), %r11
cmpw $-0x1, (%r11,%r10,2)
je 0x80a27
cmpq $0x0, 0x30(%rsi)
jne 0x80a3b
movl $0x1, %r9d
testb $0x1, %r8b
movl $0x0, %r8d
jne 0x80a06
jmp 0x80a40
movw %r9w, 0x54(%rsi)
incq %rcx
cmpq %rax, %rcx
movq -0x30(%rbp), %r8
jne 0x809e0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4dd02(%rip), %rdi     # 0xce764
leaq 0x4c73d(%rip), %rsi     # 0xcd1a6
leaq 0x4dcbd(%rip), %rcx     # 0xce72d
movl $0x9b8, %edx            # imm = 0x9B8
callq 0xc140
leaq 0x38bf7(%rip), %rdi     # 0xb9678
leaq 0x38c03(%rip), %rsi     # 0xb968b
leaq 0x38c12(%rip), %rcx     # 0xb96a1
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140
leaq 0x4d201(%rip), %rdi     # 0xcdca1
leaq 0x4c6ff(%rip), %rsi     # 0xcd1a6
leaq 0x4d1c8(%rip), %rcx     # 0xcdc76
movl $0x9eb, %edx            # imm = 0x9EB
callq 0xc140
leaq 0x4d196(%rip), %rdi     # 0xcdc55
leaq 0x4c6e0(%rip), %rsi     # 0xcd1a6
leaq 0x4d1a9(%rip), %rcx     # 0xcdc76
movl $0x9df, %edx            # imm = 0x9DF
callq 0xc140
leaq 0x4db88(%rip), %rdi     # 0xce666
leaq 0x4c6c1(%rip), %rsi     # 0xcd1a6
leaq 0x4db88(%rip), %rcx     # 0xce674
movl $0x991, %edx            # imm = 0x991
callq 0xc140
leaq 0x4dbb0(%rip), %rdi     # 0xce6ad
leaq 0x4c6a2(%rip), %rsi     # 0xcd1a6
leaq 0x4db69(%rip), %rcx     # 0xce674
movl $0x997, %edx            # imm = 0x997
callq 0xc140
leaq 0x4dbf1(%rip), %rdi     # 0xce70d
leaq 0x4c683(%rip), %rsi     # 0xcd1a6
leaq 0x4db4a(%rip), %rcx     # 0xce674
movl $0x9a0, %edx            # imm = 0x9A0
callq 0xc140
leaq 0x4db2b(%rip), %rdi     # 0xce666
leaq 0x4c664(%rip), %rsi     # 0xcd1a6
leaq 0x4dbe4(%rip), %rcx     # 0xce72d
movl $0x9ae, %edx            # imm = 0x9AE
callq 0xc140
nop