// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
leaq 0x67f42(%rip), %rax     # 0xfbcd0
movq (%rax), %r12
movl 0x1b88(%r12), %r15d
movl %r15d, %eax
andl $-0x11, %eax
movl %eax, 0x1b88(%r12)
movq 0x1ae0(%r12), %r14
movb $0x1, 0x90(%r14)
cmpb $0x0, 0x93(%r14)
jne 0x941c6
movl %edx, %r13d
movq %rsi, -0xc8(%rbp)
movl %edx, %eax
notl %eax
testb $0x60, %al
je 0x94427
movq %rdi, %rcx
movq %r14, %rdi
movq %rcx, -0x90(%rbp)
movq %rcx, %rsi
xorl %edx, %edx
callq 0x4570a
movl %eax, %ebx
xorps %xmm0, %xmm0
testb $0x20, %r13b
jne 0x93e02
callq 0x562ff
movss %xmm0, -0x34(%rbp)
movss 0x211c1(%rip), %xmm0    # 0xb4fd0
movq -0x90(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x44a23
movaps %xmm0, -0xc0(%rbp)
callq 0x5614d
movss -0x34(%rbp), %xmm3
testb $0x40, %r13b
jne 0x93e3c
movaps %xmm0, %xmm3
movl %r13d, -0x30(%rbp)
movaps -0xc0(%rbp), %xmm5
movaps %xmm5, %xmm2
shufps $0x55, %xmm5, %xmm2     # xmm2 = xmm2[1,1],xmm5[1,1]
movss 0x159c(%r12), %xmm0
movaps %xmm0, %xmm1
addss %xmm0, %xmm1
addss %xmm2, %xmm1
movss 0xd8(%r14), %xmm2
movaps %xmm3, -0xa0(%rbp)
addss %xmm3, %xmm2
addss 0xdc(%r14), %xmm1
movaps %xmm2, %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movq 0xd8(%r14), %rax
movq %rax, -0x50(%rbp)
movlps %xmm3, -0x48(%rbp)
xorps %xmm4, %xmm4
ucomiss %xmm4, %xmm5
xorps %xmm3, %xmm3
jbe 0x93eb2
movss 0x15b0(%r12), %xmm3
addss -0xc0(%rbp), %xmm3
addss %xmm2, %xmm3
addss %xmm4, %xmm1
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
leaq -0x100(%rbp), %r13
movq %rax, (%r13)
movlps %xmm3, 0x8(%r13)
movq %r13, %rdi
callq 0x559be
leaq -0x50(%rbp), %rdx
movq %r13, %rdi
movl %ebx, %esi
callq 0x524a8
testb %al, %al
je 0x941c6
movl %r15d, -0x84(%rbp)
leaq -0x50(%rbp), %r13
leaq -0x2b(%rbp), %r15
leaq -0x51(%rbp), %rcx
movq %r13, %rdi
movl %ebx, %esi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0x90b6f
movb %al, -0x29(%rbp)
movl %ebx, %edi
xorl %esi, %esi
callq 0x47824
movb %al, -0x2a(%rbp)
movzbl (%r15), %edi
addl $0x7, %edi
movss 0x210b8(%rip), %xmm0    # 0xb4fe4
callq 0x43bca
movl %eax, %r15d
movss (%r13), %xmm0
movaps %xmm0, -0x80(%rbp)
movss 0x8(%r13), %xmm0
movaps %xmm0, -0xb0(%rbp)
movq %r13, %rdi
movl %ebx, %r13d
movl %ebx, %esi
movl $0x1, %edx
callq 0x4521b
movaps -0xb0(%rbp), %xmm0
subss -0x34(%rbp), %xmm0
movaps %xmm0, %xmm1
movaps %xmm0, %xmm3
movaps -0x80(%rbp), %xmm2
cmpless %xmm2, %xmm1
movaps %xmm1, %xmm0
andnps %xmm3, %xmm0
andps %xmm2, %xmm1
orps %xmm0, %xmm1
movaps %xmm1, -0x80(%rbp)
movl -0x30(%rbp), %ebx
testb $0x40, %bl
jne 0x93fd5
testb $0x20, %bl
movq 0x2b8(%r14), %rdi
leaq -0x50(%rbp), %rsi
movss 0xc(%rsi), %xmm0
leaq -0x70(%rbp), %rdx
movaps -0x80(%rbp), %xmm1
movss %xmm1, (%rdx)
movss %xmm0, 0x4(%rdx)
movss 0x15a0(%r12), %xmm0
movl $0x5, %eax
movl $0xf, %r8d
cmovel %eax, %r8d
movl %r15d, %ecx
callq 0x785e6
testb $0x20, %bl
movb -0x2a(%rbp), %bl
jne 0x940bd
movb -0x2b(%rbp), %al
orb %bl, %al
movzbl %al, %edi
andl $0x1, %edi
addl $0x15, %edi
movss 0x20fed(%rip), %xmm0    # 0xb4fe4
callq 0x43bca
movl %eax, %r15d
xorl %edi, %edi
movss 0x20fdb(%rip), %xmm0    # 0xb4fe4
callq 0x43bca
movl %eax, -0xb0(%rbp)
movq 0x2b8(%r14), %rdi
leaq -0x48(%rbp), %rdx
movss -0x4(%rdx), %xmm0
leaq -0x70(%rbp), %rsi
movaps -0x80(%rbp), %xmm1
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
movss 0x15a0(%r12), %xmm0
xorl %eax, %eax
movss -0x34(%rbp), %xmm1
ucomiss -0xa0(%rbp), %xmm1
setae %al
leal (%rax,%rax,4), %r8d
addl $0xa, %r8d
movl %r15d, %ecx
callq 0x785e6
movss -0x34(%rbp), %xmm0
addss -0x80(%rbp), %xmm0
subss 0x1598(%r12), %xmm0
movaps %xmm0, %xmm1
leaq -0x48(%rbp), %rax
movss (%rax), %xmm0
ucomiss %xmm1, %xmm0
jb 0x940bd
movq 0x2b8(%r14), %rdi
movss 0x159c(%r12), %xmm1
movaps -0x80(%rbp), %xmm0
addss %xmm1, %xmm0
addss -0x4c(%rbp), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movss 0x20f37(%rip), %xmm1    # 0xb4fe4
movl -0xb0(%rbp), %esi
movl $0x3, %edx
callq 0x81dcb
movl -0x30(%rbp), %r15d
andl $0x40, %r15d
shrl $0x6, %r15d
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movss 0x15a0(%r12), %xmm2
callq 0x450e0
movq -0xc8(%rbp), %rdx
testq %rdx, %rdx
sete %al
orb %r15b, %al
jne 0x9414f
movss -0x50(%rbp), %xmm0
movss -0x4c(%rbp), %xmm1
addss 0x1598(%r12), %xmm0
addss 0x159c(%r12), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
leaq -0x70(%rbp), %rdi
movlps %xmm0, (%rdi)
movss -0x44(%rbp), %xmm0
leaq -0xe0(%rbp), %rsi
movaps -0x80(%rbp), %xmm1
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
xorl %eax, %eax
leaq -0xe8(%rbp), %r9
movq %rax, (%r9)
movq %rax, (%rsp)
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x44ac2
xorps %xmm0, %xmm0
movaps -0xc0(%rbp), %xmm1
ucomiss %xmm0, %xmm1
movl -0x84(%rbp), %r15d
jbe 0x94199
movss -0x48(%rbp), %xmm0
addss 0x15b0(%r12), %xmm0
movss -0x4c(%rbp), %xmm1
addss 0x159c(%r12), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq -0x90(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x44476
cmpb $0x0, -0x29(%rbp)
je 0x941ac
testb %bl, %bl
movaps -0xa0(%rbp), %xmm2
je 0x941cd
jmp 0x941ef
cmpl %r13d, 0x1ca0(%r12)
setne %al
orb %bl, %al
movaps -0xa0(%rbp), %xmm2
je 0x941cd
testb %bl, %bl
jne 0x941ef
xorl %eax, %eax
jmp 0x94415
cmpl $0x0, 0x14c(%r14)
jne 0x941de
movl %r13d, 0x3b0(%r14)
movl %r13d, %edi
xorl %esi, %esi
callq 0x56cc5
movaps -0xa0(%rbp), %xmm2
testb $0x10, %r15b
jne 0x94243
movl -0x30(%rbp), %eax
movl %eax, %r15d
orl $0x4, %r15d
testb $0x1e, %al
cmovnel %eax, %r15d
movl %r15d, %eax
andl $0x1e, %eax
leal -0x1(%rax), %ecx
xorl %ecx, %eax
cmpl %ecx, %eax
jbe 0x9446a
testb $0x4, %r15b
jne 0x94277
testb $0x2, %r15b
jne 0x94281
testb $0x8, %r15b
jne 0x9428b
movss %xmm2, -0x70(%rbp)
movl $0x0, -0x6c(%rbp)
movss 0x21602(%rip), %xmm0    # 0xb5840
jmp 0x942d5
orb $0x10, 0x1b88(%r12)
movss 0x1bc4(%r12), %xmm0
movaps %xmm2, %xmm1
cmpless %xmm0, %xmm1
andps %xmm1, %xmm0
andnps %xmm2, %xmm1
orps %xmm0, %xmm1
movss %xmm1, 0x1bc4(%r12)
movl -0x30(%rbp), %r15d
jmp 0x942f4
movss 0x21659(%rip), %xmm1    # 0xb58d8
jmp 0x94293
movss 0x215db(%rip), %xmm1    # 0xb5864
jmp 0x94293
movss 0x21675(%rip), %xmm1    # 0xb5908
movss %xmm2, -0x70(%rbp)
movl $0x0, -0x6c(%rbp)
leaq 0x67a2a(%rip), %rax     # 0xfbcd0
movq (%rax), %rax
movss 0x1568(%rax), %xmm0
movss 0x15ac(%rax), %xmm2
movss 0x1980(%rax), %xmm3
addss %xmm2, %xmm3
mulss %xmm1, %xmm3
subss %xmm2, %xmm3
addss %xmm0, %xmm0
addss %xmm3, %xmm0
leaq -0xe0(%rbp), %rsi
movl $0x7f7fffff, (%rsi)     # imm = 0x7F7FFFFF
movss %xmm0, 0x4(%rsi)
leaq -0x70(%rbp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x54628
movl 0x1c80(%r12), %ecx
leaq 0x3d1ee(%rip), %rdx     # 0xd14f1
leaq -0x70(%rbp), %rbx
movl $0x10, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41f22
movq %rbx, %rdi
callq 0x52927
testq %rax, %rax
je 0x943c5
movq %rax, %r14
cmpb $0x1, 0x8f(%rax)
jne 0x943c5
movq %r14, %rdi
callq 0x52948
leaq -0xe8(%rbp), %rbx
movlps %xmm0, (%rbx)
xorl %eax, %eax
testb $0x1, %r15b
sete %al
leal (%rax,%rax,2), %eax
movq %r14, %r15
addq $0xa8, %r15
movl %eax, 0xa8(%r14)
movq %r14, %rdi
callq 0x57b3f
movlhps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
leaq -0xe0(%rbp), %rcx
movups %xmm0, (%rcx)
leaq -0x50(%rbp), %r8
movaps (%r8), %xmm0
shufps $0xec, %xmm0, %xmm0     # xmm0 = xmm0[0,3,2,3]
leaq -0xd0(%rbp), %r14
movlps %xmm0, (%r14)
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x1, %r9d
callq 0x57828
leaq -0xf0(%rbp), %rdi
movlps %xmm0, (%rdi)
movq $0x0, (%r14)
leaq -0xd0(%rbp), %rdx
xorl %esi, %esi
callq 0x545cf
movss 0x1568(%r12), %xmm0
movss 0x1598(%r12), %xmm1
leaq -0xe0(%rbp), %rsi
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
movl $0x1, %edi
callq 0x4417f
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x4000147, %edx        # imm = 0x4000147
callq 0x4b741
movl %eax, %ebx
movl $0x1, %edi
callq 0x44325
testb %bl, %bl
je 0x94446
movb $0x1, %al
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3cfc6(%rip), %rdi     # 0xd13f4
leaq 0x3cbe3(%rip), %rsi     # 0xd1018
leaq 0x3d03d(%rip), %rcx     # 0xd1479
movl $0x609, %edx            # imm = 0x609
callq 0xc140
callq 0x5732f
leaq 0x23c9a(%rip), %rdi     # 0xb80ec
leaq 0x3cbbf(%rip), %rsi     # 0xd1018
leaq 0x3d019(%rip), %rcx     # 0xd1479
movl $0x668, %edx            # imm = 0x668
callq 0xc140
leaq 0x3d04c(%rip), %rdi     # 0xd14bd
leaq 0x3cba0(%rip), %rsi     # 0xd1018
leaq 0x3cffa(%rip), %rcx     # 0xd1479
movl $0x643, %edx            # imm = 0x643
callq 0xc140