// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_step
SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){
  int rc = SQLITE_OK;      /* Result from sqlite3Step() */
  int rc2 = SQLITE_OK;     /* Result from sqlite3Reprepare() */
  Vdbe *v = (Vdbe*)pStmt;  /* the prepared statement */
  int cnt = 0;             /* Counter to prevent infinite loop of reprepares */
  sqlite3 *db;             /* The database connection */

  if( vdbeSafetyNotNull(v) ){
    return SQLITE_MISUSE_BKPT;
  }
  db = v->db;
  sqlite3_mutex_enter(db->mutex);
  v->doingRerun = 0;
  while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
         && cnt++ < SQLITE_MAX_SCHEMA_RETRY
         && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){
    sqlite3_reset(pStmt);
    v->doingRerun = 1;
    assert( v->expired==0 );
  }
  if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){
    /* This case occurs after failing to recompile an sql statement. 
    ** The error message from the SQL compiler has already been loaded 
    ** into the database handle. This block copies the error message 
    ** from the database handle into the statement and sets the statement
    ** program counter to 0 to ensure that when the statement is 
    ** finalized or reset the parser error message is available via
    ** sqlite3_errmsg() and sqlite3_errcode().
    */
    const char *zErr = (const char *)sqlite3_value_text(db->pErr); 
    sqlite3DbFree(db, v->zErrMsg);
    if( !db->mallocFailed ){
      v->zErrMsg = sqlite3DbStrDup(db, zErr);
      v->rc = rc2;
    } else {
      v->zErrMsg = 0;
      v->rc = rc = SQLITE_NOMEM;
    }
  }
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rdi
callq 0x11320
cmpl $0x0, %eax
je 0x111a9
movl $0xf933, %edi           # imm = 0xF933
callq 0x9420
movl %eax, -0x4(%rbp)
jmp 0x11309
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xf7ff, %cx            # imm = 0xF7FF
orw $0x0, %cx
movw %cx, 0x9a(%rax)
movq -0x20(%rbp), %rdi
callq 0x11370
movl %eax, %ecx
movl %ecx, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x11, %ecx
movb %al, -0x39(%rbp)
jne 0x11214
movl -0x24(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
cmpl $0x32, %ecx
movb %al, -0x39(%rbp)
jge 0x11214
movq -0x20(%rbp), %rdi
callq 0x11670
movl %eax, -0x14(%rbp)
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x1121d
jmp 0x11244
movq -0x10(%rbp), %rdi
callq 0xfe90
movq -0x20(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xf7ff, %cx            # imm = 0xF7FF
orw $0x800, %cx             # imm = 0x800
movw %cx, 0x9a(%rax)
jmp 0x111cf
cmpl $0x0, -0x18(%rbp)
je 0x112f4
movq -0x20(%rbp), %rax
movw 0x9a(%rax), %ax
shrw $0xa, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x112f4
movq -0x30(%rbp), %rax
cmpq $0x0, 0x130(%rax)
je 0x112f4
movq -0x30(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x10350
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rsi
callq 0x9cd0
movq -0x30(%rbp), %rax
cmpb $0x0, 0x50(%rax)
jne 0x112d1
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x11720
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x94(%rax)
jmp 0x112f2
movq -0x20(%rbp), %rax
movq $0x0, 0x58(%rax)
movl $0x7, -0x14(%rbp)
movq -0x20(%rbp), %rax
movl $0x7, 0x94(%rax)
jmp 0x112f4
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xfe10
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)