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

    // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well)
    if (IsMousePosValid(&g.IO.MousePos))
        g.IO.MousePos = g.LastValidMousePos = ImFloor(g.IO.MousePos);

    // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta
    if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MousePosPrev))
        g.IO.MouseDelta = g.IO.MousePos - g.IO.MousePosPrev;
    else
        g.IO.MouseDelta = ImVec2(0.0f, 0.0f);
    if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)
        g.NavDisableMouseHover = false;

    g.IO.MousePosPrev = g.IO.MousePos;
    for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)
    {
        g.IO.MouseClicked[i] = g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] < 0.0f;
        g.IO.MouseReleased[i] = !g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] >= 0.0f;
        g.IO.MouseDownDurationPrev[i] = g.IO.MouseDownDuration[i];
        g.IO.MouseDownDuration[i] = g.IO.MouseDown[i] ? (g.IO.MouseDownDuration[i] < 0.0f ? 0.0f : g.IO.MouseDownDuration[i] + g.IO.DeltaTime) : -1.0f;
        g.IO.MouseDoubleClicked[i] = false;
        if (g.IO.MouseClicked[i])
        {
            if ((float)(g.Time - g.IO.MouseClickedTime[i]) < g.IO.MouseDoubleClickTime)
            {
                ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);
                if (ImLengthSqr(delta_from_click_pos) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist)
                    g.IO.MouseDoubleClicked[i] = true;
                g.IO.MouseClickedTime[i] = -g.IO.MouseDoubleClickTime * 2.0f; // Mark as "old enough" so the third click isn't turned into a double-click
            }
            else
            {
                g.IO.MouseClickedTime[i] = g.Time;
            }
            g.IO.MouseClickedPos[i] = g.IO.MousePos;
            g.IO.MouseDownWasDoubleClick[i] = g.IO.MouseDoubleClicked[i];
            g.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f);
            g.IO.MouseDragMaxDistanceSqr[i] = 0.0f;
        }
        else if (g.IO.MouseDown[i])
        {
            // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold
            ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);
            g.IO.MouseDragMaxDistanceSqr[i] = ImMax(g.IO.MouseDragMaxDistanceSqr[i], ImLengthSqr(delta_from_click_pos));
            g.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, delta_from_click_pos.x < 0.0f ? -delta_from_click_pos.x : delta_from_click_pos.x);
            g.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, delta_from_click_pos.y < 0.0f ? -delta_from_click_pos.y : delta_from_click_pos.y);
        }
        if (!g.IO.MouseDown[i] && !g.IO.MouseReleased[i])
            g.IO.MouseDownWasDoubleClick[i] = false;
        if (g.IO.MouseClicked[i]) // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation
            g.NavDisableMouseHover = false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x144021(%rip), %rax    # 0x212f40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0xcb710
testb $0x1, %al
jne 0xcef3d
jmp 0xcef73
movq -0x8(%rbp), %rdi
addq $0x128, %rdi            # imm = 0x128
callq 0xc2f10
movlpd %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rax, 0x2158(%rcx)
movq -0x8(%rbp), %rax
movq 0x2158(%rcx), %rcx
movq %rcx, 0x128(%rax)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0xcb710
testb $0x1, %al
jne 0xcef8d
jmp 0xcefd7
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
addq $0x3bc, %rdi            # imm = 0x3BC
callq 0xcb710
testb $0x1, %al
jne 0xcefa7
jmp 0xcefd7
movq -0x8(%rbp), %rsi
movq %rsi, %rdi
addq $0x128, %rdi            # imm = 0x128
addq $0x3c4, %rsi            # imm = 0x3C4
callq 0xc3c00
movlpd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, 0x3b8(%rax)
jmp 0xceff5
leaq -0x20(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, 0x3b8(%rax)
movq -0x8(%rbp), %rax
movss 0x3b8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xcf023
jp 0xcf023
movq -0x8(%rbp), %rax
movss 0x3bc(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xcf023
jp 0xcf023
jmp 0xcf02e
movq -0x8(%rbp), %rax
movb $0x0, 0x1ce7(%rax)
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x128(%rcx), %rcx
movq %rcx, 0x3c4(%rax)
movl $0x0, -0x24(%rbp)
cmpl $0x5, -0x24(%rbp)
jge 0xcf4f8
movq -0x8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
xorl %eax, %eax
testb $0x1, 0x130(%rcx,%rdx)
movb %al, -0x3d(%rbp)
je 0xcf085
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
xorps %xmm0, %xmm0
ucomiss 0x43c(%rax,%rcx,4), %xmm0
seta %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %dl
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
andb $0x1, %dl
movb %dl, 0x420(%rax,%rcx)
movq -0x8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
xorl %eax, %eax
testb $0x1, 0x130(%rcx,%rdx)
movb %al, -0x3e(%rbp)
jne 0xcf0ce
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss 0x43c(%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
setae %al
movb %al, -0x3e(%rbp)
movb -0x3e(%rbp), %dl
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
andb $0x1, %dl
movb %dl, 0x42a(%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss 0x43c(%rax,%rcx,4), %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss %xmm0, 0x450(%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
testb $0x1, 0x130(%rax,%rcx)
je 0xcf161
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
xorps %xmm0, %xmm0
ucomiss 0x43c(%rax,%rcx,4), %xmm0
jbe 0xcf136
xorps %xmm0, %xmm0
movss %xmm0, -0x44(%rbp)
jmp 0xcf155
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss 0x43c(%rax,%rcx,4), %xmm0
movq -0x8(%rbp), %rax
addss 0x18(%rax), %xmm0
movss %xmm0, -0x44(%rbp)
movss -0x44(%rbp), %xmm0
movss %xmm0, -0x48(%rbp)
jmp 0xcf170
movss 0xa2e17(%rip), %xmm0    # 0x171f80
movss %xmm0, -0x48(%rbp)
jmp 0xcf170
movss -0x48(%rbp), %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss %xmm0, 0x43c(%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x0, 0x425(%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
testb $0x1, 0x420(%rax,%rcx)
je 0xcf32f
movq -0x8(%rbp), %rax
movsd 0x1a60(%rax), %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
subsd 0x3f8(%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm1
movq -0x8(%rbp), %rax
movss 0x30(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0xcf29a
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0xcb710
testb $0x1, %al
jne 0xcf1f9
jmp 0xcf21f
movq -0x8(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movslq -0x24(%rbp), %rcx
leaq 0x3cc(%rax,%rcx,8), %rsi
callq 0xc3c00
movlpd %xmm0, -0x2c(%rbp)
jmp 0xcf22e
leaq -0x2c(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x2c(%rbp), %rdi
callq 0xc3bc0
movaps %xmm0, %xmm1
movq -0x8(%rbp), %rax
movss 0x34(%rax), %xmm0
movq -0x8(%rbp), %rax
mulss 0x34(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0xcf261
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x1, 0x425(%rax,%rcx)
movq -0x8(%rbp), %rax
movss 0x30(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss 0xa2d4d(%rip), %xmm1    # 0x171fcc
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd %xmm0, 0x3f8(%rax,%rcx,8)
jmp 0xcf2b7
movq -0x8(%rbp), %rax
movsd 0x1a60(%rax), %xmm0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd %xmm0, 0x3f8(%rax,%rcx,8)
movq -0x8(%rbp), %rdx
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq 0x128(%rdx), %rdx
movq %rdx, 0x3cc(%rax,%rcx,8)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb 0x425(%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
andb $0x1, %dl
movb %dl, 0x434(%rax,%rcx)
leaq -0x34(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq -0x34(%rbp), %rdx
movq %rdx, 0x464(%rax,%rcx,8)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, 0x48c(%rax,%rcx,4)
jmp 0xcf497
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
testb $0x1, 0x130(%rax,%rcx)
je 0xcf495
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0xcb710
testb $0x1, %al
jne 0xcf35f
jmp 0xcf385
movq -0x8(%rbp), %rax
movq %rax, %rdi
addq $0x128, %rdi            # imm = 0x128
movslq -0x24(%rbp), %rcx
leaq 0x3cc(%rax,%rcx,8), %rsi
callq 0xc3c00
movlpd %xmm0, -0x3c(%rbp)
jmp 0xcf394
leaq -0x3c(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss 0x48c(%rax,%rcx,4), %xmm0
movss %xmm0, -0x50(%rbp)
leaq -0x3c(%rbp), %rdi
callq 0xc3bc0
movaps %xmm0, %xmm1
movss -0x50(%rbp), %xmm0
callq 0xc88c0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss %xmm0, 0x48c(%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss 0x464(%rax,%rcx,8), %xmm0
movss %xmm0, -0x4c(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x3c(%rbp), %xmm0
jbe 0xcf409
movss -0x3c(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x54(%rbp)
jmp 0xcf413
movss -0x3c(%rbp), %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x4c(%rbp), %xmm0
movss -0x54(%rbp), %xmm1
callq 0xc88c0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss %xmm0, 0x464(%rax,%rcx,8)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss 0x468(%rax,%rcx,8), %xmm0
movss %xmm0, -0x58(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x38(%rbp), %xmm0
jbe 0xcf46b
movss -0x38(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x5c(%rbp)
jmp 0xcf475
movss -0x38(%rbp), %xmm0
movss %xmm0, -0x5c(%rbp)
movss -0x58(%rbp), %xmm0
movss -0x5c(%rbp), %xmm1
callq 0xc88c0
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movss %xmm0, 0x468(%rax,%rcx,8)
jmp 0xcf497
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
testb $0x1, 0x130(%rax,%rcx)
jne 0xcf4cb
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
testb $0x1, 0x42a(%rax,%rcx)
jne 0xcf4cb
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x0, 0x434(%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
testb $0x1, 0x420(%rax,%rcx)
je 0xcf4e8
movq -0x8(%rbp), %rax
movb $0x0, 0x1ce7(%rax)
jmp 0xcf4ea
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xcf04b
addq $0x60, %rsp
popq %rbp
retq
nop