// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: removeUnindexableInClauseTerms
static Expr *removeUnindexableInClauseTerms(
  Parse *pParse,        /* The parsing context */
  int iEq,              /* Look at loop terms starting here */
  WhereLoop *pLoop,     /* The current loop */
  Expr *pX              /* The IN expression to be reduced */
){
  sqlite3 *db = pParse->db;
  Expr *pNew;
  pNew = sqlite3ExprDup(db, pX, 0);
  if( db->mallocFailed==0 ){
    ExprList *pOrigRhs = pNew->x.pSelect->pEList;  /* Original unmodified RHS */
    ExprList *pOrigLhs = pNew->pLeft->x.pList;     /* Original unmodified LHS */
    ExprList *pRhs = 0;         /* New RHS after modifications */
    ExprList *pLhs = 0;         /* New LHS after mods */
    int i;                      /* Loop counter */
    Select *pSelect;            /* Pointer to the SELECT on the RHS */

    for(i=iEq; i<pLoop->nLTerm; i++){
      if( pLoop->aLTerm[i]->pExpr==pX ){
        int iField = pLoop->aLTerm[i]->iField - 1;
        if( pOrigRhs->a[iField].pExpr==0 ) continue; /* Duplicate PK column */
        pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr);
        pOrigRhs->a[iField].pExpr = 0;
        assert( pOrigLhs->a[iField].pExpr!=0 );
        pLhs = sqlite3ExprListAppend(pParse, pLhs, pOrigLhs->a[iField].pExpr);
        pOrigLhs->a[iField].pExpr = 0;
      }
    }
    sqlite3ExprListDelete(db, pOrigRhs);
    sqlite3ExprListDelete(db, pOrigLhs);
    pNew->pLeft->x.pList = pLhs;
    pNew->x.pSelect->pEList = pRhs;
    if( pLhs && pLhs->nExpr==1 ){
      /* Take care here not to generate a TK_VECTOR containing only a
      ** single value. Since the parser never creates such a vector, some
      ** of the subroutines do not handle this case.  */
      Expr *p = pLhs->a[0].pExpr;
      pLhs->a[0].pExpr = 0;
      sqlite3ExprDelete(db, pNew->pLeft);
      pNew->pLeft = p;
    }
    pSelect = pNew->x.pSelect;
    if( pSelect->pOrderBy ){
      /* If the SELECT statement has an ORDER BY clause, zero the
      ** iOrderByCol variables. These are set to non-zero when an
      ** ORDER BY term exactly matches one of the terms of the
      ** result-set. Since the result-set of the SELECT statement may
      ** have been modified or reordered, these variables are no longer
      ** set correctly.  Since setting them is just an optimization,
      ** it's easiest just to zero them here.  */
      ExprList *pOrderBy = pSelect->pOrderBy;
      for(i=0; i<pOrderBy->nExpr; i++){
        pOrderBy->a[i].u.x.iOrderByCol = 0;
      }
    }

#if 0
    printf("For indexing, change the IN expr:\n");
    sqlite3TreeViewExpr(0, pX, 0);
    printf("Into:\n");
    sqlite3TreeViewExpr(0, pNew, 0);
#endif
  }
  return pNew;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x42dee0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x4572b4
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x18(%rbp), %rcx
movzwl 0x2c(%rcx), %ecx
cmpl %ecx, %eax
jge 0x4571d8
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0x4571c8
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x20(%rax), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x64(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
jne 0x457146
jmp 0x4571ca
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x64(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
callq 0x41d3c0
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x64(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rax
addq $0x8, %rax
movslq -0x64(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
callq 0x41d3c0
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
addq $0x8, %rax
movslq -0x64(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
jmp 0x4571ca
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x4570df
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x40c6a0
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x40c6a0
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x20(%rax)
cmpq $0x0, -0x50(%rbp)
je 0x457257
movq -0x50(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x457257
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x40c670
movq -0x70(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x4572b2
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x4572b0
movq -0x78(%rbp), %rax
addq $0x8, %rax
movslq -0x54(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw $0x0, 0x14(%rax)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x457281
jmp 0x4572b2
jmp 0x4572b4
movq -0x30(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)