// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::RenderTextClippedEx(ImDrawList*, ImVec2 const&, ImVec2 const&, char const*, char const*, ImVec2 const*, ImVec2 const&, ImRect const*)
void ImGui::RenderTextClippedEx(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_display_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect)
{
    // Perform CPU side clipping for single clipped element to avoid using scissor state
    ImVec2 pos = pos_min;
    const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f);

    const ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min;
    const ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max;
    bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y);
    if (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min
        need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y);

    // Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment.
    if (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x);
    if (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y);

    // Render
    if (need_clipping)
    {
        ImVec4 fine_clip_rect(clip_min->x, clip_min->y, clip_max->x, clip_max->y);
        draw_list->AddText(NULL, 0.0f, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect);
    }
    else
    {
        draw_list->AddText(NULL, 0.0f, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, NULL);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xc859a
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xc85b1
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
xorps %xmm0, %xmm0
callq 0xc87e0
movlpd %xmm0, -0x40(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0xc85c2
movq 0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0xc85ca
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0xc85e7
movq 0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x78(%rbp)
jmp 0xc85ef
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x50(%rbp)
movss -0x38(%rbp), %xmm0
addss -0x40(%rbp), %xmm0
movq -0x50(%rbp), %rcx
movb $0x1, %al
ucomiss (%rcx), %xmm0
movb %al, -0x79(%rbp)
jae 0xc8627
movss -0x34(%rbp), %xmm0
addss -0x3c(%rbp), %xmm0
movq -0x50(%rbp), %rax
ucomiss 0x4(%rax), %xmm0
setae %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
andb $0x1, %al
movb %al, -0x51(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0xc8681
movss -0x38(%rbp), %xmm1
movq -0x48(%rbp), %rax
movss (%rax), %xmm0
movb $0x1, %al
ucomiss %xmm1, %xmm0
movb %al, -0x7a(%rbp)
ja 0xc8664
movss -0x34(%rbp), %xmm1
movq -0x48(%rbp), %rax
movss 0x4(%rax), %xmm0
ucomiss %xmm1, %xmm0
seta %al
movb %al, -0x7a(%rbp)
movb -0x7a(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movb -0x51(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
orl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x51(%rbp)
movq 0x10(%rbp), %rax
movss (%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xc86c7
movss -0x38(%rbp), %xmm0
movss -0x38(%rbp), %xmm2
movq -0x18(%rbp), %rax
movss (%rax), %xmm1
subss -0x38(%rbp), %xmm1
subss -0x40(%rbp), %xmm1
movq 0x10(%rbp), %rax
movss (%rax), %xmm3
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
callq 0xc88c0
movss %xmm0, -0x38(%rbp)
movq 0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xc8710
movss -0x34(%rbp), %xmm0
movss -0x34(%rbp), %xmm2
movq -0x18(%rbp), %rax
movss 0x4(%rax), %xmm1
subss -0x34(%rbp), %xmm1
subss -0x3c(%rbp), %xmm1
movq 0x10(%rbp), %rax
movss 0x4(%rax), %xmm3
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
callq 0xc88c0
movss %xmm0, -0x34(%rbp)
testb $0x1, -0x51(%rbp)
je 0xc8789
movq -0x48(%rbp), %rax
movss (%rax), %xmm0
movq -0x48(%rbp), %rax
movss 0x4(%rax), %xmm1
movq -0x50(%rbp), %rax
movss (%rax), %xmm2
movq -0x50(%rbp), %rax
movss 0x4(%rax), %xmm3
leaq -0x64(%rbp), %rdi
callq 0xbf4f0
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
xorl %edi, %edi
movss 0xa84e6(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0x88(%rbp), %rdi
movl %eax, %ecx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
xorl %eax, %eax
movl %eax, %esi
xorps %xmm1, %xmm1
leaq -0x38(%rbp), %rdx
leaq -0x64(%rbp), %rax
movaps %xmm1, %xmm0
movq %rax, (%rsp)
callq 0x1139a0
jmp 0xc87cf
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
xorl %edi, %edi
movss 0xa849e(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0x90(%rbp), %rdi
movl %eax, %ecx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
xorl %eax, %eax
movl %eax, %esi
xorps %xmm1, %xmm1
leaq -0x38(%rbp), %rdx
movaps %xmm1, %xmm0
movq $0x0, (%rsp)
callq 0x1139a0
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)