// File: /workspace/github_c_makefile_star2_O3/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, %r12
testq %rdx, %rdx
je 0x28129d
movslq 0x28(%r12), %rax
leaq 0x1500c2(%rip), %r15    # 0x3d12e0
testq %rax, %rax
jle 0x281267
movq 0x20(%r12), %r13
xorl %ebp, %ebp
movq %rbp, %rcx
shlq $0x5, %rcx
movq (%r13,%rcx), %rcx
xorl %esi, %esi
movzbl (%rdx,%rsi), %edi
movzbl (%rcx,%rsi), %r8d
cmpb %r8b, %dil
jne 0x281250
testq %rdi, %rdi
jne 0x28125a
jmp 0x281374
movb (%rdi,%r15), %dil
cmpb (%r8,%r15), %dil
jne 0x28125f
incq %rsi
jmp 0x281238
incq %rbp
cmpq %rax, %rbp
jne 0x28122a
xorl %eax, %eax
leaq 0xd9cd7(%rip), %rcx     # 0x35af47
xorl %esi, %esi
movzbl (%rdx,%rsi), %edi
movzbl (%rsi,%rcx), %r8d
cmpb %r8b, %dil
jne 0x28128a
testq %rdi, %rdi
jne 0x281298
jmp 0x28136d
movb (%rdi,%r15), %dil
cmpb (%r8,%r15), %dil
jne 0x281522
incq %rsi
jmp 0x281272
movq 0x20(%r12), %r13
movq 0x38(%r13), %r14
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2a547e
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x281522
movq 0x18(%r13), %r15
addq $0x8, %r15
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2a547e
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x281522
movslq 0x28(%r12), %r12
cmpq $0x3, %r12
jl 0x281324
shlq $0x5, %r12
addq $-0x40, %r12
xorl %ebp, %ebp
movq 0x58(%r13,%rbp), %rdi
addq $0x8, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2a547e
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x281522
addq $0x20, %rbp
cmpq %rbp, %r12
jne 0x2812fb
testq %rbx, %rbx
je 0x281520
xorl %eax, %eax
leaq 0x14ffaa(%rip), %rcx    # 0x3d12e0
leaq 0x156496(%rip), %rdx    # 0x3d77d3
movzbl (%rbx,%rax), %esi
testq %rsi, %rsi
je 0x2814df
movzbl (%rsi,%rcx), %esi
movzbl (%rax,%rdx), %edi
movb (%rdi,%rcx), %dil
cmpb %dil, %sil
jne 0x2814e9
incq %rax
cmpq $0x7, %rax
jne 0x28133d
jmp 0x2814f1
movq 0x20(%r12), %r13
xorl %ebp, %ebp
movl %ebp, %eax
shlq $0x5, %rax
movq 0x18(%r13,%rax), %r14
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2a547e
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x281522
testq %rbx, %rbx
je 0x281520
xorl %eax, %eax
leaq 0x156424(%rip), %rcx    # 0x3d77d3
movzbl (%rbx,%rax), %edx
testq %rdx, %rdx
je 0x2813d5
movzbl (%rdx,%r15), %edx
movzbl (%rax,%rcx), %esi
movb (%rsi,%r15), %sil
cmpb %sil, %dl
jne 0x2813df
incq %rax
cmpq $0x7, %rax
jne 0x2813af
jmp 0x2813eb
movzbl (%rax,%rcx), %eax
movb (%rax,%r15), %sil
xorl %edx, %edx
movzbl %sil, %eax
cmpl %eax, %edx
jne 0x281520
cmpl $0x1, %ebp
jne 0x281422
movl $0x7, %eax
leaq 0x1591f1(%rip), %rcx    # 0x3da5ed
movzbl (%rbx,%rax), %edx
movzbl (%rax,%rcx), %esi
cmpb %sil, %dl
jne 0x281413
testq %rdx, %rdx
jne 0x28141d
jmp 0x2814c3
movb (%rdx,%r15), %dl
cmpb (%rsi,%r15), %dl
jne 0x281457
incq %rax
jmp 0x2813fc
movl $0x7, %ecx
leaq 0x1591d2(%rip), %rdx    # 0x3da600
xorl %eax, %eax
movzbl (%rbx,%rcx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x281444
testq %rsi, %rsi
jne 0x281452
jmp 0x281486
movb (%rsi,%r15), %sil
cmpb (%rdi,%r15), %sil
jne 0x281522
incq %rcx
jmp 0x281430
movl $0x7, %eax
leaq 0x15919d(%rip), %rcx    # 0x3da600
movzbl (%rbx,%rax), %edx
movzbl (%rax,%rcx), %esi
cmpb %sil, %dl
jne 0x281477
testq %rdx, %rdx
jne 0x281481
jmp 0x2814c3
movb (%rdx,%r15), %dl
cmpb (%rsi,%r15), %dl
jne 0x281492
incq %rax
jmp 0x281463
leaq 0x1550a6(%rip), %rsi    # 0x3d6533
movq %r14, %rdi
jmp 0x2814d2
movl $0x7, %ecx
leaq 0x155095(%rip), %rdx    # 0x3d6533
xorl %eax, %eax
movzbl (%rbx,%rcx), %esi
movzbl (%rcx,%rdx), %edi
cmpb %dil, %sil
jne 0x2814b4
testq %rsi, %rsi
jne 0x2814be
jmp 0x2814c3
movb (%rsi,%r15), %sil
cmpb (%rdi,%r15), %sil
jne 0x281522
incq %rcx
jmp 0x2814a0
movq 0x38(%r13), %rdi
addq $0x8, %rdi
leaq 0x155142(%rip), %rsi    # 0x3d6614
xorl %edx, %edx
callq 0x2a547e
movq 0x10(%rax), %rax
jmp 0x281522
movzbl (%rax,%rdx), %eax
movb (%rax,%rcx), %dil
xorl %esi, %esi
movzbl %dil, %eax
cmpl %eax, %esi
jne 0x281520
movl $0x7, %eax
leaq 0x159103(%rip), %rdx    # 0x3da600
movzbl (%rbx,%rax), %esi
movzbl (%rax,%rdx), %edi
cmpb %dil, %sil
jne 0x281511
testq %rsi, %rsi
jne 0x28151b
jmp 0x281531
movb (%rsi,%rcx), %sil
cmpb (%rdi,%rcx), %sil
jne 0x28153d
incq %rax
jmp 0x2814fd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x154ffb(%rip), %rsi    # 0x3d6533
movq %r15, %rdi
jmp 0x2814d2
movl $0x7, %edx
leaq 0x1590a4(%rip), %rsi    # 0x3da5ed
xorl %eax, %eax
movzbl (%rbx,%rdx), %edi
movzbl (%rdx,%rsi), %r8d
cmpb %r8b, %dil
jne 0x281560
testq %rdi, %rdi
jne 0x28156a
jmp 0x28156f
movb (%rdi,%rcx), %dil
cmpb (%r8,%rcx), %dil
jne 0x281522
incq %rdx
jmp 0x28154b
leaq 0x15509e(%rip), %rsi    # 0x3d6614
jmp 0x28148d