// File: /workspace/github_c_makefile_star2_O2/s3lase[P]v6shell/glob6.c
// Function: glob2
static bool
glob2(const UChar *ename, const UChar *pattern)
{
	int cok, rok;		/* `[...]' - cok (class), rok (range) */
	UChar c, ec, pc;
	const UChar *e, *n, *p;

	e = ename;
	p = pattern;
	if ((ec = *e++) != EOS)
		if ((ec &= ASCII) == EOS)
			ec = (UChar)QUOTE;

	switch (pc = *p++) {
	case EOS:
		return ec == EOS;

	case ASTERISK:
		/*
		 * Ignore all but the last `*' in a group of consecutive
		 * `*' characters to avoid unnecessary glob2() recursion.
		 */
		while (*p++ == ASTERISK)
			;	/* nothing */
		if (*--p == EOS)
			return true;
		e--;
		while (*e != EOS)
			if (glob2(e++, p))
				return true;
		break;

	case QUESTION:
		if (ec != EOS)
			return glob2(e, p);
		break;

	case LBRACKET:
		if (*p == EOS)
			break;
		for (c = UCHAR(EOS), cok = rok = 0, n = p + 1; ; ) {
			pc = *p++;
			if (pc == RBRACKET && p > n) {
				if (cok > 0 || rok > 0)
					return glob2(e, p);
				break;
			}
			if (*p == EOS)
				break;
			if (pc == HYPHEN && c != EOS && *p != RBRACKET) {
				pc = *p++ & ASCII;
				if (*p == EOS)
					break;
				if (c <= ec && ec <= pc)
					rok++;
				else if (c == ec)
					cok--;
				c = UCHAR(EOS);
			} else {
				c = pc & ASCII;
				if (ec == c)
					cok++;
			}
		}
		break;

	default:
		if ((pc & ASCII) == ec)
			return glob2(e, p);
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movl $0x80, %eax
xorl %ecx, %ecx
pushq $0x1
popq %rdx
movb (%rdi), %r11b
movl %r11d, %esi
andb $0x7f, %sil
movzbl %sil, %r9d
cmovel %eax, %r9d
leaq 0x1(%rdi), %rsi
testb %r11b, %r11b
cmovel %ecx, %r9d
sete %bl
leaq 0x1(%r14), %r8
movzbl (%r14), %r10d
cmpl $0x3f, %r10d
je 0x183c
cmpl $0x5b, %r10d
je 0x184c
testl %r10d, %r10d
je 0x190f
cmpl $0x2a, %r10d
je 0x191a
andb $0x7f, %r10b
movq %rsi, %rdi
movq %r8, %r14
cmpb %r9b, %r10b
je 0x17e1
jmp 0x190d
movq %rsi, %rdi
movq %r8, %r14
testb %r11b, %r11b
jne 0x17e1
jmp 0x190d
movb (%r8), %bpl
xorl %ebx, %ebx
testb %bpl, %bpl
je 0x190f
movzbl %r9b, %r11d
xorl %r10d, %r10d
xorl %r14d, %r14d
movq %rdx, %rdi
cmpq $0x2, %rdi
jl 0x1873
cmpb $0x5d, %bpl
je 0x18eb
movb (%r8,%rdi), %r15b
testb %r15b, %r15b
je 0x190d
testl %r14d, %r14d
je 0x18b5
cmpb $0x2d, %bpl
jne 0x18b5
cmpb $0x5d, %r15b
je 0x18b5
movb 0x1(%r8,%rdi), %bpl
testb %bpl, %bpl
je 0x190d
cmpl %r11d, %r14d
ja 0x18cf
andb $0x7f, %r15b
cmpb %r15b, %r9b
ja 0x18cf
incl %r10d
addq $0x2, %rdi
xorl %r14d, %r14d
jmp 0x1867
andb $0x7f, %bpl
movzbl %bpl, %r14d
xorl %r12d, %r12d
cmpb %r14b, %r9b
sete %r12b
incq %rdi
movl %r15d, %ebp
jmp 0x18e3
xorl %r12d, %r12d
cmpl %r11d, %r14d
sete %r12b
negl %r12d
addq $0x2, %rdi
xorl %r14d, %r14d
addl %r12d, %ebx
jmp 0x1867
testl %ebx, %ebx
setg %r9b
testl %r10d, %r10d
setg %r10b
orb %r9b, %r10b
addq %rdi, %r8
movq %rsi, %rdi
movq %r8, %r14
testb %r10b, %r10b
jne 0x17e1
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movzbl 0x1(%r14), %eax
incq %r14
cmpl $0x2a, %eax
je 0x191a
testl %eax, %eax
jne 0x192f
movb $0x1, %bl
jmp 0x190f
cmpb $0x0, (%rdi)
setne %bl
je 0x190f
leaq 0x1(%rdi), %r15
movq %r14, %rsi
callq 0x17cc
movq %r15, %rdi
testb %al, %al
je 0x192f
jmp 0x190f