// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
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 0x187f
cmpl $0x3f, %r11d
jne 0x1962
movq %rdx, %rdi
movq %r8, %rbx
testb %r10b, %r10b
jne 0x1835
jmp 0x1980
cmpl $0x5b, %r11d
jne 0x196d
xorl %ebp, %ebp
cmpb $0x0, (%r8)
je 0x1982
leaq 0x2(%rbx), %r15
movb 0x1(%rbx), %r14b
movzbl %sil, %edi
movl $0x1, %r10d
movl $0x2, %r11d
xorl %r8d, %r8d
xorl %r9d, %r9d
movb (%r15), %r15b
testb %r15b, %r15b
je 0x1980
testl %ebp, %ebp
je 0x18f1
cmpb $0x2d, %r14b
jne 0x18f1
cmpb $0x5d, %r15b
je 0x18f1
cmpb $0x0, 0x2(%rbx,%r10)
je 0x1980
addq $0x2, %r10
cmpl %edi, %ebp
ja 0x1908
andb $0x7f, %r15b
cmpb %r15b, %sil
ja 0x1908
incl %r8d
jmp 0x1914
andb $0x7f, %r14b
movzbl %r14b, %ebp
xorl %r10d, %r10d
cmpb %bpl, %sil
sete %r10b
addl %r10d, %r9d
jmp 0x1919
xorl %r11d, %r11d
cmpl %edi, %ebp
sete %r11b
subl %r11d, %r9d
xorl %ebp, %ebp
movq %r10, %r11
movq %r11, %r10
incq %r11
leaq (%rbx,%r10), %r15
incq %r15
movb -0x1(%r15), %r14b
cmpb $0x5d, %r14b
sete %r12b
cmpq $0x2, %r10
setge %r13b
testb %r12b, %r13b
je 0x18b3
testl %r9d, %r9d
setg %sil
testl %r8d, %r8d
setg %dil
orb %sil, %dil
movq %rdx, %rdi
movq %r15, %rbx
jne 0x1835
jmp 0x1980
testl %r11d, %r11d
je 0x1982
cmpl $0x2a, %r11d
je 0x1993
andb $0x7f, %r9b
movq %rdx, %rdi
movq %r8, %rbx
cmpb %sil, %r9b
je 0x1835
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl 0x1(%rbx), %eax
incq %rbx
cmpl $0x2a, %eax
je 0x1993
testl %eax, %eax
jne 0x19a8
movb $0x1, %bpl
jmp 0x1982
cmpb $0x0, (%rdi)
setne %bpl
je 0x1982
leaq 0x1(%rdi), %r14
movq %rbx, %rsi
callq 0x1820
movq %r14, %rdi
testb %al, %al
je 0x19a8
jmp 0x1982
nop