// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/messages.c
// Function: cmd_monitor
void cmd_monitor(char **args, int num, FILE *rsp)
{
	if (num < 1) {
		fail(rsp, "monitor: Missing arguments.\n");
		return;
	}

	coordinates_t ref = {mon, NULL, NULL};
	coordinates_t trg = ref;

	if ((*args)[0] != OPT_CHR) {
		int ret;
		if ((ret = monitor_from_desc(*args, &ref, &trg)) == SELECTOR_OK) {
			num--, args++;
		} else {
			handle_failure(ret, "monitor", *args, rsp);
			return;
		}
	}

	if (num < 1) {
		fail(rsp, "monitor: Missing commands.\n");
		return;
	}

	while (num > 0) {
		if (streq("-f", *args) || streq("--focus", *args)) {
			coordinates_t dst = trg;
			if (num > 1 && *(args + 1)[0] != OPT_CHR) {
				num--, args++;
				int ret;
				if ((ret = monitor_from_desc(*args, &ref, &dst)) != SELECTOR_OK) {
					handle_failure(ret, "monitor -f", *args, rsp);
					fail(rsp, "");
					return;
				}
			}
			focus_node(dst.monitor, NULL, NULL);
		} else if (streq("-s", *args) || streq("--swap", *args)) {
			num--, args++;
			if (num < 1) {
				fail(rsp, "monitor %s: Not enough arguments.\n", *(args - 1));
				return;
			}
			coordinates_t dst;
			int ret;
			if ((ret = monitor_from_desc(*args, &ref, &dst)) == SELECTOR_OK) {
				if (!swap_monitors(trg.monitor, dst.monitor)) {
					fail(rsp, "");
					return;
				}
			} else {
				handle_failure(ret, "monitor -s", *args, rsp);
				return;
			}
		} else if (streq("-d", *args) || streq("--reset-desktops", *args)) {
			num--, args++;
			if (num < 1) {
				fail(rsp, "monitor %s: Not enough arguments.\n", *(args - 1));
				return;
			}
			desktop_t *d = trg.monitor->desk_head;
			while (num > 0 && d != NULL) {
				rename_desktop(trg.monitor, d, *args);
				d = d->next;
				num--, args++;
			}
			put_status(SBSC_MASK_REPORT);
			while (num > 0) {
				add_desktop(trg.monitor, make_desktop(*args, XCB_NONE));
				num--, args++;
			}
			while (d != NULL) {
				desktop_t *next = d->next;
				if (d == mon->desk) {
					focus_node(trg.monitor, d->prev, d->prev->focus);
				}
				merge_desktops(trg.monitor, d, mon, mon->desk);
				remove_desktop(trg.monitor, d);
				d = next;
			}
		} else if (streq("-a", *args) || streq("--add-desktops", *args)) {
			num--, args++;
			if (num < 1) {
				fail(rsp, "monitor %s: Not enough arguments.\n", *(args - 1));
				return;
			}
			while (num > 0) {
				add_desktop(trg.monitor, make_desktop(*args, XCB_NONE));
				num--, args++;
			}
		} else if (streq("-r", *args) || streq("--remove", *args)) {
			if (num > 1) {
				fail(rsp, "monitor %s: Trailing commands.\n", *args);
				return;
			}
			if (mon_head == mon_tail) {
				fail(rsp, "");
				return;
			}
			remove_monitor(trg.monitor);
			return;
		} else if (streq("-o", *args) || streq("--reorder-desktops", *args)) {
			num--, args++;
			if (num < 1) {
				fail(rsp, "monitor %s: Not enough arguments.\n", *(args - 1));
				return;
			}
			desktop_t *d = trg.monitor->desk_head;
			while (d != NULL && num > 0) {
				desktop_t *next = d->next;
				coordinates_t dst;
				if (locate_desktop(*args, &dst) && dst.monitor == trg.monitor) {
					swap_desktops(trg.monitor, d, dst.monitor, dst.desktop, false);
					if (next == dst.desktop) {
						next = d;
					}
				}
				d = next;
				num--, args++;
			}
		} else if (streq("-g", *args) || streq("--rectangle", *args)) {
			num--, args++;
			if (num < 1) {
				fail(rsp, "monitor %s: Not enough arguments.\n", *(args - 1));
				return;
			}
			xcb_rectangle_t r;
			if (parse_rectangle(*args, &r)) {
				update_root(trg.monitor, &r);
			} else {
				fail(rsp, "monitor %s: Invalid argument: '%s'.\n", *(args - 1), *args);
				return;
			}
		} else if (streq("-n", *args) || streq("--rename", *args)) {
			num--, args++;
			if (num < 1) {
				fail(rsp, "monitor %s: Not enough arguments.\n", *(args - 1));
				return;
			}
			rename_monitor(trg.monitor, *args);
		} else {
			fail(rsp, "monitor: Unknown command: '%s'.\n", *args);
			return;
		}
		num--, args++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x1b9f3
movq -0x18(%rbp), %rdi
leaq 0x1284e(%rip), %rsi     # 0x2e235
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
leaq 0x19d06(%rip), %rax     # 0x35700
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x1ba8c
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x24c20
movl %eax, -0x4c(%rbp)
cmpl $0x0, %eax
jne 0x1ba6b
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0x1ba8a
movl -0x4c(%rbp), %edi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0x1292c(%rip), %rsi     # 0x2e3ac
callq 0x1df60
jmp 0x1c273
jmp 0x1ba8c
cmpl $0x1, -0xc(%rbp)
jge 0x1baa9
movq -0x18(%rbp), %rdi
leaq 0x127b5(%rip), %rsi     # 0x2e252
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
jmp 0x1baab
cmpl $0x0, -0xc(%rbp)
jle 0x1c273
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x123ad(%rip), %rdi     # 0x2de70
callq 0x4800
cmpl $0x0, %eax
je 0x1bae9
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x12388(%rip), %rdi     # 0x2de63
callq 0x4800
cmpl $0x0, %eax
jne 0x1bb90
movq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpl $0x1, -0xc(%rbp)
jle 0x1bb7b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x1bb7b
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x24c20
movl %eax, -0x6c(%rbp)
cmpl $0x0, %eax
je 0x1bb79
movl -0x6c(%rbp), %edi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0x12711(%rip), %rsi     # 0x2e26e
callq 0x1df60
movq -0x18(%rbp), %rdi
leaq 0x13053(%rip), %rsi     # 0x2ebc0
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
jmp 0x1bb7b
movq -0x68(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0xd720
jmp 0x1c259
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x12359(%rip), %rdi     # 0x2def7
callq 0x4800
cmpl $0x0, %eax
je 0x1bbc4
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x12335(%rip), %rdi     # 0x2deeb
callq 0x4800
cmpl $0x0, %eax
jne 0x1bc74
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x1bbfe
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x8(%rax), %rdx
leaq 0x12687(%rip), %rsi     # 0x2e279
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x24c20
movl %eax, -0x8c(%rbp)
cmpl $0x0, %eax
jne 0x1bc4d
movq -0x48(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x8710
testb $0x1, %al
jne 0x1bc4b
movq -0x18(%rbp), %rdi
leaq 0x12f81(%rip), %rsi     # 0x2ebc0
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
jmp 0x1bc6f
movl -0x8c(%rbp), %edi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0x12637(%rip), %rsi     # 0x2e29c
callq 0x1df60
jmp 0x1c273
jmp 0x1c257
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x1223f(%rip), %rdi     # 0x2dec1
callq 0x4800
cmpl $0x0, %eax
je 0x1bca8
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x1260d(%rip), %rdi     # 0x2e2a7
callq 0x4800
cmpl $0x0, %eax
jne 0x1be59
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x1bce2
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x8(%rax), %rdx
leaq 0x125a3(%rip), %rsi     # 0x2e279
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
movq -0x48(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x98(%rbp)
xorl %eax, %eax
cmpl $0x0, -0xc(%rbp)
movb %al, -0xd1(%rbp)
jle 0x1bd10
cmpq $0x0, -0x98(%rbp)
setne %al
movb %al, -0xd1(%rbp)
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x1bd1c
jmp 0x1bd5c
movq -0x48(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
callq 0xa5a0
movq -0x98(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x98(%rbp)
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0x1bcf1
movl $0x1, %edi
movb $0x0, %al
callq 0x2c0b0
cmpl $0x0, -0xc(%rbp)
jle 0x1bdad
movq -0x48(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
xorl %esi, %esi
callq 0xa460
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
callq 0xa610
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0x1bd68
jmp 0x1bdaf
cmpq $0x0, -0x98(%rbp)
je 0x1be54
movq -0x98(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
leaq 0x19923(%rip), %rcx     # 0x35700
movq (%rcx), %rcx
cmpq 0x58(%rcx), %rax
jne 0x1be09
movq -0x48(%rbp), %rdi
movq -0x98(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0x98(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x38(%rax), %rdx
callq 0xd720
movq -0x48(%rbp), %rdi
movq -0x98(%rbp), %rsi
leaq 0x198e5(%rip), %rax     # 0x35700
movq (%rax), %rdx
leaq 0x198db(%rip), %rax     # 0x35700
movq (%rax), %rax
movq 0x58(%rax), %rcx
callq 0xa820
movq -0x48(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0xa710
movq -0xa0(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x1bdaf
jmp 0x1c255
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x1201c(%rip), %rdi     # 0x2de83
callq 0x4800
cmpl $0x0, %eax
je 0x1be8d
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x12439(%rip), %rdi     # 0x2e2b8
callq 0x4800
cmpl $0x0, %eax
jne 0x1bf13
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x1bec7
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x8(%rax), %rdx
leaq 0x123be(%rip), %rsi     # 0x2e279
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
jmp 0x1bec9
cmpl $0x0, -0xc(%rbp)
jle 0x1bf0e
movq -0x48(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
xorl %esi, %esi
callq 0xa460
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0xa610
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0x1bec9
jmp 0x1c253
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x1214a(%rip), %rdi     # 0x2e06b
callq 0x4800
cmpl $0x0, %eax
je 0x1bf43
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x122b2(%rip), %rdi     # 0x2e1eb
callq 0x4800
cmpl $0x0, %eax
jne 0x1bfa2
cmpl $0x1, -0xc(%rbp)
jle 0x1bf67
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x1236c(%rip), %rsi     # 0x2e2c7
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
leaq 0x1978a(%rip), %rax     # 0x356f8
movq (%rax), %rax
leaq 0x19778(%rip), %rcx     # 0x356f0
cmpq (%rcx), %rax
jne 0x1bf94
movq -0x18(%rbp), %rdi
leaq 0x12c38(%rip), %rsi     # 0x2ebc0
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
movq -0x48(%rbp), %rdi
callq 0x8e00
jmp 0x1c273
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x11235(%rip), %rdi     # 0x2d1e5
callq 0x4800
cmpl $0x0, %eax
je 0x1bfd6
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x1231f(%rip), %rdi     # 0x2e2e7
callq 0x4800
cmpl $0x0, %eax
jne 0x1c0f3
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x1c010
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x8(%rax), %rdx
leaq 0x12275(%rip), %rsi     # 0x2e279
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
movq -0x48(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0xa8(%rbp)
xorl %eax, %eax
cmpq $0x0, -0xa8(%rbp)
movb %al, -0xe9(%rbp)
je 0x1c03e
cmpl $0x0, -0xc(%rbp)
setg %al
movb %al, -0xe9(%rbp)
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x1c04d
jmp 0x1c0ee
movq -0xa8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x266b0
testb $0x1, %al
jne 0x1c078
jmp 0x1c0c6
movq -0xc8(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x1c0c6
movq -0x48(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0xc8(%rbp), %rdx
movq -0xc0(%rbp), %rcx
xorl %r8d, %r8d
callq 0xa890
movq -0xb0(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jne 0x1c0c4
movq -0xa8(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x1c0c6
movq -0xb0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0x1c01f
jmp 0x1c24f
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x11e31(%rip), %rdi     # 0x2df32
callq 0x4800
cmpl $0x0, %eax
je 0x1c127
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x121e1(%rip), %rdi     # 0x2e2fa
callq 0x4800
cmpl $0x0, %eax
jne 0x1c1b7
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x1c161
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x8(%rax), %rdx
leaq 0x12124(%rip), %rsi     # 0x2e279
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x21830
testb $0x1, %al
jne 0x1c17a
jmp 0x1c18c
movq -0x48(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x8040
jmp 0x1c1b2
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x8(%rax), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
leaq 0x12160(%rip), %rsi     # 0x2e306
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
jmp 0x1c24d
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x11d23(%rip), %rdi     # 0x2dee8
callq 0x4800
cmpl $0x0, %eax
je 0x1c1e7
movq -0x8(%rbp), %rax
movq (%rax), %rsi
leaq 0x12005(%rip), %rdi     # 0x2e1e2
callq 0x4800
cmpl $0x0, %eax
jne 0x1c230
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x1c21e
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq -0x8(%rax), %rdx
leaq 0x12064(%rip), %rsi     # 0x2e279
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
movq -0x48(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
callq 0x8960
jmp 0x1c24b
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x120e9(%rip), %rsi     # 0x2e32b
movb $0x0, %al
callq 0x18d60
jmp 0x1c273
jmp 0x1c24d
jmp 0x1c24f
jmp 0x1c251
jmp 0x1c253
jmp 0x1c255
jmp 0x1c257
jmp 0x1c259
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0x1baab
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax)