// File: /workspace/github_cpp_makefile_star2_O3/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, %r13d
movl %r8d, %r12d
movq %rcx, -0x48(%rbp)
movq %rdx, %r14
movq %rsi, %r15
leaq 0x67815(%rip), %rdx     # 0xfbcd0
movq (%rdx), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movl (%rsi), %esi
testl %esi, %esi
sets %al
cmpl %r8d, %esi
setge %cl
orb %al, %cl
jne 0x944f3
leaq -0x50(%rbp), %rdx
movq %rdi, %rbx
movq -0x48(%rbp), %rdi
callq *%r14
leaq 0x677e0(%rip), %rdx     # 0xfbcd0
movq %rbx, %rdi
cmpl $-0x1, %r13d
je 0x94575
movq -0x40(%rbp), %rax
testb $0x10, 0x1b88(%rax)
jne 0x94575
movq $0x0, -0x38(%rbp)
testl %r13d, %r13d
movq %rdi, -0x30(%rbp)
jle 0x9454d
movq (%rdx), %rax
movss 0x1568(%rax), %xmm0
movss 0x15ac(%rax), %xmm1
movss 0x1980(%rax), %xmm2
addss %xmm1, %xmm2
cvtsi2ss %r13d, %xmm3
mulss %xmm2, %xmm3
subss %xmm1, %xmm3
addss %xmm0, %xmm0
addss %xmm3, %xmm0
jmp 0x94555
movss 0x212eb(%rip), %xmm0    # 0xb5840
leaq -0x58(%rbp), %rsi
movl $0x7f7fffff, (%rsi)     # imm = 0x7F7FFFFF
movss %xmm0, 0x4(%rsi)
leaq -0x38(%rbp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x54628
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %r13d, %r13d
xorl %edx, %edx
callq 0x93d73
testb %al, %al
je 0x9463e
testl %r12d, %r12d
jle 0x94636
movl %r12d, %r13d
xorl %r12d, %r12d
movq $0x0, -0x30(%rbp)
movq %r12, %rdi
callq 0x54d60
movl (%r15), %ebx
movq -0x48(%rbp), %rdi
movl %r12d, %esi
leaq -0x38(%rbp), %rdx
callq *%r14
testb %al, %al
je 0x945c5
movq -0x38(%rbp), %rdi
jmp 0x945d0
leaq 0x3cf32(%rip), %rdi     # 0xd14fe
movq %rdi, -0x38(%rbp)
xorl %esi, %esi
cmpq %rbx, %r12
sete %sil
movq $0x0, -0x58(%rbp)
xorl %edx, %edx
leaq -0x58(%rbp), %rcx
callq 0x94650
testb %al, %al
je 0x945f9
movl %r12d, (%r15)
movb $0x1, %al
movq %rax, -0x30(%rbp)
cmpq %rbx, %r12
jne 0x94603
callq 0x549cb
callq 0x55082
incq %r12
cmpq %r12, %r13
jne 0x945a2
callq 0x5732f
testb $0x1, -0x30(%rbp)
je 0x9463b
movq -0x40(%rbp), %rax
movq 0x1ae0(%rax), %rax
movl 0x124(%rax), %edi
callq 0x4618e
movb $0x1, %r13b
jmp 0x9463e
callq 0x5732f
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq