// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movl %edx, -0x3c(%rbp)
leaq 0x6aba9(%rip), %rax     # 0xe3ce0
movq (%rax), %r14
movq 0x1ae0(%r14), %r12
movb $0x1, 0x90(%r12)
cmpb $0x0, 0x93(%r12)
jne 0x7956f
movq %rdi, %r13
testq %rdi, %rdi
je 0x7957e
movq %rsi, %rbx
testq %rsi, %rsi
jne 0x7917b
movq %r13, %rdi
callq 0xc380
movq %rax, %rbx
addq %r13, %rbx
movss 0xd8(%r12), %xmm0
movaps %xmm0, -0x90(%rbp)
movss 0xdc(%r12), %xmm0
addss 0x110(%r12), %xmm0
movaps %xmm0, -0x70(%rbp)
movss 0x1d4(%r12), %xmm0
movq %rbx, %rax
subq %r13, %rax
cmpq $0x7d1, %rax            # imm = 0x7D1
jl 0x792a3
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jae 0x792a3
callq 0x43e97
andq $0x0, -0x38(%rbp)
movaps -0x90(%rbp), %xmm2
movaps -0x70(%rbp), %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
cmpb $0x0, 0x3138(%r14)
movss %xmm0, -0x2c(%rbp)
jne 0x79376
movaps %xmm2, -0x50(%rbp)
movss 0x25c(%r12), %xmm2
subss %xmm3, %xmm2
movss -0x2c(%rbp), %xmm0
divss %xmm0, %xmm2
cvttss2si %xmm2, %r12d
testl %r12d, %r12d
jle 0x7936e
xorl %r14d, %r14d
xorps %xmm4, %xmm4
cmpq %rbx, %r13
jae 0x79340
cmpl %r12d, %r14d
jge 0x79340
movaps %xmm4, -0x80(%rbp)
movq %rbx, %rdx
subq %r13, %rdx
movq %r13, %rdi
pushq $0xa
popq %rsi
callq 0xc400
movq %rax, %r15
testq %rax, %rax
cmoveq %rbx, %r15
testb $0x1, -0x3c(%rbp)
jne 0x7928f
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
movss 0x22d83(%rip), %xmm0    # 0x9bff0
callq 0x365e8
movaps %xmm0, %xmm1
movaps -0x80(%rbp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movaps %xmm1, %xmm4
jmp 0x79293
movaps -0x80(%rbp), %xmm4
incq %r15
incl %r14d
movq %r15, %r13
movss -0x2c(%rbp), %xmm0
jmp 0x79226
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x792bd
addq $0xd8, %r12
movq %r12, %rdi
callq 0x37990
movaps %xmm0, %xmm1
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movss %xmm1, -0x50(%rbp)
movaps %xmm1, %xmm0
callq 0x365e8
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 -0x70(%rbp), %xmm2
addss %xmm2, %xmm0
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
leaq -0x60(%rbp), %r14
movss %xmm3, (%r14)
movss %xmm2, 0x4(%r14)
movlps %xmm1, 0x8(%r14)
xorps %xmm0, %xmm0
callq 0x40d3b
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x40ea5
testb %al, %al
je 0x7956f
movsd -0x60(%rbp), %xmm0
movq %r13, %rdi
movq %rbx, %rsi
movss -0x50(%rbp), %xmm1
callq 0x36386
jmp 0x7956f
movss %xmm4, -0x38(%rbp)
cvtsi2ss %r14d, %xmm3
mulss %xmm0, %xmm3
movaps -0x70(%rbp), %xmm1
addss %xmm1, %xmm3
movaps -0x50(%rbp), %xmm2
movlhps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
shufps $0xe2, %xmm2, %xmm3     # xmm3 = xmm3[2,0],xmm2[2,3]
movaps %xmm3, %xmm2
movaps %xmm1, %xmm3
movss -0x2c(%rbp), %xmm0
jmp 0x79379
movaps -0x70(%rbp), %xmm3
movaps -0x50(%rbp), %xmm2
xorps %xmm4, %xmm4
cmpq %rbx, %r13
jae 0x79527
movss 0x234e6(%rip), %xmm3    # 0x9c870
addss %xmm2, %xmm3
movaps %xmm2, %xmm1
shufps $0x55, %xmm2, %xmm1     # xmm1 = xmm1[1,1],xmm2[1,1]
addss %xmm0, %xmm1
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movaps %xmm2, %xmm1
movlhps %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
leaq -0x60(%rbp), %r12
movups %xmm1, (%r12)
pushq $0xa
popq %r14
movaps %xmm2, -0x50(%rbp)
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
movaps %xmm2, -0x80(%rbp)
cmpq %rbx, %r13
jae 0x79488
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x37840
testb %al, %al
jne 0x79488
movq %rbx, %rdx
subq %r13, %rdx
movq %r13, %rdi
movl %r14d, %esi
callq 0xc400
movq %rax, %r15
testq %rax, %rax
cmoveq %rbx, %r15
movss -0x38(%rbp), %xmm0
movaps %xmm0, -0xa0(%rbp)
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
movss 0x22be1(%rip), %xmm0    # 0x9bff0
callq 0x365e8
movaps %xmm0, %xmm1
movaps -0xa0(%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 %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x36156
incq %r15
movss -0x5c(%rbp), %xmm0
movss -0x2c(%rbp), %xmm1
addss %xmm1, %xmm0
movss %xmm0, -0x5c(%rbp)
movss -0x54(%rbp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x54(%rbp)
movaps -0x80(%rbp), %xmm2
addss %xmm1, %xmm2
movaps -0x50(%rbp), %xmm0
movlhps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm2     # xmm2 = xmm2[2,0],xmm0[2,3]
movaps %xmm2, -0x50(%rbp)
movq %r15, %r13
jmp 0x793b3
xorl %r14d, %r14d
pushq $0xa
popq %r12
movaps -0x50(%rbp), %xmm1
cmpq %rbx, %r13
jae 0x79505
movq %rbx, %rdx
subq %r13, %rdx
movq %r13, %rdi
movl %r12d, %esi
callq 0xc400
movq %rax, %r15
testq %rax, %rax
cmoveq %rbx, %r15
testb $0x1, -0x3c(%rbp)
jne 0x794fa
movss -0x38(%rbp), %xmm0
movaps %xmm0, -0xa0(%rbp)
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
movss 0x22b1b(%rip), %xmm0    # 0x9bff0
callq 0x365e8
movaps %xmm0, %xmm1
movaps -0xa0(%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, %r13
jmp 0x7948f
cvtsi2ss %r14d, %xmm0
mulss -0x2c(%rbp), %xmm0
addss -0x80(%rbp), %xmm0
movlhps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
shufps $0xe2, %xmm1, %xmm0     # xmm0 = xmm0[2,0],xmm1[2,3]
movss -0x38(%rbp), %xmm4
movaps %xmm0, %xmm2
movaps -0x70(%rbp), %xmm3
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
subss %xmm3, %xmm2
leaq -0x38(%rbp), %rdi
movss %xmm2, 0x4(%rdi)
movaps -0x90(%rbp), %xmm1
addss %xmm1, %xmm4
addss %xmm3, %xmm2
unpcklps %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
leaq -0x60(%rbp), %rbx
movss %xmm1, (%rbx)
movss %xmm3, 0x4(%rbx)
movlps %xmm4, 0x8(%rbx)
xorps %xmm0, %xmm0
callq 0x40d3b
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x40ea5
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3b893(%rip), %rdi     # 0xb4e18
leaq 0x3edfc(%rip), %rsi     # 0xb8388
leaq 0x3ee15(%rip), %rcx     # 0xb83a8
movl $0x9b, %edx
callq 0xc140