// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
je 0x5bc06
jmp 0x5bf40
movq -0x10(%rbp), %rax
movzbl 0x51(%rax), %eax
cmpl $0x0, %eax
jne 0x5bc1d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
je 0x5bc37
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x5bc32
movq -0x8(%rbp), %rax
movl $0x1, 0x18(%rax)
jmp 0x5bf40
movq -0x8(%rbp), %rdi
callq 0x6bd00
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5be98
jmp 0x5bc51
movq -0x18(%rbp), %rdi
movl $0x3e, %esi
callq 0x6bd80
cmpl $0x0, %eax
je 0x5bc66
jmp 0x5bc51
movq -0x18(%rbp), %rdi
movl $0x16, %esi
callq 0x6be00
movq -0x10(%rbp), %rax
movzbl 0x51(%rax), %eax
cmpl $0x0, %eax
jne 0x5be96
movq -0x8(%rbp), %rax
cmpl $0x0, 0x16c(%rax)
jne 0x5bca4
movq -0x8(%rbp), %rax
cmpq $0x0, 0x150(%rax)
je 0x5be96
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x6be30
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x5bd8c
movq -0x8(%rbp), %rax
movl 0x16c(%rax), %eax
movl -0x1c(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5bcf3
jmp 0x5bd7e
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x17cc0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0x168(%rax), %eax
movl -0x1c(%rbp), %ecx
movl $0x1, %esi
shll %cl, %esi
movl %esi, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rsi
movl 0x170(%rax,%rsi,4), %r8d
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rsi
shlq $0x5, %rsi
addq %rsi, %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %r9d
movl $0x3, %esi
callq 0x17b10
movq -0x10(%rbp), %rax
movzbl 0xa1(%rax), %eax
cmpl $0x0, %eax
jne 0x5bd7c
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x17b70
jmp 0x5bd7e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5bcb6
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1f0(%rcx), %eax
jge 0x5bdef
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x268(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x55e90
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %r9
movl $0x96, %esi
xorl %r8d, %r8d
movl %r8d, %edx
movl %r8d, %ecx
movl $0xfffffff6, (%rsp)     # imm = 0xFFFFFFF6
callq 0x6be70
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5bd93
movq -0x8(%rbp), %rax
movl $0x0, 0x1f0(%rax)
movq -0x8(%rbp), %rdi
callq 0x6bed0
movq -0x8(%rbp), %rdi
callq 0x6bf70
movq -0x8(%rbp), %rax
cmpq $0x0, 0x150(%rax)
je 0x5be88
movq -0x8(%rbp), %rax
movq 0x150(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, 0x23(%rax)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5be86
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %edx
callq 0x6c120
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5be3b
jmp 0x5be88
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x6c1b0
jmp 0x5be98
cmpq $0x0, -0x18(%rbp)
je 0x5bef8
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
jne 0x5bef8
movq -0x10(%rbp), %rax
cmpb $0x0, 0x51(%rax)
jne 0x5bef8
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1b8(%rax)
je 0x5bed6
movq -0x8(%rbp), %rax
cmpl $0x0, 0x50(%rax)
jne 0x5bed6
movq -0x8(%rbp), %rax
movl $0x1, 0x50(%rax)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x17fe0
movq -0x8(%rbp), %rax
movl $0x65, 0x18(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x1c(%rax)
jmp 0x5bf03
movq -0x8(%rbp), %rax
movl $0x1, 0x18(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x50(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x54(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x58(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1e4(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x16c(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)