// File: /workspace/github_cpp_makefile_star2_O3/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImDrawList::AddText(ImFont const*, float, ImVec2 const&, unsigned int, char const*, char const*, float, ImVec4 const*)
void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect)
{
    if ((col >> 24) == 0)
        return;

    if (text_end == NULL)
        text_end = text_begin + strlen(text_begin);
    if (text_begin == text_end)
        return;

    IM_ASSERT(font->ContainerAtlas->TexID == _TextureIdStack.back());  // Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font.

    // reserve vertices for worse case (over-reserving is useful and easily amortized)
    const int char_count = (int)(text_end - text_begin);
    const int vtx_count_max = char_count * 4;
    const int idx_count_max = char_count * 6;
    const int vtx_begin = VtxBuffer.Size;
    const int idx_begin = IdxBuffer.Size;
    PrimReserve(idx_count_max, vtx_count_max);

    ImVec4 clip_rect = _ClipRectStack.back();
    if (cpu_fine_clip_rect)
    {
        clip_rect.x = ImMax(clip_rect.x, cpu_fine_clip_rect->x);
        clip_rect.y = ImMax(clip_rect.y, cpu_fine_clip_rect->y);
        clip_rect.z = ImMin(clip_rect.z, cpu_fine_clip_rect->z);
        clip_rect.w = ImMin(clip_rect.w, cpu_fine_clip_rect->w);
    }
    font->RenderText(font_size, pos, col, clip_rect, text_begin, text_end, this, wrap_width, cpu_fine_clip_rect != NULL);

    // give back unused vertices
    // FIXME-OPT: clean this up
    VtxBuffer.resize((int)(_VtxWritePtr - VtxBuffer.Data));
    IdxBuffer.resize((int)(_IdxWritePtr - IdxBuffer.Data));
    int vtx_unused = vtx_count_max - (VtxBuffer.Size - vtx_begin);
    int idx_unused = idx_count_max - (IdxBuffer.Size - idx_begin);
    CmdBuffer.back().ElemCount -= idx_unused;
    _VtxWritePtr -= vtx_unused;
    _IdxWritePtr -= idx_unused;
    _VtxCurrentIdx = (ImDrawIdx)VtxBuffer.Size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpl $0x1000000, %ecx        # imm = 0x1000000
jb 0x302a1
movq %r9, %r14
movq %r8, %r12
movl %ecx, %r13d
movq %rsi, %r15
movq %rdi, %rbx
testq %r9, %r9
movss %xmm1, -0x58(%rbp)
movss %xmm0, -0x54(%rbp)
jne 0x30057
movq %r12, %rdi
movq %rdx, %r14
callq 0x72e0
movq %r14, %rdx
movq %rax, %r14
addq %r12, %r14
cmpq %r12, %r14
je 0x302a1
movslq 0x60(%rbx), %rax
testq %rax, %rax
jle 0x302b0
movq %rdx, -0x60(%rbp)
movq 0x30(%r15), %rcx
movq (%rcx), %rcx
movq 0x68(%rbx), %rdx
cmpq -0x8(%rdx,%rax,8), %rcx
jne 0x302c7
movl %r14d, %eax
subl %r12d, %eax
leal (,%rax,4), %edx
addl %eax, %eax
leal (%rax,%rax,2), %esi
movl 0x10(%rbx), %eax
movl %eax, -0x50(%rbp)
movl 0x20(%rbx), %eax
movl %eax, -0x4c(%rbp)
movq %rbx, %rdi
movl %esi, -0x44(%rbp)
movl %edx, -0x48(%rbp)
callq 0x2d97a
movslq 0x50(%rbx), %rcx
testq %rcx, %rcx
jle 0x302e6
movq 0x10(%rbp), %rax
movq 0x58(%rbx), %rdx
shlq $0x4, %rcx
movups -0x10(%rdx,%rcx), %xmm0
movaps %xmm0, -0x40(%rbp)
testq %rax, %rax
movq -0x60(%rbp), %rdx
je 0x3013b
movss (%rax), %xmm0
movss -0x40(%rbp), %xmm1
movss -0x3c(%rbp), %xmm2
movaps %xmm0, %xmm3
cmpless %xmm1, %xmm3
andps %xmm3, %xmm1
andnps %xmm0, %xmm3
orps %xmm1, %xmm3
movss %xmm3, -0x40(%rbp)
movss 0x4(%rax), %xmm0
movaps %xmm0, %xmm1
cmpless %xmm2, %xmm1
andps %xmm1, %xmm2
andnps %xmm0, %xmm1
orps %xmm2, %xmm1
movss %xmm1, -0x3c(%rbp)
movss -0x38(%rbp), %xmm0
minss 0x8(%rax), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x34(%rbp), %xmm0
minss 0xc(%rax), %xmm0
movss %xmm0, -0x34(%rbp)
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movsd (%rdx), %xmm1
movl %ecx, (%rsp)
leaq -0x40(%rbp), %rdx
movq %r15, %rdi
movss -0x54(%rbp), %xmm0
movl %r13d, %esi
movq %r12, %rcx
movq %r14, %r8
movq %rbx, %r9
movss -0x58(%rbp), %xmm2
callq 0x3031c
movq 0x40(%rbx), %rax
subq 0x28(%rbx), %rax
shrq $0x2, %rax
imull $0xcccccccd, %eax, %r15d # imm = 0xCCCCCCCD
movl 0x24(%rbx), %ecx
cmpl %r15d, %ecx
jge 0x301e4
testl %ecx, %ecx
je 0x30198
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
addl %ecx, %eax
jmp 0x3019d
movl $0x8, %eax
cmpl %r15d, %eax
cmovlel %r15d, %eax
movslq %eax, %r12
leaq (,%r12,4), %rax
leaq (%rax,%rax,4), %rdi
callq 0x8589
movq %rax, %r14
movq 0x28(%rbx), %rsi
movslq 0x20(%rbx), %rax
shlq $0x2, %rax
leaq (%rax,%rax,4), %rdx
movq %r14, %rdi
callq 0x7080
movq 0x28(%rbx), %rdi
callq 0x9019
movq %r14, 0x28(%rbx)
movl %r12d, 0x24(%rbx)
movl %r15d, 0x20(%rbx)
movq 0x48(%rbx), %r15
subq 0x18(%rbx), %r15
shrq %r15
movl 0x14(%rbx), %ecx
cmpl %r15d, %ecx
jge 0x3024b
testl %ecx, %ecx
je 0x3020c
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
addl %ecx, %eax
jmp 0x30211
movl $0x8, %eax
cmpl %r15d, %eax
cmovlel %r15d, %eax
movslq %eax, %r12
leaq (%r12,%r12), %rdi
callq 0x8589
movq %rax, %r14
movq 0x18(%rbx), %rsi
movslq 0x10(%rbx), %rdx
addq %rdx, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x18(%rbx), %rdi
callq 0x9019
movq %r14, 0x18(%rbx)
movl %r12d, 0x14(%rbx)
movl %r15d, 0x10(%rbx)
movslq (%rbx), %rax
testq %rax, %rax
jle 0x302fd
movl -0x50(%rbp), %esi
subl %r15d, %esi
addl -0x44(%rbp), %esi
movl 0x20(%rbx), %ecx
movl -0x4c(%rbp), %edi
addl -0x48(%rbp), %edi
subl %ecx, %edi
movq 0x8(%rbx), %rdx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
subl %esi, -0x30(%rdx,%rax)
movslq %edi, %rax
negq %rax
leaq (%rax,%rax,4), %rax
shlq $0x2, %rax
addq %rax, 0x40(%rbx)
movslq %esi, %rax
addq %rax, %rax
subq %rax, 0x48(%rbx)
movzwl %cx, %eax
movl %eax, 0x38(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1687e(%rip), %rdi     # 0x46b35
leaq 0xe805(%rip), %rsi      # 0x3eac3
leaq 0x17032(%rip), %rcx     # 0x472f7
jmp 0x30312
leaq 0x165be(%rip), %rdi     # 0x4688c
leaq 0x164c1(%rip), %rsi     # 0x46796
leaq 0x165e6(%rip), %rcx     # 0x468c2
movl $0x343, %edx            # imm = 0x343
callq 0x7140
leaq 0x16848(%rip), %rdi     # 0x46b35
leaq 0xe7cf(%rip), %rsi      # 0x3eac3
leaq 0xea4f(%rip), %rcx      # 0x3ed4a
jmp 0x30312
leaq 0x16831(%rip), %rdi     # 0x46b35
leaq 0xe7b8(%rip), %rsi      # 0x3eac3
leaq 0xe8b7(%rip), %rcx      # 0x3ebc9
movl $0x326, %edx            # imm = 0x326
callq 0x7140