// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3d3a77
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x3d391d
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x3c3e60
cmpl $0x0, %eax
jne 0x3d3910
jmp 0x3d391d
jmp 0x3d3912
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3d38de
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jl 0x3d3956
movq -0x20(%rbp), %rdi
leaq 0x1587c9(%rip), %rsi    # 0x52c0fd
callq 0x3c3e60
cmpl $0x0, %eax
jne 0x3d3947
movl $0x0, -0x2c(%rbp)
jmp 0x3d3954
movq $0x0, -0x8(%rbp)
jmp 0x3d3bdd
jmp 0x3d3956
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0x40ad70
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3d3a72
movq -0x18(%rbp), %rdi
leaq 0x1d92d9(%rip), %rsi    # 0x5acc6d
movl $0x7, %edx
callq 0x3c3ef0
cmpl $0x0, %eax
jne 0x3d3a72
cmpl $0x1, -0x2c(%rbp)
jne 0x3d3a26
movq -0x18(%rbp), %rdi
addq $0x7, %rdi
leaq 0x1dc0c7(%rip), %rsi    # 0x5afa83
addq $0x7, %rsi
callq 0x3c3e60
cmpl $0x0, %eax
je 0x3d3a04
movq -0x18(%rbp), %rdi
addq $0x7, %rdi
leaq 0x1dc0bd(%rip), %rsi    # 0x5afa96
addq $0x7, %rsi
callq 0x3c3e60
cmpl $0x0, %eax
je 0x3d3a04
movq -0x18(%rbp), %rdi
addq $0x7, %rdi
leaq 0x1d7fca(%rip), %rsi    # 0x5ab9c0
addq $0x7, %rsi
callq 0x3c3e60
cmpl $0x0, %eax
jne 0x3d3a24
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x38(%rax), %rdi
addq $0x8, %rdi
leaq 0x1d8086(%rip), %rsi    # 0x5abaa1
callq 0x40ad70
movq %rax, -0x28(%rbp)
jmp 0x3d3a70
movq -0x18(%rbp), %rdi
addq $0x7, %rdi
leaq 0x1dc061(%rip), %rsi    # 0x5afa96
addq $0x7, %rsi
callq 0x3c3e60
cmpl $0x0, %eax
jne 0x3d3a6e
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
addq $0x8, %rdi
leaq 0x1d7f5b(%rip), %rsi    # 0x5ab9c0
callq 0x40ad70
movq %rax, -0x28(%rbp)
jmp 0x3d3a70
jmp 0x3d3a72
jmp 0x3d3bd5
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x38(%rax), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0x40ad70
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3d3aa8
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3d3bdd
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0x40ad70
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3d3ad9
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3d3bdd
movl $0x2, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x3d3b2a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0x40ad70
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3d3b1d
jmp 0x3d3b2a
jmp 0x3d3b1f
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3d3ae0
cmpq $0x0, -0x28(%rbp)
jne 0x3d3bd3
movq -0x18(%rbp), %rdi
leaq 0x1d912d(%rip), %rsi    # 0x5acc6d
movl $0x7, %edx
callq 0x3c3ef0
cmpl $0x0, %eax
jne 0x3d3bd3
movq -0x18(%rbp), %rdi
addq $0x7, %rdi
leaq 0x1dbf34(%rip), %rsi    # 0x5afa96
addq $0x7, %rsi
callq 0x3c3e60
cmpl $0x0, %eax
jne 0x3d3b92
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rdi
addq $0x8, %rdi
leaq 0x1d7e39(%rip), %rsi    # 0x5ab9c0
callq 0x40ad70
movq %rax, -0x28(%rbp)
jmp 0x3d3bd1
movq -0x18(%rbp), %rdi
addq $0x7, %rdi
leaq 0x1dbee2(%rip), %rsi    # 0x5afa83
addq $0x7, %rsi
callq 0x3c3e60
cmpl $0x0, %eax
jne 0x3d3bcf
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x38(%rax), %rdi
addq $0x8, %rdi
leaq 0x1d7edb(%rip), %rsi    # 0x5abaa1
callq 0x40ad70
movq %rax, -0x28(%rbp)
jmp 0x3d3bd1
jmp 0x3d3bd3
jmp 0x3d3bd5
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)