// File: /workspace/github_c_makefile_star2_O1/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, 0x10(%rsp)
movq %rcx, (%rsp)
movq %rsi, %rbx
movq %rdi, %rbp
movq (%rdi), %rdi
movq %rdi, 0x8(%rsp)
movq %rdx, %rsi
callq 0x2bb67d
movq %rax, %r14
testq %rax, %rax
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x2c5a9d
cmpl $0x0, (%rbx)
jle 0x2c5a9d
leaq 0x10(%rbx), %r13
leaq 0x11501c(%rip), %r12    # 0x3daa60
xorl %r15d, %r15d
movq %r15, %rax
shlq $0x5, %rax
movq (%r13,%rax), %rax
xorl %ecx, %ecx
movzbl (%r14,%rcx), %edx
movzbl (%rax,%rcx), %esi
cmpb %sil, %dl
jne 0x2c5a6a
testq %rdx, %rdx
jne 0x2c5a74
jmp 0x2c5a79
movb (%rdx,%r12), %dil
cmpb (%rsi,%r12), %dil
jne 0x2c5a79
incq %rcx
jmp 0x2c5a55
cmpb %sil, %dl
jne 0x2c5a92
movq %rbp, %rdi
leaq 0x11dba6(%rip), %rsi    # 0x3e362e
movq %r14, %rdx
xorl %eax, %eax
callq 0x284eb8
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0x2c5a47
testq %rbx, %rbx
je 0x2c5abf
movslq (%rbx), %rdx
shlq $0x5, %rdx
addq $0x30, %rdx
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x28c4c8
jmp 0x2c5ad1
movl $0x30, %esi
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x283569
cmpb $0x0, 0x61(%r15)
je 0x2c5b12
movq (%rsp), %rsi
testq %rsi, %rsi
je 0x2c5ae9
movq %r15, %rdi
callq 0x2b0183
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x2c5b00
movq %r15, %rdi
movl $0x1, %edx
callq 0x2afecb
testq %r14, %r14
je 0x2c5b42
movq %r15, %rdi
movq %r14, %rsi
callq 0x28c3e7
jmp 0x2c5b42
movslq (%rax), %rcx
leal 0x1(%rcx), %edx
shlq $0x5, %rcx
movq 0x10(%rsp), %rsi
movq %rsi, 0x20(%rax,%rcx)
movq (%rsp), %rsi
movq %rsi, 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