// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: withExpand
static int withExpand(
  Walker *pWalker, 
  struct SrcList_item *pFrom
){
  Parse *pParse = pWalker->pParse;
  sqlite3 *db = pParse->db;
  struct Cte *pCte;               /* Matched CTE (or NULL if no match) */
  With *pWith;                    /* WITH clause that pCte belongs to */

  assert( pFrom->pTab==0 );

  pCte = searchWith(pParse->pWith, pFrom, &pWith);
  if( pCte ){
    Table *pTab;
    ExprList *pEList;
    Select *pSel;
    Select *pLeft;                /* Left-most SELECT statement */
    int bMayRecursive;            /* True if compound joined by UNION [ALL] */
    With *pSavedWith;             /* Initial value of pParse->pWith */

    /* If pCte->zCteErr is non-NULL at this point, then this is an illegal
    ** recursive reference to CTE pCte. Leave an error in pParse and return
    ** early. If pCte->zCteErr is NULL, then this is not a recursive reference.
    ** In this case, proceed.  */
    if( pCte->zCteErr ){
      sqlite3ErrorMsg(pParse, pCte->zCteErr, pCte->zName);
      return SQLITE_ERROR;
    }
    if( cannotBeFunction(pParse, pFrom) ) return SQLITE_ERROR;

    assert( pFrom->pTab==0 );
    pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
    if( pTab==0 ) return WRC_Abort;
    pTab->nRef = 1;
    pTab->zName = sqlite3DbStrDup(db, pCte->zName);
    pTab->iPKey = -1;
    pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
    pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
    pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);
    if( db->mallocFailed ) return SQLITE_NOMEM;
    assert( pFrom->pSelect );

    /* Check if this is a recursive CTE. */
    pSel = pFrom->pSelect;
    bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION );
    if( bMayRecursive ){
      int i;
      SrcList *pSrc = pFrom->pSelect->pSrc;
      for(i=0; i<pSrc->nSrc; i++){
        struct SrcList_item *pItem = &pSrc->a[i];
        if( pItem->zDatabase==0 
         && pItem->zName!=0 
         && 0==sqlite3StrICmp(pItem->zName, pCte->zName)
          ){
          pItem->pTab = pTab;
          pItem->fg.isRecursive = 1;
          pTab->nRef++;
          pSel->selFlags |= SF_Recursive;
        }
      }
    }

    /* Only one recursive reference is permitted. */ 
    if( pTab->nRef>2 ){
      sqlite3ErrorMsg(
          pParse, "multiple references to recursive table: %s", pCte->zName
      );
      return SQLITE_ERROR;
    }
    assert( pTab->nRef==1 || ((pSel->selFlags&SF_Recursive) && pTab->nRef==2 ));

    pCte->zCteErr = "circular reference: %s";
    pSavedWith = pParse->pWith;
    pParse->pWith = pWith;
    sqlite3WalkSelect(pWalker, bMayRecursive ? pSel->pPrior : pSel);
    pParse->pWith = pWith;

    for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
    pEList = pLeft->pEList;
    if( pCte->pCols ){
      if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){
        sqlite3ErrorMsg(pParse, "table %s has %d values for %d columns",
            pCte->zName, pEList->nExpr, pCte->pCols->nExpr
        );
        pParse->pWith = pSavedWith;
        return SQLITE_ERROR;
      }
      pEList = pCte->pCols;
    }

    sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol);
    if( bMayRecursive ){
      if( pSel->selFlags & SF_Recursive ){
        pCte->zCteErr = "multiple recursive references: %s";
      }else{
        pCte->zCteErr = "recursive reference in a subquery: %s";
      }
      sqlite3WalkSelect(pWalker, pSel);
    }
    pCte->zCteErr = 0;
    pParse->pWith = pSavedWith;
  }

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x280(%rax), %rdi
movq -0x18(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x796d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x78a34
movq -0x30(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x78692
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movb $0x0, %al
callq 0x17840
movl $0x1, -0x4(%rbp)
jmp 0x78a3b
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x78ef0
cmpl $0x0, %eax
je 0x786b0
movl $0x1, -0x4(%rbp)
jmp 0x78a3b
movq -0x28(%rbp), %rdi
movl $0x78, %esi
callq 0x15b80
movq %rax, %rcx
movq %rcx, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
cmpq $0x0, -0x40(%rbp)
jne 0x786e0
movl $0x2, -0x4(%rbp)
jmp 0x78a3b
movq -0x40(%rbp), %rax
movw $0x1, 0x40(%rax)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
callq 0x15800
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movw $0xffff, 0x3c(%rax)     # imm = 0xFFFF
movq -0x40(%rbp), %rax
movw $0xc8, 0x42(%rax)
movq -0x40(%rbp), %rax
movzbl 0x46(%rax), %ecx
orl $0x42, %ecx
movb %cl, 0x46(%rax)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x71840
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
cmpb $0x0, 0x51(%rax)
je 0x7875a
movl $0x7, -0x4(%rbp)
jmp 0x78a3b
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movzbl 0x8(%rax), %ecx
movb $0x1, %al
cmpl $0x74, %ecx
movb %al, -0x81(%rbp)
je 0x7878f
movq -0x50(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x73, %eax
sete %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
je 0x78866
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x78864
movq -0x78(%rbp), %rax
addq $0x8, %rax
movslq -0x6c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x78854
movq -0x80(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x78854
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
callq 0xb5c0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x78854
movq -0x40(%rbp), %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x80(%rbp), %rax
movb 0x3d(%rax), %cl
andb $-0x21, %cl
orb $0x20, %cl
movb %cl, 0x3d(%rax)
movq -0x40(%rbp), %rax
movw 0x40(%rax), %cx
addw $0x1, %cx
movw %cx, 0x40(%rax)
movq -0x50(%rbp), %rax
movzwl 0xa(%rax), %ecx
orl $0x2000, %ecx           # imm = 0x2000
movw %cx, 0xa(%rax)
jmp 0x78856
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x787be
jmp 0x78866
movq -0x40(%rbp), %rax
movzwl 0x40(%rax), %eax
cmpl $0x2, %eax
jle 0x78898
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
leaq 0x2f0f1(%rip), %rsi     # 0xa7976
movb $0x0, %al
callq 0x17840
movl $0x1, -0x4(%rbp)
jmp 0x78a3b
movq -0x30(%rbp), %rax
leaq 0x2f0fe(%rip), %rcx     # 0xa79a1
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x280(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpl $0x0, -0x5c(%rbp)
je 0x788e7
movq -0x50(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x98(%rbp)
jmp 0x788f2
movq -0x50(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x70f50
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x280(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x78937
jmp 0x78929
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x7891c
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x789b7
cmpq $0x0, -0x48(%rbp)
je 0x789ab
movq -0x48(%rbp), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpl (%rcx), %eax
je 0x789ab
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movq -0x48(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %r8d
leaq 0x2f02f(%rip), %rsi     # 0xa79b8
movb $0x0, %al
callq 0x17840
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x280(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x78a3b
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq $0x3e, %rdx
movq -0x40(%rbp), %rcx
addq $0x8, %rcx
callq 0x78a50
cmpl $0x0, -0x5c(%rbp)
je 0x78a19
movq -0x50(%rbp), %rax
movzwl 0xa(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x789fd
movq -0x30(%rbp), %rax
leaq 0x2efe7(%rip), %rcx     # 0xa79de
movq %rcx, 0x18(%rax)
jmp 0x78a0c
movq -0x30(%rbp), %rax
leaq 0x2eff8(%rip), %rcx     # 0xa7a00
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x70f50
movq -0x30(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x280(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)