// File: /workspace/github_c_makefile_star2_O3/baskerville[P]bspwm/src/tree.c
// Function: activate_node
bool activate_node(monitor_t *m, desktop_t *d, node_t *n)
{
	if (n == NULL && d->root != NULL) {
		n = d->focus;
		if (n == NULL) {
			n = history_last_node(d, NULL);
		}
		if (n == NULL) {
			n = first_focusable_leaf(d->root);
		}
	}

	if (d == mon->desk || (n != NULL && !is_focusable(n))) {
		return false;
	}

	if (n != NULL) {
		if (d->focus != NULL && n != d->focus) {
			neutralize_occluding_windows(m, d, n);
		}
		stack(d, n, true);
		if (d->focus != n) {
			for (node_t *f = first_extrema(d->focus); f != NULL; f = next_leaf(f, d->focus)) {
				if (f->client != NULL && !is_descendant(f, n)) {
					window_draw_border(f->id, get_border_color(false, (m == mon)));
				}
			}
		}
		draw_border(n, true, (m == mon));
	}

	d->focus = n;
	history_add(m, d, n, false);

	put_status(SBSC_MASK_REPORT);

	if (n == NULL) {
		return true;
	}

	put_status(SBSC_MASK_NODE_ACTIVATE, "node_activate 0x%08X 0x%08X 0x%08X\n", m->id, d->id, n->id);

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x9ae1
leaq 0x1fcaf(%rip), %r12     # 0x29710
movq (%r12), %rax
cmpq %rbx, 0x58(%rax)
je 0x9b42
testq %r15, %r15
je 0x9b1c
movq %r15, %rdi
callq 0x9943
testb %al, %al
je 0x9b42
movq 0x38(%rbx), %rax
testq %rax, %rax
sete %cl
cmpq %rax, %r15
sete %al
orb %cl, %al
jne 0x9aaa
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x9c8d
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0xd303
movq 0x38(%rbx), %rax
cmpq %r15, %rax
je 0x9bc4
movq %rax, %rcx
testq %rcx, %rcx
je 0x9bc4
movq %rcx, %r13
movq 0x30(%rcx), %rcx
testq %rcx, %rcx
jne 0x9aca
jmp 0x9b5e
cmpq $0x0, 0x30(%rbx)
je 0x9b27
movq 0x38(%rbx), %r15
testq %r15, %r15
jne 0x9a5a
movq %rbx, %rdi
xorl %esi, %esi
callq 0xd844
movq %rax, %r15
testq %rax, %rax
jne 0x9a5a
movq 0x30(%rbx), %rdi
callq 0x9c33
movq %rax, %r15
jmp 0x9a5a
movb $0x1, %r12b
xorl %r15d, %r15d
jmp 0x9bdd
leaq 0x1fbe2(%rip), %rax     # 0x29710
movq (%rax), %rax
xorl %r15d, %r15d
cmpq %rbx, 0x58(%rax)
je 0x9b42
movb $0x1, %r12b
jmp 0x9bdd
xorl %ebp, %ebp
jmp 0x9c22
movq 0x38(%r13), %rcx
testq %rcx, %rcx
je 0x9bc4
movq %rcx, %r13
movq 0x30(%rcx), %rcx
testq %rcx, %rcx
jne 0x9b4d
cmpq $0x0, 0x48(%r13)
sete %cl
cmpq %r15, %r13
sete %dl
orb %cl, %dl
jne 0x9ba8
movq %r13, %rcx
movq 0x40(%rcx), %rcx
cmpq %r15, %rcx
je 0x9b81
testq %rcx, %rcx
jne 0x9b73
cmpq %r15, %rcx
je 0x9ba8
movl (%r13), %ebp
xorl %esi, %esi
cmpq %r14, (%r12)
sete %sil
xorl %edi, %edi
callq 0x105ef
movl %ebp, %edi
movl %eax, %esi
callq 0x10619
movq 0x38(%rbx), %rax
movq %r13, %rcx
movq 0x40(%r13), %r13
testq %r13, %r13
je 0x9bbf
cmpq %rax, %rcx
je 0x9bbf
cmpq %rcx, 0x38(%r13)
je 0x9ba8
cmpq %rax, %rcx
jne 0x9b49
xorl %edx, %edx
cmpq %r14, (%r12)
sete %dl
movq %r15, %rdi
movl $0x1, %esi
callq 0xff61
xorl %r12d, %r12d
movq %r15, 0x38(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0xd4f6
movl $0x1, %edi
xorl %eax, %eax
callq 0x1e6b8
movb $0x1, %bpl
testb %r12b, %r12b
jne 0x9c22
movl 0x20(%r14), %edx
movl 0x20(%rbx), %ecx
movl (%r15), %r8d
leaq 0x15adf(%rip), %rsi     # 0x1f6f5
movl $0x400000, %edi         # imm = 0x400000
xorl %eax, %eax
callq 0x1e6b8
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq