// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: codeAllEqualityTerms
static int codeAllEqualityTerms(
  Parse *pParse,        /* Parsing context */
  WhereLevel *pLevel,   /* Which nested loop of the FROM we are coding */
  int bRev,             /* Reverse the order of IN operators */
  int nExtraReg,        /* Number of extra registers to allocate */
  char **pzAff          /* OUT: Set to point to affinity string */
){
  u16 nEq;                      /* The number of == or IN constraints to code */
  u16 nSkip;                    /* Number of left-most columns to skip */
  Vdbe *v = pParse->pVdbe;      /* The vm under construction */
  Index *pIdx;                  /* The index being used for this loop */
  WhereTerm *pTerm;             /* A single constraint term */
  WhereLoop *pLoop;             /* The WhereLoop object */
  int j;                        /* Loop counter */
  int regBase;                  /* Base register */
  int nReg;                     /* Number of registers to allocate */
  char *zAff;                   /* Affinity string to return */

  /* This module is only called on query plans that use an index. */
  pLoop = pLevel->pWLoop;
  assert( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 );
  nEq = pLoop->u.btree.nEq;
  nSkip = pLoop->nSkip;
  pIdx = pLoop->u.btree.pIndex;
  assert( pIdx!=0 );

  /* Figure out how many memory cells we will need then allocate them.
  */
  regBase = pParse->nMem + 1;
  nReg = pLoop->u.btree.nEq + nExtraReg;
  pParse->nMem += nReg;

  zAff = sqlite3DbStrDup(pParse->db,sqlite3IndexAffinityStr(pParse->db,pIdx));
  if( !zAff ){
    pParse->db->mallocFailed = 1;
  }

  if( nSkip ){
    int iIdxCur = pLevel->iIdxCur;
    sqlite3VdbeAddOp1(v, (bRev?OP_Last:OP_Rewind), iIdxCur);
    VdbeCoverageIf(v, bRev==0);
    VdbeCoverageIf(v, bRev!=0);
    VdbeComment((v, "begin skip-scan on %s", pIdx->zName));
    j = sqlite3VdbeAddOp0(v, OP_Goto);
    pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT),
                            iIdxCur, 0, regBase, nSkip);
    VdbeCoverageIf(v, bRev==0);
    VdbeCoverageIf(v, bRev!=0);
    sqlite3VdbeJumpHere(v, j);
    for(j=0; j<nSkip; j++){
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, j, regBase+j);
      testcase( pIdx->aiColumn[j]==XN_EXPR );
      VdbeComment((v, "%s", explainIndexColumnName(pIdx, j)));
    }
  }    

  /* Evaluate the equality constraints
  */
  assert( zAff==0 || (int)strlen(zAff)>=nEq );
  for(j=nSkip; j<nEq; j++){
    int r1;
    pTerm = pLoop->aLTerm[j];
    assert( pTerm!=0 );
    /* The following testcase is true for indices with redundant columns. 
    ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
    testcase( (pTerm->wtFlags & TERM_CODED)!=0 );
    testcase( pTerm->wtFlags & TERM_VIRTUAL );
    r1 = codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, regBase+j);
    if( r1!=regBase+j ){
      if( nReg==1 ){
        sqlite3ReleaseTempReg(pParse, regBase);
        regBase = r1;
      }else{
        sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j);
      }
    }
    testcase( pTerm->eOperator & WO_ISNULL );
    testcase( pTerm->eOperator & WO_IN );
    if( (pTerm->eOperator & (WO_ISNULL|WO_IN))==0 ){
      Expr *pRight = pTerm->pExpr->pRight;
      if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){
        sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);
        VdbeCoverage(v);
      }
      if( zAff ){
        if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){
          zAff[j] = SQLITE_AFF_BLOB;
        }
        if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){
          zAff[j] = SQLITE_AFF_BLOB;
        }
      }
    }
  }
  *pzAff = zAff;
  return regBase;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movw 0x18(%rax), %ax
movw %ax, -0x22(%rbp)
movq -0x48(%rbp), %rax
movw 0x2e(%rax), %ax
movw %ax, -0x24(%rbp)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl 0x54(%rax), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movzwl 0x18(%rax), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0x54(%rax), %ecx
movl %ecx, 0x54(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x8ea70
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x15800
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x8e54e
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb $0x1, 0x51(%rax)
cmpw $0x0, -0x24(%rbp)
je 0x8e60d
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %ecx
movl $0x6e, %esi
movl $0x6b, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
movl -0x64(%rbp), %edx
callq 0x6e570
movq -0x30(%rbp), %rdi
movl $0xe, %esi
callq 0x6be00
movl %eax, -0x4c(%rbp)
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %ecx
movl $0x43, %esi
movl $0x40, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
movl -0x64(%rbp), %edx
movl -0x50(%rbp), %r8d
movzwl -0x24(%rbp), %r9d
xorl %ecx, %ecx
callq 0x17b10
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x30(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x6be30
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movzwl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jge 0x8e60b
movq -0x30(%rbp), %rdi
movl -0x64(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl -0x50(%rbp), %r8d
addl -0x4c(%rbp), %r8d
movl $0x30, %esi
callq 0x56c10
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8e5d9
jmp 0x8e60d
movzwl -0x24(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movzwl -0x22(%rbp), %ecx
cmpl %ecx, %eax
jge 0x8e764
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rdx
movl -0x4c(%rbp), %ecx
movl -0x14(%rbp), %r8d
movl -0x50(%rbp), %r9d
addl -0x4c(%rbp), %r9d
callq 0x8e100
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
cmpl %ecx, %eax
je 0x8e69a
cmpl $0x1, -0x54(%rbp)
jne 0x8e681
movq -0x8(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x6f9b0
movl -0x68(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x8e698
movq -0x30(%rbp), %rdi
movl -0x68(%rbp), %edx
movl -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
movl $0x20, %esi
callq 0x6c310
jmp 0x8e69a
movq -0x40(%rbp), %rax
movzwl 0x1a(%rax), %eax
andl $0x101, %eax            # imm = 0x101
cmpl $0x0, %eax
jne 0x8e754
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rax
movzwl 0x1c(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x8e6fa
movq -0x70(%rbp), %rdi
callq 0x72b40
cmpl $0x0, %eax
je 0x8e6fa
movq -0x30(%rbp), %rdi
movl -0x50(%rbp), %edx
addl -0x4c(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
movl $0x4c, %esi
callq 0x6c310
cmpq $0x0, -0x60(%rbp)
je 0x8e752
movq -0x70(%rbp), %rdi
movq -0x60(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsbl (%rax,%rcx), %esi
callq 0x72390
movsbl %al, %eax
cmpl $0x41, %eax
jne 0x8e72a
movq -0x60(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movb $0x41, (%rax,%rcx)
movq -0x70(%rbp), %rdi
movq -0x60(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsbl (%rax,%rcx), %esi
callq 0x8e7e0
cmpl $0x0, %eax
je 0x8e750
movq -0x60(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movb $0x41, (%rax,%rcx)
jmp 0x8e752
jmp 0x8e754
jmp 0x8e756
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8e614
movq -0x60(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl -0x50(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)