// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: instrFunc
static void instrFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const unsigned char *zHaystack;
  const unsigned char *zNeedle;
  int nHaystack;
  int nNeedle;
  int typeHaystack, typeNeedle;
  int N = 1;
  int isText;
  unsigned char firstChar;
  sqlite3_value *pC1 = 0;
  sqlite3_value *pC2 = 0;

  UNUSED_PARAMETER(argc);
  typeHaystack = sqlite3_value_type(argv[0]);
  typeNeedle = sqlite3_value_type(argv[1]);
  if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return;
  nHaystack = sqlite3_value_bytes(argv[0]);
  nNeedle = sqlite3_value_bytes(argv[1]);
  if( nNeedle>0 ){
    if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
      zHaystack = sqlite3_value_blob(argv[0]);
      zNeedle = sqlite3_value_blob(argv[1]);
      isText = 0;
    }else if( typeHaystack!=SQLITE_BLOB && typeNeedle!=SQLITE_BLOB ){
      zHaystack = sqlite3_value_text(argv[0]);
      zNeedle = sqlite3_value_text(argv[1]);
      isText = 1;
    }else{
      pC1 = sqlite3_value_dup(argv[0]);
      zHaystack = sqlite3_value_text(pC1);
      if( zHaystack==0 ) goto endInstrOOM;
      nHaystack = sqlite3_value_bytes(pC1);
      pC2 = sqlite3_value_dup(argv[1]);
      zNeedle = sqlite3_value_text(pC2);
      if( zNeedle==0 ) goto endInstrOOM;
      nNeedle = sqlite3_value_bytes(pC2);
      isText = 1;
    }
    if( zNeedle==0 || (nHaystack && zHaystack==0) ) goto endInstrOOM;
    firstChar = zNeedle[0];
    while( nNeedle<=nHaystack
       && (zHaystack[0]!=firstChar || memcmp(zHaystack, zNeedle, nNeedle)!=0)
    ){
      N++;
      do{
        nHaystack--;
        zHaystack++;
      }while( isText && (zHaystack[0]&0xc0)==0x80 );
    }
    if( nNeedle>nHaystack ) N = 0;
  }
  sqlite3_result_int(context, N);
endInstr:
  sqlite3_value_free(pC1);
  sqlite3_value_free(pC2);
  return;
endInstrOOM:
  sqlite3_result_error_nomem(context);
  goto endInstr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, -0x3c(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3c7cc0
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3c7cc0
movl %eax, -0x38(%rbp)
cmpl $0x5, -0x34(%rbp)
je 0x466495
cmpl $0x5, -0x38(%rbp)
jne 0x46649a
jmp 0x46669a
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3c78a0
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3c78a0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x46666f
cmpl $0x4, -0x34(%rbp)
jne 0x4664fc
cmpl $0x4, -0x38(%rbp)
jne 0x4664fc
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3c7710
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3c7710
movq %rax, -0x28(%rbp)
movl $0x0, -0x40(%rbp)
jmp 0x4665a6
cmpl $0x4, -0x34(%rbp)
je 0x466532
cmpl $0x4, -0x38(%rbp)
je 0x466532
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3c7880
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3c7880
movq %rax, -0x28(%rbp)
movl $0x1, -0x40(%rbp)
jmp 0x4665a4
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3c7d40
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x3c7880
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x46655b
jmp 0x46668f
movq -0x50(%rbp), %rdi
callq 0x3c78a0
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3c7d40
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x3c7880
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x466591
jmp 0x46668f
movq -0x58(%rbp), %rdi
callq 0x3c78a0
movl %eax, -0x30(%rbp)
movl $0x1, -0x40(%rbp)
jmp 0x4665a6
cmpq $0x0, -0x28(%rbp)
je 0x4665ba
cmpl $0x0, -0x2c(%rbp)
je 0x4665bf
cmpq $0x0, -0x20(%rbp)
jne 0x4665bf
jmp 0x46668f
movq -0x28(%rbp), %rax
movb (%rax), %al
movb %al, -0x41(%rbp)
movl -0x30(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x59(%rbp)
jg 0x466609
movq -0x20(%rbp), %rax
movzbl (%rax), %ecx
movzbl -0x41(%rbp), %edx
movb $0x1, %al
cmpl %edx, %ecx
movb %al, -0x5a(%rbp)
jne 0x466603
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x30(%rbp), %rdx
callq 0x192c0
cmpl $0x0, %eax
setne %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x466612
jmp 0x46665e
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x40(%rbp)
movb %al, -0x5b(%rbp)
je 0x466652
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
sete %al
movb %al, -0x5b(%rbp)
movb -0x5b(%rbp), %al
testb $0x1, %al
jne 0x46661b
jmp 0x4665c8
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jle 0x46666d
movl $0x0, -0x3c(%rbp)
jmp 0x46666f
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x3c8480
movq -0x50(%rbp), %rdi
callq 0x3c7f30
movq -0x58(%rbp), %rdi
callq 0x3c7f30
jmp 0x46669a
movq -0x8(%rbp), %rdi
callq 0x3c8b60
jmp 0x46667b
addq $0x60, %rsp
popq %rbp
retq