// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/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 ){
    sqlite3VdbeAddOp0(v, OP_Halt);

#if SQLITE_USER_AUTHENTICATION
    if( pParse->nTableLock>0 && db->init.busy==0 ){
      sqlite3UserAuthInit(db);
      if( db->auth.authLevel<UAUTH_User ){
        sqlite3ErrorMsg(pParse, "user not authenticated");
        pParse->rc = SQLITE_AUTH_USER;
        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++){
        Schema *pSchema;
        if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
        sqlite3VdbeUsesBtree(v, iDb);
        pSchema = db->aDb[iDb].pSchema;
        sqlite3VdbeAddOp4Int(v,
          OP_Transaction,                    /* Opcode */
          iDb,                               /* P1 */
          DbMaskTest(pParse->writeMask,iDb), /* P2 */
          pSchema->schema_cookie,            /* P3 */
          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.
      **
      ** The pConstExpr list might also contain expressions that we simply
      ** want to keep around until the Parse object is deleted.  Such
      ** expressions have iConstExprReg==0.  Do not generate code for
      ** those expressions, of course.
      */
      if( pParse->pConstExpr ){
        ExprList *pEL = pParse->pConstExpr;
        pParse->okConstFactor = 0;
        for(i=0; i<pEL->nExpr; i++){
          int iReg = pEL->a[i].u.iConstExprReg;
          if( iReg>0 ){
            sqlite3ExprCode(pParse, pEL->a[i].pExpr, iReg);
          }
        }
      }

      /* 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 ){
    /* A minimum of one cursor is required if autoincrement is used
    *  See ticket [a696379c1f08866] */
    assert( pParse->pAinc==0 || pParse->nTab>0 );
    sqlite3VdbeMakeReady(v, pParse);
    pParse->rc = SQLITE_DONE;
  }else{
    pParse->rc = SQLITE_ERROR;
  }
}

// Assembly:
cmpb $0x0, 0x1e(%rdi)
je 0x2abed3
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r12
cmpb $0x0, 0x61(%r12)
jne 0x2abef2
cmpl $0x0, 0x30(%rbx)
je 0x2abf0e
cmpl $0x0, 0x18(%rbx)
jne 0x2abeff
movl $0x1, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x2bc630
testq %rax, %rax
je 0x2abef8
movq %rax, %r14
movq %rax, %rdi
movl $0x44, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
cmpb $0x0, 0x61(%r12)
jne 0x2ac11e
cmpl $0x0, 0x74(%rbx)
jne 0x2abf4f
cmpq $0x0, 0x58(%rbx)
je 0x2ac11e
movl 0x90(%r14), %eax
movq (%r14), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x2abf68
leaq 0x212f22(%rip), %rcx    # 0x4bee88
jmp 0x2abf6f
movq 0x88(%r14), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x0, 0x28(%r12)
jle 0x2ac04a
xorl %r13d, %r13d
xorl %r15d, %r15d
movl 0x74(%rbx), %edx
movl $0x1, %eax
movl %r15d, %ecx
shll %cl, %eax
btl %r15d, %edx
jae 0x2ac035
orl %eax, 0xc8(%r14)
cmpq $0x1, %r15
je 0x2abfc1
movq (%r14), %rcx
movq 0x20(%rcx), %rcx
movq 0x8(%rcx,%r13), %rcx
cmpb $0x0, 0x11(%rcx)
je 0x2abfc1
orl %eax, 0xcc(%r14)
movq 0x20(%r12), %rax
movq 0x18(%rax,%r13), %rax
movl 0x70(%rbx), %edx
xorl %ecx, %ecx
btl %r15d, %edx
setb %cl
movl (%rax), %r8d
movl 0x4(%rax), %ebp
movq %r14, %rdi
movl $0x2, %esi
movl %r15d, %edx
callq 0x2a83e1
movq (%r14), %rcx
cmpb $0x0, 0x61(%rcx)
jne 0x2ac00c
movq 0x88(%r14), %rcx
cltq
leaq (%rax,%rax,2), %rax
movb $-0x3, 0x1(%rcx,%rax,8)
movl %ebp, 0x10(%rcx,%rax,8)
cmpb $0x0, 0xb5(%r12)
jne 0x2ac035
movslq 0x90(%r14), %rax
testq %rax, %rax
jle 0x2ac035
movq 0x88(%r14), %rcx
leaq (%rax,%rax,2), %rax
movw $0x1, -0x16(%rcx,%rax,8)
incq %r15
movslq 0x28(%r12), %rax
addq $0x20, %r13
cmpq %rax, %r15
jl 0x2abf84
cmpl $0x0, 0x120(%rbx)
jle 0x2ac0ad
xorl %r13d, %r13d
movq 0x178(%rbx), %rax
movq (%rax,%r13,8), %rax
movq 0x60(%rax), %r15
testq %r15, %r15
je 0x2ac075
cmpq %r12, (%r15)
je 0x2ac078
movq 0x28(%r15), %r15
jmp 0x2ac065
xorl %r15d, %r15d
movq %r14, %rdi
movl $0xa2, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
movq %r14, %rdi
movl %eax, %esi
movq %r15, %rdx
movl $0xfffffff4, %ecx       # imm = 0xFFFFFFF4
callq 0x27b778
incq %r13
movslq 0x120(%rbx), %rax
cmpq %rax, %r13
jl 0x2ac056
movl $0x0, 0x120(%rbx)
movq %rbx, %rdi
callq 0x2bc65e
movq %rbx, %rdi
callq 0x2bc6db
movq 0x58(%rbx), %r15
testq %r15, %r15
je 0x2ac107
movb $0x0, 0x23(%rbx)
movl (%r15), %eax
testl %eax, %eax
jle 0x2ac107
leaq 0x8(%r15), %r13
xorl %ebp, %ebp
movl 0x14(%r13), %edx
testl %edx, %edx
jle 0x2ac0f8
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x2bc7e9
movl (%r15), %eax
incq %rbp
movslq %eax, %rcx
addq $0x18, %r13
cmpq %rcx, %rbp
jl 0x2ac0e1
movq %r14, %rdi
movl $0xb, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x2a83e1
cmpl $0x0, 0x30(%rbx)
jne 0x2abef8
cmpb $0x0, 0x61(%r12)
jne 0x2abef8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x27b7e3
movl $0x65, 0x18(%rbx)
jmp 0x2abeff