// File: /workspace/github_c_makefile_star2_O2/baskerville[P]bspwm/src/query.c
// Function: node_matches
bool node_matches(coordinates_t *loc, coordinates_t *ref, node_select_t *sel)
{
	if (loc->node == NULL) {
		return false;
	}

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

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

	if (sel->automatic != OPTION_NONE &&
	    loc->node->presel != NULL
	    ? sel->automatic == OPTION_TRUE
	    : sel->automatic == OPTION_FALSE) {
		return false;
	}

	if (sel->local != OPTION_NONE &&
	    loc->desktop != ref->desktop
	    ? sel->local == OPTION_TRUE
	    : sel->local == 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->leaf != OPTION_NONE &&
	    !is_leaf(loc->node)
	    ? sel->leaf == OPTION_TRUE
	    : sel->leaf == OPTION_FALSE) {
		return false;
	}

	if (sel->window != OPTION_NONE &&
	    loc->node->client == NULL
	    ? sel->window == OPTION_TRUE
	    : sel->window == OPTION_FALSE) {
		return false;
	}

#define NFLAG(p) \
	if (sel->p != OPTION_NONE && \
	    !loc->node->p \
	    ? sel->p == OPTION_TRUE \
	    : sel->p == OPTION_FALSE) { \
		return false; \
	}
	NFLAG(hidden)
	NFLAG(sticky)
	NFLAG(private)
	NFLAG(locked)
	NFLAG(marked)
#undef NFLAG

#define NSPLIT(p, e) \
	if (sel->p != OPTION_NONE && \
	    loc->node->split_type != e \
	    ? sel->p == OPTION_TRUE \
	    : sel->p == OPTION_FALSE) { \
		return false; \
	}
	NSPLIT(horizontal, TYPE_HORIZONTAL)
	NSPLIT(vertical, TYPE_VERTICAL)
#undef NSPLIT

	if (sel->descendant_of != OPTION_NONE &&
	    !is_descendant(loc->node, ref->node)
	    ? sel->descendant_of == OPTION_TRUE
	    : sel->descendant_of == OPTION_FALSE) {
		return false;
	}

	if (sel->ancestor_of != OPTION_NONE &&
	    !is_descendant(ref->node, loc->node)
	    ? sel->ancestor_of == OPTION_TRUE
	    : sel->ancestor_of == OPTION_FALSE) {
		return false;
	}

	if (loc->node->client == NULL) {
		if (sel->same_class == OPTION_TRUE ||
		    sel->tiled == OPTION_TRUE ||
		    sel->pseudo_tiled == OPTION_TRUE ||
		    sel->floating == OPTION_TRUE ||
		    sel->fullscreen == OPTION_TRUE ||
		    sel->below == OPTION_TRUE ||
		    sel->normal == OPTION_TRUE ||
		    sel->above == OPTION_TRUE ||
		    sel->urgent == OPTION_TRUE) {
			return false;
		}
		return true;
	}

	if (ref->node != NULL && ref->node->client != NULL &&
	    sel->same_class != OPTION_NONE &&
	    streq(loc->node->client->class_name, ref->node->client->class_name)
	    ? sel->same_class == OPTION_FALSE
	    : sel->same_class == OPTION_TRUE) {
		return false;
	}

#define WSTATE(p, e) \
	if (sel->p != OPTION_NONE && \
	    loc->node->client->state != e \
	    ? sel->p == OPTION_TRUE \
	    : sel->p == OPTION_FALSE) { \
		return false; \
	}
	WSTATE(tiled, STATE_TILED)
	WSTATE(pseudo_tiled, STATE_PSEUDO_TILED)
	WSTATE(floating, STATE_FLOATING)
	WSTATE(fullscreen, STATE_FULLSCREEN)
#undef WSTATE

#define WLAYER(p, e) \
	if (sel->p != OPTION_NONE && \
	    loc->node->client->layer != e \
	    ? sel->p == OPTION_TRUE \
	    : sel->p == OPTION_FALSE) { \
		return false; \
	}
	WLAYER(below, LAYER_BELOW)
	WLAYER(normal, LAYER_NORMAL)
	WLAYER(above, LAYER_ABOVE)
#undef WLAYER

#define WFLAG(p) \
	if (sel->p != OPTION_NONE && \
	    !loc->node->client->p \
	    ? sel->p == OPTION_TRUE \
	    : sel->p == OPTION_FALSE) { \
		return false; \
	}
	WFLAG(urgent)
#undef WFLAG

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x18296
movq %rdx, %rbx
movq %rsi, %r14
movl 0x4(%rdx), %eax
testl %eax, %eax
je 0x17ec1
leaq 0x1086f(%rip), %rcx     # 0x28710
movq (%rcx), %rcx
movq 0x58(%rcx), %rcx
cmpq 0x38(%rcx), %rdi
je 0x17eb8
cmpl $0x1, %eax
jne 0x17ec1
jmp 0x18296
cmpl $0x2, %eax
je 0x18296
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0x17ee5
movq 0x8(%r15), %rcx
cmpq 0x38(%rcx), %rdi
je 0x17edc
cmpl $0x1, %eax
jne 0x17ee5
jmp 0x18296
cmpl $0x2, %eax
je 0x18296
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x17f05
cmpq $0x0, 0x10(%rdi)
je 0x17efc
cmpl $0x1, %ecx
jne 0x17f05
jmp 0x18296
cmpl $0x2, %ecx
je 0x18296
movl 0xc(%rbx), %ecx
testl %ecx, %ecx
je 0x17f29
movq 0x8(%r15), %rdx
cmpq 0x8(%r14), %rdx
je 0x17f20
cmpl $0x1, %ecx
jne 0x17f29
jmp 0x18296
cmpl $0x2, %ecx
je 0x18296
testl %eax, %eax
je 0x17f4d
movq (%r15), %rcx
movq 0x8(%r15), %rdx
cmpq 0x58(%rcx), %rdx
je 0x17f44
cmpl $0x1, %eax
jne 0x17f4d
jmp 0x18296
cmpl $0x2, %eax
je 0x18296
cmpl $0x0, 0x10(%rbx)
je 0x17f72
callq 0x8b45
movl 0x10(%rbx), %ecx
testb %al, %al
je 0x17f69
cmpl $0x2, %ecx
jne 0x17f72
jmp 0x18296
cmpl $0x1, %ecx
je 0x18296
movl 0x14(%rbx), %eax
testl %eax, %eax
je 0x17f97
movq 0x10(%r15), %rcx
cmpq $0x0, 0x48(%rcx)
je 0x17f8e
cmpl $0x2, %eax
jne 0x17f97
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x28(%rbx), %eax
testl %eax, %eax
je 0x17fbb
movq 0x10(%r15), %rcx
cmpb $0x0, 0x25(%rcx)
je 0x17fb2
cmpl $0x2, %eax
jne 0x17fbb
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x2c(%rbx), %eax
testl %eax, %eax
je 0x17fdf
movq 0x10(%r15), %rcx
cmpb $0x0, 0x26(%rcx)
je 0x17fd6
cmpl $0x2, %eax
jne 0x17fdf
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x30(%rbx), %eax
testl %eax, %eax
je 0x18003
movq 0x10(%r15), %rcx
cmpb $0x0, 0x27(%rcx)
je 0x17ffa
cmpl $0x2, %eax
jne 0x18003
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x34(%rbx), %eax
testl %eax, %eax
je 0x18027
movq 0x10(%r15), %rcx
cmpb $0x0, 0x28(%rcx)
je 0x1801e
cmpl $0x2, %eax
jne 0x18027
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x38(%rbx), %eax
testl %eax, %eax
je 0x1804b
movq 0x10(%r15), %rcx
cmpb $0x0, 0x29(%rcx)
je 0x18042
cmpl $0x2, %eax
jne 0x1804b
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x58(%rbx), %eax
testl %eax, %eax
je 0x1806f
movq 0x10(%r15), %rcx
cmpl $0x0, 0x4(%rcx)
je 0x18066
cmpl $0x1, %eax
jne 0x1806f
jmp 0x18296
cmpl $0x2, %eax
je 0x18296
movl 0x5c(%rbx), %eax
testl %eax, %eax
je 0x18093
movq 0x10(%r15), %rcx
cmpl $0x1, 0x4(%rcx)
jne 0x1808a
cmpl $0x2, %eax
jne 0x18093
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
cmpl $0x0, 0x44(%rbx)
je 0x180c0
movq 0x10(%r15), %rdi
movq 0x10(%r14), %rsi
callq 0x9892
movl 0x44(%rbx), %ecx
testb %al, %al
je 0x180b7
cmpl $0x2, %ecx
jne 0x180c0
jmp 0x18296
cmpl $0x1, %ecx
je 0x18296
cmpl $0x0, 0x48(%rbx)
je 0x180ed
movq 0x10(%r14), %rdi
movq 0x10(%r15), %rsi
callq 0x9892
movl 0x48(%rbx), %ecx
testb %al, %al
je 0x180e4
cmpl $0x2, %ecx
jne 0x180ed
jmp 0x18296
cmpl $0x1, %ecx
je 0x18296
movq 0x10(%r15), %rax
movq 0x48(%rax), %r15
testq %r15, %r15
je 0x18148
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x18123
movq 0x48(%rax), %rsi
testq %rsi, %rsi
je 0x18123
movl 0x40(%rbx), %ebp
testl %ebp, %ebp
je 0x18123
movq %r15, %rdi
callq 0x4820
testl %eax, %eax
je 0x181ec
cmpl $0x1, 0x40(%rbx)
je 0x18296
movl 0x18(%rbx), %eax
testl %eax, %eax
je 0x181ad
cmpl $0x0, 0x308(%r15)
je 0x181a4
cmpl $0x1, %eax
jne 0x181ad
jmp 0x18296
cmpl $0x1, 0x40(%rbx)
je 0x18296
cmpl $0x1, 0x18(%rbx)
je 0x18296
cmpl $0x1, 0x1c(%rbx)
je 0x18296
cmpl $0x1, 0x20(%rbx)
je 0x18296
cmpl $0x1, 0x24(%rbx)
je 0x18296
cmpl $0x1, 0x4c(%rbx)
je 0x18296
cmpl $0x1, 0x50(%rbx)
je 0x18296
cmpl $0x1, 0x54(%rbx)
je 0x18296
cmpl $0x1, 0x3c(%rbx)
setne %al
jmp 0x18298
cmpl $0x2, %eax
je 0x18296
movl 0x1c(%rbx), %eax
testl %eax, %eax
je 0x181d1
cmpl $0x1, 0x308(%r15)
jne 0x181c8
cmpl $0x2, %eax
jne 0x181d1
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x20(%rbx), %eax
testl %eax, %eax
je 0x18203
cmpl $0x2, 0x308(%r15)
jne 0x181fa
cmpl $0x2, %eax
jne 0x18203
jmp 0x18296
cmpl $0x2, %ebp
jne 0x1812d
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x24(%rbx), %eax
testl %eax, %eax
je 0x18220
cmpl $0x3, 0x308(%r15)
jne 0x1821b
cmpl $0x2, %eax
jne 0x18220
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x4c(%rbx), %eax
testl %eax, %eax
je 0x1823d
cmpl $0x0, 0x310(%r15)
je 0x18238
cmpl $0x1, %eax
jne 0x1823d
jmp 0x18296
cmpl $0x2, %eax
je 0x18296
movl 0x50(%rbx), %eax
testl %eax, %eax
je 0x1825a
cmpl $0x1, 0x310(%r15)
jne 0x18255
cmpl $0x2, %eax
jne 0x1825a
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x54(%rbx), %eax
testl %eax, %eax
je 0x18277
cmpl $0x2, 0x310(%r15)
jne 0x18272
cmpl $0x2, %eax
jne 0x18277
jmp 0x18296
cmpl $0x1, %eax
je 0x18296
movl 0x3c(%rbx), %eax
testl %eax, %eax
je 0x1828d
cmpb $0x0, 0x304(%r15)
je 0x18291
cmpl $0x2, %eax
je 0x18296
movb $0x1, %al
jmp 0x18298
cmpl $0x1, %eax
jne 0x1828d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq