// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %r8, %r13
movq %rcx, %r14
movq %rdx, 0x20(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
movq $0x0, (%rsp)
movslq 0x28(%rdi), %rax
testq %rax, %rax
jle 0x280ebd
movq 0x20(%rbx), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x280eb4
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movq %rdi, 0x8(%rsi)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x280e9f
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x281162
movl %eax, %ebp
testl %eax, %eax
je 0x280fb8
xorl %eax, %eax
xorl %r11d, %r11d
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r15d, %r15d
testq %r13, %r13
je 0x280ee9
movq %r11, (%r13)
movq 0x70(%rsp), %rdi
testq %r12, %r12
je 0x280ef7
movq %rsi, (%r12)
movq 0x78(%rsp), %rsi
testq %rdi, %rdi
je 0x280f03
movl %edx, (%rdi)
movq 0x80(%rsp), %rdx
testq %rsi, %rsi
je 0x280f12
movl %ecx, (%rsi)
testq %rdx, %rdx
je 0x280f1a
movl %r15d, (%rdx)
testl %ebp, %ebp
setne %cl
orb %al, %cl
movq (%rsp), %rcx
jne 0x280f5c
testq %rcx, %rcx
je 0x280f37
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x282904
leaq 0x154aa4(%rip), %rsi    # 0x3d59e2
movq %rbx, %rdi
movq 0x20(%rsp), %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x27b56a
movq %rax, %rcx
movq %rax, (%rsp)
movl $0x1, %ebp
testq %rcx, %rcx
leaq 0x147b43(%rip), %rdx    # 0x3c8aa9
cmoveq %rcx, %rdx
movq %rbx, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x2762da
movq (%rsp), %rsi
testq %rsi, %rsi
je 0x280f87
movq %rbx, %rdi
callq 0x282904
cmpl $0xc0a, %ebp            # imm = 0xC0A
je 0x280f9a
cmpb $0x0, 0x61(%rbx)
jne 0x280f9a
andl 0x54(%rbx), %ebp
jmp 0x280fa7
movq %rbx, %rdi
callq 0x28fd56
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 0x20(%rsp), %rsi
movq %r15, %rdx
callq 0x2811f8
testq %rax, %rax
je 0x280ed2
movq %rax, %r15
cmpq $0x0, 0x18(%rax)
jne 0x280ed2
movw $0x1, %si
leaq 0x1549f0(%rip), %r11    # 0x3d59da
testq %r14, %r14
je 0x2810ca
movswl 0x46(%r15), %eax
testl %eax, %eax
jle 0x281065
movq 0x8(%r15), %rcx
movl %eax, %edx
movq %rdx, 0x8(%rsp)
xorl %edi, %edi
leaq 0x1502d0(%rip), %rsi    # 0x3d12e0
movq %rdi, %rdx
shlq $0x5, %rdi
leaq (%rcx,%rdi), %r8
movq %r8, 0x10(%rsp)
movq (%rcx,%rdi), %rdi
xorl %r8d, %r8d
movzbl (%rdi,%r8), %r9d
movzbl (%r14,%r8), %r10d
cmpb %r10b, %r9b
jne 0x28103d
testq %r9, %r9
jne 0x281047
jmp 0x28105b
movb (%r9,%rsi), %r9b
cmpb (%r10,%rsi), %r9b
jne 0x28104c
incq %r8
jmp 0x281027
movq %rdx, %rdi
incq %rdi
cmpq 0x8(%rsp), %rdi
jne 0x281010
jmp 0x28106f
movq %rdx, %r8
movq 0x10(%rsp), %rcx
jmp 0x28106a
xorl %r8d, %r8d
xorl %ecx, %ecx
cmpl %eax, %r8d
jne 0x2810aa
testb $-0x80, 0x40(%r15)
jne 0x280ed2
movq %r14, %rdi
callq 0x28157b
testl %eax, %eax
je 0x280ed2
movswl 0x44(%r15), %r8d
testl %r8d, %r8d
js 0x28114b
movzwl %r8w, %ecx
shll $0x5, %ecx
addq 0x8(%r15), %rcx
leaq 0x154930(%rip), %r11    # 0x3d59da
testq %rcx, %rcx
movw $0x1, %si
je 0x2810ca
movq %r15, 0x8(%rsp)
movzwl 0x1c(%rcx), %esi
xorl %r15d, %r15d
testb $0x4, %sil
jne 0x2810ec
xorl %r11d, %r11d
jmp 0x281121
xorl %eax, %eax
xorl %edx, %edx
xorl %r15d, %r15d
movzwl %si, %ecx
movzbl %dl, %edx
testq %rax, %rax
leaq 0x150a7f(%rip), %rsi    # 0x3d1b60
cmovneq %rax, %rsi
movb $0x1, %al
jmp 0x280ee0
movq (%rcx), %rdi
movq %rdi, 0x28(%rsp)
movl %esi, 0x1c(%rsp)
movq %r8, 0x30(%rsp)
movq %rcx, 0x10(%rsp)
callq 0x172f0
movq 0x10(%rsp), %rcx
movq 0x30(%rsp), %r8
movl 0x1c(%rsp), %esi
movq 0x28(%rsp), %rdx
leaq (%rdx,%rax), %r11
incq %r11
movq 0x10(%rcx), %rax
cmpb $0x0, 0x18(%rcx)
setne %dl
andl $0x1, %esi
movq 0x8(%rsp), %rdi
movswl 0x44(%rdi), %ecx
cmpl %ecx, %r8d
jne 0x2810d1
movl 0x40(%rdi), %r15d
shrl $0x3, %r15d
andl $0x1, %r15d
jmp 0x2810d1
xorl %eax, %eax
xorl %edx, %edx
xorl %r15d, %r15d
leaq 0x154881(%rip), %r11    # 0x3d59da
movw $0x1, %si
jmp 0x2810d1