// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::LogRenderedText(ImVec2 const*, char const*, char const*)
void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;

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

    const bool log_new_line = ref_pos && (ref_pos->y > g.LogLinePosY + 1);
    if (ref_pos)
        g.LogLinePosY = ref_pos->y;
    if (log_new_line)
        g.LogLineFirstItem = true;

    const char* text_remaining = text;
    if (g.LogDepthRef > window->DC.TreeDepth)  // Re-adjust padding if we have popped out of our starting depth
        g.LogDepthRef = window->DC.TreeDepth;
    const int tree_depth = (window->DC.TreeDepth - g.LogDepthRef);
    for (;;)
    {
        // Split the string. Each new line (after a '\n') is followed by spacing corresponding to the current depth of our log entry.
        // We don't add a trailing \n to allow a subsequent item on the same line to be captured.
        const char* line_start = text_remaining;
        const char* line_end = ImStreolRange(line_start, text_end);
        const bool is_first_line = (line_start == text);
        const bool is_last_line = (line_end == text_end);
        if (!is_last_line || (line_start != line_end))
        {
            const int char_count = (int)(line_end - line_start);
            if (log_new_line || !is_first_line)
                LogText(IM_NEWLINE "%*s%.*s", tree_depth * 4, "", char_count, line_start);
            else if (g.LogLineFirstItem)
                LogText("%*s%.*s", tree_depth * 4, "", char_count, line_start);
            else
                LogText(" %.*s", char_count, line_start);
            g.LogLineFirstItem = false;
        }
        else if (log_new_line)
        {
            // An empty "" string at a different Y position should output a carriage return.
            LogText(IM_NEWLINE);
            break;
        }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq 0x14ace5(%rip), %rax    # 0x212f40
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xc8286
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc8090
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x8(%rbp)
movb %al, -0x59(%rbp)
je 0xc82b8
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x20(%rbp), %rax
movss 0xa8995(%rip), %xmm1    # 0x170c3c
addss 0x3158(%rax), %xmm1
ucomiss %xmm1, %xmm0
seta %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
andb $0x1, %al
movb %al, -0x29(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xc82dc
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x3158(%rax)
testb $0x1, -0x29(%rbp)
je 0xc82ed
movq -0x20(%rbp), %rax
movb $0x1, 0x315c(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x3160(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x18c(%rcx), %eax
jle 0xc831f
movq -0x28(%rbp), %rax
movl 0x18c(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x3160(%rax)
movq -0x28(%rbp), %rax
movl 0x18c(%rax), %eax
movq -0x20(%rbp), %rcx
subl 0x3160(%rcx), %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc4a00
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x10(%rbp), %rax
sete %al
andb $0x1, %al
movb %al, -0x51(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
sete %al
andb $0x1, %al
movb %al, -0x52(%rbp)
testb $0x1, -0x52(%rbp)
je 0xc8383
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0xc8416
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x58(%rbp)
testb $0x1, -0x29(%rbp)
jne 0xc839d
testb $0x1, -0x51(%rbp)
jne 0xc83c1
movl -0x3c(%rbp), %esi
shll $0x2, %esi
movl -0x58(%rbp), %ecx
movq -0x48(%rbp), %r8
leaq 0xad434(%rip), %rdi     # 0x1757e5
leaq 0xa9b51(%rip), %rdx     # 0x171f09
movb $0x0, %al
callq 0xe0a30
jmp 0xc8409
movq -0x20(%rbp), %rax
testb $0x1, 0x315c(%rax)
je 0xc83f2
movl -0x3c(%rbp), %esi
shll $0x2, %esi
movl -0x58(%rbp), %ecx
movq -0x48(%rbp), %r8
leaq 0xad404(%rip), %rdi     # 0x1757e6
leaq 0xa9b20(%rip), %rdx     # 0x171f09
movb $0x0, %al
callq 0xe0a30
jmp 0xc8407
movl -0x58(%rbp), %esi
movq -0x48(%rbp), %rdx
leaq 0xad3ee(%rip), %rdi     # 0x1757ee
movb $0x0, %al
callq 0xe0a30
jmp 0xc8409
movq -0x20(%rbp), %rax
movb $0x0, 0x315c(%rax)
jmp 0xc842e
testb $0x1, -0x29(%rbp)
je 0xc842c
leaq 0xb6aa1(%rip), %rdi     # 0x17eec4
movb $0x0, %al
callq 0xe0a30
jmp 0xc8447
jmp 0xc842e
testb $0x1, -0x52(%rbp)
je 0xc8436
jmp 0xc8447
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xc8336
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)