// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::UpdateHoveredWindowAndCaptureFlags()
void ImGui::UpdateHoveredWindowAndCaptureFlags()
{
    ImGuiContext& g = *GImGui;

    // Find the window hovered by mouse:
    // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow.
    // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame.
    // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.
    bool clear_hovered_windows = false;
    FindHoveredWindow();

    // Modal windows prevents mouse from hovering behind them.
    ImGuiWindow* modal_window = GetTopMostPopupModal();
    if (modal_window && g.HoveredRootWindow && !IsWindowChildOf(g.HoveredRootWindow, modal_window))
        clear_hovered_windows = true;

    // Disabled mouse?
    if (g.IO.ConfigFlags & ImGuiConfigFlags_NoMouse)
        clear_hovered_windows = true;

    // We track click ownership. When clicked outside of a window the click is owned by the application and won't report hovering nor request capture even while dragging over our windows afterward.
    int mouse_earliest_button_down = -1;
    bool mouse_any_down = false;
    for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)
    {
        if (g.IO.MouseClicked[i])
            g.IO.MouseDownOwned[i] = (g.HoveredWindow != NULL) || (g.OpenPopupStack.Size > 0);
        mouse_any_down |= g.IO.MouseDown[i];
        if (g.IO.MouseDown[i])
            if (mouse_earliest_button_down == -1 || g.IO.MouseClickedTime[i] < g.IO.MouseClickedTime[mouse_earliest_button_down])
                mouse_earliest_button_down = i;
    }
    const bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.IO.MouseDownOwned[mouse_earliest_button_down];

    // If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
    // FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02)
    const bool mouse_dragging_extern_payload = g.DragDropActive && (g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) != 0;
    if (!mouse_avail_to_imgui && !mouse_dragging_extern_payload)
        clear_hovered_windows = true;

    if (clear_hovered_windows)
        g.HoveredWindow = g.HoveredRootWindow = g.HoveredWindowUnderMovingWindow = NULL;

    // Update io.WantCaptureMouse for the user application (true = dispatch mouse info to imgui, false = dispatch mouse info to Dear ImGui + app)
    if (g.WantCaptureMouseNextFrame != -1)
        g.IO.WantCaptureMouse = (g.WantCaptureMouseNextFrame != 0);
    else
        g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (g.OpenPopupStack.Size > 0);

    // Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to imgui, false = dispatch keyboard info to Dear ImGui + app)
    if (g.WantCaptureKeyboardNextFrame != -1)
        g.IO.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0);
    else
        g.IO.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL);
    if (g.IO.NavActive && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(g.IO.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard))
        g.IO.WantCaptureKeyboard = true;

    // Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible
    g.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0xb426f(%rip), %rbx     # 0xfbcd0
movq 0x1b00(%rbx), %rax
xorl %r14d, %r14d
testq %rax, %rax
je 0x47a78
testb $0x2, 0xd(%rax)
cmoveq %rax, %r14
movl 0x15c0(%rbx), %ecx
movl 0x15c4(%rbx), %edx
cmpb $0x1, 0xcc(%rbx)
jne 0x47aaf
movd %edx, %xmm0
movd %ecx, %xmm1
movss 0x6ddc7(%rip), %xmm2    # 0xb5864
maxss %xmm2, %xmm1
maxss %xmm2, %xmm0
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movq %xmm1, %rsi
jmp 0x47ab9
movq %rdx, %rsi
shlq $0x20, %rsi
orq %rcx, %rsi
movslq 0x1a88(%rbx), %rdi
testq %rdi, %rdi
jle 0x47c4d
movq %rsi, %r8
shrq $0x20, %r8
movq 0x1a90(%rbx), %r9
incq %rdi
xorl %r10d, %r10d
movq -0x10(%r9,%rdi,8), %r15
cmpb $0x1, 0x8e(%r15)
jne 0x47b2e
cmpb $0x0, 0x95(%r15)
jne 0x47b2e
movl 0xc(%r15), %r11d
btl $0x9, %r11d
jb 0x47b2e
movss 0x208(%r15), %xmm0
testl $0x1000042, %r11d       # imm = 0x1000042
movl %ecx, %r12d
cmovel %esi, %r12d
movd %r12d, %xmm2
subss %xmm2, %xmm0
movss 0x128(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jae 0x47b42
movq %r10, %r11
decq %rdi
movq %r11, %r10
cmpq $0x1, %rdi
ja 0x47add
jmp 0x47c50
testl $0x1000042, %r11d       # imm = 0x1000042
movl %edx, %r11d
cmovel %r8d, %r11d
movss 0x20c(%r15), %xmm4
movd %r11d, %xmm3
subss %xmm3, %xmm4
movss 0x12c(%rbx), %xmm0
ucomiss %xmm4, %xmm0
jb 0x47b2e
addss 0x210(%r15), %xmm2
ucomiss %xmm1, %xmm2
jbe 0x47b2e
addss 0x214(%r15), %xmm3
ucomiss %xmm0, %xmm3
jbe 0x47b2e
movzwl 0x278(%r15), %r11d
testw %r11w, %r11w
je 0x47bb4
movswl 0x27c(%r15), %r12d
xorps %xmm2, %xmm2
cvtsi2ss %r12d, %xmm2
addss 0x10(%r15), %xmm2
ucomiss %xmm2, %xmm1
jae 0x47bf3
testq %r14, %r14
cmoveq %r15, %r14
testq %r10, %r10
movq %r15, %r11
cmovneq %r10, %r11
testq %rax, %rax
je 0x47be2
testq %r10, %r10
jne 0x47be2
movq 0x390(%r15), %r10
movq %r15, %r11
cmpq 0x390(%rax), %r10
je 0x47c45
testq %r14, %r14
jne 0x47e22
xorl %r14d, %r14d
jmp 0x47b31
movswl %r11w, %r11d
xorps %xmm3, %xmm3
cvtsi2ss %r11d, %xmm3
addss %xmm3, %xmm2
ucomiss %xmm1, %xmm2
jbe 0x47bb4
movswl 0x27e(%r15), %r11d
xorps %xmm1, %xmm1
cvtsi2ss %r11d, %xmm1
addss 0x14(%r15), %xmm1
ucomiss %xmm1, %xmm0
jb 0x47bb4
movswl 0x27a(%r15), %r11d
xorps %xmm2, %xmm2
cvtsi2ss %r11d, %xmm2
addss %xmm2, %xmm1
ucomiss %xmm0, %xmm1
ja 0x47b2e
jmp 0x47bb4
xorl %r11d, %r11d
jmp 0x47b31
xorl %r11d, %r11d
movq %r14, 0x1ae8(%rbx)
testq %r14, %r14
je 0x47c65
movq 0x390(%r14), %r15
jmp 0x47c6b
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %r15, 0x1af0(%rbx)
movq %r11, 0x1af8(%rbx)
callq 0x478f9
xorl %esi, %esi
testq %rax, %rax
je 0x47cac
testq %r15, %r15
je 0x47cac
cmpq %rax, 0x390(%r15)
je 0x47caa
cmpq %rax, %r15
setne %sil
je 0x47cac
movq 0x388(%r15), %r15
testq %r15, %r15
jne 0x47c93
jmp 0x47cac
xorl %esi, %esi
movl 0x8(%rbx), %ecx
leaq 0x1ae8(%rbx), %rdi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
xorl %edx, %edx
cmpb $0x1, 0x420(%rbx,%r9)
jne 0x47ce7
movb $0x1, %r10b
testq %r14, %r14
jne 0x47cdf
cmpl $0x0, 0x1c70(%rbx)
setg %r10b
movb %r10b, 0x42f(%rbx,%r9)
movb 0x130(%rbx,%r9), %r10b
cmpb $0x1, %r10b
jne 0x47d17
cmpl $-0x1, %r8d
je 0x47d14
movslq %r8d, %r11
movsd 0x3f8(%rbx,%r11,8), %xmm0
ucomisd 0x3f8(%rbx,%r9,8), %xmm0
jbe 0x47d17
movl %r9d, %r8d
andb $0x1, %dl
orb %r10b, %dl
incq %r9
cmpq $0x5, %r9
jne 0x47cc1
movl %ecx, %r10d
andl $0x10, %r10d
shrl $0x4, %r10d
movb $0x1, %r11b
movb $0x1, %r9b
cmpl $-0x1, %r8d
je 0x47d48
movslq %r8d, %r8
movb 0x42f(%rbx,%r8), %r9b
orb %sil, %r10b
cmpb $0x1, 0x2004(%rbx)
jne 0x47d65
movl 0x2008(%rbx), %esi
testb $0x10, %sil
sete %r11b
orb %r10b, %r11b
movzbl %r10b, %esi
movzbl %r11b, %r8d
testb %r9b, %r9b
cmovnel %esi, %r8d
testb $0x1, %r8b
je 0x47d8b
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
xorl %r14d, %r14d
movl 0x336c(%rbx), %esi
cmpl $-0x1, %esi
je 0x47da1
testl %esi, %esi
setne 0x398(%rbx)
jmp 0x47dc7
testb %dl, %dl
setne %dl
testq %r14, %r14
setne %sil
orb %dl, %sil
movb $0x1, %dl
testb %sil, %r9b
jne 0x47dc1
cmpl $0x0, 0x1c70(%rbx)
setg %dl
movb %dl, 0x398(%rbx)
movl 0x3370(%rbx), %edx
cmpl $-0x1, %edx
je 0x47dd9
testl %edx, %edx
setne %al
jmp 0x47deb
testq %rax, %rax
setne %dl
cmpl $0x0, 0x1b30(%rbx)
setne %al
orb %dl, %al
andl $0x9, %ecx
cmpl $0x1, %ecx
movzbl %al, %eax
cmovnel %eax, %ecx
cmpb $0x0, 0x39d(%rbx)
cmovel %eax, %ecx
movb %cl, 0x399(%rbx)
movl 0x3374(%rbx), %eax
decl %eax
cmpl $-0x2, %eax
setb 0x39a(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x1ae8(%rbx)
jmp 0x47c5c