// File: /workspace/github_c_makefile_star2_O1/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3FinishCoding
SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
  sqlite3 *db;
  Vdbe *v;

  assert( pParse->pToplevel==0 );
  db = pParse->db;
  if( pParse->nested ) return;
  if( db->mallocFailed || pParse->nErr ){
    if( pParse->rc==SQLITE_OK ) pParse->rc = SQLITE_ERROR;
    return;
  }

  /* Begin by generating some termination code at the end of the
  ** vdbe program
  */
  v = sqlite3GetVdbe(pParse);
  assert( !pParse->isMultiWrite 
       || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
  if( v ){
    while( sqlite3VdbeDeletePriorOpcode(v, OP_Close) ){}
    sqlite3VdbeAddOp0(v, OP_Halt);

#if SQLITE_USER_AUTHENTICATION
    if( pParse->nTableLock>0 && db->init.busy==0 ){
      sqlite3UserAuthInit(db);
      if( db->auth.authLevel<UAUTH_User ){
        pParse->rc = SQLITE_AUTH_USER;
        sqlite3ErrorMsg(pParse, "user not authenticated");
        return;
      }
    }
#endif

    /* The cookie mask contains one bit for each database file open.
    ** (Bit 0 is for main, bit 1 is for temp, and so forth.)  Bits are
    ** set for each database that is used.  Generate code to start a
    ** transaction on each used database and to verify the schema cookie
    ** on each used database.
    */
    if( db->mallocFailed==0 
     && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
    ){
      int iDb, i;
      assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
      sqlite3VdbeJumpHere(v, 0);
      for(iDb=0; iDb<db->nDb; iDb++){
        if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
        sqlite3VdbeUsesBtree(v, iDb);
        sqlite3VdbeAddOp4Int(v,
          OP_Transaction,                    /* Opcode */
          iDb,                               /* P1 */
          DbMaskTest(pParse->writeMask,iDb), /* P2 */
          pParse->cookieValue[iDb],          /* P3 */
          db->aDb[iDb].pSchema->iGeneration  /* P4 */
        );
        if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
        VdbeComment((v,
              "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
      for(i=0; i<pParse->nVtabLock; i++){
        char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);
        sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
      }
      pParse->nVtabLock = 0;
#endif

      /* Once all the cookies have been verified and transactions opened, 
      ** obtain the required table-locks. This is a no-op unless the 
      ** shared-cache feature is enabled.
      */
      codeTableLocks(pParse);

      /* Initialize any AUTOINCREMENT data structures required.
      */
      sqlite3AutoincrementBegin(pParse);

      /* Code constant expressions that where factored out of inner loops */
      if( pParse->pConstExpr ){
        ExprList *pEL = pParse->pConstExpr;
        pParse->okConstFactor = 0;
        for(i=0; i<pEL->nExpr; i++){
          sqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg);
        }
      }

      /* Finally, jump back to the beginning of the executable code. */
      sqlite3VdbeGoto(v, 1);
    }
  }


  /* Get the VDBE program ready for execution
  */
  if( v && pParse->nErr==0 && !db->mallocFailed ){
    assert( pParse->iCacheLevel==0 );  /* Disables and re-enables match */
    /* A minimum of one cursor is required if autoincrement is used
    *  See ticket [a696379c1f08866] */
    if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
    sqlite3VdbeMakeReady(v, pParse);
    pParse->rc = SQLITE_DONE;
    pParse->colNamesSet = 0;
  }else{
    pParse->rc = SQLITE_ERROR;
  }
  pParse->nTab = 0;
  pParse->nMem = 0;
  pParse->nSet = 0;
  pParse->nVar = 0;
  DbMaskZero(pParse->cookieMask);
}

// Assembly:
cmpb $0x0, 0x1e(%rdi)
je 0x42829
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r13
cmpb $0x0, 0x51(%r13)
jne 0x4284a
cmpl $0x0, 0x4c(%rbx)
je 0x42860
cmpl $0x0, 0x18(%rbx)
jne 0x42acf
movl $0x1, 0x18(%rbx)
jmp 0x42acf
movq %rbx, %rdi
callq 0x507bf
testq %rax, %rax
je 0x42aaf
movq %rax, %r14
movq %r14, %rdi
movl $0x3e, %esi
callq 0x50817
testl %eax, %eax
jne 0x42874
movq %r14, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3fa9e
cmpb $0x0, 0x51(%r13)
jne 0x42a9d
cmpl $0x0, 0x16c(%rbx)
jne 0x428bb
cmpq $0x0, 0x150(%rbx)
je 0x42a9d
movl 0x3c(%r14), %eax
leal -0x1(%rax), %ecx
movq 0x30(%r14), %rdx
movl %ecx, 0x68(%rdx)
movq (%r14), %rcx
cmpb $0x0, 0x51(%rcx)
je 0x428db
leaq 0x52c0f(%rip), %rcx     # 0x954e8
jmp 0x428df
movq 0x8(%r14), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x0, 0x28(%r13)
jle 0x429c4
xorl %r12d, %r12d
xorl %r15d, %r15d
movl 0x16c(%rbx), %edx
movl $0x1, %eax
movl %r15d, %ecx
shll %cl, %eax
btl %r15d, %edx
jae 0x429b0
orl %eax, 0x94(%r14)
cmpq $0x1, %r15
je 0x42933
movq (%r14), %rcx
movq 0x20(%rcx), %rcx
movq 0x8(%rcx,%r12), %rcx
cmpb $0x0, 0x11(%rcx)
je 0x42933
orl %eax, 0x98(%r14)
movl 0x168(%rbx), %eax
xorl %ecx, %ecx
btl %r15d, %eax
setb %cl
movl 0x170(%rbx,%r15,4), %r8d
movq 0x20(%r13), %rax
movq 0x18(%rax,%r12), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x30(%rbp)
movq %r14, %rdi
movl $0x3, %esi
movl %r15d, %edx
callq 0x3fa9e
movq %r14, %rdi
movl %eax, %esi
movq -0x30(%rbp), %rdx
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14ab9
cmpb $0x0, 0xa1(%r13)
jne 0x429b0
movq (%r14), %rax
cmpb $0x0, 0x51(%rax)
leaq 0x52b52(%rip), %rax     # 0x954e8
jne 0x429ac
movslq 0x3c(%r14), %rax
movq 0x8(%r14), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rax
addq $-0x18, %rax
movb $0x1, 0x3(%rax)
incq %r15
movslq 0x28(%r13), %rax
addq $0x20, %r12
cmpq %rax, %r15
jl 0x428f3
cmpl $0x0, 0x1f0(%rbx)
jle 0x42a24
xorl %r12d, %r12d
movq 0x268(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x58(%rax), %r15
testq %r15, %r15
je 0x429ef
cmpq %r13, (%r15)
je 0x429ef
movq 0x28(%r15), %r15
jmp 0x429df
movq %r14, %rdi
movl $0x96, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3fa9e
movq %r14, %rdi
movl %eax, %esi
movq %r15, %rdx
movl $0xfffffff6, %ecx       # imm = 0xFFFFFFF6
callq 0x14ab9
incq %r12
movslq 0x1f0(%rbx), %rax
cmpq %rax, %r12
jl 0x429d0
movq %r14, -0x30(%rbp)
movl $0x0, 0x1f0(%rbx)
movq %rbx, %rdi
callq 0x50849
movq %rbx, %rdi
callq 0x508d0
movq 0x150(%rbx), %r14
testq %r14, %r14
je 0x42a82
movb $0x0, 0x23(%rbx)
cmpl $0x0, (%r14)
jle 0x42a82
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x8(%r14), %rax
movq (%rax,%r12), %rsi
movl 0x1c(%rax,%r12), %edx
movq %rbx, %rdi
callq 0x50a8d
incq %r15
movslq (%r14), %rax
addq $0x20, %r12
cmpq %rax, %r15
jl 0x42a5e
movq -0x30(%rbp), %r14
movq %r14, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x3fa9e
testq %r14, %r14
je 0x42aaf
cmpl $0x0, 0x4c(%rbx)
jne 0x42aaf
cmpb $0x0, 0x51(%r13)
je 0x42ade
movl $0x1, 0x18(%rbx)
movq $0x0, 0x50(%rbx)
xorl %eax, %eax
movl %eax, 0x58(%rbx)
movl %eax, 0x1e4(%rbx)
movl %eax, 0x16c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x1b8(%rbx)
je 0x42af5
cmpl $0x0, 0x50(%rbx)
jne 0x42af5
movl $0x1, 0x50(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x14c2a
movl $0x65, 0x18(%rbx)
movb $0x0, 0x1c(%rbx)
jmp 0x42ab6