// File: /workspace/github_cpp_makefile_star2_O1/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 0x58b54(%rip), %rax     # 0xfdcd0
movq (%rax), %r15
movq 0x1ae0(%r15), %r13
movb $0x1, 0x90(%r13)
cmpb $0x0, 0x93(%r13)
je 0xa51a0
xorl %r12d, %r12d
jmp 0xa5434
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 0x11e02(%rip), %xmm0    # 0xb6fd0
xorl %esi, %esi
movl $0x1, %edx
callq 0x4548d
movaps %xmm0, %xmm3
xorb $0x1, %r14b
movzbl %r14b, %eax
leal 0x2400000(,%rax,8), %r14d
cmpl $0x0, 0x1bc(%r13)
je 0xa5384
movq %rax, -0x68(%rbp)
xorps %xmm1, %xmm1
testq %rbx, %rbx
je 0xa5226
movss 0x11dc1(%rip), %xmm0    # 0xb6fd0
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movaps %xmm3, -0x40(%rbp)
callq 0x4548d
movaps -0x40(%rbp), %xmm3
movaps %xmm0, %xmm1
movaps %xmm1, -0x90(%rbp)
leaq 0x168(%r13), %rdi
movss 0x1980(%r15), %xmm0
mulss 0x2dc7f(%rip), %xmm0    # 0xd2ec4
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm2
movaps %xmm3, %xmm0
callq 0xa42be
movss %xmm0, -0x2c(%rbp)
callq 0x52f20
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 0x962c5
movl %eax, %r12d
movaps -0x90(%rbp), %xmm0
ucomiss 0x12597(%rip), %xmm0    # 0xb7844
jbe 0xa52f1
leaq 0x1634(%r15), %rsi
xorl %edi, %edi
callq 0x4481b
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 0x44ec4
movl $0x1, %edi
callq 0x44964
cmpb $0x0, -0x30(%rbp)
je 0xa5434
movaps -0x40(%rbp), %xmm2
addss 0x17c(%r13), %xmm2
movq 0x2b8(%r13), %rbx
movss 0x1980(%r15), %xmm0
movss 0x17bdc(%rip), %xmm1    # 0xbcefc
mulss %xmm0, %xmm1
mulss 0x2dbc8(%rip), %xmm0    # 0xd2ef4
mulss 0x11cd0(%rip), %xmm0    # 0xb7004
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 0x11c8d(%rip), %xmm0    # 0xb6fe4
movq -0x68(%rbp), %rdi
callq 0x445bd
movss 0x1980(%r15), %xmm1
mulss 0x2362f(%rip), %xmm1    # 0xc89a0
movq %rbx, %rdi
movaps -0x60(%rbp), %xmm0
movl %eax, %esi
callq 0x83ab2
jmp 0xa5434
movss 0x15a8(%r15), %xmm0
movaps %xmm3, -0x40(%rbp)
movss 0x11c6b(%rip), %xmm1    # 0xb7004
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 0x44ba2
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 0x962c5
movl %eax, %r12d
movl $0x1, %edi
callq 0x44d5f
movss 0x15a8(%r15), %xmm0
mulss 0x124a9(%rip), %xmm0    # 0xb78c4
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