// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3SelectDup
SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){
  Select *pRet = 0;
  Select *pNext = 0;
  Select **pp = &pRet;
  Select *p;

  assert( db!=0 );
  for(p=pDup; p; p=p->pPrior){
    Select *pNew = sqlite3DbMallocRawNN(db, sizeof(*p) );
    if( pNew==0 ) break;
    pNew->pEList = sqlite3ExprListDup(db, p->pEList, flags);
    pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);
    pNew->pWhere = sqlite3ExprDup(db, p->pWhere, flags);
    pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy, flags);
    pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags);
    pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags);
    pNew->op = p->op;
    pNew->pNext = pNext;
    pNew->pPrior = 0;
    pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags);
    pNew->iLimit = 0;
    pNew->iOffset = 0;
    pNew->selFlags = p->selFlags & ~SF_UsesEphemeral;
    pNew->addrOpenEphm[0] = -1;
    pNew->addrOpenEphm[1] = -1;
    pNew->nSelectRow = p->nSelectRow;
    pNew->pWith = withDup(db, p->pWith);
#ifndef SQLITE_OMIT_WINDOWFUNC
    pNew->pWin = 0;
    pNew->pWinDefn = sqlite3WindowListDup(db, p->pWinDefn);
    if( p->pWin && db->mallocFailed==0 ) gatherSelectWindows(pNew);
#endif
    pNew->selId = p->selId;
    *pp = pNew;
    pp = &pNew->pPrior;
    pNext = pNew;
  }

  return pRet;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq $0x0, 0x8(%rsp)
testq %rsi, %rsi
je 0x2cc511
movl %edx, %r14d
movq %rsi, %r13
movq %rdi, %r15
leaq 0x8(%rsp), %rbx
xorl %r12d, %r12d
movl %edx, 0x4(%rsp)
movl $0x80, %esi
movq %r15, %rdi
callq 0x28c518
testq %rax, %rax
je 0x2cc312
movq %rax, 0x18(%rsp)
movq %rax, %rbp
movq 0x20(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x2cc525
movq %rax, 0x20(%rbp)
movq 0x28(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x2cc81d
movq %rax, 0x28(%rbp)
movq 0x30(%r13), %rsi
testq %rsi, %rsi
je 0x2cc31a
movq %r15, %rdi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x2cbf97
jmp 0x2cc31c
movq %r12, %rbp
jmp 0x2cc4fc
xorl %eax, %eax
movq %rax, 0x30(%rbp)
movq 0x38(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x2cc525
movq %rax, 0x38(%rbp)
movq 0x40(%r13), %rsi
testq %rsi, %rsi
je 0x2cc34b
movq %r15, %rdi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x2cbf97
jmp 0x2cc34d
xorl %eax, %eax
movq %rax, 0x40(%rbp)
movq 0x48(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x2cc525
movq %rax, 0x48(%rbp)
movb (%r13), %al
movb %al, (%rbp)
movq %r12, 0x58(%rbp)
movq $0x0, 0x50(%rbp)
movq 0x60(%r13), %rsi
testq %rsi, %rsi
movq %rbx, 0x20(%rsp)
je 0x2cc394
movq %r15, %rdi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x2cbf97
jmp 0x2cc396
xorl %eax, %eax
movq %rax, 0x60(%rbp)
movq $0x0, 0x8(%rbp)
movl 0x4(%r13), %eax
andl $-0x21, %eax
movl %eax, 0x4(%rbp)
movq $-0x1, 0x14(%rbp)
movzwl 0x2(%r13), %eax
movw %ax, 0x2(%rbp)
movq 0x68(%r13), %rbx
testq %rbx, %rbx
je 0x2cc451
movslq (%rbx), %rsi
shlq $0x5, %rsi
orq $0x10, %rsi
movq %r15, %rdi
callq 0x283569
movq %rax, %r12
testq %rax, %rax
je 0x2cc454
movl (%rbx), %eax
movl %eax, (%r12)
cmpl $0x0, (%rbx)
jle 0x2cc454
movq %r13, 0x10(%rsp)
movl $0x20, %r13d
xorl %r14d, %r14d
movq (%rbx,%r13), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x2cc285
movq %rax, (%r12,%r13)
movq -0x8(%rbx,%r13), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x2cc525
movq %rax, -0x8(%r12,%r13)
movq -0x10(%rbx,%r13), %rsi
movq %r15, %rdi
callq 0x283365
movq %rax, -0x10(%r12,%r13)
incq %r14
movslq (%rbx), %rax
addq $0x20, %r13
cmpq %rax, %r14
jl 0x2cc3fe
movl 0x4(%rsp), %r14d
movq 0x10(%rsp), %r13
jmp 0x2cc454
xorl %r12d, %r12d
movq %r12, 0x68(%rbp)
xorl %eax, %eax
movq %rax, 0x70(%rbp)
movq 0x78(%r13), %r12
movq %rax, 0x28(%rsp)
testq %r12, %r12
je 0x2cc497
leaq 0x28(%rsp), %rbx
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x2cc6ed
movq %rax, (%rbx)
testq %rax, %rax
je 0x2cc497
addq $0x40, %rax
movq 0x40(%r12), %r12
movq %rax, %rbx
testq %r12, %r12
jne 0x2cc471
movq 0x28(%rsp), %rax
movq %rax, 0x78(%rbp)
cmpq $0x0, 0x70(%r13)
je 0x2cc4e4
cmpb $0x0, 0x61(%r15)
jne 0x2cc4e4
leaq 0x5ab(%rip), %rax       # 0x2cca60
movq %rax, 0x30(%rsp)
leaq 0x5bf(%rip), %rax       # 0x2cca80
movq %rax, 0x38(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq %rax, 0x28(%rsp)
movq %rbp, 0x50(%rsp)
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x2ca2ea
movl 0x10(%r13), %eax
movl %eax, 0x10(%rbp)
movq 0x20(%rsp), %rax
movq %rbp, (%rax)
movq 0x18(%rsp), %rax
leaq 0x50(%rax), %rbx
testq %rax, %rax
je 0x2cc511
movq 0x50(%r13), %r13
movq %rbp, %r12
testq %r13, %r13
jne 0x2cc2ba
movq 0x8(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq