// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movq %rsi, %rbx
movq 0xb7726(%rip), %r15     # 0xfbcd0
testq %rdx, %rdx
jne 0x445de
cmpq $-0x1, %rbx
je 0x445d7
movq %rbx, %r14
movzbl (%r14), %eax
cmpl $0x23, %eax
je 0x445c7
testl %eax, %eax
jne 0x445ce
jmp 0x445de
cmpb $0x23, 0x1(%r14)
je 0x445de
incq %r14
cmpq $-0x1, %r14
jne 0x445b8
movq $-0x1, %r14
movq 0x1ae0(%r15), %rax
testq %rdi, %rdi
je 0x4461d
movss 0x3158(%r15), %xmm0
addss 0x709e9(%rip), %xmm0    # 0xb4fe4
movss 0x4(%rdi), %xmm1
ucomiss %xmm0, %xmm1
movss %xmm1, 0x3158(%r15)
jbe 0x4461d
movb $0x1, 0x315c(%r15)
movb $0x1, %cl
movl %ecx, -0x2c(%rbp)
jmp 0x44624
movl $0x0, -0x2c(%rbp)
movl 0x3160(%r15), %ecx
movl 0x18c(%rax), %eax
cmpl %eax, %ecx
jle 0x4463e
movl %eax, 0x3160(%r15)
movl %eax, %ecx
subl %ecx, %eax
shll $0x2, %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %r13d
notb %r13b
movq %rbx, -0x38(%rbp)
movq %r14, %rdx
subq %rbx, %rdx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xc3c0
movq %rax, %r12
testq %rax, %rax
cmoveq %r14, %r12
movq %r12, %rax
xorq %r14, %rax
movq %rbx, %rcx
xorq %r12, %rcx
orq %rax, %rcx
jne 0x44689
cmpb $0x0, -0x2c(%rbp)
je 0x446e5
jmp 0x44702
cmpq -0x38(%rbp), %rbx
sete %al
movl %r12d, %ecx
subl %ebx, %ecx
testb %al, %r13b
jne 0x446a3
leaq 0x740d4(%rip), %rdi     # 0xb8775
jmp 0x446b4
cmpb $0x1, 0x315c(%r15)
jne 0x446ca
leaq 0x740c2(%rip), %rdi     # 0xb8776
movl -0x30(%rbp), %esi
leaq 0x7085f(%rip), %rdx     # 0xb4f1d
movq %rbx, %r8
xorl %eax, %eax
callq 0x58cc1
jmp 0x446dd
leaq 0x740ad(%rip), %rdi     # 0xb877e
movl %ecx, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x58cc1
movb $0x0, 0x315c(%r15)
leaq 0x1(%r12), %rbx
cmpq %r14, %r12
jne 0x44653
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7d18e(%rip), %rdi     # 0xc1897
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x58cc1