// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: whereRangeVectorLen
static int whereRangeVectorLen(
  Parse *pParse,       /* Parsing context */
  int iCur,            /* Cursor open on pIdx */
  Index *pIdx,         /* The index to be used for a inequality constraint */
  int nEq,             /* Number of prior equality constraints on same index */
  WhereTerm *pTerm     /* The vector inequality constraint */
){
  int nCmp = sqlite3ExprVectorSize(pTerm->pExpr->pLeft);
  int i;

  nCmp = MIN(nCmp, (pIdx->nColumn - nEq));
  for(i=1; i<nCmp; i++){
    /* Test if comparison i of pTerm is compatible with column (i+nEq)
    ** of the index. If not, exit the loop.  */
    char aff;                     /* Comparison affinity */
    char idxaff = 0;              /* Indexed columns affinity */
    CollSeq *pColl;               /* Comparison collation sequence */
    Expr *pLhs = pTerm->pExpr->pLeft->x.pList->a[i].pExpr;
    Expr *pRhs = pTerm->pExpr->pRight;
    if( pRhs->flags & EP_xIsSelect ){
      pRhs = pRhs->x.pSelect->pEList->a[i].pExpr;
    }else{
      pRhs = pRhs->x.pList->a[i].pExpr;
    }

    /* Check that the LHS of the comparison is a column reference to
    ** the right column of the right source table. And that the sort
    ** order of the index column is the same as the sort order of the
    ** leftmost index column.  */
    if( pLhs->op!=TK_COLUMN
     || pLhs->iTable!=iCur
     || pLhs->iColumn!=pIdx->aiColumn[i+nEq]
     || pIdx->aSortOrder[i+nEq]!=pIdx->aSortOrder[nEq]
    ){
      break;
    }

    testcase( pLhs->iColumn==XN_ROWID );
    aff = sqlite3CompareAffinity(pRhs, sqlite3ExprAffinity(pLhs));
    idxaff = sqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn);
    if( aff!=idxaff ) break;

    pColl = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
    if( pColl==0 ) break;
    if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break;
  }
  return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq (%r8), %rax
movq 0x10(%rax), %rax
movb (%rax), %dil
cmpb $-0x53, %dil
jne 0x2dc5e6
movb 0x2(%rax), %dil
cmpb $-0x52, %dil
je 0x2dc602
movzbl %dil, %r9d
movl $0x1, %edi
cmpl $0x88, %r9d
jne 0x2dc608
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movl (%rax), %edi
movzwl 0x60(%rdx), %ebp
subl %ecx, %ebp
cmpl %ebp, %edi
cmovll %edi, %ebp
movl $0x1, %r12d
cmpl $0x2, %ebp
jl 0x2dc768
movl %ecx, %eax
movq %rax, 0x20(%rsp)
movslq %ecx, %rax
movq %rax, 0x28(%rsp)
movl %ebp, %eax
movq %rax, 0x10(%rsp)
movl $0x1, %r12d
leaq 0xf4c9b(%rip), %rbx     # 0x3d12e0
movq %r8, 0x18(%rsp)
movq %rdx, 0x8(%rsp)
movl %esi, 0x4(%rsp)
movq (%r8), %rcx
movq 0x18(%rcx), %rax
testb $0x8, 0x5(%rax)
je 0x2dc664
movq 0x20(%rax), %rax
movq 0x10(%rcx), %rcx
movq 0x20(%rcx), %rdi
leaq (%r12,%r12,2), %rcx
movq 0x8(%rdi,%rcx,8), %r13
cmpb $-0x5c, (%r13)
jne 0x2dc768
cmpl %esi, 0x2c(%r13)
jne 0x2dc768
movzwl 0x30(%r13), %edi
movq 0x8(%rdx), %r9
movq 0x28(%rsp), %r10
leaq (%r12,%r10), %r14
cmpw (%r9,%r14,2), %di
jne 0x2dc768
movq 0x38(%rdx), %rdi
movb (%rdi,%r14), %r9b
movq 0x20(%rsp), %r10
cmpb (%rdi,%r10), %r9b
jne 0x2dc768
movq 0x20(%rax), %rax
movq 0x8(%rax,%rcx,8), %r15
movq %r13, %rdi
callq 0x2c08a4
movsbl %al, %esi
movq %r15, %rdi
callq 0x2c0948
movswq 0x30(%r13), %rcx
testq %rcx, %rcx
js 0x2dc6fb
movq 0x8(%rsp), %rdx
movq 0x18(%rdx), %rdx
movq 0x8(%rdx), %rdx
shlq $0x5, %rcx
movb 0x19(%rdx,%rcx), %cl
jmp 0x2dc6fd
movb $0x44, %cl
cmpb %cl, %al
jne 0x2dc768
movq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x2a9634
testq %rax, %rax
je 0x2dc768
movq (%rax), %rax
movq 0x8(%rsp), %rdx
movq 0x40(%rdx), %rcx
movq (%rcx,%r14,8), %rcx
xorl %r9d, %r9d
movq 0x18(%rsp), %r8
movzbl (%rax,%r9), %esi
movzbl (%rcx,%r9), %edi
cmpb %dil, %sil
jne 0x2dc744
testq %rsi, %rsi
jne 0x2dc74e
jmp 0x2dc753
movb (%rsi,%rbx), %sil
cmpb (%rdi,%rbx), %sil
jne 0x2dc768
incq %r9
jmp 0x2dc72e
incq %r12
cmpq 0x10(%rsp), %r12
movl 0x4(%rsp), %esi
jne 0x2dc653
movl %ebp, %r12d
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq