// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %rdx, -0x38(%rbp)
movl %esi, %r12d
movq %rdi, %rbx
xorl %eax, %eax
movl %r8d, -0x3c(%rbp)
testl %r8d, %r8d
setne %al
movl %eax, -0x44(%rbp)
testl %r12d, %r12d
je 0xaa62
movzbl (%rbx), %eax
cmpl $0x3f, %eax
je 0xa95e
cmpl $0x5b, %eax
je 0xa911
cmpl $0x5c, %eax
je 0xa979
cmpl $0x2a, %eax
je 0xaa0c
movl %ecx, %r14d
movl %r12d, %r15d
movq %rbx, %r13
jmp 0xa993
movl %ecx, %r14d
movq -0x38(%rbp), %r15
movzbl (%r15), %edx
movl %edx, -0x2c(%rbp)
leaq 0x1(%rbx), %rdi
leal -0x1(%r12), %esi
movl -0x44(%rbp), %ecx
callq 0x1578d
testq %rax, %rax
je 0xaa6d
movq %rax, %r13
movl %r14d, %ecx
decl %ecx
incq %r15
movq %r15, -0x38(%rbp)
subl %r13d, %ebx
movl %r12d, %r15d
movl $0x0, %r12d
addl %ebx, %r15d
movq %rax, %rbx
jne 0xa9ce
jmp 0xa8df
movq -0x38(%rbp), %rdx
movzbl (%rdx), %eax
movl %eax, -0x2c(%rbp)
incq %rdx
movq %rdx, -0x38(%rbp)
decl %ecx
movl %r12d, %r15d
movq %rbx, %r13
jmp 0xa9ce
movl %ecx, %r14d
leaq 0x1(%rbx), %r13
xorl %eax, %eax
cmpb $0x0, 0x1(%rbx)
setne %al
cmoveq %rbx, %r13
subl %eax, %r12d
movl %r12d, %r15d
movq -0x38(%rbp), %r12
movq %r12, %rdi
leaq -0x2c(%rbp), %rsi
movl -0x3c(%rbp), %ebx
movl %ebx, %edx
callq 0x158c9
movq %r13, %rdi
leaq -0x40(%rbp), %rsi
movl %ebx, %edx
callq 0x158c9
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0xaa6d
incq %r12
movq %r12, -0x38(%rbp)
movl %r14d, %ecx
decl %ecx
movq %r13, %rdi
leaq -0x40(%rbp), %rsi
movl -0x3c(%rbp), %edx
movl %ecx, %ebx
callq 0x158c9
movl %ebx, %ecx
leaq 0x1(%r13), %rbx
leal -0x1(%r15), %r12d
testl %ecx, %ecx
jne 0xa8df
movl %r15d, %ecx
pushq $0x1
popq %rax
cmpb $0x2a, (%r13,%rax)
jne 0xaa5c
cmpl %eax, %ecx
je 0xaa5c
incq %rax
jmp 0xa9f7
testb %al, %al
je 0xaa1d
addl $-0x1, %r12d
setb %al
cmpb $0x2a, 0x1(%rbx)
leaq 0x1(%rbx), %rbx
je 0xaa08
pushq $0x1
popq %r13
testl %r12d, %r12d
je 0xaa70
movl %ecx, %r15d
subl $0x1, %r15d
jb 0xaa6d
movq %rbx, %rdi
movl %r12d, %esi
movq -0x38(%rbp), %r14
movq %r14, %rdx
movl -0x3c(%rbp), %r8d
callq 0xa8b5
testl %eax, %eax
jne 0xaa70
movzbl (%r14), %eax
movl %eax, -0x2c(%rbp)
incq %r14
movq %r14, -0x38(%rbp)
movl %r15d, %ecx
jmp 0xaa29
subl %eax, %r15d
movl %r15d, %ecx
xorl %r13d, %r13d
testl %ecx, %ecx
sete %r13b
jmp 0xaa70
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq