// File: /workspace/github_cpp_makefile_star2_O1/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 0x30ac8
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 0x3086d
movq %r12, %rdi
movq %rdx, %r14
callq 0x72f0
movq %r14, %rdx
movq %rax, %r14
addq %r12, %r14
cmpq %r12, %r14
je 0x30ac8
movslq 0x60(%rbx), %rax
testq %rax, %rax
jle 0x30ad7
movq %rdx, -0x60(%rbp)
movq 0x30(%r15), %rcx
movq (%rcx), %rcx
movq 0x68(%rbx), %rdx
cmpq -0x8(%rdx,%rax,8), %rcx
jne 0x30aee
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 0x2def2
movslq 0x50(%rbx), %rcx
testq %rcx, %rcx
jle 0x30b0d
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 0x30951
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 0x30b44
movq 0x40(%rbx), %rax
subq 0x28(%rbx), %rax
shrq $0x2, %rax
imull $0xcccccccd, %eax, %r15d # imm = 0xCCCCCCCD
movl 0x24(%rbx), %eax
cmpl %r15d, %eax
jge 0x30a01
testl %eax, %eax
je 0x309b3
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl %eax, %r12d
jmp 0x309b9
movl $0x8, %r12d
cmpl %r15d, %r12d
cmovlel %r15d, %r12d
cmpl %r12d, %eax
jge 0x30a01
movslq %r12d, %rax
shlq $0x2, %rax
leaq (%rax,%rax,4), %rdi
callq 0x85d9
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 0x9065
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), %eax
cmpl %r15d, %eax
jge 0x30a72
testl %eax, %eax
je 0x30a2e
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl %eax, %r12d
jmp 0x30a34
movl $0x8, %r12d
cmpl %r15d, %r12d
cmovlel %r15d, %r12d
cmpl %r12d, %eax
jge 0x30a72
movslq %r12d, %rdi
addq %rdi, %rdi
callq 0x85d9
movq %rax, %r14
movq 0x18(%rbx), %rsi
movslq 0x10(%rbx), %rdx
addq %rdx, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x18(%rbx), %rdi
callq 0x9065
movq %r14, 0x18(%rbx)
movl %r12d, 0x14(%rbx)
movl %r15d, 0x10(%rbx)
movslq (%rbx), %rax
testq %rax, %rax
jle 0x30b24
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 0x160d7(%rip), %rdi     # 0x46bb5
leaq 0xdfae(%rip), %rsi      # 0x3ea93
leaq 0x1688b(%rip), %rcx     # 0x47377
jmp 0x30b39
leaq 0x15e17(%rip), %rdi     # 0x4690c
leaq 0x15d1a(%rip), %rsi     # 0x46816
leaq 0x15e3f(%rip), %rcx     # 0x46942
movl $0x343, %edx            # imm = 0x343
callq 0x7140
leaq 0x160a1(%rip), %rdi     # 0x46bb5
leaq 0xdf78(%rip), %rsi      # 0x3ea93
leaq 0xe1f8(%rip), %rcx      # 0x3ed1a
jmp 0x30b39
leaq 0x1608a(%rip), %rdi     # 0x46bb5
leaq 0xdf61(%rip), %rsi      # 0x3ea93
leaq 0xe060(%rip), %rcx      # 0x3eb99
movl $0x326, %edx            # imm = 0x326
callq 0x7140
nop