// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/monitor.c
// Function: swap_monitors
bool swap_monitors(monitor_t *m1, monitor_t *m2)
{
	if (m1 == NULL || m2 == NULL || m1 == m2) {
		return false;
	}

	put_status(SBSC_MASK_MONITOR_SWAP, "monitor_swap 0x%08X 0x%08X\n", m1->id, m2->id);

	if (mon_head == m1) {
		mon_head = m2;
	} else if (mon_head == m2) {
		mon_head = m1;
	}
	if (mon_tail == m1) {
		mon_tail = m2;
	} else if (mon_tail == m2) {
		mon_tail = m1;
	}

	monitor_t *p1 = m1->prev;
	monitor_t *n1 = m1->next;
	monitor_t *p2 = m2->prev;
	monitor_t *n2 = m2->next;

	if (p1 != NULL && p1 != m2) {
		p1->next = m2;
	}
	if (n1 != NULL && n1 != m2) {
		n1->prev = m2;
	}
	if (p2 != NULL && p2 != m1) {
		p2->next = m1;
	}
	if (n2 != NULL && n2 != m1) {
		n2->prev = m1;
	}

	m1->prev = p2 == m1 ? m2 : p2;
	m1->next = n2 == m1 ? m2 : n2;
	m2->prev = p1 == m2 ? m1 : p1;
	m2->next = n1 == m2 ? m1 : n1;

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

	put_status(SBSC_MASK_REPORT);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x8738
cmpq $0x0, -0x18(%rbp)
je 0x8738
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x8741
movb $0x0, -0x1(%rbp)
jmp 0x894a
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edx
movq -0x18(%rbp), %rax
movl 0x20(%rax), %ecx
movl $0x10, %edi
leaq 0x24f0b(%rip), %rsi     # 0x2d666
movb $0x0, %al
callq 0x2c0b0
leaq 0x2cf8f(%rip), %rax     # 0x356f8
movq (%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x8782
movq -0x18(%rbp), %rcx
leaq 0x2cf7b(%rip), %rax     # 0x356f8
movq %rcx, (%rax)
jmp 0x87a2
leaq 0x2cf6f(%rip), %rax     # 0x356f8
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0x87a0
movq -0x10(%rbp), %rcx
leaq 0x2cf5b(%rip), %rax     # 0x356f8
movq %rcx, (%rax)
jmp 0x87a2
leaq 0x2cf47(%rip), %rax     # 0x356f0
movq (%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x87c2
movq -0x18(%rbp), %rcx
leaq 0x2cf33(%rip), %rax     # 0x356f0
movq %rcx, (%rax)
jmp 0x87e2
leaq 0x2cf27(%rip), %rax     # 0x356f0
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0x87e0
movq -0x10(%rbp), %rcx
leaq 0x2cf13(%rip), %rax     # 0x356f0
movq %rcx, (%rax)
jmp 0x87e2
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x882f
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x882f
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x78(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x884c
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x884c
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x70(%rax)
cmpq $0x0, -0x30(%rbp)
je 0x8869
movq -0x30(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x8869
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x78(%rax)
cmpq $0x0, -0x38(%rbp)
je 0x8886
movq -0x38(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x8886
movq -0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x30(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x889a
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x88a2
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x38(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x88c2
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x88ca
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x88ea
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x88f2
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x8912
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x891a
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x78(%rax)
callq 0x2af20
callq 0x2afe0
callq 0x2b1a0
callq 0x2ae60
movl $0x1, %edi
movb $0x0, %al
callq 0x2c0b0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)