// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0xb5681(%rip), %rbx     # 0xfdcd0
movq 0x1b00(%rbx), %rax
xorl %r14d, %r14d
testq %rax, %rax
je 0x48666
testb $0x2, 0xd(%rax)
cmoveq %rax, %r14
movl 0x15c0(%rbx), %ecx
movl 0x15c4(%rbx), %edx
cmpb $0x1, 0xcc(%rbx)
jne 0x486a5
movss 0x15c0(%rbx), %xmm0
movss 0x15c4(%rbx), %xmm1
movss 0x6f1d1(%rip), %xmm2    # 0xb7864
maxss %xmm2, %xmm0
maxss %xmm2, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq %xmm0, %rsi
jmp 0x486af
movq %rdx, %rsi
shlq $0x20, %rsi
orq %rcx, %rsi
movslq 0x1a88(%rbx), %r8
testq %r8, %r8
jle 0x48875
movq %rsi, %r9
shrq $0x20, %r9
movq 0x1a90(%rbx), %r10
incq %r8
xorl %edi, %edi
movq -0x10(%r10,%r8,8), %r11
movl $0x4, %r15d
cmpb $0x1, 0x8e(%r11)
jne 0x48860
cmpb $0x0, 0x95(%r11)
jne 0x48860
movl 0xc(%r11), %r12d
btl $0x9, %r12d
jb 0x48860
movss 0x208(%r11), %xmm1
testl $0x1000042, %r12d       # imm = 0x1000042
movl %ecx, %r13d
cmovel %esi, %r13d
movd %r13d, %xmm2
subss %xmm2, %xmm1
movss 0x128(%rbx), %xmm0
ucomiss %xmm1, %xmm0
jb 0x48860
testl $0x1000042, %r12d       # imm = 0x1000042
movl %edx, %r12d
cmovel %r9d, %r12d
movss 0x20c(%r11), %xmm4
movd %r12d, %xmm3
subss %xmm3, %xmm4
movss 0x12c(%rbx), %xmm1
ucomiss %xmm4, %xmm1
jb 0x48860
addss 0x210(%r11), %xmm2
ucomiss %xmm0, %xmm2
jbe 0x48860
addss 0x214(%r11), %xmm3
ucomiss %xmm1, %xmm3
jbe 0x48860
movzwl 0x278(%r11), %r15d
testw %r15w, %r15w
je 0x48820
movswl 0x27c(%r11), %r12d
xorps %xmm2, %xmm2
cvtsi2ss %r12d, %xmm2
addss 0x10(%r11), %xmm2
ucomiss %xmm2, %xmm0
jae 0x487c0
xorl %r15d, %r15d
jmp 0x48811
movswl 0x27e(%r11), %r12d
xorps %xmm3, %xmm3
cvtsi2ss %r12d, %xmm3
movswl 0x27a(%r11), %r12d
xorps %xmm4, %xmm4
cvtsi2ss %r12d, %xmm4
addss 0x14(%r11), %xmm3
addss %xmm3, %xmm4
movswl %r15w, %r15d
cvtsi2ss %r15d, %xmm5
addss %xmm5, %xmm2
ucomiss %xmm3, %xmm1
setae %r12b
cmpltps %xmm2, %xmm0
cmpltps %xmm4, %xmm1
andps %xmm0, %xmm1
movd %xmm1, %r15d
andb %r12b, %r15b
testb %r15b, %r15b
je 0x48820
movzbl %r15b, %r15d
shll $0x2, %r15d
jmp 0x48860
testq %r14, %r14
cmoveq %r11, %r14
testq %rdi, %rdi
jne 0x48848
testq %rax, %rax
je 0x48841
movq 0x390(%r11), %rdi
cmpq 0x390(%rax), %rdi
je 0x48846
movq %r11, %rdi
jmp 0x48848
xorl %edi, %edi
testq %r14, %r14
setne %r11b
testq %rdi, %rdi
setne %r15b
andb %r11b, %r15b
movzbl %r15b, %r15d
addl %r15d, %r15d
testb $0x3, %r15b
jne 0x48877
decq %r8
cmpq $0x1, %r8
jg 0x486d2
jmp 0x48877
xorl %edi, %edi
movq %r14, 0x1ae8(%rbx)
testq %r14, %r14
je 0x4888c
movq 0x390(%r14), %r15
jmp 0x4888f
xorl %r15d, %r15d
movq %r15, 0x1af0(%rbx)
movq %rdi, 0x1af8(%rbx)
callq 0x484a1
xorl %edi, %edi
testq %rax, %rax
je 0x488d6
testq %r15, %r15
je 0x488d6
cmpq %rax, 0x390(%r15)
je 0x488d4
cmpq %rax, %r15
sete %dil
je 0x488ce
movq 0x388(%r15), %r15
testq %r15, %r15
jne 0x488b7
xorl %edi, %edi
xorb $0x1, %dil
jmp 0x488d6
xorl %edi, %edi
leaq 0x1ae8(%rbx), %rdx
movl 0x8(%rbx), %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
xorl %esi, %esi
cmpb $0x1, 0x420(%rbx,%r9)
jne 0x48911
movb $0x1, %r10b
testq %r14, %r14
jne 0x48909
cmpl $0x0, 0x1c70(%rbx)
setg %r10b
movb %r10b, 0x42f(%rbx,%r9)
movb 0x130(%rbx,%r9), %r10b
cmpb $0x1, %r10b
jne 0x48941
cmpl $-0x1, %r8d
je 0x4893e
movslq %r8d, %r11
movsd 0x3f8(%rbx,%r11,8), %xmm0
ucomisd 0x3f8(%rbx,%r9,8), %xmm0
jbe 0x48941
movl %r9d, %r8d
andb $0x1, %sil
orb %r10b, %sil
incq %r9
cmpq $0x5, %r9
jne 0x488eb
testb $0x10, %cl
movzbl %dil, %edi
movl $0x1, %r10d
cmovel %edi, %r10d
movb $0x1, %r9b
movb $0x1, %dil
cmpl $-0x1, %r8d
je 0x48979
movslq %r8d, %rdi
movb 0x42f(%rbx,%rdi), %dil
cmpb $0x1, 0x2004(%rbx)
movzbl %r10b, %r8d
jne 0x48997
testb $0x10, 0x2008(%rbx)
movl $0x1, %r9d
cmovnel %r8d, %r9d
movzbl %r9b, %r9d
testb %dil, %dil
cmovnel %r8d, %r9d
cmpb $0x1, %r9b
jne 0x489b6
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
movl 0x336c(%rbx), %r8d
cmpl $-0x1, %r8d
je 0x489cf
testl %r8d, %r8d
setne 0x398(%rbx)
jmp 0x489f1
testb %dil, %dil
je 0x489e1
cmpq $0x0, (%rdx)
movb $0x1, %dl
jne 0x489eb
testb %sil, %sil
jne 0x489eb
cmpl $0x0, 0x1c70(%rbx)
setg %dl
movb %dl, 0x398(%rbx)
movl 0x3370(%rbx), %edx
cmpl $-0x1, %edx
je 0x48a03
testl %edx, %edx
setne %al
jmp 0x48a15
testq %rax, %rax
setne %dl
cmpl $0x0, 0x1b30(%rbx)
setne %al
orb %dl, %al
movb %al, 0x399(%rbx)
andl $0x9, %ecx
cmpl $0x1, %ecx
sete %al
andb 0x39d(%rbx), %al
cmpb $0x1, %al
jne 0x48a35
movb $0x1, 0x399(%rbx)
movl 0x3374(%rbx), %eax
decl %eax
cmpl $-0x2, %eax
setb 0x39a(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq