// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/desktop.c
// Function: transfer_desktop
bool transfer_desktop(monitor_t *ms, monitor_t *md, desktop_t *d, bool follow)
{
	if (ms == NULL || md == NULL || d == NULL || ms == md) {
		return false;
	}

	bool d_was_active = (d == ms->desk);
	bool ms_was_focused = (ms == mon);
	unsigned int sc = (ms->sticky_count > 0 && d_was_active) ? sticky_count(d->root) : 0;

	unlink_desktop(ms, d);
	ms->sticky_count -= sc;

	if ((!follow || !d_was_active || !ms_was_focused) && md->desk != NULL) {
		hide_sticky = false;
		hide_desktop(d);
		hide_sticky = true;
	}

	insert_desktop(md, d);
	md->sticky_count += sc;
	history_remove(d, NULL, false);

	if (d_was_active) {
		if (follow) {
			if (activate_desktop(ms, NULL)) {
				activate_node(ms, ms->desk, NULL);
			}
			if (ms_was_focused) {
				focus_node(md, d, d->focus);
			}
		} else {
			if (ms_was_focused) {
				focus_node(ms, ms->desk, NULL);
			} else if (activate_desktop(ms, NULL)) {
				activate_node(ms, ms->desk, NULL);
			}
		}
	}

	if (sc > 0) {
		if (ms->desk != NULL) {
			transfer_sticky_nodes(md, d, ms, ms->desk, d->root);
		} else if (d != md->desk) {
			transfer_sticky_nodes(md, d, md, md->desk, d->root);
		}
	}

	adapt_geometry(&ms->rectangle, &md->rectangle, d->root);
	arrange(md, d);

	if ((!follow || !d_was_active || !ms_was_focused) && md->desk == d) {
		if (md == mon) {
			focus_node(md, d, d->focus);
		} else {
			activate_node(md, d, d->focus);
		}
	}

	ewmh_update_wm_desktops();
	ewmh_update_desktop_names();
	ewmh_update_desktop_viewport();
	ewmh_update_current_desktop();

	put_status(SBSC_MASK_DESKTOP_TRANSFER, "desktop_transfer 0x%08X 0x%08X 0x%08X\n", ms->id, d->id, md->id);
	put_status(SBSC_MASK_REPORT);

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xa05a
cmpq $0x0, -0x18(%rbp)
je 0xa05a
cmpq $0x0, -0x20(%rbp)
je 0xa05a
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0xa063
movb $0x0, -0x1(%rbp)
jmp 0xa317
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x58(%rcx), %rax
sete %al
andb $0x1, %al
movb %al, -0x22(%rbp)
movq -0x10(%rbp), %rax
leaq 0x2b67e(%rip), %rcx     # 0x35700
cmpq (%rcx), %rax
sete %al
andb $0x1, %al
movb %al, -0x23(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x40(%rax)
jbe 0xa0af
testb $0x1, -0x22(%rbp)
je 0xa0af
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xfc80
movl %eax, -0x2c(%rbp)
jmp 0xa0b6
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa0b6
movl -0x2c(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xa330
movl -0x28(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x40(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x40(%rax)
testb $0x1, -0x21(%rbp)
je 0xa0ea
testb $0x1, -0x22(%rbp)
je 0xa0ea
testb $0x1, -0x23(%rbp)
jne 0xa112
movq -0x18(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0xa112
leaq 0x2b65d(%rip), %rax     # 0x35759
movb $0x0, (%rax)
movq -0x20(%rbp), %rdi
callq 0x9b50
leaq 0x2b64a(%rip), %rax     # 0x35759
movb $0x1, (%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xa3f0
movl -0x28(%rbp), %ecx
movq -0x18(%rbp), %rax
addl 0x40(%rax), %ecx
movl %ecx, 0x40(%rax)
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x12710
testb $0x1, -0x22(%rbp)
je 0xa1db
testb $0x1, -0x21(%rbp)
je 0xa190
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x99e0
testb $0x1, %al
jne 0xa15e
jmp 0xa173
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xccb0
testb $0x1, -0x23(%rbp)
je 0xa18e
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0xd720
jmp 0xa1d9
testb $0x1, -0x23(%rbp)
je 0xa1ad
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xd720
jmp 0xa1d7
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x99e0
testb $0x1, %al
jne 0xa1c0
jmp 0xa1d5
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xccb0
jmp 0xa1d7
jmp 0xa1d9
jmp 0xa1db
cmpl $0x0, -0x28(%rbp)
jbe 0xa242
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0xa20f
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x30(%rax), %r8
callq 0xd0b0
jmp 0xa240
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x58(%rcx), %rax
je 0xa23e
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x30(%rax), %r8
callq 0xd0b0
jmp 0xa240
jmp 0xa242
movq -0x10(%rbp), %rdi
addq $0x4c, %rdi
movq -0x18(%rbp), %rsi
addq $0x4c, %rsi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdx
callq 0x82c0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xafd0
testb $0x1, -0x21(%rbp)
je 0xa27e
testb $0x1, -0x22(%rbp)
je 0xa27e
testb $0x1, -0x23(%rbp)
jne 0xa2ca
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0xa2ca
movq -0x18(%rbp), %rax
leaq 0x2b469(%rip), %rcx     # 0x35700
cmpq (%rcx), %rax
jne 0xa2b3
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0xd720
jmp 0xa2c8
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0xccb0
jmp 0xa2ca
callq 0x2af20
callq 0x2afe0
callq 0x2b1a0
callq 0x2ae60
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edx
movq -0x20(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x18(%rbp), %rax
movl 0x20(%rax), %r8d
movl $0x800, %edi            # imm = 0x800
leaq 0x233d4(%rip), %rsi     # 0x2d6d4
movb $0x0, %al
callq 0x2c0b0
movl $0x1, %edi
movb $0x0, %al
callq 0x2c0b0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)