// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::BeginCombo(char const*, char const*, int)
bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags)
{
    // Always consume the SetNextWindowSizeConstraint() call in our early return paths
    ImGuiContext& g = *GImGui;
    bool has_window_size_constraint = (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint) != 0;
    g.NextWindowData.Flags &= ~ImGuiNextWindowDataFlags_HasSizeConstraint;

    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return false;

    IM_ASSERT((flags & (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)) != (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)); // Can't use both flags together

    const ImGuiStyle& style = g.Style;
    const ImGuiID id = window->GetID(label);

    const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight();
    const ImVec2 label_size = CalcTextSize(label, NULL, true);
    const float expected_w = CalcItemWidth();
    const float w = (flags & ImGuiComboFlags_NoPreview) ? arrow_size : expected_w;
    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
    const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
    ItemSize(total_bb, style.FramePadding.y);
    if (!ItemAdd(total_bb, id, &frame_bb))
        return false;

    bool hovered, held;
    bool pressed = ButtonBehavior(frame_bb, id, &hovered, &held);
    bool popup_open = IsPopupOpen(id, ImGuiPopupFlags_None);

    const ImU32 frame_col = GetColorU32(hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
    const float value_x2 = ImMax(frame_bb.Min.x, frame_bb.Max.x - arrow_size);
    RenderNavHighlight(frame_bb, id);
    if (!(flags & ImGuiComboFlags_NoPreview))
        window->DrawList->AddRectFilled(frame_bb.Min, ImVec2(value_x2, frame_bb.Max.y), frame_col, style.FrameRounding, (flags & ImGuiComboFlags_NoArrowButton) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Left);
    if (!(flags & ImGuiComboFlags_NoArrowButton))
    {
        ImU32 bg_col = GetColorU32((popup_open || hovered) ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
        ImU32 text_col = GetColorU32(ImGuiCol_Text);
        window->DrawList->AddRectFilled(ImVec2(value_x2, frame_bb.Min.y), frame_bb.Max, bg_col, style.FrameRounding, (w <= arrow_size) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Right);
        if (value_x2 + arrow_size - style.FramePadding.x <= frame_bb.Max.x)
            RenderArrow(window->DrawList, ImVec2(value_x2 + style.FramePadding.y, frame_bb.Min.y + style.FramePadding.y), text_col, ImGuiDir_Down, 1.0f);
    }
    RenderFrameBorder(frame_bb.Min, frame_bb.Max, style.FrameRounding);
    if (preview_value != NULL && !(flags & ImGuiComboFlags_NoPreview))
        RenderTextClipped(frame_bb.Min + style.FramePadding, ImVec2(value_x2, frame_bb.Max.y), preview_value, NULL, NULL, ImVec2(0.0f, 0.0f));
    if (label_size.x > 0)
        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);

    if ((pressed || g.NavActivateId == id) && !popup_open)
    {
        if (window->DC.NavLayerCurrent == 0)
            window->NavLastIds[0] = id;
        OpenPopupEx(id, ImGuiPopupFlags_None);
        popup_open = true;
    }

    if (!popup_open)
        return false;

    if (has_window_size_constraint)
    {
        g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasSizeConstraint;
        g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w);
    }
    else
    {
        if ((flags & ImGuiComboFlags_HeightMask_) == 0)
            flags |= ImGuiComboFlags_HeightRegular;
        IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiComboFlags_HeightMask_));    // Only one
        int popup_max_height_in_items = -1;
        if (flags & ImGuiComboFlags_HeightRegular)     popup_max_height_in_items = 8;
        else if (flags & ImGuiComboFlags_HeightSmall)  popup_max_height_in_items = 4;
        else if (flags & ImGuiComboFlags_HeightLarge)  popup_max_height_in_items = 20;
        SetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));
    }

    char name[16];
    ImFormatString(name, IM_ARRAYSIZE(name), "##Combo_%02d", g.BeginPopupStack.Size); // Recycle windows based on depth

    // Position the window given a custom constraint (peak into expected window size so we can position it)
    // This might be easier to express with an hypothetical SetNextWindowPosConstraints() function.
    if (ImGuiWindow* popup_window = FindWindowByName(name))
        if (popup_window->WasActive)
        {
            // Always override 'AutoPosLastDirection' to not leave a chance for a past value to affect us.
            ImVec2 size_expected = CalcWindowNextAutoFitSize(popup_window);
            if (flags & ImGuiComboFlags_PopupAlignLeft)
                popup_window->AutoPosLastDirection = ImGuiDir_Left; // "Below, Toward Left"
            else
                popup_window->AutoPosLastDirection = ImGuiDir_Down; // "Below, Toward Right (default)"
            ImRect r_outer = GetWindowAllowedExtentRect(popup_window);
            ImVec2 pos = FindBestWindowPosForPopupEx(frame_bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, r_outer, frame_bb, ImGuiPopupPositionPolicy_ComboBox);
            SetNextWindowPos(pos);
        }

    // We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx()
    ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove;

    // Horizontally align ourselves with the framed text
    PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
    bool ret = Begin(name, NULL, window_flags);
    PopStyleVar();
    if (!ret)
    {
        EndPopup();
        IM_ASSERT(0);   // This should never happen as we tested for IsPopupOpen() above
        return false;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
leaq 0x682ac(%rip), %rax     # 0xfdcd0
movq (%rax), %r13
movl 0x1b88(%r13), %ebx
movl %ebx, %eax
andl $-0x11, %eax
movl %eax, 0x1b88(%r13)
movq 0x1ae0(%r13), %r15
movb $0x1, 0x90(%r15)
cmpb $0x0, 0x93(%r15)
jne 0x95e2f
movl %edx, %r14d
movq %rsi, -0xc0(%rbp)
movl %edx, %eax
notl %eax
testb $0x60, %al
je 0x960ad
movq %rdi, %r12
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x46258
movl %eax, -0x48(%rbp)
xorps %xmm0, %xmm0
testb $0x20, %r14b
jne 0x95a8e
callq 0x57404
movss %xmm0, -0x30(%rbp)
movss 0x21535(%rip), %xmm0    # 0xb6fd0
movq %r12, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x4548d
movaps %xmm0, -0xb0(%rbp)
callq 0x57252
movss -0x30(%rbp), %xmm3
testb $0x40, %r14b
jne 0x95ac4
movaps %xmm0, %xmm3
movq %r12, -0xb8(%rbp)
movl %r14d, -0x78(%rbp)
movl %ebx, -0x74(%rbp)
movaps -0xb0(%rbp), %xmm4
movaps %xmm4, %xmm1
shufps $0x55, %xmm4, %xmm1     # xmm1 = xmm1[1,1],xmm4[1,1]
movss 0x159c(%r13), %xmm0
movaps %xmm0, %xmm2
addss %xmm0, %xmm2
addss %xmm1, %xmm2
movss 0xd8(%r15), %xmm1
movaps %xmm3, -0x90(%rbp)
addss %xmm3, %xmm1
addss 0xdc(%r15), %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movq 0xd8(%r15), %rax
movq %rax, -0x40(%rbp)
movlps %xmm1, -0x38(%rbp)
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm4
xorps %xmm2, %xmm2
jbe 0x95b3f
movss 0x15b0(%r13), %xmm2
addss -0xb0(%rbp), %xmm2
leaq -0x40(%rbp), %rbx
addss 0x8(%rbx), %xmm2
addss 0xc(%rbx), %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
leaq -0xf8(%rbp), %r12
movq %rax, (%r12)
movlps %xmm2, 0x8(%r12)
movq %r12, %rdi
callq 0x56a82
movq %r12, %rdi
movl -0x48(%rbp), %r14d
movl %r14d, %esi
movq %rbx, %rdx
callq 0x5346f
testb %al, %al
je 0x95e2f
leaq -0x40(%rbp), %r12
leaq -0x2a(%rbp), %rbx
leaq -0x49(%rbp), %rcx
movq %r12, %rdi
movl %r14d, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x92870
movb %al, -0x29(%rbp)
movl %r14d, %edi
xorl %esi, %esi
callq 0x483c1
movl %eax, -0x44(%rbp)
movzbl (%rbx), %edi
addl $0x7, %edi
movss 0x21426(%rip), %xmm0    # 0xb6fe4
callq 0x445bd
movl %eax, %ebx
movss (%r12), %xmm0
movaps %xmm0, -0x60(%rbp)
movss 0x8(%r12), %xmm0
movaps %xmm0, -0xa0(%rbp)
movq %r12, %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x45ca4
movaps -0xa0(%rbp), %xmm0
subss -0x30(%rbp), %xmm0
movaps %xmm0, %xmm1
movaps %xmm0, %xmm3
movaps -0x60(%rbp), %xmm2
cmpless %xmm2, %xmm1
movaps %xmm1, %xmm0
andnps %xmm3, %xmm0
andps %xmm2, %xmm1
orps %xmm0, %xmm1
movaps %xmm1, -0x60(%rbp)
movl -0x78(%rbp), %r14d
testb $0x40, %r14b
jne 0x95c66
testb $0x20, %r14b
movq 0x2b8(%r15), %rdi
leaq -0x40(%rbp), %rsi
movss 0xc(%rsi), %xmm0
leaq -0x70(%rbp), %rdx
movaps -0x60(%rbp), %xmm1
movss %xmm1, (%rdx)
movss %xmm0, 0x4(%rdx)
movss 0x15a0(%r13), %xmm0
movl $0x5, %eax
movl $0xf, %r8d
cmovel %eax, %r8d
movl %ebx, %ecx
callq 0x79d4a
testb $0x20, %r14b
movl -0x44(%rbp), %r12d
jne 0x95d4c
movb -0x2a(%rbp), %al
orb %r12b, %al
movzbl %al, %edi
andl $0x1, %edi
addl $0x15, %edi
movss 0x21359(%rip), %xmm0    # 0xb6fe4
callq 0x445bd
movl %eax, %ebx
xorl %edi, %edi
movss 0x21348(%rip), %xmm0    # 0xb6fe4
callq 0x445bd
movl %eax, -0xa0(%rbp)
movq 0x2b8(%r15), %rdi
leaq -0x38(%rbp), %rdx
movss -0x4(%rdx), %xmm0
leaq -0x70(%rbp), %rsi
movaps -0x60(%rbp), %xmm1
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
movss 0x15a0(%r13), %xmm0
xorl %eax, %eax
movss -0x30(%rbp), %xmm1
ucomiss -0x90(%rbp), %xmm1
setae %al
leal (%rax,%rax,4), %r8d
addl $0xa, %r8d
movl %ebx, %ecx
callq 0x79d4a
movss -0x30(%rbp), %xmm0
addss -0x60(%rbp), %xmm0
subss 0x1598(%r13), %xmm0
movaps %xmm0, %xmm1
leaq -0x38(%rbp), %rax
movss (%rax), %xmm0
ucomiss %xmm1, %xmm0
jb 0x95d4c
movq 0x2b8(%r15), %rdi
movss 0x159c(%r13), %xmm1
movaps -0x60(%rbp), %xmm0
addss %xmm1, %xmm0
addss -0x3c(%rbp), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movss 0x212a8(%rip), %xmm1    # 0xb6fe4
movl -0xa0(%rbp), %esi
movl $0x3, %edx
callq 0x8391b
movl %r14d, %ebx
andl $0x40, %ebx
shrl $0x6, %ebx
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movss 0x15a0(%r13), %xmm2
callq 0x45b5c
movq -0xc0(%rbp), %rdx
testq %rdx, %rdx
sete %al
orb %bl, %al
jne 0x95dd7
movss -0x40(%rbp), %xmm0
movss -0x3c(%rbp), %xmm1
addss 0x1598(%r13), %xmm0
addss 0x159c(%r13), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
leaq -0x70(%rbp), %rdi
movlps %xmm0, (%rdi)
movss -0x34(%rbp), %xmm0
leaq -0xd8(%rbp), %rsi
movaps -0x60(%rbp), %xmm1
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
xorl %eax, %eax
leaq -0xe0(%rbp), %r9
movq %rax, (%r9)
movq %rax, (%rsp)
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45527
xorps %xmm0, %xmm0
movaps -0xb0(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x95e18
movss -0x38(%rbp), %xmm0
addss 0x15b0(%r13), %xmm0
movss -0x3c(%rbp), %xmm1
addss 0x159c(%r13), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq -0xb8(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x44ec4
cmpb $0x0, -0x29(%rbp)
je 0x95e47
testb %r12b, %r12b
movaps -0x90(%rbp), %xmm2
movl -0x48(%rbp), %edi
je 0x95e62
jmp 0x95e84
xorl %r12d, %r12d
movl %r12d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x48(%rbp), %edi
cmpl %edi, 0x1ca0(%r13)
setne %al
movl %r12d, %ecx
orb %al, %cl
movaps -0x90(%rbp), %xmm2
jne 0x95e84
cmpl $0x0, 0x14c(%r15)
jne 0x95e73
movl %edi, 0x3b0(%r15)
xorl %esi, %esi
callq 0x57dd4
movb $0x1, %r12b
movaps -0x90(%rbp), %xmm2
testb %r12b, %r12b
je 0x95e32
movl %r12d, -0x44(%rbp)
testb $0x10, -0x74(%rbp)
jne 0x95f2b
movl %r14d, %r12d
orl $0x4, %r12d
testb $0x1e, %r14b
cmovnel %r14d, %r12d
movl %r12d, %eax
andl $0x1e, %eax
leal -0x1(%rax), %ecx
xorl %ecx, %eax
cmpl %ecx, %eax
jbe 0x960f0
movl $0x8, %eax
testb $0x4, %r12b
jne 0x95edf
movl $0x4, %eax
testb $0x2, %r12b
jne 0x95edf
movl %r12d, %ecx
andl $0x8, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
sbbl %eax, %eax
orl $0x14, %eax
movss %xmm2, -0x70(%rbp)
movl $0x0, -0x6c(%rbp)
testl %eax, %eax
jle 0x95f5b
leaq 0x67dda(%rip), %rcx     # 0xfdcd0
movq (%rcx), %rcx
movss 0x1568(%rcx), %xmm0
movss 0x15ac(%rcx), %xmm1
movss 0x1980(%rcx), %xmm2
addss %xmm1, %xmm2
cvtsi2ss %eax, %xmm3
mulss %xmm2, %xmm3
subss %xmm1, %xmm3
addss %xmm0, %xmm0
addss %xmm3, %xmm0
jmp 0x95f63
orb $0x10, 0x1b88(%r13)
movss 0x1bc4(%r13), %xmm0
movaps %xmm2, %xmm1
cmpless %xmm0, %xmm1
andps %xmm1, %xmm0
andnps %xmm2, %xmm1
orps %xmm0, %xmm1
movss %xmm1, 0x1bc4(%r13)
movl %r14d, %r12d
jmp 0x95f82
movss 0x218dd(%rip), %xmm0    # 0xb7840
leaq -0xd8(%rbp), %rsi
movl $0x7f7fffff, (%rsi)     # imm = 0x7F7FFFFF
movss %xmm0, 0x4(%rsi)
leaq -0x70(%rbp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x556c3
movl 0x1c80(%r13), %ecx
leaq 0x3d691(%rip), %rdx     # 0xd3621
leaq -0x70(%rbp), %rbx
movl $0x10, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x427cb
movq %rbx, %rdi
callq 0x53907
testq %rax, %rax
je 0x96058
movq %rax, %r15
cmpb $0x1, 0x8f(%rax)
jne 0x96058
movq %r15, %rdi
callq 0x53928
leaq -0xe0(%rbp), %r14
movlps %xmm0, (%r14)
xorl %eax, %eax
testb $0x1, %r12b
sete %al
movq %r15, %rbx
addq $0xa8, %rbx
leal (%rax,%rax,2), %eax
movl %eax, 0xa8(%r15)
movq %r15, %rdi
callq 0x58cb2
movlhps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
leaq -0xd8(%rbp), %rcx
movups %xmm0, (%rcx)
leaq -0x40(%rbp), %r8
movaps (%r8), %xmm0
movss 0xc(%r8), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
leaq -0xc8(%rbp), %r15
movlps %xmm0, (%r15)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl $0x1, %r9d
callq 0x5897c
leaq -0xe8(%rbp), %rdi
movlps %xmm0, (%rdi)
movq $0x0, (%r15)
leaq -0xc8(%rbp), %rdx
xorl %esi, %esi
callq 0x5566a
movss 0x1568(%r13), %xmm0
movss 0x1598(%r13), %xmm1
leaq -0xd8(%rbp), %rsi
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
movl $0x1, %edi
callq 0x44ba2
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x4000147, %edx        # imm = 0x4000147
callq 0x4c3ad
movl %eax, %ebx
movl $0x1, %edi
callq 0x44d5f
testb %bl, %bl
je 0x960cc
movl -0x44(%rbp), %r12d
jmp 0x95e32
leaq 0x3d470(%rip), %rdi     # 0xd3524
leaq 0x3d08d(%rip), %rsi     # 0xd3148
leaq 0x3d4e7(%rip), %rcx     # 0xd35a9
movl $0x609, %edx            # imm = 0x609
callq 0xc140
callq 0x5847b
leaq 0x24014(%rip), %rdi     # 0xba0ec
leaq 0x3d069(%rip), %rsi     # 0xd3148
leaq 0x3d4c3(%rip), %rcx     # 0xd35a9
movl $0x668, %edx            # imm = 0x668
callq 0xc140
leaq 0x3d4f6(%rip), %rdi     # 0xd35ed
leaq 0x3d04a(%rip), %rsi     # 0xd3148
leaq 0x3d4a4(%rip), %rcx     # 0xd35a9
movl $0x643, %edx            # imm = 0x643
callq 0xc140