// File: /workspace/github_c_makefile_star2_O3/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 %rbx
pushq %rax
movq %rsi, %rbx
movl $0x80, %eax
xorl %ecx, %ecx
leaq 0x1(%rdi), %rdx
movb (%rdi), %r10b
movl %r10d, %esi
andb $0x7f, %sil
movzbl %sil, %esi
cmovel %eax, %esi
testb %r10b, %r10b
sete %bpl
cmovel %ecx, %esi
leaq 0x1(%rbx), %r8
movb (%rbx), %r9b
movzbl %r9b, %r11d
cmpl $0x5a, %r11d
jg 0x1875
cmpl $0x3f, %r11d
jne 0x194d
movq %rdx, %rdi
movq %r8, %rbx
testb %r10b, %r10b
jne 0x182b
jmp 0x196b
cmpl $0x5b, %r11d
jne 0x1958
movb (%r8), %r8b
xorl %ebp, %ebp
testb %r8b, %r8b
je 0x196d
leaq 0x2(%rbx), %r15
movzbl %sil, %edi
movl $0x1, %r11d
movl $0x2, %r14d
xorl %r9d, %r9d
xorl %r10d, %r10d
movb (%r15), %r15b
testb %r15b, %r15b
je 0x196b
testl %ebp, %ebp
je 0x18e7
cmpb $0x2d, %r8b
jne 0x18e7
cmpb $0x5d, %r15b
je 0x18e7
movb 0x2(%rbx,%r11), %r8b
testb %r8b, %r8b
je 0x196b
addq $0x2, %r11
cmpl %edi, %ebp
ja 0x1905
andb $0x7f, %r15b
cmpb %r15b, %sil
ja 0x1905
incl %r9d
jmp 0x1911
andb $0x7f, %r8b
movzbl %r8b, %ebp
xorl %r8d, %r8d
cmpb %bpl, %sil
sete %r8b
addl %r8d, %r10d
movb (%rbx,%r14), %r8b
movq %r14, %r11
jmp 0x1913
xorl %r14d, %r14d
cmpl %edi, %ebp
sete %r14b
subl %r14d, %r10d
xorl %ebp, %ebp
leaq 0x1(%r11), %r14
leaq (%rbx,%r11), %r15
incq %r15
cmpq $0x2, %r11
jl 0x18a7
cmpb $0x5d, %r8b
jne 0x18a7
testl %r10d, %r10d
setg %sil
testl %r9d, %r9d
setg %dil
orb %sil, %dil
movq %rdx, %rdi
movq %r15, %rbx
jne 0x182b
jmp 0x196b
testl %r11d, %r11d
je 0x196d
cmpl $0x2a, %r11d
je 0x197a
andb $0x7f, %r9b
movq %rdx, %rdi
movq %r8, %rbx
cmpb %sil, %r9b
je 0x182b
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movzbl 0x1(%rbx), %eax
incq %rbx
cmpl $0x2a, %eax
je 0x197a
testl %eax, %eax
jne 0x198f
movb $0x1, %bpl
jmp 0x196d
cmpb $0x0, (%rdi)
setne %bpl
je 0x196d
leaq 0x1(%rdi), %r14
movq %rbx, %rsi
callq 0x181a
movq %r14, %rdi
testb %al, %al
je 0x198f
jmp 0x196d
nopl (%rax)