// File: /workspace/github_c_makefile_star2_O2/baskerville[P]bspwm/src/query.c
// Function: desktop_matches
bool desktop_matches(coordinates_t *loc, coordinates_t *ref, desktop_select_t *sel)
{
	if (sel->occupied != OPTION_NONE &&
	    loc->desktop->root == NULL
	    ? sel->occupied == OPTION_TRUE
	    : sel->occupied == OPTION_FALSE) {
		return false;
	}

	if (sel->focused != OPTION_NONE &&
	    loc->desktop != mon->desk
	    ? sel->focused == OPTION_TRUE
	    : sel->focused == OPTION_FALSE) {
		return false;
	}

	if (sel->active != OPTION_NONE &&
	    loc->desktop != loc->monitor->desk
	    ? sel->active == OPTION_TRUE
	    : sel->active == OPTION_FALSE) {
		return false;
	}

	if (sel->urgent != OPTION_NONE &&
	    !is_urgent(loc->desktop)
	    ? sel->urgent == OPTION_TRUE
	    : sel->urgent == OPTION_FALSE) {
		return false;
	}

	if (sel->local != OPTION_NONE &&
	    ref->monitor != loc->monitor
	    ? sel->local == OPTION_TRUE
	    : sel->local == OPTION_FALSE) {
		return false;
	}

#define DLAYOUT(p, e) \
	if (sel->p != OPTION_NONE && \
	    loc->desktop->layout != e \
	    ? sel->p == OPTION_TRUE \
	    : sel->p == OPTION_FALSE) { \
		return false; \
	}
	DLAYOUT(tiled, LAYOUT_TILED)
	DLAYOUT(monocle, LAYOUT_MONOCLE)
#undef DLAYOUT

#define DUSERLAYOUT(p, e) \
	if (sel->p != OPTION_NONE && \
	    loc->desktop->user_layout != e \
	    ? sel->p == OPTION_TRUE \
	    : sel->p == OPTION_FALSE) { \
		return false; \
	}
	DUSERLAYOUT(user_tiled, LAYOUT_TILED)
	DUSERLAYOUT(user_monocle, LAYOUT_MONOCLE)
#undef DUSERLAYOUT

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl (%rdx), %eax
testl %eax, %eax
je 0x17c7f
movq 0x8(%rbx), %rcx
cmpq $0x0, 0x30(%rcx)
je 0x17c76
cmpl $0x2, %eax
jne 0x17c7f
jmp 0x17d97
cmpl $0x1, %eax
je 0x17d97
movl 0x4(%r14), %eax
testl %eax, %eax
je 0x17cae
movq 0x8(%rbx), %rcx
leaq 0x10a7e(%rip), %rdx     # 0x28710
movq (%rdx), %rdx
cmpq 0x58(%rdx), %rcx
je 0x17ca5
cmpl $0x1, %eax
jne 0x17cae
jmp 0x17d97
cmpl $0x2, %eax
je 0x17d97
movl 0x8(%r14), %eax
testl %eax, %eax
je 0x17cd6
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
cmpq 0x58(%rcx), %rdx
je 0x17ccd
cmpl $0x1, %eax
jne 0x17cd6
jmp 0x17d97
cmpl $0x2, %eax
je 0x17d97
cmpl $0x0, 0xc(%r14)
je 0x17d01
movq 0x8(%rbx), %rdi
callq 0x8634
movl 0xc(%r14), %ecx
testb %al, %al
je 0x17cf8
cmpl $0x2, %ecx
jne 0x17d01
jmp 0x17d97
cmpl $0x1, %ecx
je 0x17d97
movl 0x10(%r14), %eax
testl %eax, %eax
je 0x17d1d
movq (%r15), %rcx
cmpq (%rbx), %rcx
je 0x17d18
cmpl $0x1, %eax
jne 0x17d1d
jmp 0x17d97
cmpl $0x2, %eax
je 0x17d97
movl 0x14(%r14), %eax
testl %eax, %eax
je 0x17d3b
movq 0x8(%rbx), %rcx
cmpl $0x0, 0x24(%rcx)
je 0x17d36
cmpl $0x1, %eax
jne 0x17d3b
jmp 0x17d97
cmpl $0x2, %eax
je 0x17d97
movl 0x18(%r14), %eax
testl %eax, %eax
je 0x17d59
movq 0x8(%rbx), %rcx
cmpl $0x1, 0x24(%rcx)
jne 0x17d54
cmpl $0x2, %eax
jne 0x17d59
jmp 0x17d97
cmpl $0x1, %eax
je 0x17d97
movl 0x1c(%r14), %eax
testl %eax, %eax
je 0x17d77
movq 0x8(%rbx), %rcx
cmpl $0x0, 0x28(%rcx)
je 0x17d72
cmpl $0x1, %eax
jne 0x17d77
jmp 0x17d97
cmpl $0x2, %eax
je 0x17d97
movl 0x20(%r14), %eax
testl %eax, %eax
je 0x17d8e
movq 0x8(%rbx), %rcx
cmpl $0x1, 0x28(%rcx)
jne 0x17d92
cmpl $0x2, %eax
je 0x17d97
movb $0x1, %al
jmp 0x17d99
cmpl $0x1, %eax
jne 0x17d8e
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq