// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3_table_column_metadata
SQLITE_API int sqlite3_table_column_metadata(
  sqlite3 *db,                /* Connection handle */
  const char *zDbName,        /* Database name or NULL */
  const char *zTableName,     /* Table name */
  const char *zColumnName,    /* Column name */
  char const **pzDataType,    /* OUTPUT: Declared data type */
  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */
  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */
  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
  int *pAutoinc               /* OUTPUT: True if column is auto-increment */
){
  int rc;
  char *zErrMsg = 0;
  Table *pTab = 0;
  Column *pCol = 0;
  int iCol = 0;
  char const *zDataType = 0;
  char const *zCollSeq = 0;
  int notnull = 0;
  int primarykey = 0;
  int autoinc = 0;


#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) || zTableName==0 ){
    return SQLITE_MISUSE_BKPT;
  }
#endif

  /* Ensure the database schema has been loaded */
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);
  rc = sqlite3Init(db, &zErrMsg);
  if( SQLITE_OK!=rc ){
    goto error_out;
  }

  /* Locate the table in question */
  pTab = sqlite3FindTable(db, zTableName, zDbName);
  if( !pTab || pTab->pSelect ){
    pTab = 0;
    goto error_out;
  }

  /* Find the column for which info is requested */
  if( zColumnName==0 ){
    /* Query for existance of table only */
  }else{
    for(iCol=0; iCol<pTab->nCol; iCol++){
      pCol = &pTab->aCol[iCol];
      if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){
        break;
      }
    }
    if( iCol==pTab->nCol ){
      if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){
        iCol = pTab->iPKey;
        pCol = iCol>=0 ? &pTab->aCol[iCol] : 0;
      }else{
        pTab = 0;
        goto error_out;
      }
    }
  }

  /* The following block stores the meta information that will be returned
  ** to the caller in local variables zDataType, zCollSeq, notnull, primarykey
  ** and autoinc. At this point there are two possibilities:
  **
  **     1. The specified column name was rowid", "oid" or "_rowid_"
  **        and there is no explicitly declared IPK column.
  **
  **     2. The table is not a view and the column name identified an
  **        explicitly declared column. Copy meta information from *pCol.
  */
  if( pCol ){
    zDataType = sqlite3ColumnType(pCol,0);
    zCollSeq = pCol->zColl;
    notnull = pCol->notNull!=0;
    primarykey  = (pCol->colFlags & COLFLAG_PRIMKEY)!=0;
    autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;
  }else{
    zDataType = "INTEGER";
    primarykey = 1;
  }
  if( !zCollSeq ){
    zCollSeq = sqlite3StrBINARY;
  }

error_out:
  sqlite3BtreeLeaveAll(db);

  /* Whether the function call succeeded or failed, set the output parameters
  ** to whatever their local counterparts contain. If an error did occur,
  ** this has the effect of zeroing all output parameters.
  */
  if( pzDataType ) *pzDataType = zDataType;
  if( pzCollSeq ) *pzCollSeq = zCollSeq;
  if( pNotNull ) *pNotNull = notnull;
  if( pPrimaryKey ) *pPrimaryKey = primarykey;
  if( pAutoinc ) *pAutoinc = autoinc;

  if( SQLITE_OK==rc && !pTab ){
    sqlite3DbFree(db, zErrMsg);
    zErrMsg = sqlite3MPrintf(db, "no such table column: %s.%s", zTableName,
        zColumnName);
    rc = SQLITE_ERROR;
  }
  sqlite3ErrorWithMsg(db, rc, (zErrMsg?"%s":0), zErrMsg);
  sqlite3DbFree(db, zErrMsg);
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x30(%rsp)
movq %r8, %r13
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq $0x0, 0x10(%rsp)
movslq 0x28(%rdi), %rax
testq %rax, %rax
jle 0x28a9f5
movq 0x20(%rbx), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x28a9ec
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movq %rdi, 0x8(%rsi)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x28a9d7
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x28acc3
movl %eax, %ebp
testl %eax, %eax
je 0x28aaf5
xorl %ecx, %ecx
xorl %eax, %eax
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %r9d, %r9d
testq %r13, %r13
je 0x28aa22
movq %rax, (%r13)
movq 0x70(%rsp), %rax
movq 0x30(%rsp), %r8
testq %r8, %r8
je 0x28aa34
movq %rdi, (%r8)
movq 0x78(%rsp), %rdi
testq %rax, %rax
je 0x28aa40
movl %esi, (%rax)
movq 0x80(%rsp), %rax
testq %rdi, %rdi
je 0x28aa4f
movl %edx, (%rdi)
testq %rax, %rax
je 0x28aa57
movl %r9d, (%rax)
testl %ebp, %ebp
setne %al
orb %cl, %al
jne 0x28aa93
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x28aa72
movq %rbx, %rdi
callq 0x28c3e7
leaq 0x1546bd(%rip), %rsi    # 0x3df136
movq %rbx, %rdi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x284f95
movq %rax, 0x10(%rsp)
movl $0x1, %ebp
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
leaq 0x14772f(%rip), %rdx    # 0x3d21d1
cmoveq %rcx, %rdx
movq %rbx, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x27fc17
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x28aac4
movq %rbx, %rdi
callq 0x28c3e7
cmpl $0xc0a, %ebp            # imm = 0xC0A
je 0x28aad7
cmpb $0x0, 0x61(%rbx)
jne 0x28aad7
andl 0x54(%rbx), %ebp
jmp 0x28aae4
movq %rbx, %rdi
callq 0x299b1a
movl $0x7, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x28ad59
testq %rax, %rax
je 0x28aa0c
movq %rax, %r10
cmpq $0x0, 0x18(%rax)
jne 0x28aa0c
xorl %r9d, %r9d
testq %r14, %r14
movq %r12, 0x8(%rsp)
je 0x28abb2
movswl 0x46(%r10), %eax
testl %eax, %eax
jle 0x28abba
movq %r10, 0x18(%rsp)
movq 0x8(%r10), %rdx
leal -0x1(%rax), %ecx
shlq $0x5, %rcx
addq %rdx, %rcx
movq %rcx, 0x20(%rsp)
movl %eax, %esi
xorl %r15d, %r15d
leaq 0x14ff04(%rip), %rdi    # 0x3daa60
movq %r15, %r8
shlq $0x5, %r8
leaq (%rdx,%r8), %r12
movq (%rdx,%r8), %r8
xorl %r9d, %r9d
movzbl (%r8,%r9), %r10d
movzbl (%r14,%r9), %r11d
cmpb %r11b, %r10b
jne 0x28ab84
testq %r10, %r10
jne 0x28ab8e
jmp 0x28ab93
movb (%r10,%rdi), %cl
cmpb (%r11,%rdi), %cl
jne 0x28ab93
incq %r9
jmp 0x28ab6e
cmpb %r11b, %r10b
je 0x28aba8
incq %r15
cmpq %rsi, %r15
jne 0x28ab5c
movl %eax, %r15d
movq 0x20(%rsp), %r12
xorl %r9d, %r9d
movq 0x18(%rsp), %r10
jmp 0x28abc0
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x28ac1e
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpl %eax, %r15d
jne 0x28ac1e
testb $-0x80, 0x40(%r10)
jne 0x28ac04
movq %r10, %r15
movq %r14, %rdi
callq 0x28b0c2
testl %eax, %eax
movq 0x8(%rsp), %r12
je 0x28aa0c
movq %r15, %r10
movswl 0x44(%r15), %r15d
testl %r15d, %r15d
movl $0x0, %r9d
js 0x28ac1b
movl %r15d, %r12d
shlq $0x5, %r12
addq 0x8(%r10), %r12
jmp 0x28ac1e
xorl %ecx, %ecx
xorl %eax, %eax
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %r9d, %r9d
movq 0x8(%rsp), %r12
jmp 0x28aa19
xorl %r12d, %r12d
testq %r12, %r12
je 0x28ac36
movzwl 0x1c(%r12), %r8d
xorl %r9d, %r9d
testb $0x4, %r8b
jne 0x28ac48
xorl %eax, %eax
jmp 0x28ac78
movw $0x1, %r8w
leaq 0x1544ec(%rip), %rax    # 0x3df12e
xorl %ecx, %ecx
xorl %esi, %esi
jmp 0x28aca1
movq (%r12), %rdi
movq %rdi, 0x28(%rsp)
movq %r10, 0x18(%rsp)
movl %r8d, 0x20(%rsp)
callq 0x172f0
movl 0x20(%rsp), %r8d
movq 0x18(%rsp), %r10
xorl %r9d, %r9d
movq 0x28(%rsp), %rcx
addq %rcx, %rax
incq %rax
movq 0x10(%r12), %rcx
cmpb $0x0, 0x18(%r12)
setne %sil
andl $0x1, %r8d
movswl 0x44(%r10), %edx
cmpl %edx, %r15d
jne 0x28aca1
movl 0x40(%r10), %r9d
shrl $0x3, %r9d
andl $0x1, %r9d
movq 0x8(%rsp), %r12
movzwl %r8w, %edx
movzbl %sil, %esi
testq %rcx, %rcx
leaq 0x150628(%rip), %rdi    # 0x3db2e0
cmovneq %rcx, %rdi
movb $0x1, %cl
jmp 0x28aa19