// File: /workspace/github_c_makefile_star2_O3/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 0x1565d
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 0x15690
incq %rax
movq %rax, -0x38(%rbp)
jmp 0x1569c
leaq -0x38(%rbp), %rdi
callq 0x3f100
movl %eax, %r13d
testl %r13d, %r13d
je 0x1581a
cmpl -0x4c(%rbp), %r13d
je 0x15826
cmpl -0x48(%rbp), %r13d
jne 0x1572e
cmpl $0x0, -0x44(%rbp)
jne 0x15712
leaq -0x40(%rbp), %rdi
callq 0x3f100
xorl %ebx, %ebx
testl %eax, %eax
je 0x15876
movl %eax, %r13d
movl %r14d, %r12d
leaq -0x38(%rbp), %rdi
callq 0x3f100
cmpl $0x5e, %eax
jne 0x156f0
leaq -0x38(%rbp), %rdi
callq 0x3f100
movl $0x1, %ebx
xorl %r14d, %r14d
movl $0x0, %r15d
cmpl $0x5d, %eax
jne 0x157b0
xorl %r15d, %r15d
cmpl $0x5d, %r13d
sete %r15b
jmp 0x157a2
leaq -0x38(%rbp), %rdi
callq 0x3f100
testl %eax, %eax
je 0x15874
movl %eax, %r13d
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rcx
movsbl (%rcx), %eax
testl %eax, %eax
js 0x15742
incq %rcx
movq %rcx, -0x40(%rbp)
jmp 0x1574b
leaq -0x40(%rbp), %rdi
callq 0x3f100
cmpl %eax, %r13d
je 0x1567a
cmpb $0x0, -0x29(%rbp)
je 0x1577c
movl %eax, %ecx
orl %r13d, %ecx
cmpl $0x7f, %ecx
ja 0x1577c
movl %r13d, %ecx
leaq 0x62bf2(%rip), %rsi     # 0x78360
movb (%rcx,%rsi), %cl
movl %eax, %edx
cmpb (%rdx,%rsi), %cl
je 0x1567a
cmpl %r14d, %r13d
jne 0x15874
xorl %ebx, %ebx
testl %eax, %eax
je 0x15876
movq -0x60(%rbp), %rax
cmpq %rax, -0x38(%rbp)
jne 0x1567a
jmp 0x15876
xorl %eax, %eax
movl %eax, %r14d
leaq -0x38(%rbp), %rdi
callq 0x3f100
cmpl $0x2d, %eax
je 0x157d4
cmpl $0x5d, %eax
je 0x157c3
testl %eax, %eax
jne 0x1580c
jmp 0x15874
cmpl %ebx, %r15d
movl %r12d, %r14d
jne 0x1567a
jmp 0x15874
movq -0x38(%rbp), %rcx
movb (%rcx), %cl
cmpb $0x5d, %cl
je 0x1580c
testb %cl, %cl
sete %cl
testl %r14d, %r14d
sete %dl
orb %cl, %dl
jne 0x1580c
leaq -0x38(%rbp), %rdi
callq 0x3f100
cmpl %eax, %r13d
movl $0x1, %eax
cmoval %r15d, %eax
cmpl %r14d, %r13d
cmovael %eax, %r15d
jmp 0x157a2
cmpl %eax, %r13d
movl $0x1, %ecx
cmovel %ecx, %r15d
jmp 0x157a4
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
sete %bl
jmp 0x15876
leaq -0x40(%rbp), %r12
leaq -0x38(%rbp), %r13
movq -0x38(%rbp), %rax
movsbl (%rax), %r15d
testl %r15d, %r15d
js 0x15844
incq %rax
movq %rax, -0x38(%rbp)
jmp 0x1584f
movq %r13, %rdi
callq 0x3f100
movl %eax, %r15d
cmpl -0x4c(%rbp), %r15d
sete %al
cmpl %r14d, %r15d
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x15888
cmpl %r14d, %r15d
jne 0x1582e
movq %r12, %rdi
callq 0x3f100
testl %eax, %eax
jne 0x1582e
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 0x159e4
cmpl -0x48(%rbp), %r15d
jne 0x158b1
cmpl $0x0, -0x44(%rbp)
je 0x1593e
leaq -0x38(%rbp), %rdi
callq 0x3f100
movl %eax, %r15d
testl %eax, %eax
je 0x15874
cmpl $0x81, %r15d
jae 0x158ee
cmpb $0x0, -0x29(%rbp)
je 0x15995
movl %r15d, %eax
leaq 0x62bc2(%rip), %rcx     # 0x78490
movb (%rax,%rcx), %cl
notb %cl
orb $-0x21, %cl
movsbl %cl, %r14d
andl %r15d, %r14d
leaq 0x62a7c(%rip), %rcx     # 0x78360
movzbl (%rax,%rcx), %r15d
jmp 0x15998
movq -0x38(%rbp), %r12
leaq -0x40(%rbp), %r13
movq -0x40(%rbp), %rcx
movsbl (%rcx), %eax
testl %eax, %eax
js 0x1590a
incq %rcx
movq %rcx, -0x40(%rbp)
jmp 0x15912
movq %r13, %rdi
callq 0x3f100
testl %eax, %eax
setne %bl
je 0x15876
cmpl %r15d, %eax
jne 0x158f6
movq -0x40(%rbp), %rsi
movq %r12, %rdi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x15633
testl %eax, %eax
je 0x158f6
jmp 0x15876
movq -0x40(%rbp), %r14
movb (%r14), %r12b
testb %r12b, %r12b
je 0x15874
movq -0x38(%rbp), %r15
decq %r15
movq %r15, %rdi
movq %r14, %rsi
movq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0x15633
testl %eax, %eax
setne %bl
jne 0x159e4
cmpb $-0x40, %r12b
jb 0x15985
movb 0x1(%r14), %r12b
incq %r14
movl %r12d, %eax
andb $-0x40, %al
negb %al
jo 0x15973
jmp 0x1598b
incq %r14
movb (%r14), %r12b
testb %r12b, %r12b
jne 0x15955
jmp 0x15876
movl %r15d, %r14d
movq -0x40(%rbp), %r12
movb (%r12), %al
testb %al, %al
je 0x15874
movq -0x38(%rbp), %r13
incq %r12
xorl %ebx, %ebx
movzbl %al, %eax
cmpl %eax, %r15d
je 0x159be
cmpl %eax, %r14d
jne 0x159d4
movq %r13, %rdi
movq %r12, %rsi
movq -0x58(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x15633
testl %eax, %eax
jne 0x159e4
movb (%r12), %al
incq %r12
testb %al, %al
jne 0x159b1
jmp 0x15876
movb $0x1, %bl
jmp 0x15876