// File: /workspace/github_c_makefile_star2_O1/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, %r14
leaq 0x18da8(%rip), %r12     # 0x296e8
cmpb $0x1, 0x6(%r12)
jne 0x10953
movl (%r12), %edi
xorl %esi, %esi
callq 0x1138c
leaq 0x18d6e(%rip), %rax     # 0x296c8
movq (%rax), %r15
leaq 0x18e14(%rip), %rax     # 0x29778
movl (%rax), %esi
movq %r15, %rdi
callq 0x4860
movq %r15, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x4a00
movq %rax, %r15
testq %rax, %rax
je 0x10a8d
testq %r14, %r14
je 0x10a7b
movl 0xc(%r15), %eax
testl %eax, %eax
je 0x10a10
movl %eax, (%r14)
leaq 0x18d9f(%rip), %rax     # 0x29740
movq (%rax), %r13
testq %r13, %r13
je 0x10a7b
movl 0x10(%r15), %ebp
movq (%r13), %rdx
movq 0x48(%rdx), %rax
cmpb $0x1, 0x305(%rax)
jne 0x10a05
cmpb $0x0, 0x25(%rdx)
jne 0x10a05
xorl %edi, %edi
xorl %esi, %esi
callq 0x982d
movl %ebp, %edi
movq %rax, %rsi
callq 0x6134
testb %al, %al
je 0x10a05
movl %eax, %r12d
movq (%r13), %rax
movl 0xc(%r15), %edi
cmpl %edi, (%rax)
je 0x109f7
callq 0x1000e
testb %al, %al
je 0x10a00
movq (%r13), %rax
movl (%rax), %eax
movl %eax, (%r14)
testb %r12b, %r12b
jne 0x10a7b
movq 0x8(%r13), %r13
testq %r13, %r13
jne 0x109b1
jmp 0x10a7b
movl 0x10(%r15), %edi
movl %edi, 0x4(%rsp)
callq 0x752f
testq %rax, %rax
je 0x10a7b
movq %rax, %r12
movq 0x58(%rax), %r13
movq 0x30(%r13), %rdi
callq 0x92fd
testq %rax, %rax
je 0x10a7b
movq %rax, %rbp
cmpq $0x0, 0x48(%rbp)
jne 0x10a5f
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x982d
movl 0x4(%rsp), %edi
movq %rax, %rsi
callq 0x6134
testb %al, %al
jne 0x10a75
movq 0x30(%r13), %rsi
movq %rbp, %rdi
callq 0x9363
movq %rax, %rbp
testq %rax, %rax
jne 0x10a3a
jmp 0x10a7b
movl (%rbp), %eax
movl %eax, (%r14)
testq %rbx, %rbx
leaq 0x18c63(%rip), %r12     # 0x296e8
je 0x10a8d
movl 0x10(%r15), %eax
movl %eax, (%rbx)
movq %r15, %rdi
callq 0x4460
cmpb $0x1, 0x6(%r12)
jne 0x10ab9
movl (%r12), %edi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1138c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq