// File: /workspace/github_c_makefile_star2_O3/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 0x41823
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 0x41844
cmpl $0x0, 0x4c(%rbx)
je 0x4185a
cmpl $0x0, 0x18(%rbx)
jne 0x41ad2
movl $0x1, 0x18(%rbx)
jmp 0x41ad2
movq %rbx, %rdi
callq 0x4f63b
testq %rax, %rax
je 0x41ab2
movq %rax, %r12
movq %r12, %rdi
movl $0x3e, %esi
callq 0x4f693
testl %eax, %eax
jne 0x4186e
movq %r12, %rdi
movl $0x16, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
cmpb $0x0, 0x51(%r13)
jne 0x41aa5
cmpl $0x0, 0x16c(%rbx)
jne 0x418b5
cmpq $0x0, 0x150(%rbx)
je 0x41aa5
movl 0x3c(%r12), %eax
leal -0x1(%rax), %ecx
movq 0x30(%r12), %rdx
movl %ecx, 0x68(%rdx)
movq (%r12), %rcx
cmpb $0x0, 0x51(%rcx)
je 0x418d8
leaq 0x51c22(%rip), %rcx     # 0x934f8
jmp 0x418dd
movq 0x8(%r12), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x0, 0x28(%r13)
movq %r12, -0x30(%rbp)
jle 0x419cd
xorl %r14d, %r14d
xorl %r15d, %r15d
movl 0x16c(%rbx), %edx
movl $0x1, %eax
movl %r15d, %ecx
shll %cl, %eax
btl %r15d, %edx
jae 0x419b9
orl %eax, 0x94(%r12)
cmpq $0x1, %r15
je 0x41938
movq (%r12), %rcx
movq 0x20(%rcx), %rcx
movq 0x8(%rcx,%r14), %rcx
cmpb $0x0, 0x11(%rcx)
je 0x41938
orl %eax, 0x98(%r12)
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,%r14), %rax
movslq 0x4(%rax), %r12
movq -0x30(%rbp), %rdi
movl $0x3, %esi
movl %r15d, %edx
callq 0x3ea9f
movq -0x30(%rbp), %rdi
movl %eax, %esi
movq %r12, %rdx
movq -0x30(%rbp), %r12
movl $0xfffffff2, %ecx       # imm = 0xFFFFFFF2
callq 0x14b4f
cmpb $0x0, 0xa1(%r13)
jne 0x419b9
movq (%r12), %rax
cmpb $0x0, 0x51(%rax)
leaq 0x51b5b(%rip), %rax     # 0x934f8
jne 0x419b5
movslq 0x3c(%r12), %rax
movq 0x8(%r12), %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, %r14
cmpq %rax, %r15
jl 0x418f5
cmpl $0x0, 0x1f0(%rbx)
jle 0x41a30
xorl %r14d, %r14d
movq 0x268(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x58(%rax), %r15
testq %r15, %r15
je 0x419f8
cmpq %r13, (%r15)
je 0x419fb
movq 0x28(%r15), %r15
jmp 0x419e8
xorl %r15d, %r15d
movq %r12, %rdi
movl $0x96, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
movq %r12, %rdi
movl %eax, %esi
movq %r15, %rdx
movl $0xfffffff6, %ecx       # imm = 0xFFFFFFF6
callq 0x14b4f
incq %r14
movslq 0x1f0(%rbx), %rax
cmpq %rax, %r14
jl 0x419d9
movl $0x0, 0x1f0(%rbx)
movq %rbx, %rdi
callq 0x4f6c5
movq %rbx, %rdi
callq 0x4f74c
movq 0x150(%rbx), %r14
testq %r14, %r14
je 0x41a8a
movb $0x0, 0x23(%rbx)
cmpl $0x0, (%r14)
jle 0x41a8a
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%r14), %rax
movq (%rax,%r15), %rsi
movl 0x1c(%rax,%r15), %edx
movq %rbx, %rdi
callq 0x4f909
incq %r12
movslq (%r14), %rax
addq $0x20, %r15
cmpq %rax, %r12
jl 0x41a66
movq -0x30(%rbp), %r12
movq %r12, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x3ea9f
cmpl $0x0, 0x4c(%rbx)
jne 0x41ab2
cmpb $0x0, 0x51(%r13)
je 0x41ae1
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 0x41af8
cmpl $0x0, 0x50(%rbx)
jne 0x41af8
movl $0x1, 0x50(%rbx)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x14cb7
movl $0x65, 0x18(%rbx)
movb $0x0, 0x1c(%rbx)
jmp 0x41ab9