// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/tree.c
// Function: transfer_node
bool transfer_node(monitor_t *ms, desktop_t *ds, node_t *ns, monitor_t *md, desktop_t *dd, node_t *nd, bool follow)
{
	if (ns == NULL || ns == nd || is_child(ns, nd) || is_descendant(nd, ns)) {
		return false;
	}

	unsigned int sc = (ms->sticky_count > 0 && ds == ms->desk) ? sticky_count(ns) : 0;
	if (sticky_still && sc > 0 && dd != md->desk) {
		return false;
	}

	put_status(SBSC_MASK_NODE_TRANSFER, "node_transfer 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n", ms->id, ds->id, ns->id, md->id, dd->id, nd!=NULL?nd->id:0);

	bool held_focus = is_descendant(ds->focus, ns);
	/* avoid ending up with a dangling pointer (because of unlink_node) */
	node_t *last_ds_focus = is_child(ns, ds->focus) ? NULL : ds->focus;
	bool ds_was_focused = (ds == mon->desk);

	if (held_focus && ds_was_focused) {
		clear_input_focus();
	}

	unlink_node(ms, ds, ns);
	insert_node(md, dd, ns, nd);

	if (md != ms) {
		if (ns->client == NULL || monitor_from_client(ns->client) != md) {
			adapt_geometry(&ms->rectangle, &md->rectangle, ns);
		}
		ms->sticky_count -= sc;
		md->sticky_count += sc;
	}

	if (ds != dd) {
		ewmh_set_wm_desktop(ns, dd);
		if (sticky_still) {
			if (ds == ms->desk && dd != md->desk) {
				hide_node(ds, ns);
			} else if (ds != ms->desk && dd == md->desk) {
				show_node(dd, ns);
			}
		}
	}

	history_remove(ds, ns, true);
	stack(dd, ns, false);

	if (ds == dd) {
		if (held_focus) {
			if (ds_was_focused) {
				focus_node(ms, ds, last_ds_focus);
			} else {
				activate_node(ms, ds, last_ds_focus);
			}
		} else {
			draw_border(ns, is_descendant(ns, ds->focus), (ms == mon));
		}
	} else {
		if (single_monocle) {
			if (ds->layout != LAYOUT_MONOCLE && tiled_count(ds->root, true) <= 1) {
				set_layout(ms, ds, LAYOUT_MONOCLE, false);
			}
			if (dd->layout == LAYOUT_MONOCLE && tiled_count(dd->root, true) > 1) {
				set_layout(md, dd, dd->user_layout, false);
			}
		}
		if (held_focus) {
			if (follow) {
				if (ds_was_focused) {
					focus_node(md, dd, last_ds_focus);
				}
				activate_node(ms, ds, ds->focus);
			} else {
				if (ds_was_focused) {
					focus_node(ms, ds, ds->focus);
				} else {
					activate_node(ms, ds, ds->focus);
				}
			}
		}
		if (!held_focus || !follow || !ds_was_focused) {
			if (dd->focus == ns) {
				if (dd == mon->desk) {
					focus_node(md, dd, held_focus ? last_ds_focus : ns);
				} else {
					activate_node(md, dd, held_focus ? last_ds_focus : ns);
				}
			} else {
				draw_border(ns, is_descendant(ns, dd->focus), (md == mon));
			}
		}
	}

	arrange(ms, ds);

	if (ds != dd) {
		arrange(md, dd);
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movb 0x10(%rbp), %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
andb $0x1, %al
movb %al, -0x39(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xd1e0
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0xd1e0
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xeae0
testb $0x1, %al
jne 0xd1e0
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xd040
testb $0x1, %al
jne 0xd1e0
jmp 0xd1e9
movb $0x0, -0x1(%rbp)
jmp 0xd70f
movq -0x10(%rbp), %rax
cmpl $0x0, 0x40(%rax)
jbe 0xd20f
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0xd20f
movq -0x20(%rbp), %rdi
callq 0xfc80
movl %eax, -0x58(%rbp)
jmp 0xd216
xorl %eax, %eax
movl %eax, -0x58(%rbp)
jmp 0xd216
movl -0x58(%rbp), %eax
movl %eax, -0x40(%rbp)
leaq 0x28537(%rip), %rax     # 0x3575a
testb $0x1, (%rax)
je 0xd245
cmpl $0x0, -0x40(%rbp)
jbe 0xd245
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x58(%rcx), %rax
je 0xd245
movb $0x0, -0x1(%rbp)
jmp 0xd70f
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x28(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x30(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x5c(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xd288
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x70(%rbp)
jmp 0xd28f
xorl %eax, %eax
movl %eax, -0x70(%rbp)
jmp 0xd28f
movl -0x5c(%rbp), %r10d
movl -0x60(%rbp), %r9d
movl -0x64(%rbp), %r8d
movl -0x68(%rbp), %ecx
movl -0x6c(%rbp), %edx
movl -0x70(%rbp), %eax
movl $0x40000, %edi          # imm = 0x40000
leaq 0x206c0(%rip), %rsi     # 0x2d970
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2c0b0
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0xd040
andb $0x1, %al
movb %al, -0x41(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xeae0
testb $0x1, %al
jne 0xd2ec
jmp 0xd2f4
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0xd300
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
leaq 0x283ed(%rip), %rcx     # 0x35700
movq (%rcx), %rcx
cmpq 0x58(%rcx), %rax
sete %al
andb $0x1, %al
movb %al, -0x51(%rbp)
testb $0x1, -0x41(%rbp)
je 0xd333
testb $0x1, -0x51(%rbp)
je 0xd333
callq 0x18950
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xf740
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0xc020
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0xd3b6
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0xd381
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x90e0
cmpq -0x28(%rbp), %rax
je 0xd39a
movq -0x10(%rbp), %rdi
addq $0x4c, %rdi
movq -0x28(%rbp), %rsi
addq $0x4c, %rsi
movq -0x20(%rbp), %rdx
callq 0x82c0
movl -0x40(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x40(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x40(%rax)
movl -0x40(%rbp), %ecx
movq -0x28(%rbp), %rax
addl 0x40(%rax), %ecx
movl %ecx, 0x40(%rax)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0xd433
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x2aeb0
leaq 0x28386(%rip), %rax     # 0x3575a
testb $0x1, (%rax)
je 0xd431
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0xd404
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x58(%rcx), %rax
je 0xd404
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xdd80
jmp 0xd42f
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x58(%rcx), %rax
je 0xd42d
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0xd42d
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xde40
jmp 0xd42f
jmp 0xd431
jmp 0xd433
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x12710
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x120e0
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0xd4d6
testb $0x1, -0x41(%rbp)
je 0xd490
testb $0x1, -0x51(%rbp)
je 0xd47d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0xd720
jmp 0xd48e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0xccb0
jmp 0xd4d1
movq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xd040
movq -0x80(%rbp), %rdi
movb %al, %cl
movq -0x10(%rbp), %rax
leaq 0x28246(%rip), %rdx     # 0x35700
cmpq (%rdx), %rax
sete %al
movzbl %cl, %esi
andl $0x1, %esi
movzbl %al, %edx
andl $0x1, %edx
callq 0x167c0
jmp 0xd6e7
leaq 0x2890b(%rip), %rax     # 0x35de8
testb $0x1, (%rax)
je 0xd550
movq -0x18(%rbp), %rax
cmpl $0x1, 0x24(%rax)
je 0xd517
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdi
movl $0x1, %esi
callq 0xc8d0
cmpl $0x1, %eax
jg 0xd517
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x9e80
movq -0x30(%rbp), %rax
cmpl $0x1, 0x24(%rax)
jne 0xd54e
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rdi
movl $0x1, %esi
callq 0xc8d0
cmpl $0x1, %eax
jle 0xd54e
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x30(%rbp), %rax
movl 0x28(%rax), %edx
xorl %ecx, %ecx
callq 0x9e80
jmp 0xd550
testb $0x1, -0x41(%rbp)
je 0xd5c0
testb $0x1, -0x39(%rbp)
je 0xd58a
testb $0x1, -0x51(%rbp)
je 0xd573
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0xd720
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0xccb0
jmp 0xd5be
testb $0x1, -0x51(%rbp)
je 0xd5a7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0xd720
jmp 0xd5bc
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0xccb0
jmp 0xd5be
jmp 0xd5c0
testb $0x1, -0x41(%rbp)
je 0xd5d6
testb $0x1, -0x39(%rbp)
je 0xd5d6
testb $0x1, -0x51(%rbp)
jne 0xd6e5
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0xd69c
movq -0x30(%rbp), %rax
leaq 0x2810d(%rip), %rcx     # 0x35700
movq (%rcx), %rcx
cmpq 0x58(%rcx), %rax
jne 0xd64c
movq -0x28(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
testb $0x1, -0x41(%rbp)
je 0xd625
movq -0x50(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0xd630
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rdx
callq 0xd720
jmp 0xd69a
movq -0x28(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xa0(%rbp)
testb $0x1, -0x41(%rbp)
je 0xd675
movq -0x50(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0xd680
movq -0x20(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
callq 0xccb0
jmp 0xd6e3
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xd040
movq -0xb8(%rbp), %rdi
movb %al, %cl
movq -0x28(%rbp), %rax
leaq 0x28034(%rip), %rdx     # 0x35700
cmpq (%rdx), %rax
sete %al
movzbl %cl, %esi
andl $0x1, %esi
movzbl %al, %edx
andl $0x1, %edx
callq 0x167c0
jmp 0xd6e5
jmp 0xd6e7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xafd0
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0xd70b
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xafd0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)