// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_exec
SQLITE_API int sqlite3_exec(
  sqlite3 *db,                /* The database on which the SQL executes */
  const char *zSql,           /* The SQL to be executed */
  sqlite3_callback xCallback, /* Invoke this callback routine */
  void *pArg,                 /* First argument to xCallback() */
  char **pzErrMsg             /* Write error messages here */
){
  int rc = SQLITE_OK;         /* Return code */
  const char *zLeftover;      /* Tail of unprocessed SQL */
  sqlite3_stmt *pStmt = 0;    /* The current SQL statement */
  char **azCols = 0;          /* Names of result columns */
  int callbackIsInit;         /* True if callback data is initialized */

  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
  if( zSql==0 ) zSql = "";

  sqlite3_mutex_enter(db->mutex);
  sqlite3Error(db, SQLITE_OK, 0);
  while( rc==SQLITE_OK && zSql[0] ){
    int nCol;
    char **azVals = 0;

    pStmt = 0;
    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
    assert( rc==SQLITE_OK || pStmt==0 );
    if( rc!=SQLITE_OK ){
      continue;
    }
    if( !pStmt ){
      /* this happens for a comment or white-space */
      zSql = zLeftover;
      continue;
    }

    callbackIsInit = 0;
    nCol = sqlite3_column_count(pStmt);

    while( 1 ){
      int i;
      rc = sqlite3_step(pStmt);

      /* Invoke the callback function if required */
      if( xCallback && (SQLITE_ROW==rc || 
          (SQLITE_DONE==rc && !callbackIsInit
                           && db->flags&SQLITE_NullCallback)) ){
        if( !callbackIsInit ){
          azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1);
          if( azCols==0 ){
            goto exec_out;
          }
          for(i=0; i<nCol; i++){
            azCols[i] = (char *)sqlite3_column_name(pStmt, i);
            /* sqlite3VdbeSetColName() installs column names as UTF8
            ** strings so there is no way for sqlite3_column_name() to fail. */
            assert( azCols[i]!=0 );
          }
          callbackIsInit = 1;
        }
        if( rc==SQLITE_ROW ){
          azVals = &azCols[nCol];
          for(i=0; i<nCol; i++){
            azVals[i] = (char *)sqlite3_column_text(pStmt, i);
            if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
              db->mallocFailed = 1;
              goto exec_out;
            }
          }
        }
        if( xCallback(pArg, nCol, azVals, azCols) ){
          rc = SQLITE_ABORT;
          sqlite3VdbeFinalize((Vdbe *)pStmt);
          pStmt = 0;
          sqlite3Error(db, SQLITE_ABORT, 0);
          goto exec_out;
        }
      }

      if( rc!=SQLITE_ROW ){
        rc = sqlite3VdbeFinalize((Vdbe *)pStmt);
        pStmt = 0;
        zSql = zLeftover;
        while( sqlite3Isspace(zSql[0]) ) zSql++;
        break;
      }
    }

    sqlite3DbFree(db, azCols);
    azCols = 0;
  }

exec_out:
  if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt);
  sqlite3DbFree(db, azCols);

  rc = sqlite3ApiExit(db, rc);
  if( rc!=SQLITE_OK && ALWAYS(rc==sqlite3_errcode(db)) && pzErrMsg ){
    int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db));
    *pzErrMsg = sqlite3Malloc(nErrMsg);
    if( *pzErrMsg ){
      memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);
    }else{
      rc = SQLITE_NOMEM;
      sqlite3Error(db, SQLITE_NOMEM, 0);
    }
  }else if( pzErrMsg ){
    *pzErrMsg = 0;
  }

  assert( (rc&db->errMask)==rc );
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x15390
cmpl $0x0, %eax
jne 0x15006
movl $0x168da, %edi          # imm = 0x168DA
callq 0x9420
movl %eax, -0x4(%rbp)
jmp 0x15380
cmpq $0x0, -0x18(%rbp)
jne 0x15018
leaq 0x9dde1(%rip), %rax     # 0xb2df5
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0xd720
xorl %eax, %eax
cmpl $0x0, -0x34(%rbp)
movb %al, -0x69(%rbp)
jne 0x15044
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x15050
jmp 0x15299
movq $0x0, -0x60(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq -0x48(%rbp), %rcx
leaq -0x40(%rbp), %r8
callq 0x15400
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x15085
jmp 0x15029
cmpq $0x0, -0x48(%rbp)
jne 0x15096
movq -0x40(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x15029
movl $0x0, -0x54(%rbp)
movq -0x48(%rbp), %rdi
callq 0x11d00
movl %eax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
callq 0x11160
movl %eax, -0x34(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1522c
movl $0x64, %eax
cmpl -0x34(%rbp), %eax
je 0x150f7
movl $0x65, %eax
cmpl -0x34(%rbp), %eax
jne 0x1522c
cmpl $0x0, -0x54(%rbp)
jne 0x1522c
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x1522c
cmpl $0x0, -0x54(%rbp)
jne 0x15163
movq -0x10(%rbp), %rdi
movl -0x58(%rbp), %eax
shll %eax
cltq
shlq $0x3, %rax
addq $0x1, %rax
movl %eax, %esi
callq 0x11ca0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x15127
jmp 0x1529b
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x1515c
movq -0x48(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x12110
movq %rax, %rdx
movq -0x50(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x1512e
movl $0x1, -0x54(%rbp)
cmpl $0x64, -0x34(%rbp)
jne 0x151e2
movq -0x50(%rbp), %rax
movslq -0x58(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x151e0
movq -0x48(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x11fe0
movq %rax, %rdx
movq -0x60(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
movslq -0x64(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x151d3
movq -0x48(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x120d0
cmpl $0x5, %eax
je 0x151d3
movq -0x10(%rbp), %rax
movb $0x1, 0x50(%rax)
jmp 0x1529b
jmp 0x151d5
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x15183
jmp 0x151e2
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rdi
movl -0x58(%rbp), %esi
movq -0x60(%rbp), %rdx
movq -0x50(%rbp), %rcx
callq *%rax
cmpl $0x0, %eax
je 0x1522a
movl $0x4, -0x34(%rbp)
movq -0x48(%rbp), %rdi
callq 0xfdc0
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl $0x4, %esi
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0xd720
jmp 0x1529b
jmp 0x1522c
cmpl $0x64, -0x34(%rbp)
je 0x1527a
movq -0x48(%rbp), %rdi
callq 0xfdc0
movl %eax, -0x34(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x957e2(%rip), %rax     # 0xaaa40
movzbl (%rax,%rcx), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x15278
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1524e
jmp 0x1527f
jmp 0x150a9
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x9cd0
movq $0x0, -0x50(%rbp)
jmp 0x15029
jmp 0x1529b
cmpq $0x0, -0x48(%rbp)
je 0x152ab
movq -0x48(%rbp), %rdi
callq 0xfdc0
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x9cd0
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xfe10
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x15366
movl -0x34(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x15450
movl %eax, %ecx
movl -0x70(%rbp), %eax
cmpl %ecx, %eax
jne 0x15366
cmpq $0x0, -0x30(%rbp)
je 0x15366
movq -0x10(%rbp), %rdi
callq 0x154c0
movq %rax, %rdi
callq 0x92f0
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %edi
callq 0xa3c0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
je 0x15349
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0x154c0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
movslq -0x68(%rbp), %rdx
callq 0x82f0
jmp 0x15364
movl $0x7, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl $0x7, %esi
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0xd720
jmp 0x1537a
cmpq $0x0, -0x30(%rbp)
je 0x15378
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
jmp 0x1537a
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)