// File: Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImFont::AddGlyph(ImFontConfig const*, unsigned short, float, float, float, float, float, float, float, float, float)
void ImFont::AddGlyph(const ImFontConfig* cfg, ImWchar codepoint, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x)
{
    if (cfg != NULL)
    {
        // Clamp & recenter if needed
        const float advance_x_original = advance_x;
        advance_x = ImClamp(advance_x, cfg->GlyphMinAdvanceX, cfg->GlyphMaxAdvanceX);
        if (advance_x != advance_x_original)
        {
            float char_off_x = cfg->PixelSnapH ? ImFloor((advance_x - advance_x_original) * 0.5f) : (advance_x - advance_x_original) * 0.5f;
            x0 += char_off_x;
            x1 += char_off_x;
        }

        // Snap to pixel
        if (cfg->PixelSnapH)
            advance_x = IM_ROUND(advance_x);

        // Bake spacing
        advance_x += cfg->GlyphExtraSpacing.x;
    }

    Glyphs.resize(Glyphs.Size + 1);
    ImFontGlyph& glyph = Glyphs.back();
    glyph.Codepoint = (unsigned int)codepoint;
    glyph.Visible = (x0 != x1) && (y0 != y1);
    glyph.X0 = x0;
    glyph.Y0 = y0;
    glyph.X1 = x1;
    glyph.Y1 = y1;
    glyph.U0 = u0;
    glyph.V0 = v0;
    glyph.U1 = u1;
    glyph.V1 = v1;
    glyph.AdvanceX = advance_x;

    // Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round)
    // We use (U1-U0)*TexWidth instead of X1-X0 to account for oversampling.
    float pad = ContainerAtlas->TexGlyphPadding + 0.99f;
    DirtyLookupTables = true;
    MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + pad) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + pad);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movw %dx, %ax
movss 0x10(%rbp), %xmm8
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movss %xmm0, -0x18(%rbp)
movss %xmm1, -0x1c(%rbp)
movss %xmm2, -0x20(%rbp)
movss %xmm3, -0x24(%rbp)
movss %xmm4, -0x28(%rbp)
movss %xmm5, -0x2c(%rbp)
movss %xmm6, -0x30(%rbp)
movss %xmm7, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x11aad8
movss 0x10(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movss 0x10(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss 0x40(%rax), %xmm1
movq -0x10(%rbp), %rax
movss 0x44(%rax), %xmm2
callq 0x1158e0
movss %xmm0, 0x10(%rbp)
movss 0x10(%rbp), %xmm0
ucomiss -0x38(%rbp), %xmm0
jne 0x11aa32
jp 0x11aa32
jmp 0x11aaa1
movq -0x10(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x11aa5e
movss 0x10(%rbp), %xmm0
subss -0x38(%rbp), %xmm0
movss 0x5758a(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
callq 0x11a6c0
movss %xmm0, -0x5c(%rbp)
jmp 0x11aa79
movss 0x10(%rbp), %xmm0
subss -0x38(%rbp), %xmm0
movss 0x57568(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x5c(%rbp)
movss -0x5c(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x3c(%rbp), %xmm0
addss -0x18(%rbp), %xmm0
movss %xmm0, -0x18(%rbp)
movss -0x3c(%rbp), %xmm0
addss -0x20(%rbp), %xmm0
movss %xmm0, -0x20(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x11aac5
movss 0x57525(%rip), %xmm0    # 0x171fd8
addss 0x10(%rbp), %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x10(%rbp)
movq -0x10(%rbp), %rax
movss 0x24(%rax), %xmm0
addss 0x10(%rbp), %xmm0
movss %xmm0, 0x10(%rbp)
movq -0x58(%rbp), %rax
movq %rax, %rdi
addq $0x28, %rdi
movl 0x28(%rax), %esi
addl $0x1, %esi
callq 0x1286c0
movq -0x58(%rbp), %rdi
addq $0x28, %rdi
callq 0x128660
movq %rax, -0x48(%rbp)
movzwl -0x12(%rbp), %edx
movq -0x48(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, (%rax)
movss -0x18(%rbp), %xmm0
xorl %eax, %eax
ucomiss -0x20(%rbp), %xmm0
movb %al, -0x5d(%rbp)
jne 0x11ab2d
jp 0x11ab2d
jmp 0x11ab41
movss -0x1c(%rbp), %xmm0
ucomiss -0x24(%rbp), %xmm0
setne %al
setp %cl
orb %cl, %al
movb %al, -0x5d(%rbp)
movq -0x58(%rbp), %rax
movb -0x5d(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %esi
movq -0x48(%rbp), %rcx
movl (%rcx), %edx
andl $0x1, %esi
shll $0x1f, %esi
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orl %esi, %edx
movl %edx, (%rcx)
movss -0x18(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x8(%rcx)
movss -0x1c(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0xc(%rcx)
movss -0x20(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x10(%rcx)
movss -0x24(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x14(%rcx)
movss -0x28(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x18(%rcx)
movss -0x2c(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x1c(%rcx)
movss -0x30(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x20(%rcx)
movss -0x34(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x24(%rcx)
movss 0x10(%rbp), %xmm0
movq -0x48(%rbp), %rcx
movss %xmm0, 0x4(%rcx)
movq 0x40(%rax), %rcx
cvtsi2ssl 0x14(%rcx), %xmm0
movss 0x68e45(%rip), %xmm1    # 0x183a38
addss %xmm1, %xmm0
movss %xmm0, -0x4c(%rbp)
movb $0x1, 0x56(%rax)
movq -0x48(%rbp), %rcx
movss 0x20(%rcx), %xmm0
movq -0x48(%rbp), %rcx
subss 0x18(%rcx), %xmm0
movq 0x40(%rax), %rcx
cvtsi2ssl 0x28(%rcx), %xmm2
movss -0x4c(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movq -0x48(%rbp), %rdx
movss 0x24(%rdx), %xmm0
movq -0x48(%rbp), %rdx
subss 0x1c(%rdx), %xmm0
movq 0x40(%rax), %rdx
cvtsi2ssl 0x2c(%rdx), %xmm2
movss -0x4c(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %edx
imull %edx, %ecx
addl 0x64(%rax), %ecx
movl %ecx, 0x64(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)