// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::MenuItem(char const*, char const*, bool, bool)
bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, bool enabled)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return false;

    ImGuiContext& g = *GImGui;
    ImGuiStyle& style = g.Style;
    ImVec2 pos = window->DC.CursorPos;
    ImVec2 label_size = CalcTextSize(label, NULL, true);

    // We've been using the equivalent of ImGuiSelectableFlags_SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73),
    // but I am unsure whether this should be kept at all. For now moved it to be an opt-in feature used by menus only.
    ImGuiSelectableFlags flags = ImGuiSelectableFlags_SelectOnRelease | ImGuiSelectableFlags_SetNavIdOnHover | (enabled ? 0 : ImGuiSelectableFlags_Disabled);
    bool pressed;
    if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
    {
        // Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful
        // Note that in this situation we render neither the shortcut neither the selected tick mark
        float w = label_size.x;
        window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
        PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
        pressed = Selectable(label, false, flags, ImVec2(w, 0.0f));
        PopStyleVar();
        window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
    }
    else
    {
        // Menu item inside a vertical menu
        // (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
        //  Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
        float shortcut_w = shortcut ? CalcTextSize(shortcut, NULL).x : 0.0f;
        float min_w = window->DC.MenuColumns.DeclColumns(label_size.x, shortcut_w, IM_FLOOR(g.FontSize * 1.20f)); // Feedback for next frame
        float extra_w = ImMax(0.0f, GetContentRegionAvail().x - min_w);
        pressed = Selectable(label, false, flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f));
        if (shortcut_w > 0.0f)
        {
            PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
            RenderText(pos + ImVec2(window->DC.MenuColumns.Pos[1] + extra_w, 0.0f), shortcut, NULL, false);
            PopStyleColor();
        }
        if (selected)
            RenderCheckMark(window->DrawList, pos + ImVec2(window->DC.MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize  * 0.866f);
    }

    IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0));
    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x58509(%rip), %rax     # 0xfbcd0
movq (%rax), %r15
movq 0x1ae0(%r15), %r13
movb $0x1, 0x90(%r13)
cmpb $0x0, 0x93(%r13)
je 0xa37eb
xorl %r12d, %r12d
jmp 0xa3a7f
movl %ecx, %r14d
movq %rsi, %rbx
movq %rdi, %r12
movl %edx, -0x30(%rbp)
movss 0xd8(%r13), %xmm0
movaps %xmm0, -0x60(%rbp)
movss 0xdc(%r13), %xmm0
movaps %xmm0, -0x80(%rbp)
movss 0x117b7(%rip), %xmm0    # 0xb4fd0
xorl %esi, %esi
movl $0x1, %edx
callq 0x44a23
movaps %xmm0, %xmm3
xorb $0x1, %r14b
movzbl %r14b, %eax
leal 0x2400000(,%rax,8), %r14d
cmpl $0x0, 0x1bc(%r13)
je 0xa39cf
movq %rax, -0x68(%rbp)
xorps %xmm1, %xmm1
testq %rbx, %rbx
je 0xa3871
movss 0x11776(%rip), %xmm0    # 0xb4fd0
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movaps %xmm3, -0x40(%rbp)
callq 0x44a23
movaps -0x40(%rbp), %xmm3
movaps %xmm0, %xmm1
movaps %xmm1, -0x90(%rbp)
leaq 0x168(%r13), %rdi
movss 0x1980(%r15), %xmm0
mulss 0x2d508(%rip), %xmm0    # 0xd0d98
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm2
movaps %xmm3, %xmm0
callq 0xa2948
movss %xmm0, -0x2c(%rbp)
callq 0x51f24
movss -0x2c(%rbp), %xmm3
subss %xmm3, %xmm0
movaps %xmm0, %xmm1
xorps %xmm2, %xmm2
cmpless %xmm2, %xmm1
andnps %xmm0, %xmm1
movaps %xmm1, -0x40(%rbp)
orl $0x800000, %r14d        # imm = 0x800000
leaq -0x48(%rbp), %rcx
movss %xmm3, (%rcx)
movl $0x0, 0x4(%rcx)
movq %r12, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x94650
movl %eax, %r12d
movaps -0x90(%rbp), %xmm0
ucomiss 0x11f4c(%rip), %xmm0    # 0xb5844
jbe 0xa393c
leaq 0x1634(%r15), %rsi
xorl %edi, %edi
callq 0x43e1b
movss 0x178(%r13), %xmm0
addss -0x40(%rbp), %xmm0
addss -0x60(%rbp), %xmm0
xorps %xmm1, %xmm1
addss -0x80(%rbp), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x44476
movl $0x1, %edi
callq 0x43f55
cmpb $0x0, -0x30(%rbp)
je 0xa3a7f
movaps -0x40(%rbp), %xmm2
addss 0x17c(%r13), %xmm2
movq 0x2b8(%r13), %rbx
movss 0x1980(%r15), %xmm0
movss 0x17561(%rip), %xmm1    # 0xbaecc
mulss %xmm0, %xmm1
mulss 0x2d451(%rip), %xmm0    # 0xd0dc8
mulss 0x11685(%rip), %xmm0    # 0xb5004
addss %xmm2, %xmm1
movaps -0x60(%rbp), %xmm2
addss %xmm1, %xmm2
movaps -0x80(%rbp), %xmm1
addss %xmm0, %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movaps %xmm2, -0x60(%rbp)
movss 0x11642(%rip), %xmm0    # 0xb4fe4
movq -0x68(%rbp), %rdi
callq 0x43bca
movss 0x1980(%r15), %xmm1
mulss 0x22fb4(%rip), %xmm1    # 0xc6970
movq %rbx, %rdi
movaps -0x60(%rbp), %xmm0
movl %eax, %esi
callq 0x81f62
jmp 0xa3a7f
movss 0x15a8(%r15), %xmm0
movaps %xmm3, -0x40(%rbp)
movss 0x11620(%rip), %xmm1    # 0xb5004
mulss %xmm0, %xmm1
cvttps2dq %xmm1, %xmm1
cvtdq2ps %xmm1, %xmm1
addss 0xd8(%r13), %xmm1
movss %xmm1, 0xd8(%r13)
addss %xmm0, %xmm0
movss 0x15ac(%r15), %xmm1
leaq -0x48(%rbp), %rbx
movss %xmm0, (%rbx)
movss %xmm1, 0x4(%rbx)
movl $0xd, %edi
movq %rbx, %rsi
callq 0x4417f
movaps -0x40(%rbp), %xmm0
movss %xmm0, (%rbx)
movl $0x0, 0x4(%rbx)
leaq -0x48(%rbp), %rcx
movq %r12, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x94650
movl %eax, %r12d
movl $0x1, %edi
callq 0x44325
movss 0x15a8(%r15), %xmm0
mulss 0x11e5e(%rip), %xmm0    # 0xb58c4
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm0
addss 0xd8(%r13), %xmm0
movss %xmm0, 0xd8(%r13)
movl %r12d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq