// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.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 popup_max_height_in_items)
{
    ImGuiContext& g = *GImGui;

    // Call the getter to obtain the preview string which is a parameter to BeginCombo()
    const char* preview_value = NULL;
    if (*current_item >= 0 && *current_item < items_count)
        items_getter(data, *current_item, &preview_value);

    // The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here.
    if (popup_max_height_in_items != -1 && !(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint))
        SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));

    if (!BeginCombo(label, preview_value, ImGuiComboFlags_None))
        return false;

    // Display items
    // FIXME-OPT: Use clipper (but we need to disable it on the appearing frame to make sure our call to SetItemDefaultFocus() is processed)
    bool value_changed = false;
    for (int i = 0; i < items_count; i++)
    {
        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 (Selectable(item_text, item_selected))
        {
            value_changed = true;
            *current_item = i;
        }
        if (item_selected)
            SetItemDefaultFocus();
        PopID();
    }

    EndCombo();
    if (value_changed)
        MarkItemEdited(g.CurrentWindow->DC.LastItemId);

    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, %r12d
movl %r8d, %r13d
movq %rcx, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
movq %rsi, %r15
leaq 0x67b8e(%rip), %rdx     # 0xfdcd0
movq (%rdx), %r14
movq $0x0, -0x50(%rbp)
movl (%rsi), %esi
testl %esi, %esi
sets %al
cmpl %r8d, %esi
setge %cl
orb %al, %cl
jne 0x96176
leaq -0x50(%rbp), %rdx
movq %rdi, %rbx
movq -0x48(%rbp), %rdi
callq *-0x40(%rbp)
leaq 0x67b5d(%rip), %rdx     # 0xfdcd0
movq %rbx, %rdi
cmpl $-0x1, %r12d
je 0x961f5
testb $0x10, 0x1b88(%r14)
jne 0x961f5
movq $0x0, -0x30(%rbp)
testl %r12d, %r12d
movq %rdi, -0x38(%rbp)
jle 0x961cd
movq (%rdx), %rax
movss 0x1568(%rax), %xmm0
movss 0x15ac(%rax), %xmm1
movss 0x1980(%rax), %xmm2
addss %xmm1, %xmm2
cvtsi2ss %r12d, %xmm3
mulss %xmm2, %xmm3
subss %xmm1, %xmm3
addss %xmm0, %xmm0
addss %xmm3, %xmm0
jmp 0x961d5
movss 0x2166b(%rip), %xmm0    # 0xb7840
leaq -0x58(%rbp), %rsi
movl $0x7f7fffff, (%rsi)     # imm = 0x7F7FFFFF
movss %xmm0, 0x4(%rsi)
leaq -0x30(%rbp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x556c3
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %r12d, %r12d
xorl %edx, %edx
callq 0x95a09
testb %al, %al
je 0x962af
testl %r13d, %r13d
jle 0x9628c
movq %r14, -0x38(%rbp)
movl %r13d, %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r13, %rdi
callq 0x55e4b
movl (%r15), %r14d
movq -0x48(%rbp), %rdi
movl %r13d, %esi
leaq -0x30(%rbp), %rdx
callq *-0x40(%rbp)
testb %al, %al
jne 0x96245
leaq 0x3d3ed(%rip), %rax     # 0xd362e
movq %rax, -0x30(%rbp)
xorl %esi, %esi
cmpq %r14, %r13
sete %sil
movq -0x30(%rbp), %rdi
movq $0x0, -0x58(%rbp)
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x962c5
testb %al, %al
je 0x9626f
movl %r13d, (%r15)
movb $0x1, %r12b
cmpq %r14, %r13
jne 0x96279
callq 0x55a6e
callq 0x56188
incq %r13
cmpq %r13, %rbx
jne 0x9621d
movq -0x38(%rbp), %r14
jmp 0x9628f
xorl %r12d, %r12d
callq 0x5847b
testb $0x1, %r12b
je 0x962af
movq 0x1ae0(%r14), %rax
movl 0x124(%rax), %edi
callq 0x46ca4
movb $0x1, %r12b
andb $0x1, %r12b
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq