// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3SrcListAppendFromTerm
SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(
  Parse *pParse,          /* Parsing context */
  SrcList *p,             /* The left part of the FROM clause already seen */
  Token *pTable,          /* Name of the table to add to the FROM clause */
  Token *pDatabase,       /* Name of the database containing pTable */
  Token *pAlias,          /* The right-hand side of the AS subexpression */
  Select *pSubquery,      /* A subquery used in place of a table name */
  Expr *pOn,              /* The ON clause of a join */
  IdList *pUsing          /* The USING clause of a join */
){
  struct SrcList_item *pItem;
  sqlite3 *db = pParse->db;
  if( !p && (pOn || pUsing) ){
    sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s",
      (pOn ? "ON" : "USING")
    );
    goto append_from_error;
  }
  p = sqlite3SrcListAppend(pParse, p, pTable, pDatabase);
  if( p==0 ){
    goto append_from_error;
  }
  assert( p->nSrc>0 );
  pItem = &p->a[p->nSrc-1];
  assert( (pTable==0)==(pDatabase==0) );
  assert( pItem->zName==0 || pDatabase!=0 );
  if( IN_RENAME_OBJECT && pItem->zName ){
    Token *pToken = (ALWAYS(pDatabase) && pDatabase->z) ? pDatabase : pTable;
    sqlite3RenameTokenMap(pParse, pItem->zName, pToken);
  }
  assert( pAlias!=0 );
  if( pAlias->n ){
    pItem->zAlias = sqlite3NameFromToken(db, pAlias);
  }
  pItem->pSelect = pSubquery;
  pItem->pOn = pOn;
  pItem->pUsing = pUsing;
  return p;

 append_from_error:
  assert( p==0 );
  sqlite3ExprDelete(db, pOn);
  sqlite3IdListDelete(db, pUsing);
  sqlite3SelectDelete(db, pSubquery);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x41d099
cmpq $0x0, 0x10(%rbp)
jne 0x41d068
cmpq $0x0, 0x18(%rbp)
je 0x41d099
movq -0x10(%rbp), %rdi
movq 0x10(%rbp), %rcx
leaq 0x19109e(%rip), %rdx    # 0x5ae115
leaq 0x190464(%rip), %rax    # 0x5ad4e2
cmpq $0x0, %rcx
cmovneq %rax, %rdx
leaq 0x191064(%rip), %rsi    # 0x5ae0f1
movb $0x0, %al
callq 0x3cb660
jmp 0x41d188
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x41d960
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x41d0be
jmp 0x41d188
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x11c(%rax), %eax
cmpl $0x2, %eax
jl 0x41d138
movq -0x40(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x41d138
cmpq $0x0, -0x28(%rbp)
je 0x41d113
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
je 0x41d113
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x41d11b
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x50(%rbp), %rdx
callq 0x41dae0
movq -0x30(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x41d15a
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x41db70
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq 0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x48(%rax)
movq 0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x41d1b7
movq -0x48(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x40c670
movq -0x48(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x40cbd0
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x40c7e0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)