// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/window.c
// Function: move_client
bool move_client(coordinates_t *loc, int dx, int dy)
{
	node_t *n = loc->node;

	if (n == NULL || n->client == NULL) {
		return false;
	}

	monitor_t *pm = NULL;

	if (IS_TILED(n->client)) {
		if (!grabbing) {
			return false;
		}
		xcb_window_t pwin = XCB_NONE;
		query_pointer(&pwin, NULL);
		if (pwin == n->id) {
			return false;
		}
		coordinates_t dst;
		bool is_managed = (pwin != XCB_NONE && locate_window(pwin, &dst));
		if (is_managed && dst.monitor == loc->monitor && IS_TILED(dst.node->client)) {
			swap_nodes(loc->monitor, loc->desktop, n, loc->monitor, loc->desktop, dst.node, false);
			return true;
		} else {
			if (is_managed && dst.monitor == loc->monitor) {
				return false;
			} else {
				xcb_point_t pt = {0, 0};
				query_pointer(NULL, &pt);
				pm = monitor_from_point(pt);
			}
		}
	} else {
		client_t *c = n->client;
		xcb_rectangle_t rect = c->floating_rectangle;
		int16_t x = rect.x + dx;
		int16_t y = rect.y + dy;

		window_move(n->id, x, y);

		c->floating_rectangle.x = x;
		c->floating_rectangle.y = y;
		if (!grabbing) {
			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, rect.width, rect.height, x, y);
		}
		pm = monitor_from_client(c);
	}

	if (pm == NULL || pm == loc->monitor) {
		return true;
	}

	transfer_node(loc->monitor, loc->desktop, n, pm, pm->desk, pm->desk->focus, true);
	loc->monitor = pm;
	loc->desktop = pm->desk;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x173f3
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x173fc
movb $0x0, -0x1(%rbp)
jmp 0x1768d
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x308(%rax)
je 0x1742a
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x1, 0x308(%rax)
jne 0x1754c
leaq 0x1e9e5(%rip), %rax     # 0x35e16
testb $0x1, (%rax)
jne 0x1743f
movb $0x0, -0x1(%rbp)
jmp 0x1768d
movl $0x0, -0x2c(%rbp)
leaq -0x2c(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x176a0
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x17467
movb $0x0, -0x1(%rbp)
jmp 0x1768d
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x65(%rbp)
je 0x17486
movl -0x2c(%rbp), %edi
leaq -0x48(%rbp), %rsi
callq 0x26b20
movb %al, -0x65(%rbp)
movb -0x65(%rbp), %al
andb $0x1, %al
movb %al, -0x49(%rbp)
testb $0x1, -0x49(%rbp)
je 0x17500
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x17500
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x308(%rax)
je 0x174c3
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x1, 0x308(%rax)
jne 0x17500
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x38(%rbp), %r9
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0xfd50
movb $0x1, -0x1(%rbp)
jmp 0x1768d
testb $0x1, -0x49(%rbp)
je 0x1751c
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x1751c
movb $0x0, -0x1(%rbp)
jmp 0x1768d
leaq -0x4e(%rbp), %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x4100
xorl %eax, %eax
movl %eax, %edi
leaq -0x4e(%rbp), %rsi
callq 0x176a0
movl -0x4e(%rbp), %edi
callq 0x9080
movq %rax, -0x28(%rbp)
jmp 0x17547
jmp 0x1761d
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x318(%rax), %rax
movq %rax, -0x60(%rbp)
movswl -0x60(%rbp), %eax
addl -0x14(%rbp), %eax
movw %ax, -0x62(%rbp)
movswl -0x5e(%rbp), %eax
addl -0x18(%rbp), %eax
movw %ax, -0x64(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %edi
movw -0x62(%rbp), %ax
movswl %ax, %esi
movswl -0x64(%rbp), %edx
callq 0x17910
movw -0x62(%rbp), %cx
movq -0x58(%rbp), %rax
movw %cx, 0x318(%rax)
movw -0x64(%rbp), %cx
movq -0x58(%rbp), %rax
movw %cx, 0x31a(%rax)
leaq 0x1e85e(%rip), %rax     # 0x35e16
testb $0x1, (%rax)
jne 0x17610
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x20(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x20(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %r8d
movzwl -0x5c(%rbp), %r9d
movzwl -0x5a(%rbp), %r11d
movswl -0x62(%rbp), %r10d
movswl -0x64(%rbp), %eax
movl $0x800000, %edi         # imm = 0x800000
leaq 0x161bc(%rip), %rsi     # 0x2d7b8
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x2c0b0
movq -0x58(%rbp), %rdi
callq 0x90e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x17631
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x17637
movb $0x1, -0x1(%rbp)
jmp 0x1768d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x28(%rbp), %rax
movq 0x58(%rax), %r8
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x38(%rax), %r9
movl $0x1, (%rsp)
callq 0xd180
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)