// File: /workspace/github_c_makefile_star2_O2/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
leaq 0x10(%r15), %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x2446ab
movq 0x10(%rcx), %rdx
andl $-0x11, 0x40(%rdx)
jmp 0x244699
addq $0x28, %r15
movq %r15, %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x2446c6
movq 0x10(%rcx), %rdx
andw $0xff7f, 0x63(%rdx)     # imm = 0xFF7F
jmp 0x2446b2
movq %rbx, 0x8(%rsp)
movq 0x20(%rbx), %rcx
movq (%rcx,%rax), %r14
movq %r14, 0x10(%rsp)
leaq 0x1324c8(%rip), %rsi    # 0x376ba7
movq %rbx, %rdi
movq %r14, %rdx
callq 0x22beb2
testq %rax, %rax
je 0x244734
leaq 0x132495(%rip), %rsi    # 0x376b8b
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x226ec3
testq %rax, %rax
je 0x244738
movq %rax, %r14
leaq 0x6ae5(%rip), %rdx      # 0x24b1f7
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rsi
xorl %r8d, %r8d
callq 0x227d46
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22d0fc
jmp 0x24474c
xorl %ebp, %ebp
jmp 0x24474c
pushq $0x7
popq %rbp
jmp 0x24474c
movq 0x10(%r15), %rdi
testb $-0x80, 0x63(%rdi)
jne 0x24474c
callq 0x24b2ef
movq (%r15), %r15
testq %r15, %r15
jne 0x24473d
cmpl $0x7, %ebp
jne 0x244761
movq %rbx, %rdi
callq 0x224bb1
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq