// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_get_table
SQLITE_API int sqlite3_get_table(
  sqlite3 *db,                /* The database on which the SQL executes */
  const char *zSql,           /* The SQL to be executed */
  char ***pazResult,          /* Write the result table here */
  int *pnRow,                 /* Write the number of rows in the result here */
  int *pnColumn,              /* Write the number of columns of result here */
  char **pzErrMsg             /* Write error messages here */
){
  int rc;
  TabResult res;

  *pazResult = 0;
  if( pnColumn ) *pnColumn = 0;
  if( pnRow ) *pnRow = 0;
  if( pzErrMsg ) *pzErrMsg = 0;
  res.zErrMsg = 0;
  res.nRow = 0;
  res.nColumn = 0;
  res.nData = 1;
  res.nAlloc = 20;
  res.rc = SQLITE_OK;
  res.azResult = sqlite3_malloc(sizeof(char*)*res.nAlloc );
  if( res.azResult==0 ){
     db->errCode = SQLITE_NOMEM;
     return SQLITE_NOMEM;
  }
  res.azResult[0] = 0;
  rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
  assert( sizeof(res.azResult[0])>= sizeof(res.nData) );
  res.azResult[0] = SQLITE_INT_TO_PTR(res.nData);
  if( (rc&0xff)==SQLITE_ABORT ){
    sqlite3_free_table(&res.azResult[1]);
    if( res.zErrMsg ){
      if( pzErrMsg ){
        sqlite3_free(*pzErrMsg);
        *pzErrMsg = sqlite3_mprintf("%s",res.zErrMsg);
      }
      sqlite3_free(res.zErrMsg);
    }
    db->errCode = res.rc;  /* Assume 32-bit assignment is atomic */
    return res.rc;
  }
  sqlite3_free(res.zErrMsg);
  if( rc!=SQLITE_OK ){
    sqlite3_free_table(&res.azResult[1]);
    return rc;
  }
  if( res.nAlloc>res.nData ){
    char **azNew;
    azNew = sqlite3_realloc( res.azResult, sizeof(char*)*res.nData );
    if( azNew==0 ){
      sqlite3_free_table(&res.azResult[1]);
      db->errCode = SQLITE_NOMEM;
      return SQLITE_NOMEM;
    }
    res.azResult = azNew;
  }
  *pazResult = &res.azResult[1];
  if( pnColumn ) *pnColumn = res.nColumn;
  if( pnRow ) *pnRow = res.nRow;
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x15aac
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x15abd
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
cmpq $0x0, -0x38(%rbp)
je 0x15acf
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x60(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x1, -0x4c(%rbp)
movl $0x14, -0x58(%rbp)
movl $0x0, -0x48(%rbp)
movslq -0x58(%rbp), %rax
shlq $0x3, %rax
movl %eax, %edi
callq 0xa380
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x15b2b
movq -0x10(%rbp), %rax
movl $0x7, 0x44(%rax)
movl $0x7, -0x4(%rbp)
jmp 0x15c79
movq -0x68(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %r8
leaq 0x147(%rip), %rdx       # 0x15c90
leaq -0x68(%rbp), %rcx
callq 0x14fb0
movl %eax, -0x3c(%rbp)
movslq -0x4c(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movl -0x3c(%rbp), %eax
andl $0xff, %eax
cmpl $0x4, %eax
jne 0x15bce
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x15ed0
cmpq $0x0, -0x60(%rbp)
je 0x15bb9
cmpq $0x0, -0x38(%rbp)
je 0x15bb0
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0xa420
movq -0x60(%rbp), %rsi
leaq 0x98631(%rip), %rdi     # 0xae1d0
movb $0x0, %al
callq 0xc400
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rdi
callq 0xa420
movl -0x48(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x44(%rax)
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15c79
movq -0x60(%rbp), %rdi
callq 0xa420
cmpl $0x0, -0x3c(%rbp)
je 0x15bf5
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x15ed0
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15c79
movl -0x58(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jle 0x15c44
movq -0x68(%rbp), %rdi
movslq -0x4c(%rbp), %rax
shlq $0x3, %rax
movl %eax, %esi
callq 0xa500
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x15c3c
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x15ed0
movq -0x10(%rbp), %rax
movl $0x7, 0x44(%rax)
movl $0x7, -0x4(%rbp)
jmp 0x15c79
movq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rcx
addq $0x8, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x15c63
movl -0x50(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x15c73
movl -0x54(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)