// File: /workspace/github_c_makefile_star2_O3/baskerville[P]bspwm/src/monitor.c
// Function: update_root
void update_root(monitor_t *m, xcb_rectangle_t *rect)
{
	xcb_rectangle_t last_rect = m->rectangle;
	m->rectangle = *rect;
	if (m->root == XCB_NONE) {
		uint32_t values[] = {XCB_EVENT_MASK_ENTER_WINDOW};
		m->root = xcb_generate_id(dpy);
		xcb_create_window(dpy, XCB_COPY_FROM_PARENT, m->root, root,
		                  rect->x, rect->y, rect->width, rect->height, 0,
		                  XCB_WINDOW_CLASS_INPUT_ONLY, XCB_COPY_FROM_PARENT, XCB_CW_EVENT_MASK, values);
		xcb_icccm_set_wm_class(dpy, m->root, sizeof(ROOT_WINDOW_IC), ROOT_WINDOW_IC);
		xcb_icccm_set_wm_name(dpy, m->root, XCB_ATOM_STRING, 8, strlen(m->name), m->name);
		window_lower(m->root);
		if (focus_follows_pointer) {
			window_show(m->root);
		}
	} else {
		window_move_resize(m->root, rect->x, rect->y, rect->width, rect->height);
		put_status(SBSC_MASK_MONITOR_GEOMETRY, "monitor_geometry 0x%08X %ux%u+%i+%i\n",
		           m->id, rect->width, rect->height, rect->x, rect->y);
	}
	for (desktop_t *d = m->desk_head; d != NULL; d = d->next) {
		for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n, d->root)) {
			if (n->client == NULL) {
				continue;
			}
			adapt_geometry(&last_rect, rect, n);
		}
		arrange(m, d);
	}
	reorder_monitor(m);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x4c(%rdi), %rax
movq %rax, 0x8(%rsp)
movq (%rsi), %rax
movq %rax, 0x4c(%rdi)
movl 0x28(%rdi), %edi
testl %edi, %edi
je 0x6bea
movswl (%r14), %esi
movswl 0x2(%r14), %edx
movzwl 0x4(%r14), %ecx
movzwl 0x6(%r14), %r8d
callq 0x103c4
movl 0x20(%rbx), %edx
movzwl 0x4(%r14), %ecx
movzwl 0x6(%r14), %r8d
movswl (%r14), %r9d
movswl 0x2(%r14), %r10d
subq $0x8, %rsp
leaq 0x18875(%rip), %rsi     # 0x1f448
movl $0x40, %edi
xorl %eax, %eax
pushq %r10
callq 0x1e6b8
addq $0x10, %rsp
jmp 0x6ca8
leaq 0x14(%rsp), %r12
movl $0x10, (%r12)
leaq 0x22aca(%rip), %r15     # 0x296c8
movq (%r15), %rdi
callq 0x4920
movl %eax, 0x28(%rbx)
movq (%r15), %rdi
leaq 0x22b65(%rip), %rcx     # 0x29778
movl (%rcx), %ecx
movswl (%r14), %r8d
movswl 0x2(%r14), %r9d
movzwl 0x4(%r14), %r10d
movzwl 0x6(%r14), %r11d
subq $0x8, %rsp
xorl %r13d, %r13d
xorl %esi, %esi
movl %eax, %edx
pushq %r12
pushq $0x800                  # imm = 0x800
pushq %r13
pushq $0x2
pushq %r13
pushq %r11
pushq %r10
callq 0x4030
addq $0x40, %rsp
movq (%r15), %rdi
movl 0x28(%rbx), %esi
leaq 0x18886(%rip), %rcx     # 0x1f4e0
movl $0xb, %edx
callq 0x4710
movq (%r15), %r15
movl 0x28(%rbx), %ebp
movq %rbx, %rdi
callq 0x4470
movq %r15, %rdi
movl %ebp, %esi
movl $0x1f, %edx
movl $0x8, %ecx
movl %eax, %r8d
movq %rbx, %r9
callq 0x4180
movl 0x28(%rbx), %edi
callq 0x11374
leaq 0x2315f(%rip), %rax     # 0x29dfa
cmpb $0x1, (%rax)
jne 0x6ca8
movl 0x28(%rbx), %edi
callq 0xfe6b
movq 0x60(%rbx), %r15
testq %r15, %r15
je 0x6cfe
leaq 0x8(%rsp), %r12
movq 0x30(%r15), %rdi
callq 0x920c
movq %rax, %r13
testq %rax, %rax
je 0x6cea
cmpq $0x0, 0x48(%r13)
je 0x6cdc
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x6d15
movq 0x30(%r15), %rsi
movq %r13, %rdi
callq 0x926e
jmp 0x6cbf
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8958
movq 0x48(%r15), %r15
testq %r15, %r15
jne 0x6cb6
movq %rbx, %rdi
callq 0x6eca
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq