// File: /workspace/github_cpp_makefile_star2_O1/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 0x6c12c(%rip), %rax     # 0xfdcd0
movq (%rax), %r14
movq 0x1ae0(%r14), %r12
movb $0x1, 0x90(%r12)
cmpb $0x0, 0x93(%r12)
jne 0x91fe7
movq %rdi, %r15
testq %rdi, %rdi
je 0x91ff6
movl %edx, %r13d
movq %rsi, %rbx
testq %rsi, %rsi
jne 0x91beb
movq %r15, %rdi
callq 0xc350
movq %rax, %rbx
addq %r15, %rbx
movss 0xd8(%r12), %xmm0
movaps %xmm0, -0x90(%rbp)
movss 0xdc(%r12), %xmm0
addss 0x110(%r12), %xmm0
movaps %xmm0, -0x80(%rbp)
movss 0x1d4(%r12), %xmm0
movq %rbx, %rax
subq %r15, %rax
cmpq $0x7d1, %rax            # imm = 0x7D1
jl 0x91e42
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jae 0x91e42
callq 0x573d2
movq $0x0, -0x38(%rbp)
movaps -0x90(%rbp), %xmm3
movaps -0x80(%rbp), %xmm1
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
cmpb $0x0, 0x3138(%r14)
movl %r13d, -0x3c(%rbp)
jne 0x91d3c
movss 0x25c(%r12), %xmm2
subss %xmm1, %xmm2
divss %xmm0, %xmm2
cvttss2si %xmm2, %r13d
testl %r13d, %r13d
jle 0x91d3c
xorps %xmm2, %xmm2
cmpq %r15, %rbx
jbe 0x91d2a
movaps %xmm3, -0x50(%rbp)
movss %xmm0, -0x2c(%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 0x91cff
movss -0x38(%rbp), %xmm0
movaps %xmm0, -0x70(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
movss 0x252f3(%rip), %xmm0    # 0xb6fd0
callq 0x4548d
movaps %xmm0, %xmm1
movaps -0x70(%rbp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movss %xmm1, -0x38(%rbp)
incq %r12
incl %r14d
cmpq %rbx, %r12
jae 0x91d12
movq %r12, %r15
cmpl %r13d, %r14d
jl 0x91ca1
xorps %xmm2, %xmm2
cvtsi2ss %r14d, %xmm2
movq %r12, %r15
movaps -0x80(%rbp), %xmm1
movss -0x2c(%rbp), %xmm0
movaps -0x50(%rbp), %xmm3
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 0x91f9b
movss 0x25af3(%rip), %xmm2    # 0xb7840
addss %xmm3, %xmm2
movaps %xmm3, %xmm1
shufps $0x55, %xmm3, %xmm1     # xmm1 = xmm1[1,1],xmm3[1,1]
addss %xmm0, %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movaps %xmm3, %xmm1
movlhps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
leaq -0x60(%rbp), %r13
movups %xmm1, (%r13)
movss %xmm0, -0x2c(%rbp)
movaps %xmm3, -0x50(%rbp)
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4709d
testb %al, %al
jne 0x91ee1
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, -0x70(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
movss 0x2520f(%rip), %xmm0    # 0xb6fd0
callq 0x4548d
movaps %xmm0, %xmm1
movaps -0x70(%rbp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movss %xmm1, -0x38(%rbp)
movaps -0x50(%rbp), %xmm0
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x44ec4
movaps -0x50(%rbp), %xmm3
movaps %xmm3, %xmm2
shufps $0x55, %xmm3, %xmm2     # xmm2 = xmm2[1,1],xmm3[1,1]
incq %r12
movss -0x5c(%rbp), %xmm1
movss -0x2c(%rbp), %xmm0
addss %xmm0, %xmm1
movss %xmm1, -0x5c(%rbp)
movss -0x54(%rbp), %xmm1
addss %xmm0, %xmm1
movss %xmm1, -0x54(%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 0x91d73
jmp 0x91eed
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x91e5c
addq $0xd8, %r12
movq %r12, %rdi
callq 0x47211
movaps %xmm0, %xmm1
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movss %xmm1, -0x50(%rbp)
movaps %xmm1, %xmm0
callq 0x4548d
leaq -0x38(%rbp), %rdi
movlps %xmm0, (%rdi)
movss (%rdi), %xmm0
movaps -0x90(%rbp), %xmm3
addss %xmm3, %xmm0
movss 0x4(%rdi), %xmm1
movaps -0x80(%rbp), %xmm2
addss %xmm2, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
leaq -0x60(%rbp), %r14
movss %xmm3, (%r14)
movss %xmm2, 0x4(%r14)
movlps %xmm0, 0x8(%r14)
xorps %xmm0, %xmm0
callq 0x532de
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5346f
testb %al, %al
je 0x91fe7
movsd -0x60(%rbp), %xmm0
movq %r15, %rdi
movq %rbx, %rsi
movss -0x50(%rbp), %xmm1
callq 0x4518f
jmp 0x91fe7
movaps -0x50(%rbp), %xmm2
movq %r15, %r12
movss -0x2c(%rbp), %xmm0
xorps %xmm3, %xmm3
cmpq %rbx, %r12
jae 0x91f81
movaps %xmm2, -0x70(%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 0x91f62
movss -0x38(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movss 0x25090(%rip), %xmm0    # 0xb6fd0
callq 0x4548d
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)
incq %r15
incl %r14d
movq %r15, %r12
cmpq %rbx, %r15
jb 0x91f04
xorps %xmm3, %xmm3
cvtsi2ss %r14d, %xmm3
movss -0x2c(%rbp), %xmm0
movaps -0x70(%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]
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)
movss (%rdi), %xmm0
movaps -0x90(%rbp), %xmm2
addss %xmm2, %xmm0
addss %xmm1, %xmm3
unpcklps %xmm3, %xmm0            # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
leaq -0x60(%rbp), %rbx
movss %xmm2, (%rbx)
movss %xmm1, 0x4(%rbx)
movlps %xmm0, 0x8(%rbx)
xorps %xmm0, %xmm0
callq 0x532de
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5346f
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3db1b(%rip), %rdi     # 0xcfb18
leaq 0x41144(%rip), %rsi     # 0xd3148
leaq 0x4115d(%rip), %rcx     # 0xd3168
movl $0x9b, %edx
callq 0xc140