// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TextEx(char const*, char const*, int)
void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return;

    ImGuiContext& g = *GImGui;
    IM_ASSERT(text != NULL);
    const char* text_begin = text;
    if (text_end == NULL)
        text_end = text + strlen(text); // FIXME-OPT

    const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
    const float wrap_pos_x = window->DC.TextWrapPos;
    const bool wrap_enabled = (wrap_pos_x >= 0.0f);
    if (text_end - text > 2000 && !wrap_enabled)
    {
        // Long text!
        // Perform manual coarse clipping to optimize for long multi-line text
        // - From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
        // - We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
        // - We use memchr(), pay attention that well optimized versions of those str/mem functions are much faster than a casually written loop.
        const char* line = text;
        const float line_height = GetTextLineHeight();
        ImVec2 text_size(0, 0);

        // Lines to skip (can't skip when logging text)
        ImVec2 pos = text_pos;
        if (!g.LogEnabled)
        {
            int lines_skippable = (int)((window->ClipRect.Min.y - text_pos.y) / line_height);
            if (lines_skippable > 0)
            {
                int lines_skipped = 0;
                while (line < text_end && lines_skipped < lines_skippable)
                {
                    const char* line_end = (const char*)memchr(line, '\n', text_end - line);
                    if (!line_end)
                        line_end = text_end;
                    if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
                        text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
                    line = line_end + 1;
                    lines_skipped++;
                }
                pos.y += lines_skipped * line_height;
            }
        }

        // Lines to render
        if (line < text_end)
        {
            ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));
            while (line < text_end)
            {
                if (IsClippedEx(line_rect, 0, false))
                    break;

                const char* line_end = (const char*)memchr(line, '\n', text_end - line);
                if (!line_end)
                    line_end = text_end;
                text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
                RenderText(pos, line, line_end, false);
                line = line_end + 1;
                line_rect.Min.y += line_height;
                line_rect.Max.y += line_height;
                pos.y += line_height;
            }

            // Count remaining lines
            int lines_skipped = 0;
            while (line < text_end)
            {
                const char* line_end = (const char*)memchr(line, '\n', text_end - line);
                if (!line_end)
                    line_end = text_end;
                if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
                    text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
                line = line_end + 1;
                lines_skipped++;
            }
            pos.y += lines_skipped * line_height;
        }
        text_size.y = (pos - text_pos).y;

        ImRect bb(text_pos, text_pos + text_size);
        ItemSize(text_size, 0.0f);
        ItemAdd(bb, 0);
    }
    else
    {
        const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f;
        const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width);

        ImRect bb(text_pos, text_pos + text_size);
        ItemSize(text_size, 0.0f);
        if (!ItemAdd(bb, 0))
            return;

        // Render (we don't hide text after ## in this end-user function)
        RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x6be48(%rip), %rax     # 0xfbcd0
movq (%rax), %r14
movq 0x1ae0(%r14), %r12
movb $0x1, 0x90(%r12)
cmpb $0x0, 0x93(%r12)
jne 0x902e6
movq %rdi, %r15
testq %rdi, %rdi
je 0x902f5
movl %edx, %r13d
movq %rsi, %rbx
testq %rsi, %rsi
jne 0x8fecf
movq %r15, %rdi
callq 0xc350
movq %rax, %rbx
addq %r15, %rbx
movss 0xd8(%r12), %xmm0
movaps %xmm0, -0x90(%rbp)
movss 0xdc(%r12), %xmm1
addss 0x110(%r12), %xmm1
movss 0x1d4(%r12), %xmm0
movq %rbx, %rax
subq %r15, %rax
cmpq $0x7d1, %rax            # imm = 0x7D1
movaps %xmm1, -0x80(%rbp)
jl 0x90014
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jae 0x90014
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
callq 0x562cd
movaps -0x80(%rbp), %xmm1
movq $0x0, -0x38(%rbp)
movaps -0x90(%rbp), %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
cmpb $0x0, 0x3138(%r14)
movl %r13d, -0x3c(%rbp)
jne 0x900d3
movss 0x25c(%r12), %xmm2
subss %xmm1, %xmm2
divss %xmm0, %xmm2
cvttss2si %xmm2, %r13d
testl %r13d, %r13d
jle 0x900d3
cmpq %r15, %rbx
jbe 0x900b1
movaps %xmm3, -0x60(%rbp)
movss %xmm0, -0x2c(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
xorl %r14d, %r14d
movq %rbx, %rdx
subq %r15, %rdx
movq %r15, %rdi
movl $0xa, %esi
callq 0xc3c0
movq %rax, %r12
testq %rax, %rax
cmoveq %rbx, %r12
testb $0x1, -0x3c(%rbp)
jne 0x8ffe4
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
movss 0x2500d(%rip), %xmm0    # 0xb4fd0
callq 0x44a23
movaps %xmm0, %xmm1
movaps -0x50(%rbp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movaps %xmm1, -0x50(%rbp)
incq %r12
incl %r14d
cmpq %rbx, %r12
jae 0x8fff7
movq %r12, %r15
cmpl %r13d, %r14d
jl 0x8ff90
xorps %xmm2, %xmm2
cvtsi2ss %r14d, %xmm2
movq %r12, %r15
movaps -0x80(%rbp), %xmm1
movss -0x2c(%rbp), %xmm0
movaps -0x60(%rbp), %xmm3
jmp 0x900b8
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x9002e
addq $0xd8, %r12
movq %r12, %rdi
callq 0x466ed
movaps %xmm0, %xmm1
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movss %xmm1, -0x60(%rbp)
movaps %xmm1, %xmm0
callq 0x44a23
leaq -0x38(%rbp), %rdi
movlps %xmm0, (%rdi)
movaps -0x90(%rbp), %xmm3
movaps %xmm3, %xmm1
addss %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps -0x80(%rbp), %xmm2
addss %xmm2, %xmm0
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
leaq -0x70(%rbp), %r14
movss %xmm3, (%r14)
movss %xmm2, 0x4(%r14)
movlps %xmm1, 0x8(%r14)
xorps %xmm0, %xmm0
callq 0x52315
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x524a8
testb %al, %al
je 0x902e6
movsd -0x70(%rbp), %xmm0
movq %r15, %rdi
movq %rbx, %rsi
movss -0x60(%rbp), %xmm1
callq 0x4471e
jmp 0x902e6
xorps %xmm2, %xmm2
movaps %xmm2, -0x50(%rbp)
movaps -0x50(%rbp), %xmm4
movss %xmm4, -0x38(%rbp)
mulss %xmm0, %xmm2
addss %xmm1, %xmm2
movlhps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0]
shufps $0xe2, %xmm3, %xmm2     # xmm2 = xmm2[2,0],xmm3[2,3]
movaps %xmm2, %xmm3
cmpq %rbx, %r15
jae 0x901d6
movaps %xmm3, %xmm2
shufps $0x55, %xmm3, %xmm2     # xmm2 = xmm2[1,1],xmm3[1,1]
movss 0x25755(%rip), %xmm1    # 0xb5840
addss %xmm3, %xmm1
addss %xmm0, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movaps %xmm3, %xmm2
movlhps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
leaq -0x70(%rbp), %r13
movups %xmm2, (%r13)
movss %xmm0, -0x2c(%rbp)
movaps %xmm3, -0x60(%rbp)
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x46579
testb %al, %al
jne 0x901df
movq %rbx, %rdx
subq %r15, %rdx
movq %r15, %rdi
movl $0xa, %esi
callq 0xc3c0
movq %rax, %r12
testq %rax, %rax
cmoveq %rbx, %r12
movss -0x38(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
movss 0x24e78(%rip), %xmm0    # 0xb4fd0
callq 0x44a23
movaps %xmm0, %xmm1
movaps -0x50(%rbp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movss %xmm1, -0x38(%rbp)
movaps -0x60(%rbp), %xmm0
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x44476
movaps -0x60(%rbp), %xmm3
movaps %xmm3, %xmm2
shufps $0x55, %xmm3, %xmm2     # xmm2 = xmm2[1,1],xmm3[1,1]
incq %r12
movss -0x6c(%rbp), %xmm1
movss -0x2c(%rbp), %xmm0
addss %xmm0, %xmm1
movss %xmm1, -0x6c(%rbp)
movss -0x64(%rbp), %xmm1
addss %xmm0, %xmm1
movss %xmm1, -0x64(%rbp)
addss %xmm0, %xmm2
movlhps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0]
shufps $0xe2, %xmm3, %xmm2     # xmm2 = xmm2[2,0],xmm3[2,3]
movq %r12, %r15
movaps %xmm2, %xmm3
cmpq %rbx, %r12
jb 0x9010a
jmp 0x901eb
movaps -0x50(%rbp), %xmm2
jmp 0x9029e
movaps -0x60(%rbp), %xmm2
movq %r15, %r12
movss -0x2c(%rbp), %xmm0
xorps %xmm3, %xmm3
cmpq %rbx, %r12
jae 0x9027f
movaps %xmm2, -0x50(%rbp)
xorl %r14d, %r14d
movl -0x3c(%rbp), %r13d
movq %rbx, %rdx
subq %r12, %rdx
movq %r12, %rdi
movl $0xa, %esi
callq 0xc3c0
movq %rax, %r15
testq %rax, %rax
cmoveq %rbx, %r15
testb $0x1, %r13b
jne 0x90260
movss -0x38(%rbp), %xmm0
movaps %xmm0, -0x60(%rbp)
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movss 0x24d92(%rip), %xmm0    # 0xb4fd0
callq 0x44a23
movaps %xmm0, %xmm1
movaps -0x60(%rbp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movss %xmm1, -0x38(%rbp)
incq %r15
incl %r14d
movq %r15, %r12
cmpq %rbx, %r15
jb 0x90202
xorps %xmm3, %xmm3
cvtsi2ss %r14d, %xmm3
movss -0x2c(%rbp), %xmm0
movaps -0x50(%rbp), %xmm2
movaps %xmm2, %xmm1
shufps $0x55, %xmm2, %xmm1     # xmm1 = xmm1[1,1],xmm2[1,1]
mulss %xmm0, %xmm3
addss %xmm1, %xmm3
movlhps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
shufps $0xe2, %xmm2, %xmm3     # xmm3 = xmm3[2,0],xmm2[2,3]
movss -0x38(%rbp), %xmm2
movaps -0x80(%rbp), %xmm1
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
subss %xmm1, %xmm3
leaq -0x38(%rbp), %rdi
movss %xmm3, 0x4(%rdi)
movaps -0x90(%rbp), %xmm0
addss %xmm0, %xmm2
addss %xmm1, %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
leaq -0x70(%rbp), %rbx
movss %xmm0, (%rbx)
movss %xmm1, 0x4(%rbx)
movlps %xmm2, 0x8(%rbx)
xorps %xmm0, %xmm0
callq 0x52315
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x524a8
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3d7ec(%rip), %rdi     # 0xcdae8
leaq 0x40d15(%rip), %rsi     # 0xd1018
leaq 0x40d2e(%rip), %rcx     # 0xd1038
movl $0x9b, %edx
callq 0xc140