// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3FindTable
SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
  Table *p = 0;
  int i;

  /* All mutexes are required for schema access.  Make sure we hold them. */
  assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
#if SQLITE_USER_AUTHENTICATION
  /* Only the admin user is allowed to know that the sqlite_user table
  ** exists */
  if( db->auth.authLevel<UAUTH_Admin && sqlite3UserAuthTable(zName)!=0 ){
    return 0;
  }
#endif
  if( zDatabase ){
    for(i=0; i<db->nDb; i++){
      if( sqlite3StrICmp(zDatabase, db->aDb[i].zDbSName)==0 ) break;
    }
    if( i>=db->nDb ){
      /* No match against the official names.  But always match "main"
      ** to schema 0 as a legacy fallback. */
      if( sqlite3StrICmp(zDatabase,"main")==0 ){
        i = 0;
      }else{
        return 0;
      }
    }
    p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName);
    if( p==0 && sqlite3StrNICmp(zName, "sqlite_", 7)==0 ){
      if( i==1 ){
        if( sqlite3StrICmp(zName+7, &ALT_TEMP_SCHEMA_TABLE[7])==0
         || sqlite3StrICmp(zName+7, &ALT_SCHEMA_TABLE[7])==0
         || sqlite3StrICmp(zName+7, &DFLT_SCHEMA_TABLE[7])==0
        ){
          p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash,
                              DFLT_TEMP_SCHEMA_TABLE);
        }
      }else{
        if( sqlite3StrICmp(zName+7, &ALT_SCHEMA_TABLE[7])==0 ){
          p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash,
                              DFLT_SCHEMA_TABLE);
        }
      }
    }
  }else{
    /* Match against TEMP first */
    p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, zName);
    if( p ) return p;
    /* The main database is second */
    p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, zName);
    if( p ) return p;
    /* Attached databases are in order of attachment */
    for(i=2; i<db->nDb; i++){
      assert( sqlite3SchemaMutexHeld(db, i, 0) );
      p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName);
      if( p ) break;
    }
    if( p==0 && sqlite3StrNICmp(zName, "sqlite_", 7)==0 ){
      if( sqlite3StrICmp(zName+7, &ALT_SCHEMA_TABLE[7])==0 ){
        p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, DFLT_SCHEMA_TABLE);
      }else if( sqlite3StrICmp(zName+7, &ALT_TEMP_SCHEMA_TABLE[7])==0 ){
        p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash,
                            DFLT_TEMP_SCHEMA_TABLE);
      }
    }
  }
  return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
testq %rdx, %rdx
je 0x28add9
movslq 0x28(%r15), %rax
testq %rax, %rax
setg %cl
jle 0x28aec3
movq 0x20(%r15), %rsi
xorl %r12d, %r12d
leaq 0x14fcd3(%rip), %rdi    # 0x3daa60
movq %r12, %r8
shlq $0x5, %r8
movq (%rsi,%r8), %r8
xorl %r9d, %r9d
movzbl (%rdx,%r9), %r10d
movzbl (%r8,%r9), %r11d
cmpb %r11b, %r10b
jne 0x28adb1
testq %r10, %r10
jne 0x28adbb
jmp 0x28adc0
movb (%r10,%rdi), %bpl
cmpb (%r11,%rdi), %bpl
jne 0x28adc0
incq %r9
jmp 0x28ad9b
cmpb %r11b, %r10b
je 0x28aebe
incq %r12
cmpq %rax, %r12
setb %cl
jne 0x28ad8d
jmp 0x28aec3
movq 0x20(%r15), %r13
movq 0x38(%r13), %r14
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2aefdf
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x28af43
movq 0x18(%r13), %r12
addq $0x8, %r12
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2aefdf
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x28af43
movslq 0x28(%r15), %r15
cmpq $0x3, %r15
jl 0x28ae5a
shlq $0x5, %r15
addq $-0x40, %r15
xorl %ebp, %ebp
movq 0x58(%r13,%rbp), %rdi
addq $0x8, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2aefdf
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x28ae5c
addq $0x20, %rbp
cmpq %rbp, %r15
jne 0x28ae35
xorl %eax, %eax
testq %rax, %rax
jne 0x28af43
leaq 0x1560bc(%rip), %rsi    # 0x3e0f28
movq %rbx, %rdi
movl $0x7, %edx
callq 0x27e951
testl %eax, %eax
jne 0x28af41
movl $0x7, %ecx
leaq 0x158ec8(%rip), %rdx    # 0x3e3d55
leaq 0x14fbcc(%rip), %rax    # 0x3daa60
movzbl (%rbx,%rcx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x28aeab
testq %rsi, %rsi
jne 0x28aeb9
jmp 0x28b045
movb (%rsi,%rax), %r8b
cmpb (%rdi,%rax), %r8b
jne 0x28b045
incq %rcx
jmp 0x28ae94
testb $0x1, %cl
jne 0x28aeff
xorl %eax, %eax
leaq 0xd90f6(%rip), %rcx     # 0x363fc2
leaq 0x14fb8d(%rip), %rsi    # 0x3daa60
movzbl (%rdx,%rax), %edi
movzbl (%rax,%rcx), %r8d
cmpb %r8b, %dil
jne 0x28aee8
testq %rdi, %rdi
jne 0x28aef2
jmp 0x28aef7
movb (%rdi,%rsi), %r9b
cmpb (%r8,%rsi), %r9b
jne 0x28aef7
incq %rax
jmp 0x28aed3
xorl %r12d, %r12d
cmpb %r8b, %dil
jne 0x28af41
movq 0x20(%r15), %r15
movl %r12d, %eax
shlq $0x5, %rax
movq 0x18(%r15,%rax), %r14
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2aefdf
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x28af43
leaq 0x155ff8(%rip), %rsi    # 0x3e0f28
movq %rbx, %rdi
movl $0x7, %edx
callq 0x27e951
testl %eax, %eax
je 0x28af52
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, %r12d
jne 0x28af8e
movl $0x7, %ecx
leaq 0x158dde(%rip), %rdx    # 0x3e3d42
leaq 0x14faf5(%rip), %rax    # 0x3daa60
movzbl (%rbx,%rcx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x28af7f
testq %rsi, %rsi
jne 0x28af89
jmp 0x28afc4
movb (%rsi,%rax), %r8b
cmpb (%rdi,%rax), %r8b
jne 0x28afc4
incq %rcx
jmp 0x28af6b
movl $0x7, %eax
leaq 0x158dbb(%rip), %rcx    # 0x3e3d55
leaq 0x14fabf(%rip), %rdx    # 0x3daa60
movzbl (%rbx,%rax), %esi
movzbl (%rax,%rcx), %edi
cmpb %dil, %sil
jne 0x28afb5
testq %rsi, %rsi
jne 0x28afbf
jmp 0x28affc
movb (%rsi,%rdx), %r8b
cmpb (%rdi,%rdx), %r8b
jne 0x28affc
incq %rax
jmp 0x28afa1
cmpb %dil, %sil
je 0x28b05f
movl $0x7, %ecx
leaq 0x158d7c(%rip), %rdx    # 0x3e3d55
movzbl (%rbx,%rcx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x28afed
testq %rsi, %rsi
jne 0x28aff7
jmp 0x28b011
movb (%rsi,%rax), %r8b
cmpb (%rdi,%rax), %r8b
jne 0x28b011
incq %rcx
jmp 0x28afd9
cmpb %dil, %sil
jne 0x28af41
leaq 0x154c74(%rip), %rsi    # 0x3dfc80
movq %r14, %rdi
jmp 0x28b06e
cmpb %dil, %sil
je 0x28b05f
movl $0x7, %ecx
leaq 0x154c5e(%rip), %rdx    # 0x3dfc80
movzbl (%rbx,%rcx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x28b036
testq %rsi, %rsi
jne 0x28b040
jmp 0x28b056
movb (%rsi,%rax), %r8b
cmpb (%rdi,%rax), %r8b
jne 0x28b056
incq %rcx
jmp 0x28b022
cmpb %dil, %sil
jne 0x28b07e
leaq 0x154c2f(%rip), %rsi    # 0x3dfc80
movq %r12, %rdi
jmp 0x28b06e
cmpb %dil, %sil
jne 0x28af41
movq 0x38(%r15), %rdi
addq $0x8, %rdi
leaq 0x154cf3(%rip), %rsi    # 0x3dfd61
xorl %edx, %edx
callq 0x2aefdf
movq 0x10(%rax), %rax
jmp 0x28af43
movl $0x7, %ecx
leaq 0x158cb8(%rip), %rdx    # 0x3e3d42
movzbl (%rbx,%rcx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x28b09e
testq %rsi, %rsi
jne 0x28b0a8
jmp 0x28b0ad
movb (%rsi,%rax), %r8b
cmpb (%rdi,%rax), %r8b
jne 0x28b0ad
incq %rcx
jmp 0x28b08a
cmpb %dil, %sil
jne 0x28af41
leaq 0x154ca4(%rip), %rsi    # 0x3dfd61
jmp 0x28b00c