// File: /workspace/github_c_makefile_star2_O1/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3ExprCodeIN
static void sqlite3ExprCodeIN(
  Parse *pParse,        /* Parsing and code generating context */
  Expr *pExpr,          /* The IN expression */
  int destIfFalse,      /* Jump here if LHS is not contained in the RHS */
  int destIfNull        /* Jump here if the results are unknown due to NULLs */
){
  int rRhsHasNull = 0;  /* Register that is true if RHS contains NULL values */
  char affinity;        /* Comparison affinity to use */
  int eType;            /* Type of the RHS */
  int r1;               /* Temporary use register */
  Vdbe *v;              /* Statement under construction */

  /* Compute the RHS.   After this step, the table with cursor
  ** pExpr->iTable will contains the values that make up the RHS.
  */
  v = pParse->pVdbe;
  assert( v!=0 );       /* OOM detected prior to this routine */
  VdbeNoopComment((v, "begin IN expr"));
  eType = sqlite3FindInIndex(pParse, pExpr,
                             IN_INDEX_MEMBERSHIP | IN_INDEX_NOOP_OK,
                             destIfFalse==destIfNull ? 0 : &rRhsHasNull);

  /* Figure out the affinity to use to create a key from the results
  ** of the expression. affinityStr stores a static string suitable for
  ** P4 of OP_MakeRecord.
  */
  affinity = comparisonAffinity(pExpr);

  /* Code the LHS, the <expr> from "<expr> IN (...)".
  */
  sqlite3ExprCachePush(pParse);
  r1 = sqlite3GetTempReg(pParse);
  sqlite3ExprCode(pParse, pExpr->pLeft, r1);

  /* If sqlite3FindInIndex() did not find or create an index that is
  ** suitable for evaluating the IN operator, then evaluate using a
  ** sequence of comparisons.
  */
  if( eType==IN_INDEX_NOOP ){
    ExprList *pList = pExpr->x.pList;
    CollSeq *pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft);
    int labelOk = sqlite3VdbeMakeLabel(v);
    int r2, regToFree;
    int regCkNull = 0;
    int ii;
    assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
    if( destIfNull!=destIfFalse ){
      regCkNull = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp3(v, OP_BitAnd, r1, r1, regCkNull);
    }
    for(ii=0; ii<pList->nExpr; ii++){
      r2 = sqlite3ExprCodeTemp(pParse, pList->a[ii].pExpr, &regToFree);
      if( regCkNull && sqlite3ExprCanBeNull(pList->a[ii].pExpr) ){
        sqlite3VdbeAddOp3(v, OP_BitAnd, regCkNull, r2, regCkNull);
      }
      if( ii<pList->nExpr-1 || destIfNull!=destIfFalse ){
        sqlite3VdbeAddOp4(v, OP_Eq, r1, labelOk, r2,
                          (void*)pColl, P4_COLLSEQ);
        VdbeCoverageIf(v, ii<pList->nExpr-1);
        VdbeCoverageIf(v, ii==pList->nExpr-1);
        sqlite3VdbeChangeP5(v, affinity);
      }else{
        assert( destIfNull==destIfFalse );
        sqlite3VdbeAddOp4(v, OP_Ne, r1, destIfFalse, r2,
                          (void*)pColl, P4_COLLSEQ); VdbeCoverage(v);
        sqlite3VdbeChangeP5(v, affinity | SQLITE_JUMPIFNULL);
      }
      sqlite3ReleaseTempReg(pParse, regToFree);
    }
    if( regCkNull ){
      sqlite3VdbeAddOp2(v, OP_IsNull, regCkNull, destIfNull); VdbeCoverage(v);
      sqlite3VdbeGoto(v, destIfFalse);
    }
    sqlite3VdbeResolveLabel(v, labelOk);
    sqlite3ReleaseTempReg(pParse, regCkNull);
  }else{
  
    /* If the LHS is NULL, then the result is either false or NULL depending
    ** on whether the RHS is empty or not, respectively.
    */
    if( sqlite3ExprCanBeNull(pExpr->pLeft) ){
      if( destIfNull==destIfFalse ){
        /* Shortcut for the common case where the false and NULL outcomes are
        ** the same. */
        sqlite3VdbeAddOp2(v, OP_IsNull, r1, destIfNull); VdbeCoverage(v);
      }else{
        int addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, r1); VdbeCoverage(v);
        sqlite3VdbeAddOp2(v, OP_Rewind, pExpr->iTable, destIfFalse);
        VdbeCoverage(v);
        sqlite3VdbeGoto(v, destIfNull);
        sqlite3VdbeJumpHere(v, addr1);
      }
    }
  
    if( eType==IN_INDEX_ROWID ){
      /* In this case, the RHS is the ROWID of table b-tree
      */
      sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, destIfFalse); VdbeCoverage(v);
      sqlite3VdbeAddOp3(v, OP_NotExists, pExpr->iTable, destIfFalse, r1);
      VdbeCoverage(v);
    }else{
      /* In this case, the RHS is an index b-tree.
      */
      sqlite3VdbeAddOp4(v, OP_Affinity, r1, 1, 0, &affinity, 1);
  
      /* If the set membership test fails, then the result of the 
      ** "x IN (...)" expression must be either 0 or NULL. If the set
      ** contains no NULL values, then the result is 0. If the set 
      ** contains one or more NULL values, then the result of the
      ** expression is also NULL.
      */
      assert( destIfFalse!=destIfNull || rRhsHasNull==0 );
      if( rRhsHasNull==0 ){
        /* This branch runs if it is known at compile time that the RHS
        ** cannot contain NULL values. This happens as the result
        ** of a "NOT NULL" constraint in the database schema.
        **
        ** Also run this branch if NULL is equivalent to FALSE
        ** for this particular IN operator.
        */
        sqlite3VdbeAddOp4Int(v, OP_NotFound, pExpr->iTable, destIfFalse, r1, 1);
        VdbeCoverage(v);
      }else{
        /* In this branch, the RHS of the IN might contain a NULL and
        ** the presence of a NULL on the RHS makes a difference in the
        ** outcome.
        */
        int addr1;
  
        /* First check to see if the LHS is contained in the RHS.  If so,
        ** then the answer is TRUE the presence of NULLs in the RHS does
        ** not matter.  If the LHS is not contained in the RHS, then the
        ** answer is NULL if the RHS contains NULLs and the answer is
        ** FALSE if the RHS is NULL-free.
        */
        addr1 = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0, r1, 1);
        VdbeCoverage(v);
        sqlite3VdbeAddOp2(v, OP_IsNull, rRhsHasNull, destIfNull);
        VdbeCoverage(v);
        sqlite3VdbeGoto(v, destIfFalse);
        sqlite3VdbeJumpHere(v, addr1);
      }
    }
  }
  sqlite3ReleaseTempReg(pParse, r1);
  sqlite3ExprCachePop(pParse);
  VdbeComment((v, "end IN expr"));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r8d
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x4c(%rbp), %rax
movl $0x0, (%rax)
movq 0x10(%rdi), %rcx
movq %rcx, -0x40(%rbp)
xorl %ecx, %ecx
movl %edx, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
cmpl %r8d, %edx
cmovneq %rax, %rcx
movl $0x3, %edx
callq 0x5556e
movl %eax, %r13d
movq %r14, %rdi
callq 0x55a85
movb %al, -0x29(%rbp)
incl 0x74(%rbx)
movb 0x1f(%rbx), %al
testb %al, %al
je 0x53519
decb %al
movb %al, 0x1f(%rbx)
movzbl %al, %eax
movl 0x24(%rbx,%rax,4), %r15d
jmp 0x53524
movl 0x54(%rbx), %r15d
incl %r15d
movl %r15d, 0x54(%rbx)
movq 0x10(%r14), %rsi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x50a8d
cmpl $0x5, %r13d
jne 0x53588
movq 0x10(%r14), %rsi
movq 0x20(%r14), %r14
movq %rbx, %rdi
callq 0x529e4
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %r13
movq %r13, %rdi
callq 0x528c8
movl %eax, -0x48(%rbp)
xorl %r12d, %r12d
movl -0x34(%rbp), %eax
cmpl %eax, -0x30(%rbp)
je 0x53653
movb 0x1f(%rbx), %al
testb %al, %al
je 0x53632
decb %al
movb %al, 0x1f(%rbx)
movzbl %al, %eax
movl 0x24(%rbx,%rax,4), %r12d
jmp 0x5363d
movq 0x10(%r14), %rdi
callq 0x55ad6
testl %eax, %eax
je 0x53862
movl -0x30(%rbp), %r12d
movl -0x34(%rbp), %ecx
cmpl %ecx, %r12d
je 0x53619
movq -0x40(%rbp), %rdi
movl $0x4d, %esi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movl %eax, -0x38(%rbp)
movl 0x2c(%r14), %edx
movq -0x40(%rbp), %rdi
movl $0x6e, %esi
movl %r12d, %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movq -0x40(%rbp), %r12
movq %r12, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl -0x34(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movl 0x3c(%r12), %eax
leal -0x1(%rax), %ecx
movq 0x30(%r12), %rdx
movl %ecx, 0x68(%rdx)
movq (%r12), %rdx
cmpb $0x0, 0x51(%rdx)
je 0x53847
leaq 0x41ed4(%rip), %rcx     # 0x954e8
jmp 0x5385f
movq -0x40(%rbp), %rdi
movl $0x4c, %esi
movl %r15d, %edx
xorl %r8d, %r8d
callq 0x3fa9e
jmp 0x53862
movl 0x54(%rbx), %r12d
incl %r12d
movl %r12d, 0x54(%rbx)
movq %r13, %rdi
movl $0x55, %esi
movl %r15d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x3fa9e
movl %r12d, -0x38(%rbp)
movl %r15d, -0x44(%rbp)
cmpl $0x0, (%r14)
jle 0x5379b
xorl %r15d, %r15d
movq 0x8(%r14), %rax
movq %r15, %r13
shlq $0x5, %r13
movq (%rax,%r13), %rsi
movq %rbx, %rdi
leaq -0x50(%rbp), %rdx
callq 0x52646
movl %eax, %r12d
cmpl $0x0, -0x38(%rbp)
je 0x536b4
movq 0x8(%r14), %rax
movq (%rax,%r13), %rdi
callq 0x55ad6
testl %eax, %eax
je 0x536b4
movq -0x40(%rbp), %rdi
movl $0x55, %esi
movl -0x38(%rbp), %edx
movl %r12d, %ecx
movl %edx, %r8d
callq 0x3fa9e
movl -0x30(%rbp), %ecx
cmpl -0x34(%rbp), %ecx
jne 0x536f8
movslq (%r14), %rax
decq %rax
cmpq %rax, %r15
jl 0x536f8
movq -0x40(%rbp), %r13
movq %r13, %rdi
movl $0x4e, %esi
movl -0x44(%rbp), %edx
movl %r12d, %r8d
callq 0x3fa9e
movq %r13, %rdi
movl %eax, %esi
movq -0x58(%rbp), %rdx
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
callq 0x14ab9
movb -0x29(%rbp), %al
orb $0x10, %al
jmp 0x53728
movq -0x40(%rbp), %r13
movq %r13, %rdi
movl $0x4f, %esi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl %r12d, %r8d
callq 0x3fa9e
movq %r13, %rdi
movl %eax, %esi
movq -0x58(%rbp), %rdx
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
callq 0x14ab9
movb -0x29(%rbp), %al
movq (%r13), %rcx
cmpb $0x0, 0x51(%rcx)
leaq 0x41db1(%rip), %rcx     # 0x954e8
jne 0x5374d
movslq 0x3c(%r13), %rcx
movq 0x8(%r13), %rdx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rcx,8), %rcx
addq $-0x18, %rcx
movb %al, 0x3(%rcx)
movl -0x50(%rbp), %eax
testl %eax, %eax
je 0x5378c
movzbl 0x1f(%rbx), %ecx
cmpq $0x7, %rcx
ja 0x5378c
xorl %edx, %edx
cmpl %eax, 0x94(%rbx,%rdx)
je 0x53784
addq $0x14, %rdx
cmpl $0xc8, %edx
jne 0x53763
leal 0x1(%rcx), %edx
movb %dl, 0x1f(%rbx)
movl %eax, 0x24(%rbx,%rcx,4)
jmp 0x5378c
movb $0x1, 0x8e(%rbx,%rdx)
incq %r15
movslq (%r14), %rax
cmpq %rax, %r15
jl 0x53668
movl -0x38(%rbp), %r14d
testl %r14d, %r14d
je 0x537cf
movq %r13, %rdi
movl $0x4c, %esi
movl %r14d, %edx
movl -0x34(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movq %r13, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl -0x30(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movq 0x30(%r13), %rax
movq 0x80(%rax), %rcx
testq %rcx, %rcx
je 0x537ee
movl -0x48(%rbp), %esi
notl %esi
movl 0x3c(%r13), %edx
movslq %esi, %rsi
movl %edx, (%rcx,%rsi,4)
movl 0x3c(%r13), %ecx
decl %ecx
movl %ecx, 0x68(%rax)
testl %r14d, %r14d
movl -0x44(%rbp), %r15d
je 0x53992
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x53992
xorl %ecx, %ecx
cmpl %r14d, 0x94(%rbx,%rcx)
je 0x5383a
addq $0x14, %rcx
cmpl $0xc8, %ecx
jne 0x53814
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl %r14d, 0x24(%rbx,%rax,4)
jmp 0x53992
movb $0x1, 0x8e(%rbx,%rcx)
jmp 0x53992
movl -0x38(%rbp), %edx
testl %edx, %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x8(%r12), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x1, %r13d
jne 0x538a2
movq -0x40(%rbp), %r12
movq %r12, %rdi
movl $0x27, %esi
movl %r15d, %edx
movl -0x30(%rbp), %r13d
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movl 0x2c(%r14), %edx
movq %r12, %rdi
movl $0x4a, %esi
movl %r13d, %ecx
movl %r15d, %r8d
callq 0x3fa9e
jmp 0x53992
movq -0x40(%rbp), %r12
movq %r12, %rdi
movl $0x31, %esi
movl %r15d, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x3fa9e
leaq -0x29(%rbp), %rdx
movq %r12, %rdi
movl %eax, %esi
movl $0x1, %ecx
callq 0x14ab9
cmpl $0x0, -0x4c(%rbp)
movl 0x2c(%r14), %edx
movq %r12, %rdi
je 0x53952
movl $0x49, %esi
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x3fa9e
movl %eax, %r14d
movl $0x1, %edx
movq %r12, %rdi
movl %eax, %esi
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14ab9
movl -0x4c(%rbp), %edx
movq %r12, %rdi
movl $0x4c, %esi
movl -0x34(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movq %r12, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl -0x30(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movl 0x3c(%r12), %eax
leal -0x1(%rax), %ecx
movq 0x30(%r12), %rdx
movl %ecx, 0x68(%rdx)
movq (%r12), %rdx
cmpb $0x0, 0x51(%rdx)
je 0x53978
leaq 0x41b98(%rip), %rcx     # 0x954e8
jmp 0x5398f
movl $0x46, %esi
movl -0x30(%rbp), %ecx
movl %r15d, %r8d
callq 0x3fa9e
movl $0x1, %edx
movq %r12, %rdi
movl %eax, %esi
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14ab9
jmp 0x53992
testl %r14d, %r14d
cmovnsl %r14d, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x8(%r12), %rcx
movl %eax, 0x8(%rcx)
testl %r15d, %r15d
je 0x539ce
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x539ce
xorl %ecx, %ecx
cmpl %r15d, 0x94(%rbx,%rcx)
je 0x539c6
addq $0x14, %rcx
cmpl $0xc8, %ecx
jne 0x539a3
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl %r15d, 0x24(%rbx,%rax,4)
jmp 0x539ce
movb $0x1, 0x8e(%rbx,%rcx)
movq %rbx, %rdi
callq 0x52985
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq