// File: /workspace/github_cpp_makefile_star2_O3/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 $0x118, %rsp            # imm = 0x118
movq %rcx, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq %rsi, -0x70(%rbp)
movq 0x35a32(%rip), %r15     # 0x55480
movq 0x1758(%r15), %rbx
movb $0x1, 0x72(%rbx)
cmpb $0x0, 0x74(%rbx)
jne 0x2006c
movl %r8d, %r12d
movq %rdi, %r14
movl %r9d, -0x74(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xa766
movl %eax, -0x30(%rbp)
callq 0x14877
movss %xmm0, -0x50(%rbp)
movss 0x1d90d(%rip), %xmm0    # 0x3d39c
movq %r14, -0x68(%rbp)
movq %r14, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xe505
movaps %xmm0, %xmm6
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss -0x50(%rbp), %xmm2
addss 0xa8(%rbx), %xmm2
movss 0xac(%rbx), %xmm1
movaps %xmm0, -0x110(%rbp)
addss %xmm0, %xmm1
movss 0x1408(%r15), %xmm3
movss 0x140c(%r15), %xmm0
addss %xmm3, %xmm3
movaps %xmm0, %xmm4
addss %xmm0, %xmm4
addss %xmm2, %xmm3
addss %xmm1, %xmm4
movaps %xmm3, %xmm2
unpcklps %xmm4, %xmm2            # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
movq 0xa8(%rbx), %r13
movq %r13, -0xf0(%rbp)
movq %r13, %rax
shrq $0x20, %rax
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm6
movaps %xmm2, -0xd0(%rbp)
movlps %xmm2, -0xe8(%rbp)
movd %eax, %xmm7
movd %r13d, %xmm5
xorps %xmm2, %xmm2
jbe 0x1fb38
movss 0x141c(%r15), %xmm2
addss %xmm6, %xmm2
movaps %xmm6, -0x120(%rbp)
addss %xmm3, %xmm2
addss %xmm4, %xmm1
movaps %xmm3, -0x50(%rbp)
movaps %xmm2, %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
leaq -0x130(%rbp), %r14
movq %r13, (%r14)
movlps %xmm3, 0x8(%r14)
movd %xmm5, -0x2c(%rbp)
subss %xmm5, %xmm2
subss %xmm7, %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
leaq -0x60(%rbp), %rdi
movlps %xmm2, (%rdi)
movaps %xmm4, -0xb0(%rbp)
movaps %xmm7, -0xc0(%rbp)
callq 0xa99d
leaq -0x30(%rbp), %rsi
movq %r14, %rdi
callq 0xaaef
testb %al, %al
je 0x2006c
movq %r13, %xmm0
movdqa %xmm0, -0x100(%rbp)
movss 0x1408(%r15), %xmm0
addss %xmm0, %xmm0
addss 0x1718(%r15), %xmm0
movss %xmm0, -0xa0(%rbp)
movl -0x30(%rbp), %esi
leaq -0xf0(%rbp), %rdi
xorl %edx, %edx
callq 0xad1f
movl %eax, %r14d
movaps -0x50(%rbp), %xmm0
subss -0xa0(%rbp), %xmm0
movaps %xmm0, -0xa0(%rbp)
unpcklps -0xb0(%rbp), %xmm0      # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movq %r13, -0xe0(%rbp)
movlps %xmm0, -0xd8(%rbp)
movq 0x35874(%rip), %rax     # 0x55480
movups 0x14c0(%rax), %xmm0
movl %r12d, -0x34(%rbp)
leaq -0x60(%rbp), %r12
movaps %xmm0, (%r12)
movss 0x13e8(%rax), %xmm0
mulss 0xc(%r12), %xmm0
movss %xmm0, 0xc(%r12)
movq %r12, %rdi
callq 0x8c82
movss 0x1410(%r15), %xmm2
movaps -0x100(%rbp), %xmm0
movaps -0xd0(%rbp), %xmm1
movl %eax, %edi
movl $0x1, %esi
callq 0xe58d
movq 0x35818(%rip), %rax     # 0x55480
movzbl %r14b, %ecx
shll $0x4, %ecx
movups 0x15b0(%rcx,%rax), %xmm0
movaps %xmm0, (%r12)
movss 0x13e8(%rax), %xmm0
mulss 0xc(%r12), %xmm0
movss %xmm0, 0xc(%r12)
leaq -0x60(%rbp), %rdi
callq 0x8c82
movss 0x1410(%r15), %xmm2
movaps -0xa0(%rbp), %xmm0
unpcklps -0xc0(%rbp), %xmm0      # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps -0xd0(%rbp), %xmm1
movl %eax, %edi
movl $0x1, %esi
callq 0xe58d
movaps -0xa0(%rbp), %xmm1
addss 0x1408(%r15), %xmm1
movss 0x140c(%r15), %xmm0
addss -0xc0(%rbp), %xmm0
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movaps %xmm1, %xmm0
movss 0x1d69c(%rip), %xmm1    # 0x3d390
movl $0x1, %edi
xorl %esi, %esi
callq 0xe6eb
movq -0x70(%rbp), %rax
movl (%rax), %esi
testl %esi, %esi
sets %al
cmpl -0x34(%rbp), %esi
setge %cl
orb %al, %cl
jne 0x1fd75
leaq -0x60(%rbp), %rdx
movq -0x88(%rbp), %rdi
callq *-0x80(%rbp)
testb %al, %al
je 0x1fd75
leaq -0xd8(%rbp), %rsi
movss 0x1408(%r15), %xmm0
addss -0x2c(%rbp), %xmm0
movss 0x140c(%r15), %xmm1
addss -0xc0(%rbp), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
leaq -0x90(%rbp), %rdi
movlps %xmm0, (%rdi)
movq -0x60(%rbp), %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x9, %r9d
callq 0xe23a
xorps %xmm0, %xmm0
movaps -0x120(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1fdb5
movss 0x141c(%r15), %xmm0
addss -0x50(%rbp), %xmm0
movaps -0xc0(%rbp), %xmm1
addss 0x140c(%r15), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xdecf
testb %r14b, %r14b
movaps -0x50(%rbp), %xmm2
movaps -0xb0(%rbp), %xmm3
je 0x1fe2c
movl -0x30(%rbp), %edi
movl %edi, 0x1788(%r15)
cmpb $0x1, 0x354(%r15)
movss -0x2c(%rbp), %xmm4
jne 0x1fe31
movq 0x3569b(%rip), %rax     # 0x55480
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
movslq 0x1808(%rax), %rcx
cmpl %ecx, 0x17f8(%rax)
jle 0x1fe36
movq 0x1800(%rax), %rax
leaq (%rcx,%rcx,4), %rcx
cmpl %edi, (%rax,%rcx,8)
jne 0x1fe36
callq 0x12c36
xorl %r12d, %r12d
jmp 0x1fe4a
xorl %r12d, %r12d
jmp 0x1fe55
xorl %r12d, %r12d
jmp 0x1fe5a
movq %rbx, %rdi
callq 0xce68
movq -0x68(%rbp), %rdi
callq 0x12594
movb $0x1, %r12b
movaps -0x50(%rbp), %xmm2
movaps -0xb0(%rbp), %xmm3
movss -0x2c(%rbp), %xmm4
movq 0x3561f(%rip), %rax     # 0x55480
movslq 0x1808(%rax), %rcx
cmpl %ecx, 0x17f8(%rax)
jle 0x2006c
movq 0x1800(%rax), %rdx
leaq (%rcx,%rcx,4), %rcx
movl (%rdx,%rcx,8), %ecx
cmpl -0x30(%rbp), %ecx
jne 0x2006c
movl -0x74(%rbp), %edx
testl %edx, %edx
movl $0x7, %ecx
cmovnsl %edx, %ecx
movl -0x34(%rbp), %r14d
cmpl %ecx, %r14d
cmovll %r14d, %ecx
leaq 0x1408(%r15), %rsi
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movaps -0x110(%rbp), %xmm1
addss 0x1418(%r15), %xmm1
mulss %xmm1, %xmm0
movss 0x140c(%r15), %xmm1
mulss 0x1d51a(%rip), %xmm1    # 0x3d3f0
addss %xmm0, %xmm1
addss %xmm3, %xmm1
movss 0xc(%r15), %xmm0
subss 0x1454(%r15), %xmm0
minss %xmm0, %xmm1
movl %r13d, 0x1818(%rax)
movss %xmm3, 0x181c(%rax)
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x1834(%rax)
subss %xmm4, %xmm2
subss %xmm3, %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movlps %xmm2, 0x1820(%rax)
movl $0x1, %edi
callq 0x14ee8
movl $0x80, %esi
andl 0xc(%rbx), %esi
orl $0x800000, %esi         # imm = 0x800000
movq -0x68(%rbp), %rdi
callq 0x129d3
testb %al, %al
je 0x20085
callq 0x20180
testl %r14d, %r14d
jle 0x20089
movl %r14d, %r15d
xorl %r14d, %r14d
xorb $0x1, %r12b
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x16a34
movq -0x70(%rbp), %rax
movl (%rax), %r13d
movq -0x88(%rbp), %rdi
movl %r14d, %esi
leaq -0x60(%rbp), %rdx
callq *-0x80(%rbp)
testb %al, %al
je 0x1ff90
movq -0x60(%rbp), %rdi
jmp 0x1ff9b
leaq 0x1e6ea(%rip), %rdi     # 0x3e681
movq %rdi, -0x60(%rbp)
xorl %esi, %esi
cmpq %r13, %r14
sete %sil
movq $0x0, -0x90(%rbp)
xorl %edx, %edx
leaq -0x90(%rbp), %rcx
callq 0x201b9
testb %al, %al
je 0x1ffef
movq 0x354b8(%rip), %rax     # 0x55480
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
movq -0x70(%rbp), %rax
movl %r14d, (%rax)
movb $0x1, %bl
cmpq %r13, %r14
setne %al
orb %r12b, %al
jne 0x20059
movq 0x3547f(%rip), %rax     # 0x55480
movq 0x1758(%rax), %rcx
movss 0xd0(%rcx), %xmm0
mulss 0x1d3b4(%rip), %xmm0    # 0x3d3cc
addss 0xb4(%rcx), %xmm0
movss 0x1418(%rax), %xmm1
mulss 0x1d3a8(%rip), %xmm1    # 0x3d3d8
addss %xmm1, %xmm1
addss %xmm0, %xmm1
subss 0x1c(%rcx), %xmm1
movb $0x1, 0x72(%rcx)
addss 0x50(%rcx), %xmm1
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
movss %xmm0, 0x58(%rcx)
movl $0x3f000000, 0x60(%rcx) # imm = 0x3F000000
callq 0x16b19
incq %r14
cmpq %r14, %r15
jne 0x1ff66
jmp 0x2008b
xorl %ebx, %ebx
andb $0x1, %bl
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x20090
xorl %ebx, %ebx
callq 0x12baf
movl $0x1, %edi
callq 0x12c6e
jmp 0x2006e