// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x4c(%rdi), %rax
movq %rax, 0x38(%rsp)
movq (%rsi), %rax
movq %rax, 0x4c(%rdi)
movl 0x28(%rdi), %edi
testl %edi, %edi
je 0x6acf
movswl (%r14), %esi
movswl 0x2(%r14), %edx
movzwl 0x4(%r14), %ecx
movzwl 0x6(%r14), %r8d
callq 0xf602
movl 0x20(%rbx), %edx
movzwl 0x4(%r14), %ecx
movzwl 0x6(%r14), %r8d
movswl (%r14), %r9d
movswl 0x2(%r14), %eax
movl %eax, (%rsp)
leaq 0x17988(%rip), %rsi     # 0x1e448
pushq $0x40
popq %rdi
xorl %eax, %eax
callq 0x1d07d
jmp 0x6b91
leaq 0x44(%rsp), %r12
movl $0x10, (%r12)
leaq 0x21be5(%rip), %r15     # 0x286c8
movq (%r15), %rdi
callq 0x4920
movl %eax, 0x28(%rbx)
movq (%r15), %rdi
leaq 0x21c80(%rip), %rcx     # 0x28778
movl (%rcx), %ecx
movswl (%r14), %r8d
movswl 0x2(%r14), %r9d
movzwl 0x4(%r14), %edx
movzwl 0x6(%r14), %esi
movq %r12, 0x30(%rsp)
movl %esi, 0x8(%rsp)
andl $0x0, 0x20(%rsp)
movl %edx, (%rsp)
andl $0x0, 0x10(%rsp)
movl $0x800, 0x28(%rsp)      # imm = 0x800
movl $0x2, 0x18(%rsp)
xorl %esi, %esi
movl %eax, %edx
callq 0x4030
movq (%r15), %rdi
movl 0x28(%rbx), %esi
leaq 0x17997(%rip), %rcx     # 0x1e4e0
pushq $0xb
popq %rdx
callq 0x4710
movq (%r15), %r15
movl 0x28(%rbx), %ebp
movq %rbx, %rdi
callq 0x4470
pushq $0x1f
popq %rdx
pushq $0x8
popq %rcx
movq %r15, %rdi
movl %ebp, %esi
movl %eax, %r8d
movq %rbx, %r9
callq 0x4180
movl 0x28(%rbx), %edi
callq 0x104ab
leaq 0x22276(%rip), %rax     # 0x28dfa
cmpb $0x1, (%rax)
jne 0x6b91
movl 0x28(%rbx), %edi
callq 0xf175
leaq 0x60(%rbx), %r15
leaq 0x38(%rsp), %r12
movq (%r15), %r15
testq %r15, %r15
je 0x6be7
movq 0x30(%r15), %rdi
callq 0x8e72
movq %rax, %r13
testq %rax, %rax
je 0x6bd6
cmpq $0x0, 0x48(%r13)
je 0x6bc8
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x6bfe
movq 0x30(%r15), %rsi
movq %r13, %rdi
callq 0x8ed0
jmp 0x6bab
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8670
addq $0x48, %r15
jmp 0x6b9a
movq %rbx, %rdi
callq 0x6dac
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq