// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3_get_table_cb
static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
  TabResult *p = (TabResult*)pArg;  /* Result accumulator */
  int need;                         /* Slots needed in p->azResult[] */
  int i;                            /* Loop counter */
  char *z;                          /* A single column of result */

  /* Make sure there is enough space in p->azResult to hold everything
  ** we need to remember from this invocation of the callback.
  */
  if( p->nRow==0 && argv!=0 ){
    need = nCol*2;
  }else{
    need = nCol;
  }
  if( p->nData + need > p->nAlloc ){
    char **azNew;
    p->nAlloc = p->nAlloc*2 + need;
    azNew = sqlite3_realloc( p->azResult, sizeof(char*)*p->nAlloc );
    if( azNew==0 ) goto malloc_failed;
    p->azResult = azNew;
  }

  /* If this is the first row, then generate an extra row containing
  ** the names of all columns.
  */
  if( p->nRow==0 ){
    p->nColumn = nCol;
    for(i=0; i<nCol; i++){
      z = sqlite3_mprintf("%s", colv[i]);
      if( z==0 ) goto malloc_failed;
      p->azResult[p->nData++] = z;
    }
  }else if( p->nColumn!=nCol ){
    sqlite3_free(p->zErrMsg);
    p->zErrMsg = sqlite3_mprintf(
       "sqlite3_get_table() called with two or more incompatible queries"
    );
    p->rc = SQLITE_ERROR;
    return 1;
  }

  /* Copy over the row data
  */
  if( argv!=0 ){
    for(i=0; i<nCol; i++){
      if( argv[i]==0 ){
        z = 0;
      }else{
        int n = sqlite3Strlen30(argv[i])+1;
        z = sqlite3_malloc( n );
        if( z==0 ) goto malloc_failed;
        memcpy(z, argv[i], n);
      }
      p->azResult[p->nData++] = z;
    }
    p->nRow++;
  }
  return 0;

malloc_failed:
  p->rc = SQLITE_NOMEM;
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x15cca
cmpq $0x0, -0x20(%rbp)
je 0x15cca
movl -0x14(%rbp), %eax
shll %eax
movl %eax, -0x34(%rbp)
jmp 0x15cd0
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
movl 0x1c(%rax), %eax
addl -0x34(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jle 0x15d2b
movq -0x30(%rbp), %rax
movl 0x10(%rax), %ecx
shll %ecx
addl -0x34(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movslq 0x10(%rax), %rax
shlq $0x3, %rax
movl %eax, %esi
callq 0xa500
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x15d20
jmp 0x15eb2
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x15da6
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x15da4
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x9846f(%rip), %rdi     # 0xae1d0
movb $0x0, %al
callq 0xc400
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x15d78
jmp 0x15eb2
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rsi
movl 0x1c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x1c(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x15d46
jmp 0x15df1
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x15def
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa420
leaq 0x99889(%rip), %rdi     # 0xaf64f
movb $0x0, %al
callq 0xc400
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movl $0x1, 0x20(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x15ec4
jmp 0x15df1
cmpq $0x0, -0x20(%rbp)
je 0x15ea9
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x15e9c
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x15e28
movq $0x0, -0x40(%rbp)
jmp 0x15e6d
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x92f0
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %edi
callq 0xa380
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x15e54
jmp 0x15eb2
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq -0x4c(%rbp), %rdx
callq 0x82f0
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rsi
movl 0x1c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x1c(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x15e03
movq -0x30(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x15ec4
movq -0x30(%rbp), %rax
movl $0x7, 0x20(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)