// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/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;
  int invert;
  int seen;
  u8 matchOne = pInfo->matchOne;
  u8 matchAll = pInfo->matchAll;
  u8 matchSet = pInfo->matchSet;
  u8 noCase = pInfo->noCase; 
  int prevEscape = 0;     /* True if the previous character was 'escape' */

  while( (c = sqlite3Utf8Read(&zPattern))!=0 ){
    if( c==matchAll && !prevEscape ){
      while( (c=sqlite3Utf8Read(&zPattern)) == matchAll
               || c == matchOne ){
        if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
          return 0;
        }
      }
      if( c==0 ){
        return 1;
      }else if( c==esc ){
        c = sqlite3Utf8Read(&zPattern);
        if( c==0 ){
          return 0;
        }
      }else if( c==matchSet ){
        assert( esc==0 );         /* This is GLOB, not LIKE */
        assert( matchSet<0x80 );  /* '[' is a single-byte character */
        while( *zString && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){
          SQLITE_SKIP_UTF8(zString);
        }
        return *zString!=0;
      }
      while( (c2 = sqlite3Utf8Read(&zString))!=0 ){
        if( noCase ){
          GlogUpperToLower(c2);
          GlogUpperToLower(c);
          while( c2 != 0 && c2 != c ){
            c2 = sqlite3Utf8Read(&zString);
            GlogUpperToLower(c2);
          }
        }else{
          while( c2 != 0 && c2 != c ){
            c2 = sqlite3Utf8Read(&zString);
          }
        }
        if( c2==0 ) return 0;
        if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;
      }
      return 0;
    }else if( c==matchOne && !prevEscape ){
      if( sqlite3Utf8Read(&zString)==0 ){
        return 0;
      }
    }else if( c==matchSet ){
      u32 prior_c = 0;
      assert( esc==0 );    /* This only occurs for GLOB, not LIKE */
      seen = 0;
      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;
      }
    }else if( esc==c && !prevEscape ){
      prevEscape = 1;
    }else{
      c2 = sqlite3Utf8Read(&zString);
      if( noCase ){
        GlogUpperToLower(c);
        GlogUpperToLower(c2);
      }
      if( c!=c2 ){
        return 0;
      }
      prevEscape = 0;
    }
  }
  return *zString==0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x20(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x35(%rbp)
movq -0x20(%rbp), %rax
movb (%rax), %al
movb %al, -0x36(%rbp)
movq -0x20(%rbp), %rax
movb 0x2(%rax), %al
movb %al, -0x37(%rbp)
movq -0x20(%rbp), %rax
movb 0x3(%rax), %al
movb %al, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, -0x28(%rbp)
cmpl $0x0, %eax
je 0x14f85
movl -0x28(%rbp), %eax
movzbl -0x36(%rbp), %ecx
cmpl %ecx, %eax
jne 0x14d8d
cmpl $0x0, -0x3c(%rbp)
jne 0x14d8d
jmp 0x14b25
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, %ecx
movl %ecx, -0x28(%rbp)
movzbl -0x36(%rbp), %edx
movb $0x1, %al
cmpl %edx, %ecx
movb %al, -0x41(%rbp)
je 0x14b4f
movl -0x28(%rbp), %eax
movzbl -0x35(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x14b58
jmp 0x14b7f
movl -0x28(%rbp), %eax
movzbl -0x35(%rbp), %ecx
cmpl %ecx, %eax
jne 0x14b7d
leaq -0x18(%rbp), %rdi
callq 0x4b740
cmpl $0x0, %eax
jne 0x14b7d
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
jmp 0x14b25
cmpl $0x0, -0x28(%rbp)
jne 0x14b91
movl $0x1, -0x4(%rbp)
jmp 0x14f9a
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x14bbc
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x14bb7
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
jmp 0x14c64
movl -0x28(%rbp), %eax
movzbl -0x37(%rbp), %ecx
cmpl %ecx, %eax
jne 0x14c62
jmp 0x14bcd
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x42(%rbp)
je 0x14bff
movq -0x10(%rbp), %rdi
addq $-0x1, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x14ab0
cmpl $0x0, %eax
sete %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
testb $0x1, %al
jne 0x14c08
jmp 0x14c48
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
cmpl $0xc0, %eax
jl 0x14c46
jmp 0x14c23
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x14c44
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x14c23
jmp 0x14c46
jmp 0x14bcd
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x14f9a
jmp 0x14c64
jmp 0x14c66
jmp 0x14c68
leaq -0x18(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x14d81
cmpb $0x0, -0x38(%rbp)
je 0x14d13
movl -0x2c(%rbp), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x14ca5
movl -0x2c(%rbp), %eax
movl %eax, %ecx
leaq 0x95ea2(%rip), %rax     # 0xaab40
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x14cc3
movl -0x28(%rbp), %eax
movl %eax, %ecx
leaq 0x95e84(%rip), %rax     # 0xaab40
movzbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
jmp 0x14cc5
xorl %eax, %eax
cmpl $0x0, -0x2c(%rbp)
movb %al, -0x43(%rbp)
je 0x14cdc
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
setne %al
movb %al, -0x43(%rbp)
movb -0x43(%rbp), %al
testb $0x1, %al
jne 0x14ce5
jmp 0x14d11
leaq -0x18(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x14d0f
movl -0x2c(%rbp), %eax
movl %eax, %ecx
leaq 0x95e38(%rip), %rax     # 0xaab40
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
jmp 0x14cc5
jmp 0x14d45
jmp 0x14d15
xorl %eax, %eax
cmpl $0x0, -0x2c(%rbp)
movb %al, -0x44(%rbp)
je 0x14d2c
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
setne %al
movb %al, -0x44(%rbp)
movb -0x44(%rbp), %al
testb $0x1, %al
jne 0x14d35
jmp 0x14d43
leaq -0x18(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
jmp 0x14d15
jmp 0x14d45
cmpl $0x0, -0x2c(%rbp)
jne 0x14d57
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x14ab0
cmpl $0x0, %eax
je 0x14d7c
movl $0x1, -0x4(%rbp)
jmp 0x14f9a
jmp 0x14c68
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
movl -0x28(%rbp), %eax
movzbl -0x35(%rbp), %ecx
cmpl %ecx, %eax
jne 0x14dbd
cmpl $0x0, -0x3c(%rbp)
jne 0x14dbd
leaq -0x18(%rbp), %rdi
callq 0x4b740
cmpl $0x0, %eax
jne 0x14db8
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
jmp 0x14f7e
movl -0x28(%rbp), %eax
movzbl -0x37(%rbp), %ecx
cmpl %ecx, %eax
jne 0x14efb
movl $0x0, -0x40(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x4b740
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x14dff
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
cmpl $0x5e, -0x2c(%rbp)
jne 0x14e24
movl $0x1, -0x30(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
cmpl $0x5d, -0x2c(%rbp)
jne 0x14e43
cmpl $0x5d, -0x28(%rbp)
jne 0x14e37
movl $0x1, -0x34(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
jmp 0x14e45
xorl %eax, %eax
cmpl $0x0, -0x2c(%rbp)
movb %al, -0x45(%rbp)
je 0x14e5a
cmpl $0x5d, -0x2c(%rbp)
setne %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x14e63
jmp 0x14ed9
cmpl $0x2d, -0x2c(%rbp)
jne 0x14eb3
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5d, %eax
je 0x14eb3
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x14eb3
cmpl $0x0, -0x40(%rbp)
jbe 0x14eb3
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x40(%rbp), %eax
jb 0x14eaa
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
ja 0x14eaa
movl $0x1, -0x34(%rbp)
movl $0x0, -0x40(%rbp)
jmp 0x14ec8
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x14ec2
movl $0x1, -0x34(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x40(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
jmp 0x14e45
cmpl $0x0, -0x2c(%rbp)
je 0x14eea
movl -0x34(%rbp), %eax
xorl -0x30(%rbp), %eax
cmpl $0x0, %eax
jne 0x14ef6
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
jmp 0x14f7c
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x14f12
cmpl $0x0, -0x3c(%rbp)
jne 0x14f12
movl $0x1, -0x3c(%rbp)
jmp 0x14f7a
leaq -0x18(%rbp), %rdi
callq 0x4b740
movl %eax, -0x2c(%rbp)
cmpb $0x0, -0x38(%rbp)
je 0x14f62
movl -0x28(%rbp), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x14f42
movl -0x28(%rbp), %eax
movl %eax, %ecx
leaq 0x95c05(%rip), %rax     # 0xaab40
movzbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
andl $-0x80, %eax
cmpl $0x0, %eax
jne 0x14f60
movl -0x2c(%rbp), %eax
movl %eax, %ecx
leaq 0x95be7(%rip), %rax     # 0xaab40
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
jmp 0x14f62
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
je 0x14f73
movl $0x0, -0x4(%rbp)
jmp 0x14f9a
movl $0x0, -0x3c(%rbp)
jmp 0x14f7c
jmp 0x14f7e
jmp 0x14f80
jmp 0x14af5
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)