// File: /workspace/github_c_makefile_star2_O1/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 0x5b29c
cmpl $0x4c, %eax
jne 0x5b2b8
movq %rsi, %r14
movq 0x18(%r12), %rsi
movq %r13, %rdi
movl %ebx, %edx
callq 0x4d211
movq %r14, %rsi
movl %eax, %ebx
jmp 0x5b406
movq %rsi, %r14
movl $0x18, %esi
xorl %edx, %edx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movq %r14, %rsi
jmp 0x5b406
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 0x5b2f5
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x5b2f5
movq 0x38(%rax), %rax
movslq %ecx, %rcx
cmpb $0x0, (%rax,%rcx)
je 0x5b2f5
xorl %eax, %eax
testl %r14d, %r14d
sete %al
movl %eax, %r14d
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x4ef2c
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
xorl %r8d, %r8d
callq 0x45b9e
movq -0x50(%rbp), %rax
orb $0x8, 0x29(%rax)
cmpl $0x0, 0x30(%r15)
jne 0x5b353
movq -0x38(%rbp), %rdi
callq 0x4c4bf
movl %eax, 0x10(%r15)
movl 0x30(%r15), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x30(%r15)
movq (%r13), %rdi
movq 0x38(%r15), %rsi
leal 0x4(,%rax,4), %eax
leal (%rax,%rax,2), %edx
callq 0x33504
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x5b3b0
movslq 0x30(%r15), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,4), %r14
movl %r12d, -0xc(%rax,%rcx,4)
cmpl $0x1, -0x3c(%rbp)
jne 0x5b3bd
movq -0x38(%rbp), %r13
movq %r13, %rdi
movl $0x60, %esi
movl %r12d, %edx
movl -0x2c(%rbp), %r12d
movl %r12d, %ecx
xorl %r8d, %r8d
jmp 0x5b3d5
movl $0x0, 0x30(%r15)
movl -0x2c(%rbp), %ebx
jmp 0x5b402
movq -0x38(%rbp), %r13
movq %r13, %rdi
movl $0x29, %esi
movl %r12d, %edx
xorl %ecx, %ecx
movl -0x2c(%rbp), %r12d
movl %r12d, %r8d
callq 0x45b9e
testl %ebx, %ebx
sete %cl
movl %eax, -0x8(%r14)
orb $0x6, %cl
movb %cl, -0x4(%r14)
movq %r13, %rdi
movl $0x49, %esi
movl %r12d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x45b9e
movl %r12d, %ebx
movq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0x5b41f
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq