// File: /workspace/github_c_makefile_star2_O3/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 0x18d71(%rip), %r12     # 0x296e8
cmpb $0x1, 0x6(%r12)
jne 0x1098a
movl (%r12), %edi
xorl %esi, %esi
callq 0x11398
leaq 0x18d37(%rip), %rax     # 0x296c8
movq (%rax), %r14
leaq 0x18ddd(%rip), %rax     # 0x29778
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 0x10abf
movq %r13, (%rsp)
testq %r13, %r13
je 0x10aad
movl 0xc(%r15), %eax
testl %eax, %eax
je 0x10a2a
movq (%rsp), %rcx
movl %eax, (%rcx)
leaq 0x18d61(%rip), %rax     # 0x29740
movq (%rax), %r14
testq %r14, %r14
je 0x10aad
movl 0x10(%r15), %ebp
movq (%r14), %rdx
movq 0x48(%rdx), %rax
cmpb $0x1, 0x305(%rax)
jne 0x10a1c
cmpb $0x0, 0x25(%rdx)
jne 0x10a1c
xorl %edi, %edi
xorl %esi, %esi
callq 0x970b
movl %ebp, %edi
movq %rax, %rsi
callq 0x60d4
testb %al, %al
jne 0x10a8b
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0x109ef
jmp 0x10aad
movl 0x10(%r15), %ebp
movl %ebp, %edi
callq 0x7446
testq %rax, %rax
je 0x10aad
movq %rax, %r12
movq 0x58(%rax), %r13
movq 0x30(%r13), %rdi
callq 0x920c
testq %rax, %rax
je 0x10aad
movq %rax, %r14
cmpq $0x0, 0x48(%r14)
jne 0x10a75
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x970b
movl %ebp, %edi
movq %rax, %rsi
callq 0x60d4
testb %al, %al
jne 0x10aa4
movq 0x30(%r13), %rsi
movq %r14, %rdi
callq 0x926e
movq %rax, %r14
testq %rax, %rax
jne 0x10a52
jmp 0x10aad
movq (%r14), %rax
movl (%rax), %eax
movl 0xc(%r15), %edi
cmpl %edi, %eax
je 0x10aa7
callq 0x10080
testb %al, %al
je 0x10aad
movq (%r14), %r14
movl (%r14), %eax
movq (%rsp), %rcx
movl %eax, (%rcx)
testq %rbx, %rbx
leaq 0x18c31(%rip), %r12     # 0x296e8
je 0x10abf
movl 0x10(%r15), %eax
movl %eax, (%rbx)
movq %r15, %rdi
callq 0x4460
cmpb $0x1, 0x6(%r12)
jne 0x10aeb
movl (%r12), %edi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11398
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq