// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3WithAdd
SQLITE_PRIVATE With *sqlite3WithAdd(
  Parse *pParse,          /* Parsing context */
  With *pWith,            /* Existing WITH clause, or NULL */
  Token *pName,           /* Name of the common-table */
  ExprList *pArglist,     /* Optional column name list for the table */
  Select *pQuery          /* Query used to initialize the table */
){
  sqlite3 *db = pParse->db;
  With *pNew;
  char *zName;

  /* Check that the CTE name is unique within this WITH clause. If
  ** not, store an error in the Parse structure. */
  zName = sqlite3NameFromToken(pParse->db, pName);
  if( zName && pWith ){
    int i;
    for(i=0; i<pWith->nCte; i++){
      if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){
        sqlite3ErrorMsg(pParse, "duplicate WITH table name: %s", zName);
      }
    }
  }

  if( pWith ){
    sqlite3_int64 nByte = sizeof(*pWith) + (sizeof(pWith->a[1]) * pWith->nCte);
    pNew = sqlite3DbRealloc(db, pWith, nByte);
  }else{
    pNew = sqlite3DbMallocZero(db, sizeof(*pWith));
  }
  assert( (pNew!=0 && zName!=0) || db->mallocFailed );

  if( db->mallocFailed ){
    sqlite3ExprListDelete(db, pArglist);
    sqlite3SelectDelete(db, pQuery);
    sqlite3DbFree(db, zName);
    pNew = pWith;
  }else{
    pNew->a[pNew->nCte].pSelect = pQuery;
    pNew->a[pNew->nCte].pCols = pArglist;
    pNew->a[pNew->nCte].zName = zName;
    pNew->a[pNew->nCte].zCteErr = 0;
    pNew->nCte++;
  }

  return pNew;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r15
movq %rcx, %r13
movq %rsi, %rbx
movq %rdi, %rbp
movq (%rdi), %r12
movq %r12, %rdi
movq %rdx, %rsi
callq 0x2b1f02
movq %rax, %r14
testq %rax, %rax
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x2bc2ec
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl (%rbx), %eax
testl %eax, %eax
jle 0x2bc305
leaq 0x10(%rbx), %r13
leaq 0x11504c(%rip), %r12    # 0x3d12e0
xorl %r15d, %r15d
movq %r15, %rcx
shlq $0x5, %rcx
movq (%r13,%rcx), %rcx
xorl %edx, %edx
movzbl (%r14,%rdx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x2bc2ba
testq %rsi, %rsi
jne 0x2bc2c4
jmp 0x2bc2c9
movb (%rsi,%r12), %sil
cmpb (%rdi,%r12), %sil
jne 0x2bc2df
incq %rdx
jmp 0x2bc2a5
movq %rbp, %rdi
leaq 0x11dc06(%rip), %rsi    # 0x3d9ed9
movq %r14, %rdx
xorl %eax, %eax
callq 0x27b48d
movl (%rbx), %eax
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0x2bc297
jmp 0x2bc305
testq %rbx, %rbx
je 0x2bc3a1
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl (%rbx), %eax
movslq %eax, %rdx
shlq $0x5, %rdx
addq $0x30, %rdx
movq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2829e5
movq 0x10(%rsp), %r15
movq (%rsp), %r13
cmpb $0x0, 0x61(%r12)
je 0x2bc368
testq %r13, %r13
je 0x2bc341
movq %r12, %rdi
movq %r13, %rsi
callq 0x2a65a3
testq %r15, %r15
je 0x2bc356
movq %r12, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2a62e6
testq %r14, %r14
je 0x2bc38f
movq %r12, %rdi
movq %r14, %rsi
callq 0x282904
jmp 0x2bc38f
movslq (%rax), %rcx
leal 0x1(%rcx), %edx
shlq $0x5, %rcx
movq %r15, 0x20(%rax,%rcx)
movq %r13, 0x18(%rax,%rcx)
movq %r14, 0x10(%rax,%rcx)
movq $0x0, 0x28(%rax,%rcx)
movl %edx, (%rax)
movq %rax, %rbx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x30, %esi
movq %r12, %rdi
callq 0x279b27
jmp 0x2bc329