// File: /workspace/github_cpp_makefile_star2_O1/donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::Combo(char const*, int*, bool (*)(void*, int, char const**), void*, int, int)
bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return false;

    ImGuiState& g = *GImGui;
    const ImGuiStyle& style = g.Style;
    const ImGuiID id = window->GetID(label);
    const float w = CalcItemWidth();

    const ImVec2 label_size = CalcTextSize(label, NULL, true);
    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*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))
        return false;

    const float arrow_size = (g.FontSize + style.FramePadding.x * 2.0f);
    const bool hovered = IsHovered(frame_bb, id);

    const ImRect value_bb(frame_bb.Min, frame_bb.Max - ImVec2(arrow_size, 0.0f));
    RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
    RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, window->Color(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding); // FIXME-ROUNDING
    RenderCollapseTriangle(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y) + style.FramePadding, true);

    if (*current_item >= 0 && *current_item < items_count)
    {
        const char* item_text;
        if (items_getter(data, *current_item, &item_text))
            RenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, item_text, NULL, NULL);
    }

    if (label_size.x > 0)
        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);

    bool menu_toggled = false;
    if (hovered)
    {
        g.HoveredId = id;
        if (g.IO.MouseClicked[0])
        {
            SetActiveID(0);
            if (IsPopupOpen(id))
            {
                ClosePopup(id);
            }
            else
            {
                FocusWindow(window);
                ImGui::OpenPopup(label);
                menu_toggled = true;
            }
        }
    }

    bool value_changed = false;
    if (IsPopupOpen(id))
    {
        // Size default to hold ~7 items
        if (height_in_items < 0)
            height_in_items = 7;

        float popup_height = (label_size.y + style.ItemSpacing.y) * ImMin(items_count, height_in_items) + (style.FramePadding.y * 3);
        ImRect popup_rect(ImVec2(frame_bb.Min.x, frame_bb.Max.y), ImVec2(frame_bb.Max.x, frame_bb.Max.y + popup_height));
        popup_rect.Max.y = ImMin(popup_rect.Max.y, g.IO.DisplaySize.y - style.DisplaySafeAreaPadding.y); // Adhoc height limit for Combo. Ideally should be handled in Begin() along with other popups size, we want to have the possibility of moving the popup above as well.
        ImGui::SetNextWindowPos(popup_rect.Min);
        ImGui::SetNextWindowSize(popup_rect.GetSize());
        ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);

        const ImGuiWindowFlags flags = ImGuiWindowFlags_ComboBox | ((window->Flags & ImGuiWindowFlags_ShowBorders) ? ImGuiWindowFlags_ShowBorders : 0);
        if (BeginPopupEx(label, flags))
        {
            // Display items
            ImGui::Spacing();
            for (int i = 0; i < items_count; i++)
            {
                ImGui::PushID((void*)(intptr_t)i);
                const bool item_selected = (i == *current_item);
                const char* item_text;
                if (!items_getter(data, i, &item_text))
                    item_text = "*Unknown item*";
                if (ImGui::Selectable(item_text, item_selected))
                {
                    SetActiveID(0);
                    value_changed = true;
                    *current_item = i;
                }
                if (item_selected && menu_toggled)
                    ImGui::SetScrollHere();
                ImGui::PopID();
            }
            ImGui::EndPopup();
        }
        ImGui::PopStyleVar();
    }
    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, -0x90(%rbp)
movq %rdx, -0x88(%rbp)
movq %rsi, -0x58(%rbp)
movq 0x35781(%rip), %r13     # 0x55490
movq 0x1758(%r13), %rbx
movb $0x1, 0x72(%rbx)
cmpb $0x0, 0x74(%rbx)
jne 0x20321
movl %r8d, %r12d
movq %rdi, %r14
movl %r9d, -0x70(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xa872
movl %eax, -0x30(%rbp)
callq 0x14bda
movss %xmm0, -0x2c(%rbp)
movss 0x1d63c(%rip), %xmm0    # 0x3d38c
movq %r14, -0xb8(%rbp)
movq %r14, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xe720
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
movss -0x2c(%rbp), %xmm4
addss 0xa8(%rbx), %xmm4
movss 0xac(%rbx), %xmm3
movaps %xmm1, -0xf0(%rbp)
addss %xmm1, %xmm3
movss 0x1408(%r13), %xmm1
movss 0x140c(%r13), %xmm2
addss %xmm1, %xmm1
addss %xmm2, %xmm2
addss %xmm4, %xmm1
addss %xmm3, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movq 0xa8(%rbx), %r15
movq %r15, -0x68(%rbp)
movlps %xmm1, -0x60(%rbp)
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
xorps %xmm1, %xmm1
jbe 0x1fdd9
movss 0x141c(%r13), %xmm1
addss %xmm0, %xmm1
movaps %xmm0, -0x100(%rbp)
movss -0x60(%rbp), %xmm0
movss -0x5c(%rbp), %xmm3
movaps %xmm0, -0x40(%rbp)
addss %xmm0, %xmm1
movaps %xmm3, -0x80(%rbp)
addss %xmm3, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
leaq -0x110(%rbp), %r14
movq %r15, (%r14)
movlps %xmm1, 0x8(%r14)
movss 0x8(%r14), %xmm1
movss 0xc(%r14), %xmm2
subss (%r14), %xmm1
subss 0x4(%r14), %xmm2
movss 0x140c(%r13), %xmm0
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
leaq -0x50(%rbp), %rdi
movlps %xmm1, (%rdi)
callq 0xaab7
leaq -0x30(%rbp), %rsi
movq %r14, %rdi
callq 0xac09
testb %al, %al
je 0x20321
movss 0x1408(%r13), %xmm0
addss %xmm0, %xmm0
addss 0x1718(%r13), %xmm0
movss %xmm0, -0x2c(%rbp)
movl -0x30(%rbp), %esi
movl %r12d, -0x6c(%rbp)
leaq -0x68(%rbp), %r12
movq %r12, %rdi
xorl %edx, %edx
callq 0xae36
movl %eax, %r14d
movaps -0x40(%rbp), %xmm0
subss -0x2c(%rbp), %xmm0
unpcklps -0x80(%rbp), %xmm0      # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movq %r15, -0xc8(%rbp)
movlps %xmm0, -0xc0(%rbp)
movsd (%r12), %xmm0
movaps %xmm0, -0x40(%rbp)
movsd 0x8(%r12), %xmm0
movaps %xmm0, -0x80(%rbp)
movq 0x355d7(%rip), %rax     # 0x55490
movups 0x14c0(%rax), %xmm0
leaq -0x50(%rbp), %r15
movaps %xmm0, (%r15)
movss 0x13e8(%rax), %xmm0
mulss 0xc(%r15), %xmm0
movss %xmm0, 0xc(%r15)
movq %r15, %rdi
callq 0x8cce
movss 0x1410(%r13), %xmm2
movaps -0x40(%rbp), %xmm0
movaps -0x80(%rbp), %xmm1
movl %eax, %edi
movl $0x1, %esi
callq 0xe7a8
movss 0x4(%r12), %xmm0
movaps %xmm0, -0x40(%rbp)
movss 0x8(%r12), %xmm0
subss -0x2c(%rbp), %xmm0
movaps %xmm0, -0xe0(%rbp)
movsd 0x8(%r12), %xmm0
movaps %xmm0, -0xb0(%rbp)
movq 0x3555c(%rip), %rax     # 0x55490
movb %r14b, -0x80(%rbp)
movzbl %r14b, %ecx
shll $0x4, %ecx
movups 0x15b0(%rcx,%rax), %xmm0
movaps %xmm0, (%r15)
movss 0x13e8(%rax), %xmm0
mulss 0xc(%r15), %xmm0
movss %xmm0, 0xc(%r15)
leaq -0x50(%rbp), %rdi
callq 0x8cce
movss 0x1410(%r13), %xmm2
movaps -0xe0(%rbp), %xmm0
unpcklps -0x40(%rbp), %xmm0      # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps -0xb0(%rbp), %xmm1
movl %eax, %edi
movl $0x1, %esi
callq 0xe7a8
movss 0x8(%r12), %xmm0
movl -0x6c(%rbp), %r12d
movaps %xmm0, -0xb0(%rbp)
subss -0x2c(%rbp), %xmm0
addss 0x1408(%r13), %xmm0
movss 0x140c(%r13), %xmm1
addss -0x40(%rbp), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movss 0x1d3b8(%rip), %xmm1    # 0x3d380
movl $0x1, %edi
xorl %esi, %esi
callq 0xe906
movq -0x58(%rbp), %rax
movl (%rax), %esi
testl %esi, %esi
sets %al
cmpl %r12d, %esi
setge %cl
orb %al, %cl
movq -0xb8(%rbp), %r14
jne 0x20050
leaq -0x50(%rbp), %rdx
movq -0x90(%rbp), %rdi
callq *-0x88(%rbp)
testb %al, %al
je 0x20050
leaq -0xc0(%rbp), %rsi
movss -0x68(%rbp), %xmm0
addss 0x1408(%r13), %xmm0
movss 0x140c(%r13), %xmm1
addss -0x40(%rbp), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
leaq -0x98(%rbp), %rdi
movlps %xmm0, (%rdi)
movq -0x50(%rbp), %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x9, %r9d
callq 0xe466
xorps %xmm0, %xmm0
movaps -0x100(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x2008f
movss 0x141c(%r13), %xmm0
addss -0xb0(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
addss 0x140c(%r13), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq %r14, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xe0f3
cmpb $0x0, -0x80(%rbp)
je 0x200fa
movl -0x30(%rbp), %edi
movl %edi, 0x1788(%r13)
cmpb $0x1, 0x354(%r13)
jne 0x200fa
movq 0x353e0(%rip), %rax     # 0x55490
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
movslq 0x1808(%rax), %rcx
cmpl %ecx, 0x17f8(%rax)
jle 0x2033a
movq 0x1800(%rax), %rax
leaq (%rcx,%rcx,4), %rcx
cmpl %edi, (%rax,%rcx,8)
jne 0x2033a
callq 0x12fc5
xorl %r15d, %r15d
movq 0x3538c(%rip), %rax     # 0x55490
movslq 0x1808(%rax), %rcx
cmpl %ecx, 0x17f8(%rax)
jle 0x20321
movq 0x1800(%rax), %rdx
leaq (%rcx,%rcx,4), %rcx
movl (%rdx,%rcx,8), %ecx
cmpl -0x30(%rbp), %ecx
jne 0x20321
movl -0x70(%rbp), %edx
testl %edx, %edx
movl $0x7, %ecx
cmovnsl %edx, %ecx
movaps -0xf0(%rbp), %xmm1
addss 0x1418(%r13), %xmm1
cmpl %ecx, %r12d
cmovll %r12d, %ecx
leaq 0x1408(%r13), %rsi
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
mulss %xmm1, %xmm0
movss 0x140c(%r13), %xmm1
mulss 0x1d267(%rip), %xmm1    # 0x3d3dc
addss %xmm0, %xmm1
movss -0x68(%rbp), %xmm0
movss -0x5c(%rbp), %xmm2
addss %xmm2, %xmm1
movss 0xc(%r13), %xmm3
subss 0x1454(%r13), %xmm3
minss %xmm3, %xmm1
movss %xmm0, 0x1818(%rax)
movss %xmm2, 0x181c(%rax)
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x1834(%rax)
movaps -0xb0(%rbp), %xmm3
subss %xmm0, %xmm3
subss %xmm2, %xmm1
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movlps %xmm3, 0x1820(%rax)
movl $0x1, %edi
callq 0x15319
movl $0x80, %esi
andl 0xc(%rbx), %esi
orl $0x800000, %esi         # imm = 0x800000
movq %r14, %rdi
callq 0x12d5c
testb %al, %al
je 0x20352
callq 0x2044d
testl %r12d, %r12d
jle 0x20356
movl %r12d, %r12d
xorl %r14d, %r14d
xorb $0x1, %r15b
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x16ecb
movq -0x58(%rbp), %rax
movl (%rax), %r13d
movq -0x90(%rbp), %rdi
movl %r14d, %esi
leaq -0x50(%rbp), %rdx
callq *-0x88(%rbp)
testb %al, %al
jne 0x20248
leaq 0x1e40d(%rip), %rax     # 0x3e651
movq %rax, -0x50(%rbp)
xorl %esi, %esi
cmpq %r13, %r14
sete %sil
movq -0x50(%rbp), %rdi
movq $0x0, -0x98(%rbp)
xorl %edx, %edx
leaq -0x98(%rbp), %rcx
callq 0x20486
testb %al, %al
je 0x202a0
movq 0x35217(%rip), %rax     # 0x55490
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
movq -0x58(%rbp), %rax
movl %r14d, (%rax)
movb $0x1, %bl
cmpq %r13, %r14
setne %al
orb %r15b, %al
jne 0x2030e
movq 0x351de(%rip), %rax     # 0x55490
movq 0x1758(%rax), %rcx
movb $0x1, %dl
movb %dl, 0x72(%rcx)
movss 0xd0(%rcx), %xmm0
mulss 0x1d0ee(%rip), %xmm0    # 0x3d3bc
addss 0xb4(%rcx), %xmm0
movss 0x1418(%rax), %xmm1
mulss 0x1d0ba(%rip), %xmm1    # 0x3d3a0
addss %xmm1, %xmm1
addss %xmm0, %xmm1
subss 0x1c(%rcx), %xmm1
movb %dl, 0x72(%rcx)
addss 0x50(%rcx), %xmm1
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
movss %xmm0, 0x58(%rcx)
movl $0x3f000000, 0x60(%rcx) # imm = 0x3F000000
callq 0x16fc0
incq %r14
cmpq %r14, %r12
jne 0x20216
jmp 0x20358
xorl %ebx, %ebx
andb $0x1, %bl
movl %ebx, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0xd00c
movq %r14, %rdi
callq 0x128f4
movb $0x1, %r15b
jmp 0x200fd
xorl %ebx, %ebx
jmp 0x2035d
xorl %ebx, %ebx
callq 0x12f3e
movl $0x1, %edi
callq 0x12ffd
jmp 0x20323