// File: /workspace/github_c_makefile_star2_O2/baskerville[P]bspwm/src/window.c
// Function: query_pointer
void query_pointer(xcb_window_t *win, xcb_point_t *pt)
{
	if (motion_recorder.enabled) {
		window_hide(motion_recorder.id);
	}

	xcb_query_pointer_reply_t *qpr = xcb_query_pointer_reply(dpy, xcb_query_pointer(dpy, root), NULL);

	if (qpr != NULL) {
		if (win != NULL) {
			if (qpr->child == XCB_NONE) {
				xcb_point_t mpt = (xcb_point_t) {qpr->root_x, qpr->root_y};
				monitor_t *m = monitor_from_point(mpt);
				if (m != NULL) {
					desktop_t *d = m->desk;
					for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n, d->root)) {
						if (n->client == NULL && is_inside(mpt, get_rectangle(m, d, n))) {
							*win = n->id;
							break;
						}
					}
				}
			} else {
				*win = qpr->child;
				xcb_point_t pt = {qpr->root_x, qpr->root_y};
				for (stacking_list_t *s = stack_tail; s != NULL; s = s->prev) {
					if (!s->node->client->shown || s->node->hidden) {
						continue;
					}
					xcb_rectangle_t rect = get_rectangle(NULL, NULL, s->node);
					if (is_inside(pt, rect)) {
						if (s->node->id == qpr->child || is_presel_window(qpr->child)) {
							*win = s->node->id;
						}
						break;
					}
				}
			}
		}
		if (pt != NULL) {
			*pt = (xcb_point_t) {qpr->root_x, qpr->root_y};
		}
	}

	free(qpr);

	if (motion_recorder.enabled) {
		window_show(motion_recorder.id);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r13
leaq 0x18b6a(%rip), %r12     # 0x286e8
cmpb $0x1, 0x6(%r12)
jne 0xfb8f
movl (%r12), %edi
callq 0xf6f7
leaq 0x18b32(%rip), %rax     # 0x286c8
movq (%rax), %r14
leaq 0x18bd8(%rip), %rax     # 0x28778
movl (%rax), %esi
movq %r14, %rdi
callq 0x4860
movq %r14, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x4a00
movq %rax, %r15
testq %rax, %rax
je 0xfcb4
movq %r13, (%rsp)
testq %r13, %r13
je 0xfca2
movl 0xc(%r15), %eax
testl %eax, %eax
je 0xfc27
movq (%rsp), %rcx
movl %eax, (%rcx)
movl 0x10(%r15), %ebp
leaq 0x18b58(%rip), %r14     # 0x28740
movq (%r14), %r14
testq %r14, %r14
je 0xfca2
movq (%r14), %rdx
movq 0x48(%rdx), %rax
cmpb $0x1, 0x305(%rax)
jne 0xfc21
cmpb $0x0, 0x25(%rdx)
jne 0xfc21
xorl %edi, %edi
xorl %esi, %esi
callq 0x932e
movl %ebp, %edi
movq %rax, %rsi
callq 0x6020
testb %al, %al
jne 0xfc80
addq $0x8, %r14
jmp 0xfbe8
movl 0x10(%r15), %ebp
movl %ebp, %edi
callq 0x72fe
testq %rax, %rax
je 0xfca2
movq %rax, %r12
movq 0x58(%rax), %r13
movq 0x30(%r13), %rdi
callq 0x8e72
movq %rax, %r14
testq %rax, %rax
je 0xfca2
cmpq $0x0, 0x48(%r14)
jne 0xfc72
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x932e
movl %ebp, %edi
movq %rax, %rsi
callq 0x6020
testb %al, %al
jne 0xfc99
movq 0x30(%r13), %rsi
movq %r14, %rdi
callq 0x8ed0
jmp 0xfc47
movq (%r14), %rax
movl (%rax), %eax
movl 0xc(%r15), %edi
cmpl %edi, %eax
je 0xfc9c
callq 0xf32f
testb %al, %al
je 0xfca2
movq (%r14), %r14
movl (%r14), %eax
movq (%rsp), %rcx
movl %eax, (%rcx)
testq %rbx, %rbx
leaq 0x18a3c(%rip), %r12     # 0x286e8
je 0xfcb4
movl 0x10(%r15), %eax
movl %eax, (%rbx)
movq %r15, %rdi
callq 0x4460
cmpb $0x1, 0x6(%r12)
jne 0xfcdb
movl (%r12), %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf175
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq