// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: patternCompare
static int patternCompare(
  const u8 *zPattern,              /* The glob pattern */
  const u8 *zString,               /* The string to compare against the glob */
  const int esc,                    /* The escape character */
  int noCase
){
  int c, c2;
  int invert;
  int seen;
  u8 matchOne = '?';
  u8 matchAll = '*';
  u8 matchSet = '[';
  int prevEscape = 0;     /* True if the previous character was 'escape' */

  if( !zPattern || !zString ) return 0;
  while( (c = jx9Utf8Read(zPattern, 0, &zPattern))!=0 ){
    if( !prevEscape && c==matchAll ){
      while( (c= jx9Utf8Read(zPattern, 0, &zPattern)) == matchAll
               || c == matchOne ){
        if( c==matchOne && jx9Utf8Read(zString, 0, &zString)==0 ){
          return 0;
        }
      }
      if( c==0 ){
        return 1;
      }else if( c==esc ){
        c = jx9Utf8Read(zPattern, 0, &zPattern);
        if( c==0 ){
          return 0;
        }
      }else if( c==matchSet ){
	  if( (esc==0) || (matchSet<0x80) ) return 0;
	  while( *zString && patternCompare(&zPattern[-1], zString, esc, noCase)==0 ){
          SQLITE_SKIP_UTF8(zString);
        }
        return *zString!=0;
      }
      while( (c2 = jx9Utf8Read(zString, 0, &zString))!=0 ){
        if( noCase ){
          GlogUpperToLower(c2);
          GlogUpperToLower(c);
          while( c2 != 0 && c2 != c ){
            c2 = jx9Utf8Read(zString, 0, &zString);
            GlogUpperToLower(c2);
          }
        }else{
          while( c2 != 0 && c2 != c ){
            c2 = jx9Utf8Read(zString, 0, &zString);
          }
        }
        if( c2==0 ) return 0;
		if( patternCompare(zPattern, zString, esc, noCase) ) return 1;
      }
      return 0;
    }else if( !prevEscape && c==matchOne ){
      if( jx9Utf8Read(zString, 0, &zString)==0 ){
        return 0;
      }
    }else if( c==matchSet ){
      int prior_c = 0;
      if( esc == 0 ) return 0;
      seen = 0;
      invert = 0;
      c = jx9Utf8Read(zString, 0, &zString);
      if( c==0 ) return 0;
      c2 = jx9Utf8Read(zPattern, 0, &zPattern);
      if( c2=='^' ){
        invert = 1;
        c2 = jx9Utf8Read(zPattern, 0, &zPattern);
      }
      if( c2==']' ){
        if( c==']' ) seen = 1;
        c2 = jx9Utf8Read(zPattern, 0, &zPattern);
      }
      while( c2 && c2!=']' ){
        if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){
          c2 = jx9Utf8Read(zPattern, 0, &zPattern);
          if( c>=prior_c && c<=c2 ) seen = 1;
          prior_c = 0;
        }else{
          if( c==c2 ){
            seen = 1;
          }
          prior_c = c2;
        }
        c2 = jx9Utf8Read(zPattern, 0, &zPattern);
      }
      if( c2==0 || (seen ^ invert)==0 ){
        return 0;
      }
    }else if( esc==c && !prevEscape ){
      prevEscape = 1;
    }else{
      c2 = jx9Utf8Read(zString, 0, &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)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movb $0x3f, -0x31(%rbp)
movb $0x2a, -0x32(%rbp)
movb $0x5b, -0x33(%rbp)
movl $0x0, -0x38(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xa9737
cmpq $0x0, -0x18(%rbp)
jne 0xa9743
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa9745
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
je 0xa9c6e
cmpl $0x0, -0x38(%rbp)
jne 0xa9a27
movl -0x24(%rbp), %eax
movzbl -0x32(%rbp), %ecx
cmpl %ecx, %eax
jne 0xa9a27
jmp 0xa977d
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, %ecx
movl %ecx, -0x24(%rbp)
movzbl -0x32(%rbp), %edx
movb $0x1, %al
cmpl %edx, %ecx
movb %al, -0x3d(%rbp)
je 0xa97af
movl -0x24(%rbp), %eax
movzbl -0x31(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0xa97b8
jmp 0xa97e7
movl -0x24(%rbp), %eax
movzbl -0x31(%rbp), %ecx
cmpl %ecx, %eax
jne 0xa97e5
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdx
callq 0x8dbf0
cmpl $0x0, %eax
jne 0xa97e5
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa977d
cmpl $0x0, -0x24(%rbp)
jne 0xa97f9
movl $0x1, -0x4(%rbp)
jmp 0xa9c83
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0xa982c
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xa9827
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa98f0
movl -0x24(%rbp), %eax
movzbl -0x33(%rbp), %ecx
cmpl %ecx, %eax
jne 0xa98ee
cmpl $0x0, -0x1c(%rbp)
je 0xa984c
movzbl -0x33(%rbp), %eax
cmpl $0x80, %eax
jge 0xa9858
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa985a
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3e(%rbp)
je 0xa988b
movq -0x10(%rbp), %rdi
addq $-0x1, %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
callq 0xa9700
cmpl $0x0, %eax
sete %al
movb %al, -0x3e(%rbp)
movb -0x3e(%rbp), %al
testb $0x1, %al
jne 0xa9894
jmp 0xa98d4
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
cmpl $0xc0, %eax
jl 0xa98d2
jmp 0xa98af
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0xa98d0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xa98af
jmp 0xa98d2
jmp 0xa985a
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa98f0
jmp 0xa98f2
jmp 0xa98f4
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
cmpl $0x0, %eax
je 0xa9a1b
cmpl $0x0, -0x20(%rbp)
je 0xa99a6
cmpl $0x80, -0x28(%rbp)
jge 0xa9936
movslq -0x28(%rbp), %rcx
leaq 0x17fb1(%rip), %rax     # 0xc18e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
cmpl $0x80, -0x24(%rbp)
jge 0xa9951
movslq -0x24(%rbp), %rcx
leaq 0x17f96(%rip), %rax     # 0xc18e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x24(%rbp)
jmp 0xa9953
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x3f(%rbp)
je 0xa996a
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
setne %al
movb %al, -0x3f(%rbp)
movb -0x3f(%rbp), %al
testb $0x1, %al
jne 0xa9973
jmp 0xa99a4
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
cmpl $0x80, -0x28(%rbp)
jge 0xa99a2
movslq -0x28(%rbp), %rcx
leaq 0x17f45(%rip), %rax     # 0xc18e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
jmp 0xa9953
jmp 0xa99e0
jmp 0xa99a8
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x40(%rbp)
je 0xa99bf
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
setne %al
movb %al, -0x40(%rbp)
movb -0x40(%rbp), %al
testb $0x1, %al
jne 0xa99c8
jmp 0xa99de
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
jmp 0xa99a8
jmp 0xa99e0
cmpl $0x0, -0x28(%rbp)
jne 0xa99f2
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
callq 0xa9700
cmpl $0x0, %eax
je 0xa9a16
movl $0x1, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa98f4
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
cmpl $0x0, -0x38(%rbp)
jne 0xa9a5f
movl -0x24(%rbp), %eax
movzbl -0x31(%rbp), %ecx
cmpl %ecx, %eax
jne 0xa9a5f
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdx
callq 0x8dbf0
cmpl $0x0, %eax
jne 0xa9a5a
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa9c67
movl -0x24(%rbp), %eax
movzbl -0x33(%rbp), %ecx
cmpl %ecx, %eax
jne 0xa9be2
movl $0x0, -0x3c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0xa9a87
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xa9abb
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
cmpl $0x5e, -0x28(%rbp)
jne 0xa9af0
movl $0x1, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
cmpl $0x5d, -0x28(%rbp)
jne 0xa9b17
cmpl $0x5d, -0x24(%rbp)
jne 0xa9b03
movl $0x1, -0x30(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
jmp 0xa9b19
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x41(%rbp)
je 0xa9b2e
cmpl $0x5d, -0x28(%rbp)
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0xa9b3a
jmp 0xa9bc0
cmpl $0x2d, -0x28(%rbp)
jne 0xa9b92
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5d, %eax
je 0xa9b92
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0xa9b92
cmpl $0x0, -0x3c(%rbp)
jle 0xa9b92
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jl 0xa9b89
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jg 0xa9b89
movl $0x1, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
jmp 0xa9ba7
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0xa9ba1
movl $0x1, -0x30(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x10(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
jmp 0xa9b19
cmpl $0x0, -0x28(%rbp)
je 0xa9bd1
movl -0x30(%rbp), %eax
xorl -0x2c(%rbp), %eax
cmpl $0x0, %eax
jne 0xa9bdd
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
jmp 0xa9c65
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0xa9bf9
cmpl $0x0, -0x38(%rbp)
jne 0xa9bf9
movl $0x1, -0x38(%rbp)
jmp 0xa9c63
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x18(%rbp), %rdx
callq 0x8dbf0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0xa9c4b
cmpl $0x80, -0x24(%rbp)
jge 0xa9c2e
movslq -0x24(%rbp), %rcx
leaq 0x17cb9(%rip), %rax     # 0xc18e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x24(%rbp)
cmpl $0x80, -0x28(%rbp)
jge 0xa9c49
movslq -0x28(%rbp), %rcx
leaq 0x17c9e(%rip), %rax     # 0xc18e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
jmp 0xa9c4b
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
je 0xa9c5c
movl $0x0, -0x4(%rbp)
jmp 0xa9c83
movl $0x0, -0x38(%rbp)
jmp 0xa9c65
jmp 0xa9c67
jmp 0xa9c69
jmp 0xa9745
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
nopl (%rax)