// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: LogRenderedText(ImVec2 const&, char const*, char const*)
static void LogRenderedText(const ImVec2& ref_pos, const char* text, const char* text_end)
{
    ImGuiState& g = *GImGui;
    ImGuiWindow* window = ImGui::GetCurrentWindowRead();

    if (!text_end)
        text_end = FindTextDisplayEnd(text, text_end);

    const bool log_new_line = ref_pos.y > window->DC.LogLinePosY+1;
    window->DC.LogLinePosY = ref_pos.y;

    const char* text_remaining = text;
    if (g.LogStartDepth > window->DC.TreeDepth)  // Re-adjust padding if we have popped out of our starting depth
        g.LogStartDepth = window->DC.TreeDepth;
    const int tree_depth = (window->DC.TreeDepth - g.LogStartDepth);
    for (;;)
    {
        // Split the string. Each new line (after a '\n') is followed by spacing corresponding to the current depth of our log entry.
        const char* line_end = text_remaining;
        while (line_end < text_end)
            if (*line_end == '\n')
                break;
            else
                line_end++;
        if (line_end >= text_end)
            line_end = NULL;

        const bool is_first_line = (text == text_remaining);
        bool is_last_line = false;
        if (line_end == NULL)
        {
            is_last_line = true;
            line_end = text_end;
        }
        if (line_end != NULL && !(is_last_line && (line_end - text_remaining)==0))
        {
            const int char_count = (int)(line_end - text_remaining);
            if (log_new_line || !is_first_line)
                ImGui::LogText(IM_NEWLINE "%*s%.*s", tree_depth*4, "", char_count, text_remaining);
            else
                ImGui::LogText(" %.*s", char_count, text_remaining);
        }

        if (is_last_line)
            break;
        text_remaining = line_end + 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq 0x69185(%rip), %rax     # 0x794c0
movq %rax, -0x20(%rbp)
callq 0x2e290
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x10360
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x10230
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x28(%rbp), %rax
movss 0x4aca3(%rip), %xmm1    # 0x5b018
addss 0xd8(%rax), %xmm1
ucomiss %xmm1, %xmm0
seta %al
andb $0x1, %al
movb %al, -0x29(%rbp)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, 0xd8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x2c00(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0xdc(%rcx), %eax
jle 0x103cf
movq -0x28(%rbp), %rax
movl 0xdc(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2c00(%rax)
movq -0x28(%rbp), %rax
movl 0xdc(%rax), %eax
movq -0x20(%rbp), %rcx
subl 0x2c00(%rcx), %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x10414
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x10406
jmp 0x10414
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x103ee
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jb 0x10426
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
sete %al
andb $0x1, %al
movb %al, -0x49(%rbp)
movb $0x0, -0x4a(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x1044d
movb $0x1, -0x4a(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x104c0
testb $0x1, -0x4a(%rbp)
je 0x1046b
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
cmpq $0x0, %rax
je 0x104c0
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x50(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x10485
testb $0x1, -0x49(%rbp)
jne 0x104a9
movl -0x3c(%rbp), %esi
shll $0x2, %esi
movl -0x50(%rbp), %ecx
movq -0x38(%rbp), %r8
leaq 0x4c3b1(%rip), %rdi     # 0x5c84a
leaq 0x4edae(%rip), %rdx     # 0x5f24e
movb $0x0, %al
callq 0x10010
jmp 0x104be
movl -0x50(%rbp), %esi
movq -0x38(%rbp), %rdx
leaq 0x4c39c(%rip), %rdi     # 0x5c853
movb $0x0, %al
callq 0x10010
jmp 0x104c0
testb $0x1, -0x4a(%rbp)
je 0x104c8
jmp 0x104d9
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x103e6
addq $0x50, %rsp
popq %rbp
retq
nop