// File: /workspace/github_cpp_makefile_star2_O2/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
subq $0x48, %rsp
movq 0xab5e5(%rip), %r12     # 0xe3ce0
movq 0x1b00(%r12), %rax
xorl %edx, %edx
testq %rax, %rax
je 0x38712
testb $0x2, 0xd(%rax)
cmoveq %rax, %rdx
movl 0x15c0(%r12), %ecx
movl 0x15c4(%r12), %eax
movd %ecx, %xmm1
movd %eax, %xmm2
cmpb $0x1, 0xcc(%r12)
movd %xmm1, -0x50(%rbp)
movd %xmm2, -0x4c(%rbp)
jne 0x38759
movss 0x64149(%rip), %xmm0    # 0x9c890
maxss %xmm0, %xmm1
maxss %xmm0, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movq %xmm1, %rax
jmp 0x38760
shlq $0x20, %rax
orq %rcx, %rax
movq %rdx, -0x48(%rbp)
movl %eax, -0x58(%rbp)
shrq $0x20, %rax
movl %eax, -0x54(%rbp)
leaq 0x1a88(%r12), %rbx
movl 0x1a88(%r12), %r14d
leaq 0x128(%r12), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x30(%rbp)
movl %r14d, %r13d
testl %r13d, %r13d
jle 0x3890e
movl %r13d, %r14d
leal -0x1(%r14), %r13d
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4ad62
movq (%rax), %r15
cmpb $0x1, 0x8e(%r15)
jne 0x38795
cmpb $0x0, 0x95(%r15)
jne 0x38795
testb $0x2, 0xd(%r15)
jne 0x38795
movups 0x208(%r15), %xmm0
movaps %xmm0, -0x40(%rbp)
testl $0x1000042, 0xc(%r15)   # imm = 0x1000042
movss -0x58(%rbp), %xmm1
movss -0x54(%rbp), %xmm0
je 0x387f8
movss -0x50(%rbp), %xmm1
movss -0x4c(%rbp), %xmm0
movss -0x40(%rbp), %xmm2
movss -0x3c(%rbp), %xmm3
subss %xmm1, %xmm2
movss %xmm2, -0x40(%rbp)
subss %xmm0, %xmm3
movss %xmm3, -0x3c(%rbp)
addss -0x38(%rbp), %xmm1
movss %xmm1, -0x38(%rbp)
addss -0x34(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
leaq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x4acc0
testb %al, %al
je 0x388cd
movzwl 0x278(%r15), %eax
testw %ax, %ax
je 0x388ad
movswl 0x27c(%r15), %ecx
cvtsi2ss %ecx, %xmm0
addss 0x10(%r15), %xmm0
movswl 0x27e(%r15), %ecx
cvtsi2ss %ecx, %xmm1
cwtl
cvtsi2ss %eax, %xmm2
movswl 0x27a(%r15), %eax
cvtsi2ss %eax, %xmm3
addss 0x14(%r15), %xmm1
addss %xmm0, %xmm2
addss %xmm1, %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movss %xmm0, -0x70(%rbp)
movss %xmm1, -0x6c(%rbp)
movlps %xmm2, -0x68(%rbp)
leaq -0x70(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x4acc0
testb %al, %al
jne 0x38795
movq -0x48(%rbp), %r13
testq %r13, %r13
cmoveq %r15, %r13
cmpq $0x0, -0x30(%rbp)
je 0x388dd
testq %r13, %r13
jne 0x38aeb
xorl %r13d, %r13d
jmp 0x388d1
movq -0x48(%rbp), %r13
movq %r13, -0x48(%rbp)
decl %r14d
jmp 0x38792
movq 0x1b00(%r12), %rax
testq %rax, %rax
je 0x38908
movq 0x390(%r15), %rcx
movq %r15, -0x30(%rbp)
cmpq 0x390(%rax), %rcx
jne 0x388bf
movq $0x0, -0x30(%rbp)
jmp 0x388d1
movq %r15, -0x30(%rbp)
jmp 0x388bf
movq -0x48(%rbp), %r13
movq %r13, 0x1ae8(%r12)
testq %r13, %r13
je 0x38928
movq 0x390(%r13), %r14
jmp 0x3892e
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %r14, 0x1af0(%r12)
movq -0x30(%rbp), %rax
movq %rax, 0x1af8(%r12)
callq 0x38561
movq %rax, %rbx
xorl %eax, %eax
testq %rbx, %rbx
je 0x38963
testq %r14, %r14
je 0x38963
movq %r14, %rdi
movq %rbx, %rsi
callq 0x38af8
xorb $0x1, %al
movl 0x8(%r12), %ecx
leaq 0x1ae8(%r12), %rsi
pushq $-0x1
popq %rdi
xorl %r8d, %r8d
xorl %edx, %edx
movslq %edi, %r9
cmpq $0x5, %r8
je 0x389e0
cmpb $0x1, 0x420(%r12,%r8)
jne 0x389a9
movb $0x1, %r10b
testq %r13, %r13
jne 0x389a1
cmpl $0x0, 0x1c70(%r12)
setg %r10b
movb %r10b, 0x42f(%r12,%r8)
movb 0x130(%r12,%r8), %r10b
cmpb $0x1, %r10b
jne 0x389d5
cmpl $-0x1, %edi
je 0x389d2
movsd 0x3f8(%r12,%r9,8), %xmm0
ucomisd 0x3f8(%r12,%r8,8), %xmm0
jbe 0x389d5
movl %r8d, %edi
andb $0x1, %dl
orb %r10b, %dl
incq %r8
jmp 0x38978
movl %ecx, %r10d
andl $0x10, %r10d
shrl $0x4, %r10d
movb $0x1, %r11b
movb $0x1, %r8b
cmpl $-0x1, %edi
je 0x389fe
movb 0x42f(%r12,%r9), %r8b
orb %al, %r10b
cmpb $0x1, 0x2004(%r12)
jne 0x38a1d
movl 0x2008(%r12), %eax
testb $0x10, %al
sete %r11b
orb %r10b, %r11b
movzbl %r10b, %eax
movzbl %r11b, %edi
testb %r8b, %r8b
cmovnel %eax, %edi
testb $0x1, %dil
je 0x38a3f
xorps %xmm0, %xmm0
movups %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
xorl %r13d, %r13d
movl 0x336c(%r12), %eax
cmpl $-0x1, %eax
je 0x38a59
testl %eax, %eax
setne 0x398(%r12)
jmp 0x38a7e
testq %r13, %r13
setne %sil
orb %dl, %sil
movb $0x1, %al
testb %sil, %r8b
jne 0x38a76
cmpl $0x0, 0x1c70(%r12)
setg %al
movb %al, 0x398(%r12)
movl 0x3370(%r12), %eax
cmpl $-0x1, %eax
je 0x38a92
testl %eax, %eax
setne %al
jmp 0x38aa6
testq %rbx, %rbx
setne %dl
cmpl $0x0, 0x1b30(%r12)
setne %al
orb %dl, %al
andl $0x9, %ecx
cmpl $0x1, %ecx
movzbl %al, %eax
cmovnel %eax, %ecx
cmpb $0x0, 0x39d(%r12)
cmovel %eax, %ecx
movb %cl, 0x399(%r12)
movl 0x3374(%r12), %eax
decl %eax
cmpl $-0x2, %eax
setb 0x39a(%r12)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, 0x1ae8(%r12)
jmp 0x3891f