// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: likeFunc
static void likeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const unsigned char *zA, *zB;
  u32 escape;
  int nPat;
  sqlite3 *db = sqlite3_context_db_handle(context);
  struct compareInfo *pInfo = sqlite3_user_data(context);
  struct compareInfo backupInfo;

#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
  if( sqlite3_value_type(argv[0])==SQLITE_BLOB
   || sqlite3_value_type(argv[1])==SQLITE_BLOB
  ){
#ifdef SQLITE_TEST
    sqlite3_like_count++;
#endif
    sqlite3_result_int(context, 0);
    return;
  }
#endif

  /* Limit the length of the LIKE or GLOB pattern to avoid problems
  ** of deep recursion and N*N behavior in patternCompare().
  */
  nPat = sqlite3_value_bytes(argv[0]);
  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] );
  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 );
  if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){
    sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1);
    return;
  }
  if( argc==3 ){
    /* The escape character string must consist of a single UTF-8 character.
    ** Otherwise, return an error.
    */
    const unsigned char *zEsc = sqlite3_value_text(argv[2]);
    if( zEsc==0 ) return;
    if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
      sqlite3_result_error(context,
          "ESCAPE expression must be a single character", -1);
      return;
    }
    escape = sqlite3Utf8Read(&zEsc);
    if( escape==pInfo->matchAll || escape==pInfo->matchOne ){
      memcpy(&backupInfo, pInfo, sizeof(backupInfo));
      pInfo = &backupInfo;
      if( escape==pInfo->matchAll ) pInfo->matchAll = 0;
      if( escape==pInfo->matchOne ) pInfo->matchOne = 0;
    }
  }else{
    escape = pInfo->matchSet;
  }
  zB = sqlite3_value_text(argv[0]);
  zA = sqlite3_value_text(argv[1]);
  if( zA && zB ){
#ifdef SQLITE_TEST
    sqlite3_like_count++;
#endif
    sqlite3_result_int(context,
                      patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq 0x28(%rax), %r12
movq 0x8(%rcx), %r14
movq (%rdx), %rdi
movl $0x1, %esi
callq 0x281bba
cmpl 0x9c(%r12), %eax
jle 0x2f0f38
movl $0x1, 0x24(%rbx)
movq (%rbx), %rdi
leaq 0xf1a8c(%rip), %rsi     # 0x3e29a2
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x281f27
cmpl $0x3, %ebp
jne 0x2f0fce
movq 0x10(%r15), %rdi
movl $0x1, %esi
callq 0x281c96
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x2f0fc6
movb (%rax), %dl
testb %dl, %dl
sete %cl
cmpq $-0x1, %rax
sete %sil
orb %cl, %sil
jne 0x2f0f9f
xorl %esi, %esi
movl %esi, %ecx
cmpb $-0x40, %dl
jb 0x2f0f85
movb 0x1(%rax), %dl
incq %rax
andb $-0x40, %dl
negb %dl
jo 0x2f0f76
jmp 0x2f0f88
incq %rax
cmpq $-0x1, %rax
je 0x2f0f97
leal 0x1(%rcx), %esi
movb (%rax), %dl
testb %dl, %dl
jne 0x2f0f6f
testl %ecx, %ecx
je 0x2f1042
movl $0x1, 0x24(%rbx)
movq (%rbx), %rdi
leaq 0xf1a13(%rip), %rsi     # 0x3e29c3
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq $-0x1, %r8
callq 0x281f27
xorl %eax, %eax
testb %al, %al
jne 0x2f0fd3
jmp 0x2f1035
movzbl 0x2(%r14), %ebp
movq (%r15), %rdi
movl $0x1, %esi
callq 0x281c96
movq %rax, %r12
movq 0x8(%r15), %rdi
movl $0x1, %esi
callq 0x281c96
testq %rax, %rax
setne %cl
testq %r12, %r12
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x2f1035
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x285aed
xorl %esi, %esi
testl %eax, %eax
sete %sil
movq (%rbx), %rdi
testb $0x24, 0x9(%rdi)
je 0x2f102c
callq 0x29c706
jmp 0x2f1035
movq %rsi, (%rdi)
movw $0x4, 0x8(%rdi)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
callq 0x2b3087
movl %eax, %ebp
movzbl (%r14), %eax
cmpl %eax, %ebp
je 0x2f1065
movzbl 0x1(%r14), %ecx
movb $0x1, %al
cmpl %ecx, %ebp
jne 0x2f0fc8
movl (%r14), %eax
movl %eax, 0x4(%rsp)
movzbl %al, %eax
cmpl %eax, %ebp
jne 0x2f1078
movb $0x0, 0x4(%rsp)
leaq 0x4(%rsp), %r14
movzbl 0x1(%r14), %ecx
movb $0x1, %al
cmpl %ecx, %ebp
jne 0x2f0fc8
movb $0x0, 0x5(%rsp)
jmp 0x2f0fc8