// File: /workspace/github_cpp_makefile_star2_O2/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, -0x38(%rbp)
movq %rdi, %rbx
movq 0xada9c(%rip), %r13     # 0xe3ce0
movq 0x1ae0(%r13), %r15
testq %rdx, %rdx
jne 0x3625e
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x36123
movq %rax, %r14
testq %rbx, %rbx
je 0x36296
movss 0x3158(%r13), %xmm0
addss 0x65d84(%rip), %xmm0    # 0x9bff8
movss 0x4(%rbx), %xmm1
ucomiss %xmm0, %xmm1
movss %xmm1, 0x3158(%r13)
jbe 0x36296
movb $0x1, 0x315c(%r13)
movb $0x1, %al
movl %eax, -0x2c(%rbp)
jmp 0x3629d
movl $0x0, -0x2c(%rbp)
movl 0x3160(%r13), %eax
movl 0x18c(%r15), %ecx
cmpl %ecx, %eax
jle 0x362b8
movl %ecx, 0x3160(%r13)
movl %ecx, %eax
subl %eax, %ecx
shll $0x2, %ecx
movl %ecx, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %r15d
notb %r15b
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x34502
movq %rax, %r12
xorq %r14, %rax
movq %rbx, %rcx
xorq %r12, %rcx
orq %rax, %rcx
jne 0x362f1
cmpb $0x0, -0x2c(%rbp)
je 0x3634d
jmp 0x3636a
cmpq -0x38(%rbp), %rbx
sete %al
movl %r12d, %ecx
subl %ebx, %ecx
testb %al, %r15b
jne 0x3630b
leaq 0x6949c(%rip), %rdi     # 0x9f7a5
jmp 0x3631c
cmpb $0x1, 0x315c(%r13)
jne 0x36332
leaq 0x6948a(%rip), %rdi     # 0x9f7a6
movl -0x30(%rbp), %esi
leaq 0x65bfb(%rip), %rdx     # 0x9bf21
movq %rbx, %r8
xorl %eax, %eax
callq 0x462f3
jmp 0x36345
leaq 0x69475(%rip), %rdi     # 0x9f7ae
movl %ecx, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x462f3
movb $0x0, 0x315c(%r13)
leaq 0x1(%r12), %rbx
cmpq %r14, %r12
jne 0x362cd
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x72856(%rip), %rdi     # 0xa8bc7
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x462f3