// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::TextUnformatted(char const*, char const*)
void ImGui::TextUnformatted(const char* text, const char* text_end)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return;

    ImGuiState& g = *GImGui;
    IM_ASSERT(text != NULL);
    const char* text_begin = text;
    if (text_end == NULL)
        text_end = text + strlen(text); // FIXME-OPT

    const float wrap_pos_x = window->DC.TextWrapPos;
    const bool wrap_enabled = wrap_pos_x >= 0.0f;
    if (text_end - text > 2000 && !wrap_enabled)
    {
        // Long text!
        // Perform manual coarse clipping to optimize for long multi-line text
        // From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
        // We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
        const char* line = text;
        const float line_height = ImGui::GetTextLineHeight();
        const ImVec2 text_pos = window->DC.CursorPos + ImVec2(0.0f, window->DC.CurrentLineTextBaseOffset);
        const ImRect clip_rect = window->ClipRect;
        ImVec2 text_size(0,0);

        if (text_pos.y <= clip_rect.Max.y)
        {
            ImVec2 pos = text_pos;

            // Lines to skip (can't skip when logging text)
            if (!g.LogEnabled)
            {
                int lines_skippable = (int)((clip_rect.Min.y - text_pos.y) / line_height);
                if (lines_skippable > 0)
                {
                    int lines_skipped = 0;
                    while (line < text_end && lines_skipped < lines_skippable)
                    {
                        const char* line_end = strchr(line, '\n');
                        line = line_end + 1;
                        lines_skipped++;
                    }
                    pos.y += lines_skipped * line_height;
                }
            }

            // Lines to render
            if (line < text_end)
            {
                ImRect line_rect(pos, pos + ImVec2(ImGui::GetWindowWidth(), line_height));
                while (line < text_end)
                {
                    const char* line_end = strchr(line, '\n');
                    if (IsClippedEx(line_rect, NULL, false))
                        break;

                    const ImVec2 line_size = CalcTextSize(line, line_end, false);
                    text_size.x = ImMax(text_size.x, line_size.x);
                    RenderText(pos, line, line_end, false);
                    if (!line_end)
                        line_end = text_end;
                    line = line_end + 1;
                    line_rect.Min.y += line_height;
                    line_rect.Max.y += line_height;
                    pos.y += line_height;
                }

                // Count remaining lines
                int lines_skipped = 0;
                while (line < text_end)
                {
                    const char* line_end = strchr(line, '\n');
                    if (!line_end)
                        line_end = text_end;
                    line = line_end + 1;
                    lines_skipped++;
                }
                pos.y += lines_skipped * line_height;
            }

            text_size.y += (pos - text_pos).y;
        }

        ImRect bb(text_pos, text_pos + text_size);
        ItemSize(bb);
        ItemAdd(bb, NULL);
    }
    else
    {
        const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f;
        const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width);

        // Account of baseline offset
        ImVec2 text_pos = window->DC.CursorPos;
        text_pos.y += window->DC.CurrentLineTextBaseOffset;

        ImRect bb(text_pos, text_pos + text_size);
        ItemSize(text_size);
        if (!ItemAdd(bb, NULL))
            return;

        // Render (we don't hide text after ## in this end-user function)
        RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x2e220
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0x74(%rax)
je 0xf8eb
jmp 0xfe43
movq 0x69bce(%rip), %rax     # 0x794c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xf8ff
jmp 0xf91e
leaq 0x4c47f(%rip), %rdi     # 0x5bd85
leaq 0x4b9b8(%rip), %rsi     # 0x5b2c5
movl $0x133d, %edx           # imm = 0x133D
leaq 0x4c47b(%rip), %rcx     # 0x5bd94
callq 0x7160
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xf952
movq -0x8(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7330
movq %rax, %rcx
movq -0x128(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movss 0x120(%rax), %xmm0
movss %xmm0, -0x2c(%rbp)
movss -0x2c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
setae %al
andb $0x1, %al
movb %al, -0x2d(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
cmpq $0x7d0, %rax            # imm = 0x7D0
jle 0xfd2b
testb $0x1, -0x2d(%rbp)
jne 0xfd2b
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x199e0
movss %xmm0, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0xa8, %rcx
movq %rcx, -0x138(%rbp)
movss 0xcc(%rax), %xmm1
leaq -0x4c(%rbp), %rdi
movq %rdi, -0x130(%rbp)
xorps %xmm0, %xmm0
callq 0x2d280
movq -0x138(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0xc7e0
movlpd %xmm0, -0x44(%rbp)
movq -0x18(%rbp), %rax
movq 0x1e0(%rax), %rcx
movq %rcx, -0x5c(%rbp)
movq 0x1e8(%rax), %rax
movq %rax, -0x54(%rbp)
leaq -0x64(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x2d280
movss -0x40(%rbp), %xmm1
movss -0x50(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jb 0xfcdb
movq -0x44(%rbp), %rax
movq %rax, -0x6c(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x2be8(%rax)
jne 0xfadd
movss -0x58(%rbp), %xmm0
subss -0x40(%rbp), %xmm0
divss -0x3c(%rbp), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
jle 0xfadb
movl $0x0, -0x74(%rbp)
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq -0x10(%rbp), %rcx
movb %al, -0x139(%rbp)
jae 0xfa8a
movl -0x74(%rbp), %eax
cmpl -0x70(%rbp), %eax
setl %al
movb %al, -0x139(%rbp)
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0xfa96
jmp 0xfabf
movq -0x38(%rbp), %rdi
movl $0xa, %esi
callq 0x7430
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xfa69
cvtsi2ssl -0x74(%rbp), %xmm0
movss -0x3c(%rbp), %xmm2
movss -0x68(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x68(%rbp)
jmp 0xfadd
movq -0x38(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0xfcb4
callq 0x19040
movss -0x3c(%rbp), %xmm1
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x2d280
movq -0x148(%rbp), %rsi
leaq -0x6c(%rbp), %rdi
callq 0xc7e0
movlpd %xmm0, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x2eb40
movq -0x38(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0xfc37
movq -0x38(%rbp), %rdi
movl $0xa, %esi
callq 0x7430
movq %rax, -0xa8(%rbp)
leaq -0x90(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0xc220
testb $0x1, %al
jne 0xfb72
jmp 0xfb77
jmp 0xfc37
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rsi
xorl %edx, %edx
movss 0x4b4f0(%rip), %xmm0    # 0x5b07c
callq 0x10930
movlpd %xmm0, -0xb0(%rbp)
movss -0x64(%rbp), %xmm0
movss -0xb0(%rbp), %xmm1
callq 0xb7c0
movss %xmm0, -0x64(%rbp)
movq -0x6c(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movsd -0xb8(%rbp), %xmm0
xorl %edx, %edx
callq 0x10100
cmpq $0x0, -0xa8(%rbp)
jne 0xfbea
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movss -0x3c(%rbp), %xmm0
addss -0x8c(%rbp), %xmm0
movss %xmm0, -0x8c(%rbp)
movss -0x3c(%rbp), %xmm0
addss -0x84(%rbp), %xmm0
movss %xmm0, -0x84(%rbp)
movss -0x3c(%rbp), %xmm0
addss -0x68(%rbp), %xmm0
movss %xmm0, -0x68(%rbp)
jmp 0xfb37
movl $0x0, -0xbc(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0xfc95
movq -0x38(%rbp), %rdi
movl $0xa, %esi
callq 0x7430
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
jne 0xfc75
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xfc41
cvtsi2ssl -0xbc(%rbp), %xmm0
movss -0x3c(%rbp), %xmm2
movss -0x68(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x68(%rbp)
leaq -0x6c(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0xdf20
movlpd %xmm0, -0xd0(%rbp)
movss -0xcc(%rbp), %xmm0
addss -0x60(%rbp), %xmm0
movss %xmm0, -0x60(%rbp)
leaq -0x44(%rbp), %rdi
leaq -0x64(%rbp), %rsi
callq 0xc7e0
movlpd %xmm0, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x44(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x2eb40
leaq -0xe0(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0xc060
leaq -0xe0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc0a0
jmp 0xfe43
testb $0x1, -0x2d(%rbp)
je 0xfd50
movq -0x18(%rbp), %rdi
addq $0xa8, %rdi
movss -0x2c(%rbp), %xmm0
callq 0xc940
movss %xmm0, -0x14c(%rbp)
jmp 0xfd5d
xorps %xmm0, %xmm0
movss %xmm0, -0x14c(%rbp)
jmp 0xfd5d
movss -0x14c(%rbp), %xmm0
movss %xmm0, -0xec(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movss -0xec(%rbp), %xmm0
xorl %edx, %edx
callq 0x10930
movlpd %xmm0, -0xf4(%rbp)
movq -0x18(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x18(%rbp), %rax
movss 0xcc(%rax), %xmm1
movss -0xfc(%rbp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0xfc(%rbp)
leaq -0x100(%rbp), %rdi
leaq -0xf4(%rbp), %rsi
callq 0xc7e0
movlpd %xmm0, -0x118(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x2eb40
leaq -0xf4(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0xbeb0
leaq -0x110(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc0a0
testb $0x1, %al
jne 0xfe18
jmp 0xfe43
movq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movss -0xec(%rbp), %xmm1
movsd -0x120(%rbp), %xmm0
callq 0x104e0
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopl (%rax)