// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %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 0x416d86
jmp 0x41703c
movq -0x10(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x416d9d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x416db7
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x416db2
movq -0x8(%rbp), %rax
movl $0x1, 0x18(%rax)
jmp 0x41703c
movq -0x8(%rbp), %rdi
callq 0x4299d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x416ffc
movq -0x18(%rbp), %rdi
movl $0x44, %esi
callq 0x429a40
movq -0x10(%rbp), %rax
movzbl 0x61(%rax), %eax
cmpl $0x0, %eax
jne 0x416ffa
movq -0x8(%rbp), %rax
cmpl $0x0, 0x74(%rax)
jne 0x416e07
movq -0x8(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x416ffa
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x429a70
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x416ee8
movq -0x8(%rbp), %rax
movl 0x74(%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 0x416e53
jmp 0x416eda
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x3cbbb0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0x70(%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 -0x28(%rbp), %rax
movl (%rax), %r8d
movq -0x28(%rbp), %rax
movl 0x4(%rax), %r9d
movl $0x2, %esi
callq 0x3cb970
movq -0x10(%rbp), %rax
movzbl 0xb5(%rax), %eax
cmpl $0x0, %eax
jne 0x416ed8
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x3cb9f0
jmp 0x416eda
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x416e19
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x120(%rcx), %eax
jge 0x416f4b
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x178(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x40f150
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %r9
movl $0xa2, %esi
xorl %r8d, %r8d
movl %r8d, %edx
movl %r8d, %ecx
movl $0xfffffff4, (%rsp)     # imm = 0xFFFFFFF4
callq 0x429aa0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x416eef
movq -0x8(%rbp), %rax
movl $0x0, 0x120(%rax)
movq -0x8(%rbp), %rdi
callq 0x429b00
movq -0x8(%rbp), %rdi
callq 0x429ba0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x416fec
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, 0x23(%rax)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x416fea
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jle 0x416fdd
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
addq $0x8, %rax
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x3c(%rbp), %edx
callq 0x429d30
jmp 0x416fdf
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x416f91
jmp 0x416fec
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x429db0
jmp 0x416ffc
cmpq $0x0, -0x18(%rbp)
je 0x417031
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x417031
movq -0x10(%rbp), %rax
cmpb $0x0, 0x61(%rax)
jne 0x417031
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x3cbd30
movq -0x8(%rbp), %rax
movl $0x65, 0x18(%rax)
jmp 0x41703c
movq -0x8(%rbp), %rax
movl $0x1, 0x18(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)