// File: /workspace/github_cpp_makefile_star2_O2/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
subq $0x10, %rsp
movq 0xab94c(%rip), %r14     # 0xe3ce0
cmpl $0x0, 0x1b30(%r14)
jne 0x383a8
cmpl $0x0, 0x1b1c(%r14)
je 0x383b1
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x1c90(%r14), %rax
testq %rax, %rax
je 0x383c6
cmpb $0x0, 0x94(%rax)
jne 0x383a8
cmpb $0x1, 0x420(%r14)
jne 0x3846a
movq 0x1af0(%r14), %rbx
testq %rbx, %rbx
je 0x38454
testb $0x4, 0xf(%rbx)
je 0x383fa
movl 0xa0(%rbx), %edi
movl $0x100, %esi            # imm = 0x100
callq 0x384af
testb %al, %al
je 0x3846a
movq 0x1ae8(%r14), %rdi
callq 0x37f23
cmpb $0x1, 0xcd(%r14)
jne 0x38440
testb $0x1, 0xc(%rbx)
jne 0x38440
movq %rbx, %rdi
callq 0x4ac7e
movlhps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
leaq -0x20(%rbp), %rdi
movups %xmm0, (%rdi)
leaq 0x3cc(%r14), %rsi
callq 0x4acc0
testb %al, %al
jne 0x38440
andq $0x0, 0x1b00(%r14)
cmpb $0x1, 0x1b27(%r14)
jne 0x3846a
andq $0x0, 0x1b00(%r14)
jmp 0x3846a
testq %rax, %rax
je 0x3846a
callq 0x38561
testq %rax, %rax
jne 0x3846a
xorl %edi, %edi
callq 0x37fa1
cmpb $0x1, 0x421(%r14)
jne 0x383a8
callq 0x38561
movq %rax, %rbx
movq 0x1ae8(%r14), %rdi
testq %rdi, %rdi
je 0x3849f
movq %rbx, %rsi
callq 0x385a0
testb %al, %al
je 0x3849f
movq 0x1ae8(%r14), %rbx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x385f5
jmp 0x383a8