// File: /workspace/github_c_makefile_star2_O2/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
movl %edx, %r14d
movq %rsi, %r13
movq %rdi, %r15
leaq 0x20(%rsp), %rbx
andq $0x0, (%rbx)
xorl %r12d, %r12d
movl %edx, 0x4(%rsp)
testq %r13, %r13
je 0x269d70
movl $0x80, %esi
movq %r15, %rdi
callq 0x22d205
testq %rax, %rax
je 0x269d70
movq %rbx, 0x18(%rsp)
movq %rax, 0x8(%rsp)
movq %rax, %rbp
movq 0x20(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x269d84
movq %rax, 0x20(%rbp)
movq 0x28(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x269ff5
movq %rax, 0x28(%rbp)
movq 0x30(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x267197
movq %rax, 0x30(%rbp)
movq 0x38(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x269d84
movq %rax, 0x38(%rbp)
movq 0x40(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x267197
movq %rax, 0x40(%rbp)
movq 0x48(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x269d84
movq %rax, 0x48(%rbp)
movb (%r13), %al
movb %al, (%rbp)
movq %r12, 0x58(%rbp)
andq $0x0, 0x50(%rbp)
movq 0x60(%r13), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0x267197
movq %rax, 0x60(%rbp)
andq $0x0, 0x8(%rbp)
movl 0x4(%r13), %eax
andl $-0x21, %eax
movl %eax, 0x4(%rbp)
orq $-0x1, 0x14(%rbp)
movzwl 0x2(%r13), %eax
movw %ax, 0x2(%rbp)
movq 0x68(%r13), %rbx
testq %rbx, %rbx
je 0x269cae
movslq (%rbx), %rsi
shlq $0x5, %rsi
orq $0x10, %rsi
movq %r15, %rdi
callq 0x2258ed
testq %rax, %rax
je 0x269cae
movq %rax, %r12
movq %r13, 0x10(%rsp)
movl (%rbx), %eax
movl %eax, (%r12)
pushq $0x20
popq %r13
xorl %r14d, %r14d
cltq
cmpq %rax, %r14
jge 0x269cb3
movq (%rbx,%r13), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x269b29
movq %rax, (%r12,%r13)
movq -0x8(%rbx,%r13), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x269d84
movq %rax, -0x8(%r12,%r13)
movq -0x10(%rbx,%r13), %rsi
movq %r15, %rdi
callq 0x22572a
movq %rax, -0x10(%r12,%r13)
incq %r14
movl (%rbx), %eax
addq $0x20, %r13
jmp 0x269c64
xorl %r12d, %r12d
jmp 0x269cbd
movl 0x4(%rsp), %r14d
movq 0x10(%rsp), %r13
addq $0x50, 0x8(%rsp)
movq %r12, 0x68(%rbp)
andq $0x0, 0x70(%rbp)
movq 0x78(%r13), %r12
andq $0x0, 0x28(%rsp)
leaq 0x28(%rsp), %rbx
testq %r12, %r12
je 0x269d03
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x269ee8
movq %rax, (%rbx)
testq %rax, %rax
je 0x269d03
addq $0x40, %rax
movq 0x40(%r12), %r12
movq %rax, %rbx
jmp 0x269cdb
movq 0x28(%rsp), %rax
movq %rax, 0x78(%rbp)
cmpq $0x0, 0x70(%r13)
je 0x269d50
cmpb $0x0, 0x61(%r15)
jne 0x269d50
leaq 0x4e6(%rip), %rax       # 0x26a207
movq %rax, 0x30(%rsp)
leaq 0x4fa(%rip), %rax       # 0x26a227
movq %rax, 0x38(%rsp)
andq $0x0, 0x40(%rsp)
andq $0x0, 0x28(%rsp)
movq %rbp, 0x50(%rsp)
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x268025
movl 0x10(%r13), %eax
movl %eax, 0x10(%rbp)
movq 0x18(%rsp), %rax
movq %rbp, (%rax)
movq 0x50(%r13), %r13
movq 0x8(%rsp), %rbx
movq %rbp, %r12
jmp 0x269b50
movq 0x20(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq