// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: isAuxiliaryVtabOperator
static int isAuxiliaryVtabOperator(
  sqlite3 *db,                    /* Parsing context */
  Expr *pExpr,                    /* Test this expression */
  unsigned char *peOp2,           /* OUT: 0 for MATCH, or else an op2 value */
  Expr **ppLeft,                  /* Column expression to left of MATCH/op2 */
  Expr **ppRight                  /* Expression to left of MATCH/op2 */
){
  if( pExpr->op==TK_FUNCTION ){
    static const struct Op2 {
      const char *zOp;
      unsigned char eOp2;
    } aOp[] = {
      { "match",  SQLITE_INDEX_CONSTRAINT_MATCH },
      { "glob",   SQLITE_INDEX_CONSTRAINT_GLOB },
      { "like",   SQLITE_INDEX_CONSTRAINT_LIKE },
      { "regexp", SQLITE_INDEX_CONSTRAINT_REGEXP }
    };
    ExprList *pList;
    Expr *pCol;                     /* Column reference */
    int i;

    pList = pExpr->x.pList;
    if( pList==0 || pList->nExpr!=2 ){
      return 0;
    }

    /* Built-in operators MATCH, GLOB, LIKE, and REGEXP attach to a
    ** virtual table on their second argument, which is the same as
    ** the left-hand side operand in their in-fix form.
    **
    **       vtab_column MATCH expression
    **       MATCH(expression,vtab_column)
    */
    pCol = pList->a[1].pExpr;
    testcase( pCol->op==TK_COLUMN && pCol->y.pTab==0 );
    if( ExprIsVtab(pCol) ){
      for(i=0; i<ArraySize(aOp); i++){
        if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){
          *peOp2 = aOp[i].eOp2;
          *ppRight = pList->a[0].pExpr;
          *ppLeft = pCol;
          return 1;
        }
      }
    }

    /* We can also match against the first column of overloaded
    ** functions where xFindFunction returns a value of at least
    ** SQLITE_INDEX_CONSTRAINT_FUNCTION.
    **
    **      OVERLOADED(vtab_column,expression)
    **
    ** Historically, xFindFunction expected to see lower-case function
    ** names.  But for this use case, xFindFunction is expected to deal
    ** with function names in an arbitrary case.
    */
    pCol = pList->a[0].pExpr;
    testcase( pCol->op==TK_COLUMN && pCol->y.pTab==0 );
    if( ExprIsVtab(pCol) ){
      sqlite3_vtab *pVtab;
      sqlite3_module *pMod;
      void (*xNotUsed)(sqlite3_context*,int,sqlite3_value**);
      void *pNotUsed;
      pVtab = sqlite3GetVTable(db, pCol->y.pTab)->pVtab;
      assert( pVtab!=0 );
      assert( pVtab->pModule!=0 );
      pMod = (sqlite3_module *)pVtab->pModule;
      if( pMod->xFindFunction!=0 ){
        i = pMod->xFindFunction(pVtab,2, pExpr->u.zToken, &xNotUsed, &pNotUsed);
        if( i>=SQLITE_INDEX_CONSTRAINT_FUNCTION ){
          *peOp2 = i;
          *ppRight = pList->a[1].pExpr;
          *ppLeft = pCol;
          return 1;
        }
      }
    }
  }else if( pExpr->op==TK_NE || pExpr->op==TK_ISNOT || pExpr->op==TK_NOTNULL ){
    int res = 0;
    Expr *pLeft = pExpr->pLeft;
    Expr *pRight = pExpr->pRight;
    testcase( pLeft->op==TK_COLUMN && pLeft->y.pTab==0 );
    if( ExprIsVtab(pLeft) ){
      res++;
    }
    testcase( pRight && pRight->op==TK_COLUMN && pRight->y.pTab==0 );
    if( pRight && ExprIsVtab(pRight) ){
      res++;
      SWAP(Expr*, pLeft, pRight);
    }
    *ppLeft = pLeft;
    *ppRight = pRight;
    if( pExpr->op==TK_NE ) *peOp2 = SQLITE_INDEX_CONSTRAINT_NE;
    if( pExpr->op==TK_ISNOT ) *peOp2 = SQLITE_INDEX_CONSTRAINT_ISNOT;
    if( pExpr->op==TK_NOTNULL ) *peOp2 = SQLITE_INDEX_CONSTRAINT_ISNOTNULL;
    return res;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa9, %eax
jne 0x44fd69
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x44fbbd
movq -0x38(%rbp), %rax
cmpl $0x2, (%rax)
je 0x44fbc9
movl $0x0, -0x4(%rbp)
jmp 0x44fe99
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa4, %eax
jne 0x44fc8c
movq -0x40(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x44fc8c
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x54(%rax)
je 0x44fc8c
movl $0x0, -0x44(%rbp)
cmpl $0x4, -0x44(%rbp)
jge 0x44fc8a
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x44(%rbp), %rcx
leaq 0x1eb228(%rip), %rax    # 0x63ae50
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x3c3e60
cmpl $0x0, %eax
jne 0x44fc7d
movslq -0x44(%rbp), %rcx
leaq 0x1eb209(%rip), %rax    # 0x63ae50
shlq $0x4, %rcx
addq %rcx, %rax
movb 0x8(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x44fe99
jmp 0x44fc7f
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x44fc0f
jmp 0x44fc8c
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa4, %eax
jne 0x44fd64
movq -0x40(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x44fd64
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x54(%rax)
je 0x44fd64
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x40f150
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x90(%rax)
je 0x44fd62
movq -0x58(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rdx
movl $0x2, %esi
leaq -0x60(%rbp), %rcx
leaq -0x68(%rbp), %r8
callq *%rax
movl %eax, -0x44(%rbp)
cmpl $0x96, -0x44(%rbp)
jl 0x44fd60
movl -0x44(%rbp), %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x44fe99
jmp 0x44fd62
jmp 0x44fd64
jmp 0x44fe92
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x34, %eax
je 0x44fd93
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa8, %eax
je 0x44fd93
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x33, %eax
jne 0x44fe90
movl $0x0, -0x6c(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa4, %eax
jne 0x44fde2
movq -0x78(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x44fde2
movq -0x78(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x54(%rax)
je 0x44fde2
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x44fe37
movq -0x80(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa4, %eax
jne 0x44fe37
movq -0x80(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x44fe37
movq -0x80(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x54(%rax)
je 0x44fe37
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x34, %eax
jne 0x44fe60
movq -0x20(%rbp), %rax
movb $0x44, (%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa8, %eax
jne 0x44fe75
movq -0x20(%rbp), %rax
movb $0x45, (%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x33, %eax
jne 0x44fe88
movq -0x20(%rbp), %rax
movb $0x46, (%rax)
movl -0x6c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x44fe99
jmp 0x44fe92
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)