// File: /workspace/github_c_makefile_star2_O2/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, 0x10(%rsp)
movq %r8, 0x8(%rsp)
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rsp), %r15
andq $0x0, (%r15)
callq 0x21f0e2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22be24
movl %eax, %ebp
testl %eax, %eax
movq %r12, 0x30(%rsp)
je 0x22bc9b
xorl %eax, %eax
xorl %r9d, %r9d
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r12d, %r12d
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x22bbee
movq %r9, (%rdi)
movq 0x70(%rsp), %rdi
testq %r8, %r8
je 0x22bbfb
movq %rsi, (%r8)
movq 0x78(%rsp), %rsi
testq %rdi, %rdi
je 0x22bc07
movl %edx, (%rdi)
movq 0x80(%rsp), %rdx
testq %rsi, %rsi
je 0x22bc16
movl %ecx, (%rsi)
testq %rdx, %rdx
je 0x22bc1e
movl %r12d, (%rdx)
testl %ebp, %ebp
setne %cl
orb %al, %cl
movq 0x18(%rsp), %rcx
jne 0x22bc5b
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x21f26b
leaq 0x14a1c4(%rip), %rsi    # 0x375e02
movq %rbx, %rdi
movq 0x30(%rsp), %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x226ec3
movq %rax, %rcx
movq %rax, 0x18(%rsp)
pushq $0x1
popq %rbp
testq %rcx, %rcx
leaq 0x13d244(%rip), %rdx    # 0x368ea9
cmoveq %rcx, %rdx
movq %rbx, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x2226f3
movq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x21f26b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x22417d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x22beb2
testq %rax, %rax
je 0x22bbce
cmpq $0x0, 0x18(%rax)
jne 0x22bbce
movw $0x1, %si
leaq 0x14a132(%rip), %r9     # 0x375dfa
testq %r13, %r13
je 0x22bd20
movl %ebp, 0x4(%rsp)
movq %r13, 0x28(%rsp)
movswl 0x46(%rax), %ecx
xorl %r12d, %r12d
testl %ecx, %ecx
movl $0x0, %r14d
movl %ecx, 0x24(%rsp)
cmovgl %ecx, %r14d
xorl %r13d, %r13d
xorl %r15d, %r15d
cmpq %r13, %r14
je 0x22bd35
movq %rax, %rbp
movq 0x8(%rax), %r15
movq (%r15,%r12), %rdi
movq 0x28(%rsp), %rsi
callq 0x221779
testl %eax, %eax
je 0x22bd2c
addq %r12, %r15
incq %r13
addq $0x20, %r12
movq %rbp, %rax
jmp 0x22bcf3
xorl %edi, %edi
xorl %edx, %edx
xorl %r12d, %r12d
jmp 0x22bdf5
addq %r12, %r15
movl %r13d, %r14d
movq %rbp, %rax
cmpl 0x24(%rsp), %r14d
movq 0x28(%rsp), %r13
jne 0x22bd7b
testb $-0x80, 0x40(%rax)
jne 0x22bdbe
movq %rax, %r14
movq %r13, %rdi
callq 0x22c0cb
testl %eax, %eax
movl 0x4(%rsp), %ebp
je 0x22bbce
movq %r14, %rax
movswl 0x44(%r14), %r14d
testl %r14d, %r14d
js 0x22be10
movzwl %r14w, %r15d
shll $0x5, %r15d
addq 0x8(%rax), %r15
testq %r15, %r15
je 0x22bddf
xorl %r12d, %r12d
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rbp
callq 0x22c117
movq 0x10(%r15), %rdi
cmpb $0x0, 0x18(%r15)
setne %dl
movzwl 0x1c(%r15), %esi
andl $0x1, %esi
movswl 0x44(%rbp), %ecx
cmpl %ecx, %r14d
jne 0x22bdb9
movl 0x40(%rbp), %r12d
shrl $0x3, %r12d
andl $0x1, %r12d
movq %rax, %r9
jmp 0x22bdf1
xorl %eax, %eax
xorl %r9d, %r9d
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r12d, %r12d
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %ebp
jmp 0x22bbe6
xorl %edi, %edi
xorl %edx, %edx
xorl %r12d, %r12d
leaq 0x14a00d(%rip), %r9     # 0x375dfa
movw $0x1, %si
movl 0x4(%rsp), %ebp
movzwl %si, %ecx
movzbl %dl, %edx
testq %rdi, %rdi
leaq 0x14616b(%rip), %rsi    # 0x371f70
cmovneq %rdi, %rsi
movb $0x1, %al
jmp 0x22bbdc
xorl %edi, %edi
xorl %edx, %edx
xorl %r12d, %r12d
leaq 0x149fdc(%rip), %r9     # 0x375dfa
movw $0x1, %si
jmp 0x22bdf5