// File: /workspace/github_c_makefile_star2_O3/msteveb[P]autosetup/./jimsh0.c
// Function: JimGlobMatch
static int JimGlobMatch(const char *pattern, int plen, const char *string, int slen, int nocase)
{
    int c;
    int pchar;
    int n;
    const char *p;
    while (plen) {
        switch (pattern[0]) {
            case '*':
                while (pattern[1] == '*' && plen) {
                    pattern++;
                    plen--;
                }
                pattern++;
                plen--;
                if (!plen) {
                    return 1;
                }
                while (slen) {

                    if (JimGlobMatch(pattern, plen, string, slen, nocase))
                        return 1;
                    n = utf8_tounicode(string, &c);
                    string += n;
                    slen -= n;
                }
                return 0;

            case '?':
                n = utf8_tounicode(string, &c);
                string += n;
                slen -= n;
                break;

            case '[': {
                    n = utf8_tounicode(string, &c);
                    string += n;
                    slen -= n;
                    p = JimCharsetMatch(pattern + 1, plen - 1, c, nocase ? JIM_NOCASE : 0);
                    if (!p) {
                        return 0;
                    }
                    plen -= p - pattern;
                    pattern = p;

                    if (!plen) {

                        continue;
                    }
                    break;
                }
            case '\\':
                if (pattern[1]) {
                    pattern++;
                    plen--;
                }

            default:
                n = utf8_tounicode_case(string, &c, nocase);
                string += n;
                slen -= n;
                utf8_tounicode_case(pattern, &pchar, nocase);
                if (pchar != c) {
                    return 0;
                }
                break;
        }
        n = utf8_tounicode_case(pattern, &pchar, nocase);
        pattern += n;
        plen -= n;
        if (!slen) {
            while (*pattern == '*' && plen) {
                pattern++;
                plen--;
            }
            break;
        }
    }
    if (!plen && !slen) {
        return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testl %esi, %esi
je 0xb275
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %r13
xorl %eax, %eax
testl %r8d, %r8d
setne %al
movl %eax, -0x30(%rbp)
movl %r8d, -0x2c(%rbp)
movb (%r13), %bl
movzbl %bl, %eax
cmpl $0x5a, %eax
jle 0xb1ca
cmpl $0x5b, %eax
je 0xb1d9
cmpl $0x5c, %eax
jne 0xb216
leaq 0x1(%r13), %r14
movzbl 0x1(%r13), %ebx
xorl %eax, %eax
testb %bl, %bl
setne %al
movl $0x5c, %edx
cmovel %edx, %ebx
cmoveq %r13, %r14
subl %eax, %r12d
movl %r12d, %edx
jmp 0xb21c
cmpl $0x3f, %eax
jne 0xb20d
decl %ecx
movl %r12d, %edx
movq %r13, %r14
jmp 0xb258
movl %ecx, %ebx
movzbl (%r15), %edx
leaq 0x1(%r13), %rdi
leal -0x1(%r12), %esi
movl -0x30(%rbp), %ecx
callq 0x178ee
testq %rax, %rax
je 0xb2da
movq %rax, %r14
movl %ebx, %ecx
decl %ecx
subl %r14d, %r13d
addl %r13d, %r12d
je 0xb275
movl %r12d, %edx
jmp 0xb254
cmpl $0x2a, %eax
je 0xb298
movl %r12d, %edx
movq %r13, %r14
movzbl (%r15), %r12d
testl %r8d, %r8d
je 0xb246
movl %r12d, %edi
movl %ecx, -0x34(%rbp)
movq %rdx, %r13
callq 0x60e0
movl %eax, %r12d
movzbl %bl, %edi
callq 0x60e0
movq %r13, %rdx
movl -0x34(%rbp), %ecx
jmp 0xb249
movzbl %bl, %eax
cmpl %r12d, %eax
jne 0xb2da
decl %ecx
movl -0x2c(%rbp), %r8d
leaq 0x1(%r14), %r13
leal -0x1(%rdx), %r12d
testl %ecx, %ecx
je 0xb2df
incq %r15
testl %r12d, %r12d
jne 0xb190
movl $0x1, %ecx
xorl %r12d, %r12d
xorl %r14d, %r14d
orl %ecx, %r12d
sete %r14b
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %al, %al
je 0xb2aa
addl $-0x1, %r12d
setb %al
cmpb $0x2a, 0x1(%r13)
leaq 0x1(%r13), %r13
je 0xb294
movl $0x1, %r14d
testl %r12d, %r12d
je 0xb282
testl %ecx, %ecx
je 0xb2da
movq %r13, %rdi
movl %r12d, %esi
movq %r15, %rdx
movl %ecx, %ebx
callq 0xb15f
testl %eax, %eax
jne 0xb282
incq %r15
decl %ebx
movl %ebx, %ecx
movl -0x2c(%rbp), %r8d
jne 0xb2b9
xorl %r14d, %r14d
jmp 0xb282
xorl %ecx, %ecx
cmpb $0x2a, (%r13)
jne 0xb278
testl %r12d, %r12d
je 0xb278
leal -0x2(%rdx), %eax
xorl %ecx, %ecx
leaq 0x1(%rcx), %r12
cmpb $0x2a, 0x2(%r14,%rcx)
jne 0xb305
cmpl %ecx, %eax
movq %r12, %rcx
jne 0xb2f2
notl %r12d
addl %edx, %r12d
xorl %ecx, %ecx
jmp 0xb278