// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3bfd40
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3d37a0
movl %eax, -0x34(%rbp)
xorl %eax, %eax
cmpl -0x34(%rbp), %eax
je 0x3d34e8
jmp 0x3d36af
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x3d38b0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x3d350f
movq -0x48(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x3d351c
movq $0x0, -0x48(%rbp)
jmp 0x3d36af
cmpq $0x0, -0x20(%rbp)
jne 0x3d3528
jmp 0x3d35f7
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x48(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jge 0x3d357c
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x54(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x3c3e60
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3d356f
jmp 0x3d357c
jmp 0x3d3571
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x3d352f
movl -0x54(%rbp), %eax
movq -0x48(%rbp), %rcx
movswl 0x46(%rcx), %ecx
cmpl %ecx, %eax
jne 0x3d35f5
movq -0x48(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x3d35e6
movq -0x20(%rbp), %rdi
callq 0x3d3bf0
cmpl $0x0, %eax
je 0x3d35e6
movq -0x48(%rbp), %rax
movswl 0x44(%rax), %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jl 0x3d35d4
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x54(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
jmp 0x3d35dc
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0x3d35dc
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x3d35f3
movq $0x0, -0x48(%rbp)
jmp 0x3d36af
jmp 0x3d35f5
jmp 0x3d35f7
cmpq $0x0, -0x50(%rbp)
je 0x3d3689
movq -0x50(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3d3c70
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movzbl 0x18(%rax), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x6c(%rbp)
movq -0x50(%rbp), %rax
movzwl 0x1c(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x70(%rbp)
movq -0x48(%rbp), %rax
movswl 0x44(%rax), %ecx
xorl %eax, %eax
cmpl -0x54(%rbp), %ecx
movb %al, -0x81(%rbp)
jne 0x3d3679
movq -0x48(%rbp), %rax
movl 0x40(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x74(%rbp)
jmp 0x3d369b
leaq 0x1d77c9(%rip), %rax    # 0x5aae59
movq %rax, -0x60(%rbp)
movl $0x1, -0x70(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x3d36ad
leaq 0x1d362c(%rip), %rax    # 0x5a6cd5
movq %rax, -0x68(%rbp)
jmp 0x3d36af
cmpq $0x0, -0x28(%rbp)
je 0x3d36c1
movq -0x60(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x3d36d3
movq -0x68(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, 0x10(%rbp)
je 0x3d36e3
movl -0x6c(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, 0x18(%rbp)
je 0x3d36f3
movl -0x70(%rbp), %ecx
movq 0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, 0x20(%rbp)
je 0x3d3703
movl -0x74(%rbp), %ecx
movq 0x20(%rbp), %rax
movl %ecx, (%rax)
xorl %eax, %eax
cmpl -0x34(%rbp), %eax
jne 0x3d3743
cmpq $0x0, -0x48(%rbp)
jne 0x3d3743
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3c00a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1d7730(%rip), %rsi    # 0x5aae61
movb $0x0, %al
callq 0x3cb7d0
movq %rax, -0x40(%rbp)
movl $0x1, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
movq -0x40(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0x1c88c8(%rip), %rax    # 0x59c021
cmpq $0x0, %rcx
cmovneq %rax, %rdx
movq -0x40(%rbp), %rcx
movb $0x0, %al
callq 0x3c50b0
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3c00a0
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x3c7380
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)