// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/pointer.c
// Function: track_pointer
void track_pointer(coordinates_t loc, pointer_action_t pac, xcb_point_t pos)
{
	node_t *n = loc.node;
	resize_handle_t rh = get_handle(loc.node, pos, pac);

	uint16_t last_motion_x = pos.x, last_motion_y = pos.y;
	xcb_timestamp_t last_motion_time = 0;

	xcb_generic_event_t *evt = NULL;

	grabbing = true;
	grabbed_node = n;

	do {
		free(evt);
		while ((evt = xcb_wait_for_event(dpy)) == NULL) {
			xcb_flush(dpy);
		}
		uint8_t resp_type = XCB_EVENT_RESPONSE_TYPE(evt);
		if (resp_type == XCB_MOTION_NOTIFY) {
			xcb_motion_notify_event_t *e = (xcb_motion_notify_event_t*) evt;
			uint32_t dtime = e->time - last_motion_time;
			if (dtime < pointer_motion_interval) {
				continue;
			}
			last_motion_time = e->time;
			int16_t dx = e->root_x - last_motion_x;
			int16_t dy = e->root_y - last_motion_y;
			if (pac == ACTION_MOVE) {
				move_client(&loc, dx, dy);
			} else if (n) {
				client_t *c = n->client;
				if (c && SHOULD_HONOR_SIZE_HINTS(c->honor_size_hints, c->state)) {
					resize_client(&loc, rh, e->root_x, e->root_y, false);
				} else {
					resize_client(&loc, rh, dx, dy, true);
				}
			}
			last_motion_x = e->root_x;
			last_motion_y = e->root_y;
			xcb_flush(dpy);
		} else if (resp_type == XCB_BUTTON_RELEASE) {
			grabbing = false;
		} else {
			handle_event(evt);
		}
	} while (grabbing && grabbed_node != NULL);
	free(evt);

	xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);

	if (grabbed_node == NULL) {
		grabbing = false;
		return;
	}

	if (pac == ACTION_MOVE) {
		put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X move end\n", loc.monitor->id, loc.desktop->id, n->id);
	} else if (pac == ACTION_RESIZE_CORNER) {
		put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X resize_corner end\n", loc.monitor->id, loc.desktop->id, n->id);
	} else if (pac == ACTION_RESIZE_SIDE) {
		put_status(SBSC_MASK_POINTER_ACTION, "pointer_action 0x%08X 0x%08X 0x%08X resize_side end\n", loc.monitor->id, loc.desktop->id, n->id);
	}

	xcb_rectangle_t r = get_rectangle(NULL, NULL, n);

	put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc.monitor->id, loc.desktop->id, loc.node->id, r.width, r.height, r.x, r.y);

	if ((pac == ACTION_MOVE && IS_TILED(n->client)) ||
	    ((pac == ACTION_RESIZE_CORNER || pac == ACTION_RESIZE_SIDE) &&
	     n->client->state == STATE_TILED)) {
		for (node_t *f = first_extrema(loc.desktop->root); f != NULL; f = next_leaf(f, loc.desktop->root)) {
			if (f == n || f->client == NULL || !IS_TILED(f->client)) {
				continue;
			}
			xcb_rectangle_t r = f->client->tiled_rectangle;
			put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc.monitor->id, loc.desktop->id, f->id, r.width, r.height, r.x, r.y);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movl %esi, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x10(%rbp)
movq 0x10(%rax), %rdi
movl -0x8(%rbp), %edx
movl -0x4(%rbp), %esi
callq 0x152a0
movl %eax, -0x14(%rbp)
movw -0x4(%rbp), %ax
movw %ax, -0x16(%rbp)
movw -0x2(%rbp), %ax
movw %ax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movb $0x1, 0x206fd(%rip)     # 0x35e16
movq -0x10(%rbp), %rax
movq %rax, 0x206f4(%rip)     # 0x35e18
movq -0x28(%rbp), %rdi
callq 0x4450
leaq 0x1ff84(%rip), %rax     # 0x356b8
movq (%rax), %rdi
callq 0x4600
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x15757
leaq 0x1ff6b(%rip), %rax     # 0x356b8
movq (%rax), %rdi
callq 0x4650
jmp 0x1572d
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
andl $0x7f, %eax
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
cmpl $0x6, %eax
jne 0x158d5
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
leaq 0x20644(%rip), %rcx     # 0x35dd4
cmpl (%rcx), %eax
jae 0x15799
jmp 0x158f4
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x38(%rbp), %rax
movswl 0x14(%rax), %eax
movzwl -0x16(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x3e(%rbp)
movq -0x38(%rbp), %rax
movswl 0x16(%rax), %eax
movzwl -0x18(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x40(%rbp)
cmpl $0x2, -0x8(%rbp)
jne 0x157e3
movq -0x70(%rbp), %rdi
movswl -0x3e(%rbp), %esi
movswl -0x40(%rbp), %edx
callq 0x173c0
jmp 0x158ac
cmpq $0x0, -0x10(%rbp)
je 0x158aa
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x1588e
movq -0x48(%rbp), %rax
cmpl $0x0, 0x328(%rax)
je 0x1588e
movq -0x48(%rbp), %rax
cmpl $0x1, 0x328(%rax)
jne 0x1582c
movq -0x48(%rbp), %rax
cmpl $0x3, 0x308(%rax)
jne 0x1586d
movq -0x48(%rbp), %rax
cmpl $0x3, 0x328(%rax)
jne 0x15846
movq -0x48(%rbp), %rax
cmpl $0x0, 0x308(%rax)
je 0x1586d
movq -0x48(%rbp), %rax
cmpl $0x2, 0x328(%rax)
jne 0x1588e
movq -0x48(%rbp), %rax
cmpl $0x2, 0x308(%rax)
je 0x1586d
movq -0x48(%rbp), %rax
cmpl $0x1, 0x308(%rax)
jne 0x1588e
movq -0x70(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x38(%rbp), %rax
movswl 0x14(%rax), %edx
movq -0x38(%rbp), %rax
movswl 0x16(%rax), %ecx
xorl %r8d, %r8d
callq 0x17960
jmp 0x158a8
movq -0x70(%rbp), %rdi
movl -0x14(%rbp), %esi
movswl -0x3e(%rbp), %edx
movswl -0x40(%rbp), %ecx
movl $0x1, %r8d
callq 0x17960
jmp 0x158aa
jmp 0x158ac
movq -0x38(%rbp), %rax
movw 0x14(%rax), %ax
movw %ax, -0x16(%rbp)
movq -0x38(%rbp), %rax
movw 0x16(%rax), %ax
movw %ax, -0x18(%rbp)
leaq 0x1fded(%rip), %rax     # 0x356b8
movq (%rax), %rdi
callq 0x4650
jmp 0x158f2
movzbl -0x29(%rbp), %eax
cmpl $0x5, %eax
jne 0x158e7
movb $0x0, 0x20531(%rip)     # 0x35e16
jmp 0x158f0
movq -0x28(%rbp), %rdi
callq 0x130b0
jmp 0x158f2
jmp 0x158f4
xorl %eax, %eax
testb $0x1, 0x20519(%rip)     # 0x35e16
movb %al, -0x71(%rbp)
je 0x15910
cmpq $0x0, 0x2050e(%rip)     # 0x35e18
setne %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x15724
movq -0x28(%rbp), %rdi
callq 0x4450
leaq 0x1fd8d(%rip), %rax     # 0x356b8
movq (%rax), %rdi
xorl %esi, %esi
callq 0x4050
movl %eax, -0x4c(%rbp)
cmpq $0x0, 0x204d8(%rip)     # 0x35e18
jne 0x1594e
movb $0x0, 0x204cd(%rip)     # 0x35e16
jmp 0x15b6f
cmpl $0x2, -0x8(%rbp)
jne 0x15981
movq -0x70(%rbp), %rax
movq (%rax), %rcx
movl 0x20(%rcx), %edx
movq 0x8(%rax), %rax
movl 0x20(%rax), %ecx
movq -0x10(%rbp), %rax
movl (%rax), %r8d
movl $0x8000000, %edi        # imm = 0x8000000
leaq 0x18350(%rip), %rsi     # 0x2dcc8
movb $0x0, %al
callq 0x2c0b0
jmp 0x159e9
cmpl $0x4, -0x8(%rbp)
jne 0x159b4
movq -0x70(%rbp), %rax
movq (%rax), %rcx
movl 0x20(%rcx), %edx
movq 0x8(%rax), %rax
movl 0x20(%rax), %ecx
movq -0x10(%rbp), %rax
movl (%rax), %r8d
movl $0x8000000, %edi        # imm = 0x8000000
leaq 0x1834b(%rip), %rsi     # 0x2dcf6
movb $0x0, %al
callq 0x2c0b0
jmp 0x159e7
cmpl $0x3, -0x8(%rbp)
jne 0x159e5
movq -0x70(%rbp), %rax
movq (%rax), %rcx
movl 0x20(%rcx), %edx
movq 0x8(%rax), %rax
movl 0x20(%rax), %ecx
movq -0x10(%rbp), %rax
movl (%rax), %r8d
movl $0x8000000, %edi        # imm = 0x8000000
leaq 0x1834f(%rip), %rsi     # 0x2dd2d
movb $0x0, %al
callq 0x2c0b0
jmp 0x159e7
jmp 0x159e9
movq -0x10(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0xc7f0
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, -0x54(%rbp)
movq (%rax), %rcx
movl 0x20(%rcx), %edx
movq 0x8(%rax), %rcx
movl 0x20(%rcx), %ecx
movq 0x10(%rax), %rax
movl (%rax), %r8d
movzwl -0x50(%rbp), %r9d
movzwl -0x4e(%rbp), %r11d
movswl -0x54(%rbp), %r10d
movswl -0x52(%rbp), %eax
movl $0x800000, %edi         # imm = 0x800000
leaq 0x17d81(%rip), %rsi     # 0x2d7b8
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x2c0b0
cmpl $0x2, -0x8(%rbp)
jne 0x15a73
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x308(%rax)
je 0x15a98
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x1, 0x308(%rax)
je 0x15a98
cmpl $0x4, -0x8(%rbp)
je 0x15a83
cmpl $0x3, -0x8(%rbp)
jne 0x15b6f
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x308(%rax)
jne 0x15b6f
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rdi
callq 0xbe70
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x15b6d
movq -0x60(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x15aef
movq -0x60(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x15aef
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x308(%rax)
je 0x15af1
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x1, 0x308(%rax)
je 0x15af1
jmp 0x15b4f
movq -0x70(%rbp), %rax
movq -0x60(%rbp), %rcx
movq 0x48(%rcx), %rcx
movq 0x320(%rcx), %rcx
movq %rcx, -0x68(%rbp)
movq (%rax), %rcx
movl 0x20(%rcx), %edx
movq 0x8(%rax), %rax
movl 0x20(%rax), %ecx
movq -0x60(%rbp), %rax
movl (%rax), %r8d
movzwl -0x64(%rbp), %r9d
movzwl -0x62(%rbp), %r11d
movswl -0x68(%rbp), %r10d
movswl -0x66(%rbp), %eax
movl $0x800000, %edi         # imm = 0x800000
leaq 0x17c7d(%rip), %rsi     # 0x2d7b8
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x2c0b0
movq -0x70(%rbp), %rax
movq -0x60(%rbp), %rdi
movq 0x8(%rax), %rax
movq 0x30(%rax), %rsi
callq 0xbf80
movq %rax, -0x60(%rbp)
jmp 0x15aad
jmp 0x15b6f
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)