// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: codeAttach
static void codeAttach(
  Parse *pParse,       /* The parser context */
  int type,            /* Either SQLITE_ATTACH or SQLITE_DETACH */
  FuncDef const *pFunc,/* FuncDef wrapper for detachFunc() or attachFunc() */
  Expr *pAuthArg,      /* Expression to pass to authorization callback */
  Expr *pFilename,     /* Name of database file */
  Expr *pDbname,       /* Name of the database to use internally */
  Expr *pKey           /* Database key for encryption extension */
){
  int rc;
  NameContext sName;
  Vdbe *v;
  sqlite3* db = pParse->db;
  int regArgs;

  if( pParse->nErr ) goto attach_end;
  memset(&sName, 0, sizeof(NameContext));
  sName.pParse = pParse;

  if(
      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pFilename)) ||
      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pDbname)) ||
      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pKey))
  ){
    goto attach_end;
  }

#ifndef SQLITE_OMIT_AUTHORIZATION
  if( pAuthArg ){
    char *zAuthArg;
    if( pAuthArg->op==TK_STRING ){
      zAuthArg = pAuthArg->u.zToken;
    }else{
      zAuthArg = 0;
    }
    rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0);
    if(rc!=SQLITE_OK ){
      goto attach_end;
    }
  }
#endif /* SQLITE_OMIT_AUTHORIZATION */


  v = sqlite3GetVdbe(pParse);
  regArgs = sqlite3GetTempRange(pParse, 4);
  sqlite3ExprCode(pParse, pFilename, regArgs);
  sqlite3ExprCode(pParse, pDbname, regArgs+1);
  sqlite3ExprCode(pParse, pKey, regArgs+2);

  assert( v || db->mallocFailed );
  if( v ){
    sqlite3VdbeAddFunctionCall(pParse, 0, regArgs+3-pFunc->nArg, regArgs+3,
                               pFunc->nArg, pFunc, 0);
    /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this
    ** statement only). For DETACH, set it to false (expire all existing
    ** statements).
    */
    sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH));
  }

attach_end:
  sqlite3ExprDelete(db, pFilename);
  sqlite3ExprDelete(db, pDbname);
  sqlite3ExprDelete(db, pKey);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %rbx
movq %r8, %r12
movl %esi, 0x14(%rsp)
movq (%rdi), %r15
cmpl $0x0, 0x30(%rdi)
jne 0x283edc
movq %rcx, %rbp
movq %rdx, %r13
movq %rdi, %r14
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
movq %r14, (%rdi)
movq %r12, %rsi
callq 0x284544
testl %eax, %eax
jne 0x283edc
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x284544
testl %eax, %eax
jne 0x283edc
leaq 0x20(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x284544
testl %eax, %eax
je 0x283f11
movq %r15, %rdi
movq %r12, %rsi
callq 0x24b639
movq %r15, %rdi
movq %rbx, %rsi
callq 0x24b639
movq %r15, %rdi
movq 0x90(%rsp), %rsi
callq 0x24b639
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rbp, %rbp
je 0x283f39
cmpb $0x73, (%rbp)
jne 0x283f22
movq 0x8(%rbp), %rdx
jmp 0x283f24
xorl %edx, %edx
movq %r14, %rdi
movl 0x14(%rsp), %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x26a651
testl %eax, %eax
jne 0x283edc
movq %r14, %rdi
callq 0x2645be
movq %rax, 0x18(%rsp)
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x266492
movl %eax, %ebp
movq %r14, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x26463f
leal 0x1(%rbp), %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x26463f
leal 0x2(%rbp), %edx
movq %r14, %rdi
movq 0x90(%rsp), %rsi
callq 0x26463f
cmpq $0x0, 0x18(%rsp)
je 0x283edc
addl $0x3, %ebp
movsbl (%r13), %r8d
movl %ebp, %edx
subl %r8d, %edx
andl $0x0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
movl %ebp, %ecx
movq %r13, %r9
callq 0x26660d
xorl %edx, %edx
cmpl $0x18, 0x14(%rsp)
sete %dl
movq 0x18(%rsp), %rdi
movl $0x9e, %esi
callq 0x265d5c
jmp 0x283edc