// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: createTableStmt
static char *createTableStmt(sqlite3 *db, Table *p){
  int i, k, n;
  char *zStmt;
  char *zSep, *zSep2, *zEnd;
  Column *pCol;
  n = 0;
  for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){
    n += identLength(pCol->zName) + 5;
  }
  n += identLength(p->zName);
  if( n<50 ){ 
    zSep = "";
    zSep2 = ",";
    zEnd = ")";
  }else{
    zSep = "\n  ";
    zSep2 = ",\n  ";
    zEnd = "\n)";
  }
  n += 35 + 6*p->nCol;
  zStmt = sqlite3DbMallocRaw(0, n);
  if( zStmt==0 ){
    db->mallocFailed = 1;
    return 0;
  }
  sqlite3_snprintf(n, zStmt, "CREATE TABLE ");
  k = sqlite3Strlen30(zStmt);
  identPut(zStmt, &k, p->zName);
  zStmt[k++] = '(';
  for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
    static const char * const azType[] = {
        /* SQLITE_AFF_TEXT    */ " TEXT",
        /* SQLITE_AFF_NONE    */ "",
        /* SQLITE_AFF_NUMERIC */ " NUM",
        /* SQLITE_AFF_INTEGER */ " INT",
        /* SQLITE_AFF_REAL    */ " REAL"
    };
    int len;
    const char *zType;

    sqlite3_snprintf(n-k, &zStmt[k], zSep);
    k += sqlite3Strlen30(&zStmt[k]);
    zSep = zSep2;
    identPut(zStmt, &k, pCol->zName);
    assert( pCol->affinity-SQLITE_AFF_TEXT >= 0 );
    assert( pCol->affinity-SQLITE_AFF_TEXT < ArraySize(azType) );
    testcase( pCol->affinity==SQLITE_AFF_TEXT );
    testcase( pCol->affinity==SQLITE_AFF_NONE );
    testcase( pCol->affinity==SQLITE_AFF_NUMERIC );
    testcase( pCol->affinity==SQLITE_AFF_INTEGER );
    testcase( pCol->affinity==SQLITE_AFF_REAL );
    
    zType = azType[pCol->affinity - SQLITE_AFF_TEXT];
    len = sqlite3Strlen30(zType);
    assert( pCol->affinity==SQLITE_AFF_NONE 
            || pCol->affinity==sqlite3AffinityType(zType) );
    memcpy(&zStmt[k], zType, len);
    k += len;
    assert( k<=n );
  }
  sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd);
  return zStmt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x5f125
movq -0x50(%rbp), %rax
movq (%rax), %rdi
callq 0x66890
addl $0x5, %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x50(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x50(%rbp)
jmp 0x5f0ea
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x66890
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x32, -0x24(%rbp)
jge 0x5f160
leaq 0x53cb1(%rip), %rax     # 0xb2df5
movq %rax, -0x38(%rbp)
leaq 0x50cfa(%rip), %rax     # 0xafe49
movq %rax, -0x40(%rbp)
leaq 0x50cf7(%rip), %rax     # 0xafe51
movq %rax, -0x48(%rbp)
jmp 0x5f181
leaq 0x50ce5(%rip), %rax     # 0xafe4c
movq %rax, -0x38(%rbp)
leaq 0x50cd9(%rip), %rax     # 0xafe4b
movq %rax, -0x40(%rbp)
leaq 0x50cd3(%rip), %rax     # 0xafe50
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movswl 0x42(%rax), %eax
imull $0x6, %eax, %eax
addl $0x23, %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x134e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x5f1c1
movq -0x10(%rbp), %rax
movb $0x1, 0x50(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x5f30f
movl -0x24(%rbp), %edi
movq -0x30(%rbp), %rsi
leaq 0x50c84(%rip), %rdx     # 0xafe53
movb $0x0, %al
callq 0xc540
movq -0x30(%rbp), %rdi
callq 0x92f0
movl %eax, -0x20(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x20(%rbp), %rsi
callq 0x668e0
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x28, (%rax,%rcx)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x5f2e4
movl -0x24(%rbp), %edi
subl -0x20(%rbp), %edi
movq -0x30(%rbp), %rsi
movslq -0x20(%rbp), %rax
addq %rax, %rsi
movq -0x38(%rbp), %rdx
movb $0x0, %al
callq 0xc540
movq -0x30(%rbp), %rdi
movslq -0x20(%rbp), %rax
addq %rax, %rdi
callq 0x92f0
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rdx
leaq -0x20(%rbp), %rsi
callq 0x668e0
movq -0x50(%rbp), %rax
movsbl 0x29(%rax), %eax
subl $0x61, %eax
movslq %eax, %rcx
leaq 0x7028b(%rip), %rax     # 0xcf520
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x92f0
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x20(%rbp), %rax
addq %rax, %rdi
movq -0x60(%rbp), %rsi
movslq -0x54(%rbp), %rdx
callq 0x82f0
movl -0x54(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x50(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x50(%rbp)
jmp 0x5f21f
movl -0x24(%rbp), %edi
subl -0x20(%rbp), %edi
movq -0x30(%rbp), %rsi
movslq -0x20(%rbp), %rax
addq %rax, %rsi
movq -0x48(%rbp), %rcx
leaq 0x4eed0(%rip), %rdx     # 0xae1d0
movb $0x0, %al
callq 0xc540
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)