// File: /workspace/github_c_makefile_star2_O1/zenlinux[P]cwm/search.c
// Function: search_match_client
void
search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
{
	struct winname	*wn;
	struct menu	*mi, *tierp[4], *before = NULL;

	TAILQ_INIT(resultq);

	(void)memset(tierp, 0, sizeof(tierp));

	/*
	 * In order of rank:
	 *
	 *   1. Look through labels.
	 *   2. Look at title history, from present to past.
	 *   3. Look at window class name.
	 */

	TAILQ_FOREACH(mi, menuq, entry) {
		int tier = -1, t;
		struct client_ctx *cc = mi->ctx;

		/* First, try to match on labels. */
		if (cc->label != NULL && strsubmatch(search, cc->label, 0)) {
			cc->matchname = cc->label;
			tier = 0;
		}

		/* Then, on window names. */
		if (tier < 0) {
			TAILQ_FOREACH_REVERSE(wn, &cc->nameq, winname_q, entry)
				if (strsubmatch(search, wn->name, 0)) {
					cc->matchname = wn->name;
					tier = 2;
					break;
				}
		}

		/* Then if there is a match on the window class name. */
		if (tier < 0 && strsubmatch(search, cc->app_class, 0)) {
			cc->matchname = cc->app_class;
			tier = 3;
		}

		if (tier < 0)
			continue;

		/*
		 * De-rank a client one tier if it's the current
		 * window.  Furthermore, this is denoted by a "!" when
		 * printing the window name in the search menu.
		 */
		if (cc == client_current() && tier < nitems(tierp) - 1)
			tier++;

		/* Clients that are hidden get ranked one up. */
		if (cc->flags & CLIENT_HIDDEN && tier > 0)
			tier--;

		assert(tier < nitems(tierp));

		/*
		 * If you have a tierp, insert after it, and make it
		 * the new tierp.  If you don't have a tierp, find the
		 * first nonzero tierp above you, insert after it.
		 * Always make your current tierp the newly inserted
		 * entry.
		 */
		for (t = tier; t >= 0 && ((before = tierp[t]) == NULL); t--)
			;

		if (before == NULL)
			TAILQ_INSERT_HEAD(resultq, mi, resultentry);
		else
			TAILQ_INSERT_AFTER(resultq, before, mi, resultentry);

		tierp[tier] = mi;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq $0x0, (%rsi)
movq %rsi, (%rsp)
movq %rsi, 0x8(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq (%rdi), %r12
testq %r12, %r12
je 0x84b2
movq %rdx, %rbx
movq (%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movq 0x88(%r12), %rbp
movq 0xe0(%rbp), %r15
testq %r15, %r15
je 0x83a2
xorl %r13d, %r13d
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x84e0
testl %eax, %eax
jne 0x83e7
movq 0xc8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %r14
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x83dd
movq 0x10(%r14), %r15
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x84e0
testl %eax, %eax
jne 0x83e1
movq 0x8(%r14), %rax
movq 0x8(%rax), %rax
movq (%rax), %r14
jmp 0x83b6
movb $0x1, %al
jmp 0x83f0
movl $0x2, %r13d
movq %r15, 0xe8(%rbp)
xorl %eax, %eax
testb %al, %al
je 0x8421
movq 0xf8(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x84e0
testl %eax, %eax
je 0x841b
movq %r15, 0xe8(%rbp)
movl $0x3, %r13d
jmp 0x8421
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %r13d, %r13d
js 0x84a5
callq 0x6da4
cmpq %rax, %rbp
sete %al
cmpl $0x3, %r13d
setb %cl
andb %al, %cl
movzbl %cl, %ecx
addl %r13d, %ecx
testl %ecx, %ecx
setg %al
andb 0xa8(%rbp), %al
movzbl %al, %eax
subl %eax, %ecx
cmpl $0x3, %ecx
ja 0x84c1
movslq %ecx, %rax
movl %ecx, %edx
movq 0x10(%rsp,%rdx,8), %rdx
testq %rdx, %rdx
jne 0x846f
leal -0x1(%rcx), %edx
testl %ecx, %ecx
movl %edx, %ecx
jg 0x8458
xorl %edx, %edx
leaq 0x10(%rdx), %rcx
testq %rdx, %rdx
cmoveq (%rsp), %rcx
movq (%rcx), %rdx
leaq 0x10(%r12), %rsi
movq %rdx, 0x10(%r12)
leaq 0x18(%rdx), %rdi
testq %rdx, %rdx
cmoveq 0x8(%rsp), %rdi
movq %rsi, (%rdi)
movq %r12, (%rcx)
movq %rcx, 0x18(%r12)
movq %r12, 0x10(%rsp,%rax,8)
movq (%r12), %r12
testq %r12, %r12
jne 0x837a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5c4d(%rip), %rdi      # 0xe115
leaq 0x5c5b(%rip), %rsi      # 0xe12a
leaq 0x5c5d(%rip), %rcx      # 0xe133
movl $0x63, %edx
callq 0x5190