// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::IsItemHovered(int)
bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (g.NavDisableMouseHover && !g.NavDisableHighlight)
        return IsItemFocused();

    // Test for bounding box overlap, as updated as ItemAdd()
    if (!(window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect))
        return false;
    IM_ASSERT((flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows)) == 0);   // Flags not supported by this function

    // Test if we are hovering the right window (our window could be behind another window)
    // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable to use IsItemHovered() after EndChild() itself.
    // Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was the test that has been running for a long while.
    //if (g.HoveredWindow != window)
    //    return false;
    if (g.HoveredRootWindow != window->RootWindow && !(flags & ImGuiHoveredFlags_AllowWhenOverlapped))
        return false;

    // Test if another item is active (e.g. being dragged)
    if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
        if (g.ActiveId != 0 && g.ActiveId != window->DC.LastItemId && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId)
            return false;

    // Test if interactions on this window are blocked by an active popup or modal.
    // The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here.
    if (!IsWindowContentHoverable(window, flags))
        return false;

    // Test if the item is disabled
    if ((window->DC.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled))
        return false;

    // Special handling for calling after Begin() which represent the title bar or tab.
    // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case.
    if (window->DC.LastItemId == window->MoveId && window->WriteAccessed)
        return false;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movq 0x148d6e(%rip), %rax    # 0x212f40
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x1ce7(%rax)
je 0xca20e
movq -0x10(%rbp), %rax
testb $0x1, 0x1ce6(%rax)
jne 0xca20e
callq 0xca350
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0xca33c
movq -0x18(%rbp), %rax
movl 0x128(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xca229
movb $0x0, -0x1(%rbp)
jmp 0xca33c
movl -0x8(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0xca236
jmp 0xca255
leaq 0xa9525(%rip), %rdi     # 0x173762
leaq 0xa8cc5(%rip), %rsi     # 0x172f09
movl $0xc26, %edx            # imm = 0xC26
leaq 0xa9561(%rip), %rcx     # 0x1737b1
callq 0xd180
movq -0x10(%rbp), %rax
movq 0x1af0(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x390(%rcx), %rax
je 0xca281
movl -0x8(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0xca281
movb $0x0, -0x1(%rbp)
jmp 0xca33c
movl -0x8(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0xca2d7
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1b30(%rax)
je 0xca2d5
movq -0x10(%rbp), %rax
movl 0x1b30(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x124(%rcx), %eax
je 0xca2d5
movq -0x10(%rbp), %rax
testb $0x1, 0x1b3d(%rax)
jne 0xca2d5
movq -0x10(%rbp), %rax
movl 0x1b30(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x54(%rcx), %eax
je 0xca2d5
movb $0x0, -0x1(%rbp)
jmp 0xca33c
jmp 0xca2d7
movq -0x18(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0xca3b0
testb $0x1, %al
jne 0xca2ed
movb $0x0, -0x1(%rbp)
jmp 0xca33c
movq -0x18(%rbp), %rax
movl 0x1cc(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xca312
movl -0x8(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xca312
movb $0x0, -0x1(%rbp)
jmp 0xca33c
movq -0x18(%rbp), %rax
movl 0x124(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x54(%rcx), %eax
jne 0xca338
movq -0x18(%rbp), %rax
testb $0x1, 0x90(%rax)
je 0xca338
movb $0x0, -0x1(%rbp)
jmp 0xca33c
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)