// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::UpdateMouseMovingWindowEndFrame()
void ImGui::UpdateMouseMovingWindowEndFrame()
{
    ImGuiContext& g = *GImGui;
    if (g.ActiveId != 0 || g.HoveredId != 0)
        return;

    // Unless we just made a window/popup appear
    if (g.NavWindow && g.NavWindow->Appearing)
        return;

    // Click on empty space to focus window and start moving (after we're done with all our widgets)
    if (g.IO.MouseClicked[0])
    {
        // Handle the edge case of a popup being closed while clicking in its empty space.
        // If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more.
        ImGuiWindow* root_window = g.HoveredRootWindow;
        const bool is_closed_popup = root_window && (root_window->Flags & ImGuiWindowFlags_Popup) && !IsPopupOpen(root_window->PopupId, ImGuiPopupFlags_AnyPopupLevel);

        if (root_window != NULL && !is_closed_popup)
        {
            StartMouseMovingWindow(g.HoveredWindow); //-V595

            // Cancel moving if clicked outside of title bar
            if (g.IO.ConfigWindowsMoveFromTitleBarOnly && !(root_window->Flags & ImGuiWindowFlags_NoTitleBar))
                if (!root_window->TitleBarRect().Contains(g.IO.MouseClickedPos[0]))
                    g.MovingWindow = NULL;

            // Cancel moving if clicked over an item which was disabled or inhibited by popups (note that we know HoveredId == 0 already)
            if (g.HoveredIdDisabled)
                g.MovingWindow = NULL;
        }
        else if (root_window == NULL && g.NavWindow != NULL && GetTopMostPopupModal() == NULL)
        {
            // Clicking on void disable focus
            FocusWindow(NULL);
        }
    }

    // With right mouse button we close popups without changing focus based on where the mouse is aimed
    // Instead, focus will be restored to the window under the bottom-most closed popup.
    // (The left mouse button path calls FocusWindow on the hovered window, which will lead NewFrame->ClosePopupsOverWindow to trigger)
    if (g.IO.MouseClicked[1])
    {
        // Find the top-most window between HoveredWindow and the top-most Modal Window.
        // This is where we can trim the popup stack.
        ImGuiWindow* modal = GetTopMostPopupModal();
        bool hovered_window_above_modal = g.HoveredWindow && IsWindowAbove(g.HoveredWindow, modal);
        ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal, true);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0xb4624(%rip), %r14     # 0xfbcd0
cmpl $0x0, 0x1b30(%r14)
jne 0x476c0
cmpl $0x0, 0x1b1c(%r14)
je 0x476c5
popq %rbx
popq %r14
popq %rbp
retq
movq 0x1c90(%r14), %rax
testq %rax, %rax
je 0x476da
cmpb $0x0, 0x94(%rax)
jne 0x476c0
cmpb $0x1, 0x420(%r14)
jne 0x477c5
movq 0x1af0(%r14), %rbx
testq %rbx, %rbx
je 0x47741
testb $0x4, 0xf(%rbx)
jne 0x47759
movq 0x1ae8(%r14), %rdi
callq 0x471ee
cmpb $0x1, 0xcd(%r14)
jne 0x477b0
testb $0x1, 0xc(%rbx)
jne 0x477b0
movq %rbx, %rdi
callq 0x5dcfe
movss 0x3cc(%r14), %xmm3
ucomiss %xmm0, %xmm3
jae 0x47790
movq $0x0, 0x1b00(%r14)
jmp 0x477b0
testq %rax, %rax
je 0x477c5
callq 0x478f9
testq %rax, %rax
jne 0x477c5
xorl %edi, %edi
callq 0x4726c
jmp 0x477c5
movslq 0x1c70(%r14), %rdx
testq %rdx, %rdx
jle 0x477c5
movl 0xa0(%rbx), %eax
movq 0x1c78(%r14), %rcx
shlq $0x4, %rdx
leaq (%rdx,%rdx,2), %rdx
xorl %esi, %esi
cmpl %eax, (%rcx,%rsi)
je 0x476fa
addq $0x30, %rsi
cmpq %rsi, %rdx
jne 0x4777c
jmp 0x477c5
movss 0x3d0(%r14), %xmm2
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
ucomiss %xmm0, %xmm2
jb 0x47734
ucomiss %xmm3, %xmm1
jbe 0x47734
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
ucomiss %xmm2, %xmm1
jbe 0x47734
cmpb $0x1, 0x1b27(%r14)
jne 0x477c5
movq $0x0, 0x1b00(%r14)
cmpb $0x1, 0x421(%r14)
jne 0x476c0
callq 0x478f9
movq 0x1ae8(%r14), %rcx
testq %rcx, %rcx
je 0x47813
movq 0xb44e5(%rip), %rdx     # 0xfbcd0
movl 0x1a88(%rdx), %esi
testl %esi, %esi
jle 0x47813
movq 0x1a90(%rdx), %rdi
movq -0x8(%rdi,%rsi,8), %rdi
cmpq %rcx, %rdi
je 0x47810
decq %rsi
cmpq %rax, %rdi
jne 0x477f1
jmp 0x47813
movq %rcx, %rax
movq %rax, %rdi
movl $0x1, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x4797e