// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, -0x38(%rbp)
movq %rdi, %rbx
movq 0x4722a(%rip), %r12     # 0x55490
movq 0x1758(%r12), %r15
testq %rdx, %rdx
jne 0xe281
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0xe1e7
movq %rax, %r14
movss 0x4(%rbx), %xmm0
movss 0xd8(%r15), %xmm1
movss %xmm1, -0x2c(%rbp)
movss %xmm0, -0x3c(%rbp)
movss %xmm0, 0xd8(%r15)
movl 0xdc(%r15), %r15d
cmpl %r15d, 0x2c00(%r12)
jle 0xe2bb
movl %r15d, 0x2c00(%r12)
movss -0x2c(%rbp), %xmm0
addss 0x2f0b8(%rip), %xmm0    # 0x3d380
movss %xmm0, -0x2c(%rbp)
subl 0x2c00(%r12), %r15d
shll $0x2, %r15d
movq -0x38(%rbp), %r13
cmpq %r14, %r13
jae 0xe2f8
movq %r14, %rax
subq %r13, %rax
movq %r13, %rbx
cmpb $0xa, (%rbx)
je 0xe2fa
incq %rbx
decq %rax
jne 0xe2eb
xorl %ebx, %ebx
testq %rbx, %rbx
sete %al
movq %rbx, %r12
cmoveq %r14, %r12
testq %r12, %r12
sete %cl
cmpq %r13, %r12
sete %dl
andb %al, %dl
orb %cl, %dl
jne 0xe360
movl %r12d, %ecx
subl %r13d, %ecx
movss -0x3c(%rbp), %xmm0
ucomiss -0x2c(%rbp), %xmm0
ja 0xe345
cmpq -0x38(%rbp), %r13
jne 0xe345
leaq 0x308a3(%rip), %rdi     # 0x3ebda
movl %ecx, %esi
movq %r13, %rdx
xorl %eax, %eax
callq 0xe031
jmp 0xe360
leaq 0x30885(%rip), %rdi     # 0x3ebd1
movl %r15d, %esi
leaq 0x33163(%rip), %rdx     # 0x414b9
movq %r13, %r8
xorl %eax, %eax
callq 0xe031
incq %r12
testq %rbx, %rbx
cmovneq %r12, %r13
jne 0xe2dd
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq