// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, -0x38(%rbp)
testq %rdx, %rdx
je 0x45024
movq 0xb8cd3(%rip), %r12     # 0xfdcd0
testq %rdi, %rdi
je 0x4505d
movss 0x4(%rdi), %xmm0
movss 0x3158(%r12), %xmm1
addss 0x71fcb(%rip), %xmm1    # 0xb6fe4
ucomiss %xmm1, %xmm0
seta %al
movl %eax, -0x2c(%rbp)
jmp 0x45064
movq -0x38(%rbp), %rax
movq %rax, %r15
cmpq $-0x1, %rax
je 0x44ff6
movq -0x38(%rbp), %r15
movzbl (%r15), %eax
cmpl $0x23, %eax
je 0x45044
testl %eax, %eax
jne 0x4504b
jmp 0x44ff6
cmpb $0x23, 0x1(%r15)
je 0x44ff6
incq %r15
cmpq $-0x1, %r15
jne 0x45035
movq $-0x1, %r15
jmp 0x44ff6
movl $0x0, -0x2c(%rbp)
testq %rdi, %rdi
je 0x45078
movss 0x4(%rdi), %xmm0
movss %xmm0, 0x3158(%r12)
movq 0x1ae0(%r12), %rax
cmpb $0x0, -0x2c(%rbp)
je 0x4508f
movb $0x1, 0x315c(%r12)
movl 0x18c(%rax), %eax
cmpl %eax, 0x3160(%r12)
jle 0x450a7
movl %eax, 0x3160(%r12)
subl 0x3160(%r12), %eax
shll $0x2, %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %r13d
notb %r13b
movq -0x38(%rbp), %rbx
movq %r15, %rdx
subq %rbx, %rdx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xc3c0
movq %r15, %r14
testq %rax, %rax
je 0x450e0
movq %rax, %r14
movq %r14, %rax
xorq %r15, %rax
movq %rbx, %rcx
xorq %r14, %rcx
orq %rax, %rcx
jne 0x4510a
cmpb $0x0, -0x2c(%rbp)
je 0x45168
xorl %r14d, %r14d
leaq 0x7e7c6(%rip), %rdi     # 0xc38c7
xorl %eax, %eax
callq 0x59e5b
jmp 0x45177
cmpq -0x38(%rbp), %rbx
sete %al
movl %r14d, %ecx
subl %ebx, %ecx
testb %al, %r13b
jne 0x45124
leaq 0x75653(%rip), %rdi     # 0xba775
jmp 0x45136
cmpb $0x1, 0x315c(%r12)
jne 0x4514c
leaq 0x75640(%rip), %rdi     # 0xba776
movl -0x30(%rbp), %esi
leaq 0x71ddd(%rip), %rdx     # 0xb6f1d
movq %rbx, %r8
xorl %eax, %eax
callq 0x59e5b
jmp 0x4515f
leaq 0x7562b(%rip), %rdi     # 0xba77e
movl %ecx, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x59e5b
movb $0x0, 0x315c(%r12)
leaq 0x1(%r14), %rax
cmpq %r15, %r14
setne %r14b
cmovneq %rax, %rbx
testb %r14b, %r14b
jne 0x450c2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq