// File: /workspace/github_c_makefile_star2_O0/tudurom[P]windowchef/wm.c
// Function: track_pointer
static void
track_pointer(struct client *client, enum pointer_action pac, xcb_point_t pos)
{
	enum resize_handle handle = get_handle(client, pos, pac);
	struct window_geom geom = client->geom;

	xcb_generic_event_t *ev = NULL;

	bool grabbing = true;
	struct client *grabbed = client;

	if (client == NULL)
		return;

	do {
		free(ev);
		while ((ev = xcb_wait_for_event(conn)) == NULL)
			xcb_flush(conn);
		uint8_t resp = EVENT_MASK(ev->response_type);

		if (resp == XCB_MOTION_NOTIFY) {
			xcb_motion_notify_event_t *e = (xcb_motion_notify_event_t *)ev;
			DMSG("tracking window by mouse root_x = %d  root_y = %d  posx = %d  posy = %d\n", e->root_x, e->root_y, pos.x, pos.y);
			int16_t dx = e->root_x - pos.x;
			int16_t dy = e->root_y - pos.y;
			int32_t x = client->geom.x, y = client->geom.y,
				width = client->geom.width, height = client->geom.height;

			if (pac == POINTER_ACTION_MOVE) {
				client->geom.x = geom.x + dx;
				client->geom.y = geom.y + dy;
				teleport_window(client->window, client->geom.x, client->geom.y);
			} else if (pac == POINTER_ACTION_RESIZE_SIDE || pac == POINTER_ACTION_RESIZE_CORNER) {

				DMSG("dx: %d\tdy: %d\n", dx, dy);
				if (conf.resize_hints) {
					dx /= client->width_inc;
					dx *= client->width_inc;

					dy /= client->width_inc;
					dy *= client->width_inc;
					DMSG("we have resize hints\tdx: %d\tdy: %d\n", dx, dy);
				}
				/* oh boy */
				switch (handle) {
				case HANDLE_LEFT:
					x = geom.x + dx;
					width = geom.width - dx;
					break;
				case HANDLE_BOTTOM:
					height  = geom.height + dy;
					break;
				case HANDLE_TOP:
					y = geom.y + dy;
					height = geom.height - dy;
					break;
				case HANDLE_RIGHT:
					width = geom.width + dx;
					break;

				case HANDLE_TOP_LEFT:
					y = geom.y + dy;
					height = geom.height - dy;
					x = geom.x + dx;
					width = geom.width - dx;
					break;
				case HANDLE_TOP_RIGHT:
					y = geom.y + dy;
					height = geom.height - dy;
					width = geom.width + dx;
					break;
				case HANDLE_BOTTOM_LEFT:
					x = geom.x + dx;
					width = geom.width - dx;
					height = geom.height + dy;
					break;
				case HANDLE_BOTTOM_RIGHT:
					width = geom.width + dx;
					height = geom.height + dy;
					break;
				}

				/* check for overflow */
				if (width < client->min_width) {
					width = client->min_width;
					x = client->geom.x;
				}

				if (height < client->min_height) {
					height = client->min_height;
					y = client->geom.y;
				}

				DMSG("moving by %d %d\n", x - geom.x, y - geom.y);
				DMSG("resizing by %d %d\n", width - geom.width, height - geom.height);
				client->geom.x = x;
				client->geom.width = width;
				client->geom.height = height;
				client->geom.y = y;

				resize_window_absolute(client->window, client->geom.width, client->geom.height);
				teleport_window(client->window, client->geom.x, client->geom.y);
				xcb_flush(conn);
			}
		} else if (resp == XCB_BUTTON_RELEASE) {

			grabbing = false;
		} else {
			if (events[resp] != NULL)
				(events[resp])(ev);
		}
	} while (grabbing && grabbed != NULL);
	free(ev);

	xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl %edx, -0x4(%rbp)
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x4(%rbp), %esi
callq 0x84a0
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x4(%rax), %rcx
movq %rcx, -0x22(%rbp)
movw 0xc(%rax), %ax
movw %ax, -0x1a(%rbp)
movq $0x0, -0x30(%rbp)
movb $0x1, -0x31(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x80bb
jmp 0x8488
jmp 0x80bd
movq -0x30(%rbp), %rdi
callq 0x32d0
movq 0x730b(%rip), %rdi      # 0xf3d8
callq 0x33d0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x80ea
movq 0x72f5(%rip), %rdi      # 0xf3d8
callq 0x3400
jmp 0x80c6
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
andl $0xffffff7f, %eax       # imm = 0xFFFFFF7F
movb %al, -0x41(%rbp)
movzbl -0x41(%rbp), %eax
cmpl $0x6, %eax
jne 0x840d
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movswl 0x14(%rax), %eax
movswl -0x4(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x52(%rbp)
movq -0x50(%rbp), %rax
movswl 0x16(%rax), %eax
movswl -0x2(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x54(%rbp)
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movswl 0x6(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x8(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movzwl 0xa(%rax), %eax
movl %eax, -0x64(%rbp)
cmpl $0x2, -0x14(%rbp)
jne 0x81b1
movswl -0x22(%rbp), %eax
movswl -0x52(%rbp), %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x4(%rax)
movswl -0x20(%rbp), %eax
movswl -0x54(%rbp), %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rax
movw 0x4(%rax), %cx
movq -0x10(%rbp), %rax
movswl %cx, %esi
movswl 0x6(%rax), %edx
callq 0x5460
jmp 0x840b
cmpl $0x4, -0x14(%rbp)
je 0x81c1
cmpl $0x3, -0x14(%rbp)
jne 0x8409
testb $0x1, 0x7619(%rip)      # 0xf7e1
je 0x8216
movq -0x10(%rbp), %rax
movzwl 0x50(%rax), %ecx
movswl -0x52(%rbp), %eax
cltd
idivl %ecx
movw %ax, -0x52(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x50(%rax), %ecx
movswl -0x52(%rbp), %eax
imull %ecx, %eax
movw %ax, -0x52(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x50(%rax), %ecx
movswl -0x54(%rbp), %eax
cltd
idivl %ecx
movw %ax, -0x54(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x50(%rax), %ecx
movswl -0x54(%rbp), %eax
imull %ecx, %eax
movw %ax, -0x54(%rbp)
movl -0x18(%rbp), %eax
movq %rax, -0x70(%rbp)
subq $0x7, %rax
ja 0x833f
movq -0x70(%rbp), %rax
leaq 0x3de6(%rip), %rcx      # 0xc018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movswl -0x22(%rbp), %eax
movswl -0x52(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x58(%rbp)
movzwl -0x1e(%rbp), %eax
movswl -0x52(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x60(%rbp)
jmp 0x833f
movzwl -0x1c(%rbp), %eax
movswl -0x54(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x64(%rbp)
jmp 0x833f
movswl -0x20(%rbp), %eax
movswl -0x54(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
movzwl -0x1c(%rbp), %eax
movswl -0x54(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x64(%rbp)
jmp 0x833f
movzwl -0x1e(%rbp), %eax
movswl -0x52(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x60(%rbp)
jmp 0x833f
movswl -0x20(%rbp), %eax
movswl -0x54(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
movzwl -0x1c(%rbp), %eax
movswl -0x54(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x64(%rbp)
movswl -0x22(%rbp), %eax
movswl -0x52(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x58(%rbp)
movzwl -0x1e(%rbp), %eax
movswl -0x52(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x60(%rbp)
jmp 0x833f
movswl -0x20(%rbp), %eax
movswl -0x54(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
movzwl -0x1c(%rbp), %eax
movswl -0x54(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x64(%rbp)
movzwl -0x1e(%rbp), %eax
movswl -0x52(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x60(%rbp)
jmp 0x833f
movswl -0x22(%rbp), %eax
movswl -0x52(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x58(%rbp)
movzwl -0x1e(%rbp), %eax
movswl -0x52(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x60(%rbp)
movzwl -0x1c(%rbp), %eax
movswl -0x54(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x64(%rbp)
jmp 0x833f
movzwl -0x1e(%rbp), %eax
movswl -0x52(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x60(%rbp)
movzwl -0x1c(%rbp), %eax
movswl -0x54(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x64(%rbp)
movl -0x60(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x48(%rcx), %ecx
cmpl %ecx, %eax
jge 0x8364
movq -0x10(%rbp), %rax
movzwl 0x48(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x64(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x4a(%rcx), %ecx
cmpl %ecx, %eax
jge 0x8389
movq -0x10(%rbp), %rax
movzwl 0x4a(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rax
movswl 0x6(%rax), %eax
movl %eax, -0x5c(%rbp)
movl -0x58(%rbp), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x4(%rax)
movl -0x60(%rbp), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x8(%rax)
movl -0x64(%rbp), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0xa(%rax)
movl -0x5c(%rbp), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rax
movw 0x8(%rax), %cx
movq -0x10(%rbp), %rax
movzwl %cx, %esi
movzwl 0xa(%rax), %edx
callq 0x54e0
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rax
movw 0x4(%rax), %cx
movq -0x10(%rbp), %rax
movswl %cx, %esi
movswl 0x6(%rax), %edx
callq 0x5460
movq 0x6fd4(%rip), %rdi      # 0xf3d8
callq 0x3400
jmp 0x840b
jmp 0x844b
movzbl -0x41(%rbp), %eax
cmpl $0x5, %eax
jne 0x841c
movb $0x0, -0x31(%rbp)
jmp 0x8449
movzbl -0x41(%rbp), %eax
movl %eax, %ecx
leaq 0x6fd7(%rip), %rax      # 0xf400
cmpq $0x0, (%rax,%rcx,8)
je 0x8447
movzbl -0x41(%rbp), %eax
movl %eax, %ecx
leaq 0x6fc3(%rip), %rax      # 0xf400
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rdi
callq *%rax
jmp 0x8449
jmp 0x844b
jmp 0x844d
xorl %eax, %eax
testb $0x1, -0x31(%rbp)
movb %al, -0x71(%rbp)
je 0x8463
cmpq $0x0, -0x40(%rbp)
setne %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x80bd
movq -0x30(%rbp), %rdi
callq 0x32d0
movq 0x6f5a(%rip), %rdi      # 0xf3d8
xorl %esi, %esi
callq 0x3040
movl %eax, -0x68(%rbp)
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)