// File: /workspace/github_c_makefile_star2_O1/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), %rcx
testq %rcx, %rcx
je 0x2a772a
movq 0x10(%rcx), %rdx
andl $-0x11, 0x40(%rdx)
movq (%rcx), %rcx
jmp 0x2a7718
movq 0x28(%r15), %rcx
testq %rcx, %rcx
je 0x2a7742
movq 0x10(%rcx), %rdx
andw $0xff7f, 0x63(%rdx)     # imm = 0xFF7F
movq (%rcx), %rcx
jmp 0x2a772e
movq %rbx, 0x8(%rsp)
movq 0x20(%rbx), %rcx
movq (%rcx,%rax), %rdx
movq %rdx, 0x10(%rsp)
leaq 0x138779(%rip), %rsi    # 0x3dfed4
movq %rbx, %rdi
callq 0x28ad59
testq %rax, %rax
je 0x2a77af
movq 0x10(%rsp), %rdx
leaq 0x138744(%rip), %rsi    # 0x3dfeb8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x284f95
testq %rax, %rax
je 0x2a77b3
movq %rax, %r14
leaq 0x80ed(%rip), %rdx      # 0x2af87a
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rsi
xorl %r8d, %r8d
callq 0x285f46
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x28c3e7
jmp 0x2a77b8
xorl %ebp, %ebp
jmp 0x2a77b8
movl $0x7, %ebp
movq 0x28(%r15), %r14
testq %r14, %r14
je 0x2a77d5
movq 0x10(%r14), %rdi
testb $-0x80, 0x63(%rdi)
jne 0x2a77d0
callq 0x2af9aa
movq (%r14), %r14
jmp 0x2a77bc
cmpl $0x7, %ebp
jne 0x2a77e2
movq %rbx, %rdi
callq 0x2824bb
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq