// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x4637d0
jmp 0x46394b
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x19360
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x464330
movl %eax, %ecx
movl %ecx, -0x34(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x463830
movq -0x30(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x464330
movl %eax, %ecx
movl %ecx, -0x34(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x463830
movq 0x10(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x464330
movl %eax, %ecx
movl %ecx, -0x34(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
je 0x463835
jmp 0x46394b
cmpq $0x0, -0x20(%rbp)
je 0x46388f
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x73, %eax
jne 0x463859
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0x463864
movq $0x0, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x90(%rbp), %rdx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x4338b0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x46388d
jmp 0x46394b
jmp 0x46388f
movq -0x8(%rbp), %rdi
callq 0x4299d0
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4, %esi
callq 0x42cb30
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x84(%rbp), %edx
callq 0x429d30
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x84(%rbp), %edx
addl $0x1, %edx
callq 0x429d30
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rsi
movl -0x84(%rbp), %edx
addl $0x2, %edx
callq 0x429d30
cmpq $0x0, -0x78(%rbp)
je 0x463949
movq -0x8(%rbp), %rdi
movl -0x84(%rbp), %edx
addl $0x3, %edx
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
subl %eax, %edx
movl -0x84(%rbp), %ecx
addl $0x3, %ecx
movq -0x18(%rbp), %rax
movsbl (%rax), %r8d
movq -0x18(%rbp), %r9
xorl %esi, %esi
movl $0x0, (%rsp)
callq 0x42cfa0
movq -0x78(%rbp), %rdi
cmpl $0x18, -0xc(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %edx
movl $0x9e, %esi
callq 0x42ba70
jmp 0x46394b
movq -0x80(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x40c670
movq -0x80(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x40c670
movq -0x80(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x40c670
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)