// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/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 esc                          /* The escape character */
){
  u32 c, c2;                       /* Next pattern and input string chars */
  u32 matchOne = pInfo->matchOne;  /* "?" or "_" */
  u32 matchAll = pInfo->matchAll;  /* "*" or "%" */
  u32 matchOther;                  /* "[" or the escape character */
  u8 noCase = pInfo->noCase;       /* True if uppercase==lowercase */
  const u8 *zEscaped = 0;          /* One past the last escaped input char */
  
  /* The GLOB operator does not have an ESCAPE clause.  And LIKE does not
  ** have the matchSet operator.  So we either have to look for one or
  ** the other, never both.  Hence the single variable matchOther is used
  ** to store the one we have to look for.
  */
  matchOther = esc ? esc : pInfo->matchSet;

  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 0;
        }
      }
      if( c==0 ){
        return 1;   /* "*" at the end of the pattern matches */
      }else if( c==matchOther ){
        if( esc ){
          c = sqlite3Utf8Read(&zPattern);
          if( c==0 ) return 0;
        }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
                 && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){
            SQLITE_SKIP_UTF8(zString);
          }
          return *zString!=0;
        }
      }

      /* 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 contine 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 ){
        u32 cx;
        if( noCase ){
          cx = sqlite3Toupper(c);
          c = sqlite3Tolower(c);
        }else{
          cx = c;
        }
        while( (c2 = *(zString++))!=0 ){
          if( c2!=c && c2!=cx ) continue;
          if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;
        }
      }else{
        while( (c2 = Utf8Read(zString))!=0 ){
          if( c2!=c ) continue;
          if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;
        }
      }
      return 0;
    }
    if( c==matchOther ){
      if( esc ){
        c = sqlite3Utf8Read(&zPattern);
        if( c==0 ) return 0;
        zEscaped = zPattern;
      }else{
        u32 prior_c = 0;
        int seen = 0;
        int invert = 0;
        c = sqlite3Utf8Read(&zString);
        if( c==0 ) return 0;
        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 0;
        }
        continue;
      }
    }
    c2 = Utf8Read(zString);
    if( c==c2 ) continue;
    if( noCase && c<0x80 && c2<0x80 && sqlite3Tolower(c)==sqlite3Tolower(c2) ){
      continue;
    }
    if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
    return 0;
  }
  return *zString==0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movl %ecx, -0x48(%rbp)
movl %ecx, -0x44(%rbp)
testl %ecx, %ecx
jne 0x14257
movzbl 0x2(%rdx), %eax
movl %eax, -0x48(%rbp)
movzbl 0x1(%rdx), %r14d
movzbl (%rdx), %eax
movl %eax, -0x4c(%rbp)
movq %rdx, -0x58(%rbp)
movb 0x3(%rdx), %al
movb %al, -0x29(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %r13d
testl %r13d, %r13d
js 0x1428a
incq %rax
movq %rax, -0x38(%rbp)
jmp 0x14296
leaq -0x38(%rbp), %rdi
callq 0x38bce
movl %eax, %r13d
testl %r13d, %r13d
je 0x1440e
cmpl -0x4c(%rbp), %r13d
je 0x1441a
cmpl -0x48(%rbp), %r13d
jne 0x14326
cmpl $0x0, -0x44(%rbp)
jne 0x1430a
leaq -0x40(%rbp), %rdi
callq 0x38bce
xorl %ebx, %ebx
testl %eax, %eax
je 0x1446a
movl %eax, %r13d
movl %r14d, %r12d
leaq -0x38(%rbp), %rdi
callq 0x38bce
cmpl $0x5e, %eax
jne 0x142e8
leaq -0x38(%rbp), %rdi
callq 0x38bce
pushq $0x1
popq %rbx
xorl %r14d, %r14d
movl $0x0, %r15d
cmpl $0x5d, %eax
jne 0x143a8
xorl %r15d, %r15d
cmpl $0x5d, %r13d
sete %r15b
jmp 0x1439a
leaq -0x38(%rbp), %rdi
callq 0x38bce
testl %eax, %eax
je 0x14468
movl %eax, %r13d
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rcx
movsbl (%rcx), %eax
testl %eax, %eax
js 0x1433a
incq %rcx
movq %rcx, -0x40(%rbp)
jmp 0x14343
leaq -0x40(%rbp), %rdi
callq 0x38bce
cmpl %eax, %r13d
je 0x14274
cmpb $0x0, -0x29(%rbp)
je 0x14374
movl %eax, %ecx
orl %r13d, %ecx
cmpl $0x7f, %ecx
ja 0x14374
movl %r13d, %ecx
leaq 0x54faa(%rip), %rsi     # 0x69310
movb (%rcx,%rsi), %cl
movl %eax, %edx
cmpb (%rdx,%rsi), %cl
je 0x14274
cmpl %r14d, %r13d
jne 0x14468
xorl %ebx, %ebx
testl %eax, %eax
je 0x1446a
movq -0x60(%rbp), %rax
cmpq %rax, -0x38(%rbp)
jne 0x14274
jmp 0x1446a
xorl %eax, %eax
movl %eax, %r14d
leaq -0x38(%rbp), %rdi
callq 0x38bce
cmpl $0x2d, %eax
je 0x143cc
cmpl $0x5d, %eax
je 0x143bb
testl %eax, %eax
jne 0x14402
jmp 0x14468
cmpl %ebx, %r15d
movl %r12d, %r14d
jne 0x14274
jmp 0x14468
movq -0x38(%rbp), %rcx
movb (%rcx), %cl
cmpb $0x5d, %cl
je 0x14402
testb %cl, %cl
sete %cl
testl %r14d, %r14d
sete %dl
orb %cl, %dl
jne 0x14402
leaq -0x38(%rbp), %rdi
callq 0x38bce
cmpl %eax, %r13d
pushq $0x1
popq %rax
cmoval %r15d, %eax
cmpl %r14d, %r13d
cmovael %eax, %r15d
jmp 0x1439a
cmpl %eax, %r13d
pushq $0x1
popq %rcx
cmovel %ecx, %r15d
jmp 0x1439c
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
sete %bl
jmp 0x1446a
leaq -0x40(%rbp), %r12
leaq -0x38(%rbp), %r13
movq -0x38(%rbp), %rax
movsbl (%rax), %r15d
testl %r15d, %r15d
js 0x14438
incq %rax
movq %rax, -0x38(%rbp)
jmp 0x14443
movq %r13, %rdi
callq 0x38bce
movl %eax, %r15d
cmpl -0x4c(%rbp), %r15d
sete %al
cmpl %r14d, %r15d
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x1447c
cmpl %r14d, %r15d
jne 0x14422
movq %r12, %rdi
callq 0x38bce
testl %eax, %eax
jne 0x14422
xorl %ebx, %ebx
movzbl %bl, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r15d, %r15d
je 0x144de
cmpl -0x48(%rbp), %r15d
jne 0x144a1
cmpl $0x0, -0x44(%rbp)
je 0x14532
leaq -0x38(%rbp), %rdi
callq 0x38bce
movl %eax, %r15d
testl %eax, %eax
je 0x14468
cmpl $0x81, %r15d
jae 0x144e2
cmpb $0x0, -0x29(%rbp)
je 0x14584
movl %r15d, %eax
leaq 0x54f82(%rip), %rcx     # 0x69440
movb (%rax,%rcx), %cl
notb %cl
orb $-0x21, %cl
movsbl %cl, %r14d
andl %r15d, %r14d
leaq 0x54e3c(%rip), %rcx     # 0x69310
movzbl (%rax,%rcx), %r15d
jmp 0x14587
movb $0x1, %bl
jmp 0x1446a
movq -0x38(%rbp), %r12
leaq -0x40(%rbp), %r13
movq -0x40(%rbp), %rcx
movsbl (%rcx), %eax
testl %eax, %eax
js 0x144fe
incq %rcx
movq %rcx, -0x40(%rbp)
jmp 0x14506
movq %r13, %rdi
callq 0x38bce
testl %eax, %eax
setne %bl
je 0x1446a
cmpl %r15d, %eax
jne 0x144ea
movq -0x40(%rbp), %rsi
movq %r12, %rdi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x1422d
testl %eax, %eax
je 0x144ea
jmp 0x1446a
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r14
decq %r14
movb (%rax), %r12b
testb %r12b, %r12b
setne %bl
je 0x1446a
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
movq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0x1422d
testl %eax, %eax
jne 0x1446a
leaq 0x1(%r15), %rax
cmpb $-0x40, %r12b
jb 0x1453d
movq %r15, %rax
movb 0x1(%rax), %cl
incq %rax
andb $-0x40, %cl
negb %cl
jo 0x14575
jmp 0x1453d
movl %r15d, %r14d
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r13
incq %r12
movzbl -0x1(%r12), %eax
testl %eax, %eax
setne %bl
je 0x1446a
cmpl %eax, %r15d
je 0x145ad
cmpl %eax, %r14d
jne 0x1458f
movq %r13, %rdi
movq %r12, %rsi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x1422d
testl %eax, %eax
je 0x1458f
jmp 0x1446a