// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3AnalysisLoad
SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
  analysisInfo sInfo;
  HashElem *i;
  char *zSql;
  int rc = SQLITE_OK;
  Schema *pSchema = db->aDb[iDb].pSchema;

  assert( iDb>=0 && iDb<db->nDb );
  assert( db->aDb[iDb].pBt!=0 );

  /* Clear any prior statistics */
  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){
    Table *pTab = sqliteHashData(i);
    pTab->tabFlags &= ~TF_HasStat1;
  }
  for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
    Index *pIdx = sqliteHashData(i);
    pIdx->hasStat1 = 0;
#ifdef SQLITE_ENABLE_STAT4
    sqlite3DeleteIndexSamples(db, pIdx);
    pIdx->aSample = 0;
#endif
  }

  /* Load new statistics out of the sqlite_stat1 table */
  sInfo.db = db;
  sInfo.zDatabase = db->aDb[iDb].zDbSName;
  if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)!=0 ){
    zSql = sqlite3MPrintf(db,
        "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase);
    if( zSql==0 ){
      rc = SQLITE_NOMEM_BKPT;
    }else{
      rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);
      sqlite3DbFree(db, zSql);
    }
  }

  /* Set appropriate defaults on all indexes not in the sqlite_stat1 table */
  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
  for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
    Index *pIdx = sqliteHashData(i);
    if( !pIdx->hasStat1 ) sqlite3DefaultRowEst(pIdx);
  }

  /* Load the statistics from the sqlite_stat4 table. */
#ifdef SQLITE_ENABLE_STAT4
  if( rc==SQLITE_OK ){
    DisableLookaside;
    rc = loadStat4(db, sInfo.zDatabase);
    EnableLookaside;
  }
  for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
    Index *pIdx = sqliteHashData(i);
    sqlite3_free(pIdx->aiRowEst);
    pIdx->aiRowEst = 0;
  }
#endif

  if( rc==SQLITE_NOMEM ){
    sqlite3OomFault(db);
  }
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %rcx
movslq %esi, %rax
shlq $0x5, %rax
movq 0x18(%rcx,%rax), %r15
movq 0x10(%r15), %rdx
testq %rdx, %rdx
je 0x29dee2
movq 0x10(%rdx), %rsi
andl $-0x11, 0x40(%rsi)
movq (%rdx), %rdx
jmp 0x29ded0
movq 0x28(%r15), %rdx
testq %rdx, %rdx
je 0x29df01
movq 0x10(%rdx), %rcx
andw $0xff7f, 0x63(%rcx)     # imm = 0xFF7F
movq (%rdx), %rdx
testq %rdx, %rdx
jne 0x29deeb
movq 0x20(%rbx), %rcx
movq %rbx, 0x8(%rsp)
movq (%rcx,%rax), %r14
movq %r14, 0x10(%rsp)
leaq 0x138871(%rip), %rsi    # 0x3d6787
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2811f8
testq %rax, %rax
je 0x29df6b
leaq 0x13883e(%rip), %rsi    # 0x3d676b
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x27b56a
testq %rax, %rax
je 0x29df6f
movq %rax, %r14
leaq 0x7d2d(%rip), %rdx      # 0x2a5c76
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rsi
xorl %r8d, %r8d
callq 0x27c539
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x282904
jmp 0x29df74
xorl %ebp, %ebp
jmp 0x29df74
movl $0x7, %ebp
movq 0x28(%r15), %r14
testq %r14, %r14
je 0x29df91
movq 0x10(%r14), %rdi
testb $-0x80, 0x63(%rdi)
jne 0x29df8c
callq 0x2a5db6
movq (%r14), %r14
jmp 0x29df78
cmpl $0x7, %ebp
jne 0x29df9e
movq %rbx, %rdi
callq 0x278b1c
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq