// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3Step
static int sqlite3Step(Vdbe *p){
  sqlite3 *db;
  int rc;

  assert(p);
  if( p->magic!=VDBE_MAGIC_RUN ){
    /* We used to require that sqlite3_reset() be called before retrying
    ** sqlite3_step() after any error or after SQLITE_DONE.  But beginning
    ** with version 3.7.0, we changed this so that sqlite3_reset() would
    ** be called automatically instead of throwing the SQLITE_MISUSE error.
    ** This "automatic-reset" change is not technically an incompatibility,
    ** since any application that receives an SQLITE_MISUSE is broken by
    ** definition.
    **
    ** Nevertheless, some published applications that were originally written
    ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
    ** returns, and those were broken by the automatic-reset change.  As a
    ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
    ** legacy behavior of returning SQLITE_MISUSE for cases where the
    ** previous sqlite3_step() returned something other than a SQLITE_LOCKED
    ** or SQLITE_BUSY error.
    */
#ifdef SQLITE_OMIT_AUTORESET
    if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){
      sqlite3_reset((sqlite3_stmt*)p);
    }else{
      return SQLITE_MISUSE_BKPT;
    }
#else
    sqlite3_reset((sqlite3_stmt*)p);
#endif
  }

  /* Check that malloc() has not failed. If it has, return early. */
  db = p->db;
  if( db->mallocFailed ){
    p->rc = SQLITE_NOMEM;
    return SQLITE_NOMEM_BKPT;
  }

  if( p->pc<0 && p->expired ){
    p->rc = SQLITE_SCHEMA;
    rc = SQLITE_ERROR;
    if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
      /* If this statement was prepared using saved SQL and an
      ** error has occurred, then return the error code in p->rc to the
      ** caller. Set the error code in the database handle to the same value.
      */
      rc = sqlite3VdbeTransferError(p);
    }
    goto end_of_step;
  }
  if( p->pc<0 ){
    /* If there are no other statements currently running, then
    ** reset the interrupt flag.  This prevents a call to sqlite3_interrupt
    ** from interrupting a statement that has not yet started.
    */
    if( db->nVdbeActive==0 ){
      AtomicStore(&db->u1.isInterrupted, 0);
    }

    assert( db->nVdbeWrite>0 || db->autoCommit==0
        || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
    );

#ifndef SQLITE_OMIT_TRACE
    if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
        && !db->init.busy && p->zSql ){
      sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
    }else{
      assert( p->startTime==0 );
    }
#endif

    db->nVdbeActive++;
    if( p->readOnly==0 ) db->nVdbeWrite++;
    if( p->bIsReader ) db->nVdbeRead++;
    p->pc = 0;
  }
#ifdef SQLITE_DEBUG
  p->rcApp = SQLITE_OK;
#endif
#ifndef SQLITE_OMIT_EXPLAIN
  if( p->explain ){
    rc = sqlite3VdbeList(p);
  }else
#endif /* SQLITE_OMIT_EXPLAIN */
  {
    db->nVdbeExec++;
    rc = sqlite3VdbeExec(p);
    db->nVdbeExec--;
  }

  if( rc!=SQLITE_ROW ){
#ifndef SQLITE_OMIT_TRACE
    /* If the statement completed successfully, invoke the profile callback */
    checkProfileCallback(db, p);
#endif

    if( rc==SQLITE_DONE && db->autoCommit ){
      assert( p->rc==SQLITE_OK );
      p->rc = doWalCallbacks(db);
      if( p->rc!=SQLITE_OK ){
        rc = SQLITE_ERROR;
      }
    }else if( rc!=SQLITE_DONE && (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
      /* If this statement was prepared using saved SQL and an
      ** error has occurred, then return the error code in p->rc to the
      ** caller. Set the error code in the database handle to the same value.
      */
      rc = sqlite3VdbeTransferError(p);
    }
  }

  db->errCode = rc;
  if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){
    p->rc = SQLITE_NOMEM_BKPT;
    if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ) rc = p->rc;
  }
end_of_step:
  /* There are only a limited number of result codes allowed from the
  ** statements prepared using the legacy sqlite3_prepare() interface */
  assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0
       || rc==SQLITE_ROW  || rc==SQLITE_DONE   || rc==SQLITE_ERROR
       || (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE
  );
  return (rc&db->errMask);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2df20da3, 0x24(%rax) # imm = 0x2DF20DA3
je 0x3c8e12
movq -0x10(%rbp), %rdi
callq 0x3c73d0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, 0x61(%rax)
je 0x3c8e3e
movq -0x10(%rbp), %rax
movl $0x7, 0x38(%rax)
movl $0x7, -0x4(%rbp)
jmp 0x3c90ca
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jge 0x3c8e97
movq -0x10(%rbp), %rax
movw 0xc6(%rax), %ax
andw $0x3, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x3c8e97
movq -0x10(%rbp), %rax
movl $0x11, 0x38(%rax)
movl $0x1, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movzbl 0xc4(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x3c8e92
movq -0x10(%rbp), %rdi
callq 0x3ebdd0
movl %eax, -0x1c(%rbp)
jmp 0x3c90bd
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jge 0x3c8f88
movq -0x18(%rbp), %rax
cmpl $0x0, 0xc0(%rax)
jne 0x3c8ec6
movq -0x18(%rbp), %rax
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %ecx
movl %ecx, 0x168(%rax)
movq -0x18(%rbp), %rax
movzbl 0x68(%rax), %eax
andl $0x82, %eax
cmpl $0x0, %eax
je 0x3c8f0c
movq -0x18(%rbp), %rax
cmpb $0x0, 0xb5(%rax)
jne 0x3c8f0c
movq -0x10(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0x3c8f0c
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0xb8, %rsi
callq 0x3eb740
jmp 0x3c8f0e
jmp 0x3c8f0e
movq -0x18(%rbp), %rax
movl 0xc0(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc0(%rax)
movq -0x10(%rbp), %rax
movw 0xc6(%rax), %ax
shrw $0x7, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x3c8f4f
movq -0x18(%rbp), %rax
movl 0xc8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc8(%rax)
movq -0x10(%rbp), %rax
movw 0xc6(%rax), %ax
shrw $0x8, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x3c8f7d
movq -0x18(%rbp), %rax
movl 0xc4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x34(%rax)
movq -0x10(%rbp), %rax
movw 0xc6(%rax), %ax
shrw $0x2, %ax
andw $0x3, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x3c8fb1
movq -0x10(%rbp), %rdi
callq 0x3f0110
movl %eax, -0x1c(%rbp)
jmp 0x3c8fe3
movq -0x18(%rbp), %rax
movl 0xcc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xcc(%rax)
movq -0x10(%rbp), %rdi
callq 0x3f0470
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl 0xcc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xcc(%rax)
cmpl $0x64, -0x1c(%rbp)
je 0x3c9067
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
jle 0x3c9004
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x3c7270
cmpl $0x65, -0x1c(%rbp)
jne 0x3c903c
movq -0x18(%rbp), %rax
movzbl 0x5f(%rax), %eax
cmpl $0x0, %eax
je 0x3c903c
movq -0x18(%rbp), %rdi
callq 0x3f9190
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0x3c903a
movl $0x1, -0x1c(%rbp)
jmp 0x3c9065
cmpl $0x65, -0x1c(%rbp)
je 0x3c9063
movq -0x10(%rbp), %rax
movzbl 0xc4(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x3c9063
movq -0x10(%rbp), %rdi
callq 0x3ebdd0
movl %eax, -0x1c(%rbp)
jmp 0x3c9065
jmp 0x3c9067
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x50(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x38(%rax), %esi
callq 0x3c7380
movl %eax, %ecx
movl $0x7, %eax
cmpl %ecx, %eax
jne 0x3c90bb
movq -0x10(%rbp), %rax
movl $0x7, 0x38(%rax)
movq -0x10(%rbp), %rax
movzbl 0xc4(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x3c90b9
movq -0x10(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0x3c90bb
jmp 0x3c90bd
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
andl 0x54(%rcx), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)