// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: patternCompare
static int patternCompare(
  const u8 *zPattern,              /* The glob pattern */
  const u8 *zString,               /* The string to compare against the glob */
  const struct compareInfo *pInfo, /* Information about how to do the compare */
  u32 matchOther                   /* The escape char (LIKE) or '[' (GLOB) */
){
  u32 c, c2;                       /* Next pattern and input string chars */
  u32 matchOne = pInfo->matchOne;  /* "?" or "_" */
  u32 matchAll = pInfo->matchAll;  /* "*" or "%" */
  u8 noCase = pInfo->noCase;       /* True if uppercase==lowercase */
  const u8 *zEscaped = 0;          /* One past the last escaped input char */

  while( (c = Utf8Read(zPattern))!=0 ){
    if( c==matchAll ){  /* Match "*" */
      /* Skip over multiple "*" characters in the pattern.  If there
      ** are also "?" characters, skip those as well, but consume a
      ** single character of the input string for each "?" skipped */
      while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
        if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
          return SQLITE_NOWILDCARDMATCH;
        }
      }
      if( c==0 ){
        return SQLITE_MATCH;   /* "*" at the end of the pattern matches */
      }else if( c==matchOther ){
        if( pInfo->matchSet==0 ){
          c = sqlite3Utf8Read(&zPattern);
          if( c==0 ) return SQLITE_NOWILDCARDMATCH;
        }else{
          /* "[...]" immediately follows the "*".  We have to do a slow
          ** recursive search in this case, but it is an unusual case. */
          assert( matchOther<0x80 );  /* '[' is a single-byte character */
          while( *zString ){
            int bMatch = patternCompare(&zPattern[-1],zString,pInfo,matchOther);
            if( bMatch!=SQLITE_NOMATCH ) return bMatch;
            SQLITE_SKIP_UTF8(zString);
          }
          return SQLITE_NOWILDCARDMATCH;
        }
      }

      /* At this point variable c contains the first character of the
      ** pattern string past the "*".  Search in the input string for the
      ** first matching character and recursively continue the match from
      ** that point.
      **
      ** For a case-insensitive search, set variable cx to be the same as
      ** c but in the other case and search the input string for either
      ** c or cx.
      */
      if( c<=0x80 ){
        char zStop[3];
        int bMatch;
        if( noCase ){
          zStop[0] = sqlite3Toupper(c);
          zStop[1] = sqlite3Tolower(c);
          zStop[2] = 0;
        }else{
          zStop[0] = c;
          zStop[1] = 0;
        }
        while(1){
          zString += strcspn((const char*)zString, zStop);
          if( zString[0]==0 ) break;
          zString++;
          bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
          if( bMatch!=SQLITE_NOMATCH ) return bMatch;
        }
      }else{
        int bMatch;
        while( (c2 = Utf8Read(zString))!=0 ){
          if( c2!=c ) continue;
          bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
          if( bMatch!=SQLITE_NOMATCH ) return bMatch;
        }
      }
      return SQLITE_NOWILDCARDMATCH;
    }
    if( c==matchOther ){
      if( pInfo->matchSet==0 ){
        c = sqlite3Utf8Read(&zPattern);
        if( c==0 ) return SQLITE_NOMATCH;
        zEscaped = zPattern;
      }else{
        u32 prior_c = 0;
        int seen = 0;
        int invert = 0;
        c = sqlite3Utf8Read(&zString);
        if( c==0 ) return SQLITE_NOMATCH;
        c2 = sqlite3Utf8Read(&zPattern);
        if( c2=='^' ){
          invert = 1;
          c2 = sqlite3Utf8Read(&zPattern);
        }
        if( c2==']' ){
          if( c==']' ) seen = 1;
          c2 = sqlite3Utf8Read(&zPattern);
        }
        while( c2 && c2!=']' ){
          if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){
            c2 = sqlite3Utf8Read(&zPattern);
            if( c>=prior_c && c<=c2 ) seen = 1;
            prior_c = 0;
          }else{
            if( c==c2 ){
              seen = 1;
            }
            prior_c = c2;
          }
          c2 = sqlite3Utf8Read(&zPattern);
        }
        if( c2==0 || (seen ^ invert)==0 ){
          return SQLITE_NOMATCH;
        }
        continue;
      }
    }
    c2 = Utf8Read(zString);
    if( c==c2 ) continue;
    if( noCase  && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){
      continue;
    }
    if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
    return SQLITE_NOMATCH;
  }
  return *zString==0 ? SQLITE_MATCH : SQLITE_NOMATCH;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movb 0x3(%rax), %al
movb %al, -0x35(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x3cca16
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movzbl (%rax), %eax
movl %eax, -0x60(%rbp)
jmp 0x3cca22
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, %eax
je 0x3cceed
movl -0x28(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x3cccc4
jmp 0x3cca3f
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x3cca64
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movzbl (%rax), %eax
movl %eax, -0x64(%rbp)
jmp 0x3cca70
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %ecx
movl %ecx, -0x28(%rbp)
movb $0x1, %al
cmpl -0x34(%rbp), %ecx
movb %al, -0x65(%rbp)
je 0x3cca8c
movl -0x28(%rbp), %eax
cmpl -0x30(%rbp), %eax
sete %al
movb %al, -0x65(%rbp)
movb -0x65(%rbp), %al
testb $0x1, %al
jne 0x3cca95
jmp 0x3ccab9
movl -0x28(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x3ccab7
leaq -0x18(%rbp), %rdi
callq 0x411dc0
cmpl $0x0, %eax
jne 0x3ccab7
movl $0x2, -0x4(%rbp)
jmp 0x3ccf04
jmp 0x3cca3f
cmpl $0x0, -0x28(%rbp)
jne 0x3ccacb
movl $0x0, -0x4(%rbp)
jmp 0x3ccf04
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x3ccb8c
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x3ccb07
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x3ccb02
movl $0x2, -0x4(%rbp)
jmp 0x3ccf04
jmp 0x3ccb8a
jmp 0x3ccb09
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3ccb7e
movq -0x10(%rbp), %rdi
addq $-0x1, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x3cc9b0
movl %eax, -0x44(%rbp)
cmpl $0x1, -0x44(%rbp)
je 0x3ccb3e
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3ccf04
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
cmpl $0xc0, %eax
jl 0x3ccb7c
jmp 0x3ccb59
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x3ccb7a
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3ccb59
jmp 0x3ccb7c
jmp 0x3ccb09
movl $0x2, -0x4(%rbp)
jmp 0x3ccf04
jmp 0x3ccb8c
jmp 0x3ccb8e
cmpl $0x80, -0x28(%rbp)
ja 0x3ccc44
cmpb $0x0, -0x35(%rbp)
je 0x3ccbdd
movl -0x28(%rbp), %eax
movl -0x28(%rbp), %ecx
movzbl %cl, %ecx
movl %ecx, %edx
leaq 0x1da01d(%rip), %rcx    # 0x5a6bd0
movzbl (%rcx,%rdx), %ecx
andl $0x20, %ecx
xorl $-0x1, %ecx
andl %ecx, %eax
movb %al, -0x47(%rbp)
movl -0x28(%rbp), %eax
movzbl %al, %eax
movl %eax, %ecx
leaq 0x1d9e8f(%rip), %rax    # 0x5a6a60
movb (%rax,%rcx), %al
movb %al, -0x46(%rbp)
movb $0x0, -0x45(%rbp)
jmp 0x3ccbe7
movl -0x28(%rbp), %eax
movb %al, -0x47(%rbp)
movb $0x0, -0x46(%rbp)
jmp 0x3ccbe9
movq -0x18(%rbp), %rdi
leaq -0x47(%rbp), %rsi
callq 0x19090
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x3ccc0c
jmp 0x3ccc42
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x3cc9b0
movl %eax, -0x4c(%rbp)
cmpl $0x1, -0x4c(%rbp)
je 0x3ccc40
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3ccf04
jmp 0x3ccbe9
jmp 0x3cccb8
jmp 0x3ccc46
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x3ccc6b
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3ccc77
leaq -0x18(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x3cccb6
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
je 0x3ccc8c
jmp 0x3ccc46
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x3cc9b0
movl %eax, -0x50(%rbp)
cmpl $0x1, -0x50(%rbp)
je 0x3cccb4
movl -0x50(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3ccf04
jmp 0x3ccc46
jmp 0x3cccb8
movl $0x2, -0x4(%rbp)
jmp 0x3ccf04
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x3cce39
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x3ccd08
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x3cccfb
movl $0x1, -0x4(%rbp)
jmp 0x3ccf04
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x3cce37
movl $0x0, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x3ccd3b
movl $0x1, -0x4(%rbp)
jmp 0x3ccf04
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x2c(%rbp)
cmpl $0x5e, -0x2c(%rbp)
jne 0x3ccd60
movl $0x1, -0x5c(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x2c(%rbp)
cmpl $0x5d, -0x2c(%rbp)
jne 0x3ccd7f
cmpl $0x5d, -0x28(%rbp)
jne 0x3ccd73
movl $0x1, -0x58(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x2c(%rbp)
jmp 0x3ccd81
xorl %eax, %eax
cmpl $0x0, -0x2c(%rbp)
movb %al, -0x6d(%rbp)
je 0x3ccd96
cmpl $0x5d, -0x2c(%rbp)
setne %al
movb %al, -0x6d(%rbp)
movb -0x6d(%rbp), %al
testb $0x1, %al
jne 0x3ccd9f
jmp 0x3cce15
cmpl $0x2d, -0x2c(%rbp)
jne 0x3ccdef
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5d, %eax
je 0x3ccdef
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x3ccdef
cmpl $0x0, -0x54(%rbp)
jbe 0x3ccdef
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x54(%rbp), %eax
jb 0x3ccde6
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
ja 0x3ccde6
movl $0x1, -0x58(%rbp)
movl $0x0, -0x54(%rbp)
jmp 0x3cce04
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x3ccdfe
movl $0x1, -0x58(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x54(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x2c(%rbp)
jmp 0x3ccd81
cmpl $0x0, -0x2c(%rbp)
je 0x3cce26
movl -0x58(%rbp), %eax
xorl -0x5c(%rbp), %eax
cmpl $0x0, %eax
jne 0x3cce32
movl $0x1, -0x4(%rbp)
jmp 0x3ccf04
jmp 0x3cc9f1
jmp 0x3cce39
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x3cce5e
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0x3cce6a
leaq -0x18(%rbp), %rdi
callq 0x411dc0
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x3cce7d
jmp 0x3cc9f1
movzbl -0x35(%rbp), %eax
cmpl $0x0, %eax
je 0x3ccec7
movl -0x28(%rbp), %eax
movzbl %al, %eax
movl %eax, %ecx
leaq 0x1d9bcb(%rip), %rax    # 0x5a6a60
movzbl (%rax,%rcx), %eax
movl -0x2c(%rbp), %ecx
movzbl %cl, %ecx
movl %ecx, %edx
leaq 0x1d9bb8(%rip), %rcx    # 0x5a6a60
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x3ccec7
cmpl $0x80, -0x28(%rbp)
jae 0x3ccec7
cmpl $0x80, -0x2c(%rbp)
jae 0x3ccec7
jmp 0x3cc9f1
movl -0x28(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x3ccee4
movq -0x10(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x3ccee4
cmpl $0x0, -0x2c(%rbp)
je 0x3ccee4
jmp 0x3cc9f1
movl $0x1, -0x4(%rbp)
jmp 0x3ccf04
movq -0x18(%rbp), %rax
movzbl (%rax), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq