// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movl %ecx, -0x50(%rbp)
movl %ecx, -0x44(%rbp)
testl %ecx, %ecx
jne 0x155e7
movzbl 0x2(%rdx), %eax
movl %eax, -0x50(%rbp)
movzbl 0x1(%rdx), %ebx
movzbl (%rdx), %r13d
movq %rdx, -0x58(%rbp)
movb 0x3(%rdx), %al
movb %al, -0x29(%rbp)
movq $0x0, -0x68(%rbp)
movl %ebx, -0x60(%rbp)
movl %r13d, -0x5c(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %r14d
testl %r14d, %r14d
js 0x1561e
incq %rax
movq %rax, -0x38(%rbp)
jmp 0x1562a
leaq -0x38(%rbp), %rdi
callq 0x400f1
movl %eax, %r14d
testl %r14d, %r14d
je 0x157b5
cmpl %r13d, %r14d
je 0x157c5
cmpl -0x50(%rbp), %r14d
jne 0x156c1
cmpl $0x0, -0x44(%rbp)
jne 0x156a5
leaq -0x40(%rbp), %rdi
callq 0x400f1
testl %eax, %eax
je 0x15812
movl %eax, %r14d
leaq -0x38(%rbp), %rdi
callq 0x400f1
movl %eax, %r15d
xorl %r13d, %r13d
movl $0x0, %r12d
cmpl $0x5e, %eax
jne 0x15688
leaq -0x38(%rbp), %rdi
callq 0x400f1
movl %eax, %r15d
movl $0x1, %r12d
movl $0x0, %ebx
cmpl $0x5d, %r15d
jne 0x15748
xorl %ebx, %ebx
cmpl $0x5d, %r14d
sete %bl
jmp 0x15736
leaq -0x38(%rbp), %rdi
callq 0x400f1
testl %eax, %eax
je 0x15812
movl %eax, %r14d
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rcx
movsbl (%rcx), %eax
testl %eax, %eax
js 0x156d5
incq %rcx
movq %rcx, -0x40(%rbp)
jmp 0x156de
leaq -0x40(%rbp), %rdi
callq 0x400f1
cmpl %eax, %r14d
je 0x15608
cmpb $0x0, -0x29(%rbp)
je 0x1570f
movl %eax, %ecx
orl %r14d, %ecx
cmpl $0x7f, %ecx
ja 0x1570f
movl %r14d, %ecx
leaq 0x64c0f(%rip), %rsi     # 0x7a310
movb (%rcx,%rsi), %cl
movl %eax, %edx
cmpb (%rdx,%rsi), %cl
je 0x15608
xorl %r15d, %r15d
cmpl %ebx, %r14d
jne 0x15815
testl %eax, %eax
je 0x15815
movq -0x68(%rbp), %rax
cmpq %rax, -0x38(%rbp)
jne 0x15608
jmp 0x15815
xorl %r15d, %r15d
movl %r15d, %r13d
leaq -0x38(%rbp), %rdi
callq 0x400f1
movl %eax, %r15d
cmpl $0x2d, %r15d
je 0x15773
cmpl $0x5d, %r15d
je 0x1575e
testl %r15d, %r15d
jne 0x157a8
jmp 0x15815
cmpl %r12d, %ebx
movl -0x60(%rbp), %ebx
movl -0x5c(%rbp), %r13d
jne 0x15608
jmp 0x15812
movq -0x38(%rbp), %rax
movb (%rax), %al
cmpb $0x5d, %al
je 0x157a8
testb %al, %al
sete %al
testl %r13d, %r13d
sete %cl
orb %al, %cl
jne 0x157a8
leaq -0x38(%rbp), %rdi
callq 0x400f1
cmpl %eax, %r14d
movl $0x1, %eax
cmoval %ebx, %eax
cmpl %r13d, %r14d
cmovael %eax, %ebx
jmp 0x15736
cmpl %r15d, %r14d
movl $0x1, %eax
cmovel %eax, %ebx
jmp 0x15739
movq -0x40(%rbp), %rax
xorl %r15d, %r15d
cmpb $0x0, (%rax)
sete %r15b
jmp 0x15815
leaq -0x40(%rbp), %r14
leaq -0x38(%rbp), %r15
movq -0x38(%rbp), %rax
movsbl (%rax), %r12d
testl %r12d, %r12d
js 0x157e3
incq %rax
movq %rax, -0x38(%rbp)
jmp 0x157ee
movq %r15, %rdi
callq 0x400f1
movl %eax, %r12d
cmpl %r13d, %r12d
sete %al
cmpl %ebx, %r12d
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x15827
cmpl %ebx, %r12d
jne 0x157cd
movq %r14, %rdi
callq 0x400f1
testl %eax, %eax
jne 0x157cd
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %r15d
testl %r12d, %r12d
je 0x15815
cmpl -0x50(%rbp), %r12d
jne 0x15852
cmpl $0x0, -0x44(%rbp)
je 0x158db
leaq -0x38(%rbp), %rdi
callq 0x400f1
movl %eax, %r12d
testl %eax, %eax
je 0x15812
cmpl $0x81, %r12d
jae 0x1588e
cmpb $0x0, -0x29(%rbp)
je 0x1592e
movl %r12d, %eax
leaq 0x64bd1(%rip), %rcx     # 0x7a440
movb (%rax,%rcx), %cl
notb %cl
orb $-0x21, %cl
movsbl %cl, %ebx
andl %r12d, %ebx
leaq 0x64a8c(%rip), %rcx     # 0x7a310
movzbl (%rax,%rcx), %r12d
jmp 0x15931
movq -0x38(%rbp), %r14
leaq -0x40(%rbp), %r13
movq -0x40(%rbp), %rcx
movsbl (%rcx), %eax
testl %eax, %eax
js 0x158aa
incq %rcx
movq %rcx, -0x40(%rbp)
jmp 0x158b2
movq %r13, %rdi
callq 0x400f1
testl %eax, %eax
je 0x15812
cmpl %r12d, %eax
jne 0x15896
movq -0x40(%rbp), %rsi
movq %r14, %rdi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x155bd
testl %eax, %eax
je 0x15896
jmp 0x15815
movq -0x40(%rbp), %r14
movb (%r14), %bl
xorl %r15d, %r15d
testb %bl, %bl
je 0x159a0
movq -0x38(%rbp), %r12
decq %r12
movq %r12, %rdi
movq %r14, %rsi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x155bd
testl %eax, %eax
jne 0x1599a
cmpb $-0x40, %bl
jb 0x15922
movb 0x1(%r14), %al
incq %r14
andb $-0x40, %al
negb %al
jo 0x15913
jmp 0x15925
incq %r14
movb (%r14), %bl
testb %bl, %bl
jne 0x158f4
jmp 0x159a0
movl %r12d, %ebx
movq -0x40(%rbp), %r14
movb (%r14), %al
incq %r14
xorl %r15d, %r15d
testb %al, %al
sete %r13b
je 0x15987
movq -0x38(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movzbl %al, %eax
cmpl %eax, %r12d
je 0x1595a
cmpl %eax, %ebx
jne 0x15971
movq -0x50(%rbp), %rdi
movq %r14, %rsi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x155bd
testl %eax, %eax
jne 0x15981
movb (%r14), %al
incq %r14
testb %al, %al
sete %r13b
jne 0x1594e
jmp 0x15987
movl $0x1, %r15d
movq %r14, -0x40(%rbp)
testb $0x1, %r13b
jne 0x15812
jmp 0x15815
movl $0x1, %r15d
movq %r14, -0x40(%rbp)
jmp 0x15815