// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: codeEqualityTerm
static int codeEqualityTerm(
  Parse *pParse,      /* The parsing context */
  WhereTerm *pTerm,   /* The term of the WHERE clause to be coded */
  WhereLevel *pLevel, /* The level of the FROM clause we are working on */
  int iEq,            /* Index of the equality term within this level */
  int bRev,           /* True for reverse-order IN operations */
  int iTarget         /* Attempt to leave results in this register */
){
  Expr *pX = pTerm->pExpr;
  Vdbe *v = pParse->pVdbe;
  int iReg;                  /* Register holding results */

  assert( iTarget>0 );
  if( pX->op==TK_EQ ){
    iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);
  }else if( pX->op==TK_ISNULL ){
    iReg = iTarget;
    sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);
#ifndef SQLITE_OMIT_SUBQUERY
  }else{
    int eType;
    int iTab;
    struct InLoop *pIn;
    WhereLoop *pLoop = pLevel->pWLoop;

    if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
      && pLoop->u.btree.pIndex!=0
      && pLoop->u.btree.pIndex->aSortOrder[iEq]
    ){
      testcase( iEq==0 );
      testcase( bRev );
      bRev = !bRev;
    }
    assert( pX->op==TK_IN );
    iReg = iTarget;
    eType = sqlite3FindInIndex(pParse, pX, 0);
    if( eType==IN_INDEX_INDEX_DESC ){
      testcase( bRev );
      bRev = !bRev;
    }
    iTab = pX->iTable;
    sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);
    assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
    pLoop->wsFlags |= WHERE_IN_ABLE;
    if( pLevel->u.in.nIn==0 ){
      pLevel->addrNxt = sqlite3VdbeMakeLabel(v);
    }
    pLevel->u.in.nIn++;
    pLevel->u.in.aInLoop =
       sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
                              sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
    pIn = pLevel->u.in.aInLoop;
    if( pIn ){
      pIn += pLevel->u.in.nIn - 1;
      pIn->iCur = iTab;
      if( eType==IN_INDEX_ROWID ){
        pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);
      }else{
        pIn->addrInTop = sqlite3VdbeAddOp3(v, OP_Column, iTab, 0, iReg);
      }
      pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
      sqlite3VdbeAddOp1(v, OP_IsNull, iReg);
    }else{
      pLevel->u.in.nIn = 0;
    }
#endif
  }
  disableTerm(pLevel, pTerm);
  return iReg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebx
movq %rdx, %r15
movq %rdi, %r13
movq (%rsi), %r12
movq 0x10(%rdi), %rdi
movzbl (%r12), %eax
cmpl $0x49, %eax
je 0x523ee
cmpl $0x4c, %eax
jne 0x52405
movq %rsi, %r14
movq 0x18(%r12), %rsi
movq %r13, %rdi
movl %ebx, %edx
callq 0x484da
movq %r14, %rsi
movl %eax, %ebx
jmp 0x5253f
movq %rsi, %r14
pushq $0x18
popq %rsi
xorl %edx, %edx
movl %ebx, %ecx
callq 0x41f42
movq %r14, %rsi
jmp 0x5253f
movl %r8d, %r14d
movq 0x40(%r15), %rax
testb $0x4, 0x29(%rax)
movl %ebx, -0x2c(%rbp)
movq %rsi, -0x48(%rbp)
movq %rdi, -0x38(%rbp)
movq %rax, -0x50(%rbp)
jne 0x52442
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x52442
movq 0x38(%rax), %rax
movslq %ecx, %rcx
cmpb $0x0, (%rax,%rcx)
je 0x52442
xorl %eax, %eax
testl %r14d, %r14d
sete %al
movl %eax, %r14d
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x49c33
xorl %ebx, %ebx
testl %r14d, %r14d
sete %bl
movl %eax, -0x3c(%rbp)
cmpl $0x4, %eax
cmovnel %r14d, %ebx
movl 0x2c(%r12), %r12d
xorl %eax, %eax
testl %ebx, %ebx
sete %al
leal (%rax,%rax,2), %esi
addl $0x62, %esi
movq -0x38(%rbp), %rdi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0x41f42
movq -0x50(%rbp), %rax
orb $0x8, 0x29(%rax)
movl 0x30(%r15), %eax
testl %eax, %eax
jne 0x524a2
movq -0x38(%rbp), %rdi
callq 0x47934
movl %eax, 0x10(%r15)
movl 0x30(%r15), %eax
incl %eax
movl %eax, 0x30(%r15)
movq (%r13), %rdi
movq 0x38(%r15), %rsi
imull $0xc, %eax, %edx
callq 0x2eac1
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x524f5
movq %rax, %r14
movslq 0x30(%r15), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %r14
movl %r12d, -0xc(%rax,%rcx)
cmpl $0x1, -0x3c(%rbp)
jne 0x524ff
pushq $0x60
popq %rsi
movq -0x38(%rbp), %r13
movq %r13, %rdi
movl %r12d, %edx
movl -0x2c(%rbp), %r12d
movl %r12d, %ecx
callq 0x41f42
jmp 0x5251a
andl $0x0, 0x30(%r15)
movl -0x2c(%rbp), %ebx
jmp 0x5253b
pushq $0x29
popq %rsi
movq -0x38(%rbp), %r13
movq %r13, %rdi
movl %r12d, %edx
xorl %ecx, %ecx
movl -0x2c(%rbp), %r12d
movl %r12d, %r8d
callq 0x41f4c
testl %ebx, %ebx
sete %cl
movl %eax, -0x8(%r14)
orb $0x6, %cl
movb %cl, -0x4(%r14)
pushq $0x49
popq %rsi
movq %r13, %rdi
movl %r12d, %edx
callq 0x42436
movl %r12d, %ebx
movq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0x52558
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq