// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: whereScanNext
static WhereTerm *whereScanNext(WhereScan *pScan){
  int iCur;            /* The cursor on the LHS of the term */
  i16 iColumn;         /* The column on the LHS of the term.  -1 for IPK */
  Expr *pX;            /* An expression being tested */
  WhereClause *pWC;    /* Shorthand for pScan->pWC */
  WhereTerm *pTerm;    /* The term being tested */
  int k = pScan->k;    /* Where to start scanning */

  assert( pScan->iEquiv<=pScan->nEquiv );
  pWC = pScan->pWC;
  while(1){
    iColumn = pScan->aiColumn[pScan->iEquiv-1];
    iCur = pScan->aiCur[pScan->iEquiv-1];
    assert( pWC!=0 );
    do{
      for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){
        if( pTerm->leftCursor==iCur
         && pTerm->u.leftColumn==iColumn
         && (iColumn!=XN_EXPR
             || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft,
                                       pScan->pIdxExpr,iCur)==0)
         && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
        ){
          if( (pTerm->eOperator & WO_EQUIV)!=0
           && pScan->nEquiv<ArraySize(pScan->aiCur)
           && (pX = sqlite3ExprSkipCollateAndLikely(pTerm->pExpr->pRight))->op
               ==TK_COLUMN
          ){
            int j;
            for(j=0; j<pScan->nEquiv; j++){
              if( pScan->aiCur[j]==pX->iTable
               && pScan->aiColumn[j]==pX->iColumn ){
                  break;
              }
            }
            if( j==pScan->nEquiv ){
              pScan->aiCur[j] = pX->iTable;
              pScan->aiColumn[j] = pX->iColumn;
              pScan->nEquiv++;
            }
          }
          if( (pTerm->eOperator & pScan->opMask)!=0 ){
            /* Verify the affinity and collating sequence match */
            if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){
              CollSeq *pColl;
              Parse *pParse = pWC->pWInfo->pParse;
              pX = pTerm->pExpr;
              if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){
                continue;
              }
              assert(pX->pLeft);
              pColl = sqlite3ExprCompareCollSeq(pParse, pX);
              if( pColl==0 ) pColl = pParse->db->pDfltColl;
              if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){
                continue;
              }
            }
            if( (pTerm->eOperator & (WO_EQ|WO_IS))!=0
             && (pX = pTerm->pExpr->pRight)->op==TK_COLUMN
             && pX->iTable==pScan->aiCur[0]
             && pX->iColumn==pScan->aiColumn[0]
            ){
              testcase( pTerm->eOperator & WO_IS );
              continue;
            }
            pScan->pWC = pWC;
            pScan->k = k+1;
            return pTerm;
          }
        }
      }
      pWC = pWC->pOuter;
      k = 0;
    }while( pWC!=0 );
    if( pScan->iEquiv>=pScan->nEquiv ) break;
    pWC = pScan->pOrigWC;
    k = 0;
    pScan->iEquiv++;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movzbl 0x22(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw 0x58(%rax,%rcx,2), %ax
movw %ax, -0x16(%rbp)
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movzbl 0x22(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x2c(%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jge 0x450c45
movq -0x30(%rbp), %rax
movl 0x1c(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x450c29
movq -0x30(%rbp), %rax
movl 0x28(%rax), %eax
movswl -0x16(%rbp), %ecx
cmpl %ecx, %eax
jne 0x450c29
movswl -0x16(%rbp), %eax
cmpl $-0x2, %eax
jne 0x4509fd
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x4500b0
cmpl $0x0, %eax
jne 0x450c29
movq -0x10(%rbp), %rax
movzbl 0x22(%rax), %eax
cmpl $0x1, %eax
jle 0x450a20
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x450c29
movq -0x30(%rbp), %rax
movzwl 0x14(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x450b02
movq -0x10(%rbp), %rax
movzbl 0x21(%rax), %eax
cmpl $0xb, %eax
jge 0x450b02
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
callq 0x42f120
movq %rax, -0x20(%rbp)
movzbl (%rax), %eax
cmpl $0xa4, %eax
jne 0x450b02
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x21(%rcx), %ecx
cmpl %ecx, %eax
jge 0x450abc
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl 0x2c(%rax,%rcx,4), %eax
movq -0x20(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
jne 0x450aaf
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movswl 0x58(%rax,%rcx,2), %eax
movq -0x20(%rbp), %rcx
movswl 0x30(%rcx), %ecx
cmpl %ecx, %eax
jne 0x450aaf
jmp 0x450abc
jmp 0x450ab1
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x450a70
movl -0x38(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x21(%rcx), %ecx
cmpl %ecx, %eax
jne 0x450b00
movq -0x20(%rbp), %rax
movl 0x2c(%rax), %edx
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl %edx, 0x2c(%rax,%rcx,4)
movq -0x20(%rbp), %rax
movw 0x30(%rax), %dx
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movw %dx, 0x58(%rax,%rcx,2)
movq -0x10(%rbp), %rax
movb 0x21(%rax), %cl
addb $0x1, %cl
movb %cl, 0x21(%rax)
jmp 0x450b02
movq -0x30(%rbp), %rax
movzwl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
andl 0x24(%rcx), %eax
cmpl $0x0, %eax
je 0x450c27
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x450bb3
movq -0x30(%rbp), %rax
movzwl 0x14(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
jne 0x450bb3
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movsbl 0x20(%rax), %esi
callq 0x450cf0
cmpl $0x0, %eax
jne 0x450b6f
jmp 0x450c2b
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3cf220
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x450b96
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x3c3e60
cmpl $0x0, %eax
je 0x450bb1
jmp 0x450c2b
jmp 0x450bb3
movq -0x30(%rbp), %rax
movzwl 0x14(%rax), %eax
andl $0x82, %eax
cmpl $0x0, %eax
je 0x450c04
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movzbl (%rax), %eax
cmpl $0xa4, %eax
jne 0x450c04
movq -0x20(%rbp), %rax
movl 0x2c(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
jne 0x450c04
movq -0x20(%rbp), %rax
movswl 0x30(%rax), %eax
movq -0x10(%rbp), %rcx
movswl 0x58(%rcx), %ecx
cmpl %ecx, %eax
jne 0x450c04
jmp 0x450c2b
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x450ca5
jmp 0x450c29
jmp 0x450c2b
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x30(%rbp)
jmp 0x45099d
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x450986
movq -0x10(%rbp), %rax
movzbl 0x22(%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0x21(%rcx), %ecx
cmpl %ecx, %eax
jl 0x450c79
jmp 0x450c9d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movb 0x22(%rax), %cl
addb $0x1, %cl
movb %cl, 0x22(%rax)
jmp 0x450952
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop