// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x4327f9
movq -0x8(%rbp), %rdi
movl $0x80, %esi
callq 0x3d62a0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x43260c
jmp 0x4327f9
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x432810
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x432c70
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x42dee0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x432810
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x42dee0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x432810
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rax
movb (%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x42dee0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x40(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x40(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %ecx
andl $-0x21, %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x40(%rbp), %rax
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rax
movw 0x2(%rax), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rsi
callq 0x432f10
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x433060
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x4327bb
movq -0x8(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x4327bb
movq -0x40(%rbp), %rdi
callq 0x4330e0
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x4325e3
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)