// File: /workspace/github_c_makefile_star2_O3/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 -0x50(%rbp), %rax
movl $0x0, (%rax)
movq 0x10(%rdi), %rcx
movq %rcx, -0x48(%rbp)
xorl %ecx, %ecx
movl %edx, -0x30(%rbp)
movl %r8d, -0x3c(%rbp)
cmpl %r8d, %edx
cmovneq %rax, %rcx
movl $0x3, %edx
callq 0x54388
movl %eax, %r13d
movq %r14, %rdi
callq 0x547f7
movb %al, -0x29(%rbp)
movb %al, -0x32(%rbp)
incl 0x74(%rbx)
movb 0x1f(%rbx), %al
testb %al, %al
je 0x52340
decb %al
movb %al, 0x1f(%rbx)
movzbl %al, %eax
movl 0x24(%rbx,%rax,4), %r15d
jmp 0x5234b
movl 0x54(%rbx), %r15d
incl %r15d
movl %r15d, 0x54(%rbx)
movq 0x10(%r14), %rsi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x4f909
cmpl $0x5, %r13d
jne 0x523b0
movq 0x10(%r14), %rsi
movq 0x20(%r14), %r14
movq %rbx, %rdi
callq 0x51845
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %r13
movq 0x30(%r13), %rdi
callq 0x51729
movl %eax, -0x4c(%rbp)
xorl %r12d, %r12d
movl -0x3c(%rbp), %eax
cmpl %eax, -0x30(%rbp)
je 0x52477
movb 0x1f(%rbx), %al
testb %al, %al
je 0x52456
decb %al
movb %al, 0x1f(%rbx)
movzbl %al, %eax
movl 0x24(%rbx,%rax,4), %r12d
jmp 0x52461
movq 0x10(%r14), %rdi
callq 0x54848
testl %eax, %eax
movl -0x3c(%rbp), %eax
je 0x526c0
movl -0x30(%rbp), %ecx
cmpl %eax, %ecx
je 0x5243d
movq -0x48(%rbp), %r12
movq %r12, %rdi
movl $0x4d, %esi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movl %eax, -0x40(%rbp)
movl 0x2c(%r14), %edx
movq %r12, %rdi
movl $0x6e, %esi
movl -0x30(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movq %r12, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl -0x3c(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movl 0x3c(%r12), %eax
leal -0x1(%rax), %ecx
movq 0x30(%r12), %rdx
movl %ecx, 0x68(%rdx)
movq (%r12), %rdx
cmpb $0x0, 0x51(%rdx)
je 0x526a5
leaq 0x410c0(%rip), %rcx     # 0x934f8
jmp 0x526bd
movq -0x48(%rbp), %rdi
movl $0x4c, %esi
movl %r15d, %edx
xorl %r8d, %r8d
callq 0x3ea9f
jmp 0x526c0
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 0x3ea9f
movl %r12d, -0x40(%rbp)
movl %r15d, -0x38(%rbp)
cmpl $0x0, (%r14)
jle 0x525cd
movb -0x29(%rbp), %al
orb $0x10, %al
movb %al, -0x31(%rbp)
xorl %r15d, %r15d
movq 0x8(%r14), %rax
movq %r15, %r13
shlq $0x5, %r13
movq (%rax,%r13), %rsi
movq %rbx, %rdi
leaq -0x54(%rbp), %rdx
callq 0x514d0
movl %eax, %r12d
cmpl $0x0, -0x40(%rbp)
je 0x524e0
movq 0x8(%r14), %rax
movq (%rax,%r13), %rdi
callq 0x54848
testl %eax, %eax
je 0x524e0
movq -0x48(%rbp), %rdi
movl $0x55, %esi
movl -0x40(%rbp), %edx
movl %r12d, %ecx
movl %edx, %r8d
callq 0x3ea9f
movl -0x30(%rbp), %ecx
cmpl -0x3c(%rbp), %ecx
jne 0x5252a
movslq (%r14), %rax
decq %rax
cmpq %rax, %r15
jl 0x5252a
movq -0x48(%rbp), %r13
movq %r13, %rdi
movl $0x4e, %esi
movl -0x38(%rbp), %edx
movl %r12d, %r8d
callq 0x3ea9f
movq %r13, %rdi
movl %eax, %esi
movq -0x60(%rbp), %rdx
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
callq 0x14b4f
movq (%r13), %rax
cmpb $0x0, 0x51(%rax)
movb -0x31(%rbp), %al
jmp 0x52562
movq -0x48(%rbp), %r13
movq %r13, %rdi
movl $0x4f, %esi
movl -0x38(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl %r12d, %r8d
callq 0x3ea9f
movq %r13, %rdi
movl %eax, %esi
movq -0x60(%rbp), %rdx
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
callq 0x14b4f
movq (%r13), %rax
cmpb $0x0, 0x51(%rax)
movb -0x29(%rbp), %al
leaq 0x40f8f(%rip), %rcx     # 0x934f8
jne 0x5257f
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 -0x54(%rbp), %eax
testl %eax, %eax
je 0x525be
movzbl 0x1f(%rbx), %ecx
cmpq $0x7, %rcx
ja 0x525be
xorl %edx, %edx
cmpl %eax, 0x94(%rbx,%rdx)
je 0x525b6
addq $0x14, %rdx
cmpl $0xc8, %edx
jne 0x52595
leal 0x1(%rcx), %edx
movb %dl, 0x1f(%rbx)
movl %eax, 0x24(%rbx,%rcx,4)
jmp 0x525be
movb $0x1, 0x8e(%rbx,%rdx)
incq %r15
movslq (%r14), %rax
cmpq %rax, %r15
jl 0x52494
movl -0x40(%rbp), %r14d
testl %r14d, %r14d
je 0x52622
movq %r13, %rdi
movl $0x4c, %esi
movl %r14d, %edx
movl -0x3c(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movq %r13, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl -0x30(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movq 0x30(%r13), %rax
movq 0x80(%rax), %rdx
testq %rdx, %rdx
je 0x52643
movl -0x4c(%rbp), %esi
notl %esi
movl 0x3c(%r13), %ecx
movslq %esi, %rsi
movl %ecx, (%rdx,%rsi,4)
jmp 0x52647
movq 0x30(%r13), %rax
movq 0x80(%rax), %rdx
testq %rdx, %rdx
je 0x52693
movl -0x4c(%rbp), %esi
notl %esi
movl 0x3c(%r13), %ecx
movslq %esi, %rsi
movl %ecx, (%rdx,%rsi,4)
jmp 0x52697
movl 0x3c(%r13), %ecx
movl -0x38(%rbp), %r15d
decl %ecx
movl %ecx, 0x68(%rax)
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x527f0
xorl %ecx, %ecx
cmpl %r14d, 0x94(%rbx,%rcx)
je 0x52686
addq $0x14, %rcx
cmpl $0xc8, %ecx
jne 0x52660
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl %r14d, 0x24(%rbx,%rax,4)
jmp 0x527f0
movb $0x1, 0x8e(%rbx,%rcx)
jmp 0x527f0
movl 0x3c(%r13), %ecx
movl -0x38(%rbp), %r15d
decl %ecx
movl %ecx, 0x68(%rax)
jmp 0x527f0
movl -0x40(%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 0x52700
movq -0x48(%rbp), %r12
movq %r12, %rdi
movl $0x27, %esi
movl %r15d, %edx
movl -0x30(%rbp), %r13d
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movl 0x2c(%r14), %edx
movq %r12, %rdi
movl $0x4a, %esi
movl %r13d, %ecx
movl %r15d, %r8d
callq 0x3ea9f
jmp 0x527f0
movq -0x48(%rbp), %r12
movq %r12, %rdi
movl $0x31, %esi
movl %r15d, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
leaq -0x32(%rbp), %rdx
movq %r12, %rdi
movl %eax, %esi
movl $0x1, %ecx
callq 0x14b4f
cmpl $0x0, -0x50(%rbp)
movl 0x2c(%r14), %edx
movq %r12, %rdi
je 0x527b0
movl $0x49, %esi
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x3ea9f
movl %eax, %r14d
movl $0x1, %edx
movq %r12, %rdi
movl %eax, %esi
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14b4f
movl -0x50(%rbp), %edx
movq %r12, %rdi
movl $0x4c, %esi
movl -0x3c(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movq %r12, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl -0x30(%rbp), %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movl 0x3c(%r12), %eax
leal -0x1(%rax), %ecx
movq 0x30(%r12), %rdx
movl %ecx, 0x68(%rdx)
movq (%r12), %rdx
cmpb $0x0, 0x51(%rdx)
je 0x527d6
leaq 0x40d4a(%rip), %rcx     # 0x934f8
jmp 0x527ed
movl $0x46, %esi
movl -0x30(%rbp), %ecx
movl %r15d, %r8d
callq 0x3ea9f
movl $0x1, %edx
movq %r12, %rdi
movl %eax, %esi
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14b4f
jmp 0x527f0
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 0x5282c
movzbl 0x1f(%rbx), %eax
cmpq $0x7, %rax
ja 0x5282c
xorl %ecx, %ecx
cmpl %r15d, 0x94(%rbx,%rcx)
je 0x52824
addq $0x14, %rcx
cmpl $0xc8, %ecx
jne 0x52801
leal 0x1(%rax), %ecx
movb %cl, 0x1f(%rbx)
movl %r15d, 0x24(%rbx,%rax,4)
jmp 0x5282c
movb $0x1, 0x8e(%rbx,%rcx)
movq %rbx, %rdi
callq 0x517e6
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq