// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: walCleanupHash
static void walCleanupHash(Wal *pWal){
  volatile ht_slot *aHash = 0;    /* Pointer to hash table to clear */
  volatile u32 *aPgno = 0;        /* Page number array for hash table */
  u32 iZero = 0;                  /* frame == (aHash[x]+iZero) */
  int iLimit = 0;                 /* Zero values greater than this */
  int nByte;                      /* Number of bytes to zero in aPgno[] */
  int i;                          /* Used to iterate through aHash[] */

  assert( pWal->writeLock );
  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );
  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );
  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );

  if( pWal->hdr.mxFrame==0 ) return;

  /* Obtain pointers to the hash-table and page-number array containing 
  ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed
  ** that the page said hash-table and array reside on is already mapped.
  */
  assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );
  assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );
  walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &aHash, &aPgno, &iZero);

  /* Zero all hash-table entries that correspond to frame numbers greater
  ** than pWal->hdr.mxFrame.
  */
  iLimit = pWal->hdr.mxFrame - iZero;
  assert( iLimit>0 );
  for(i=0; i<HASHTABLE_NSLOT; i++){
    if( aHash[i]>iLimit ){
      aHash[i] = 0;
    }
  }
  
  /* Zero the entries in the aPgno array that correspond to frames with
  ** frame numbers greater than pWal->hdr.mxFrame. 
  */
  nByte = (int)((char *)aHash - (char *)&aPgno[iLimit+1]);
  memset((void *)&aPgno[iLimit+1], 0, nByte);

#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
  /* Verify that the every entry in the mapping region is still reachable
  ** via the hash table even after the cleanup.
  */
  if( iLimit ){
    int j;           /* Loop counter */
    int iKey;        /* Hash key */
    for(j=1; j<=iLimit; j++){
      for(iKey=walHash(aPgno[j]); aHash[iKey]; iKey=walNextHash(iKey)){
        if( aHash[iKey]==j ) break;
      }
      assert( aHash[iKey]==j );
    }
  }
#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x58(%rax)
jne 0x2a569
jmp 0x2a61c
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x58(%rax), %edi
callq 0x2a500
movq -0x30(%rbp), %rdi
movl %eax, %esi
leaq -0x10(%rbp), %rdx
leaq -0x18(%rbp), %rcx
leaq -0x1c(%rbp), %r8
callq 0x2a460
movq -0x8(%rbp), %rax
movl 0x58(%rax), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x2000, -0x28(%rbp)    # imm = 0x2000
jge 0x2a5e0
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movw (%rax,%rcx,2), %ax
movzwl %ax, %eax
cmpl -0x20(%rbp), %eax
jle 0x2a5d3
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
jmp 0x2a5d5
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2a5a8
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movl -0x20(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
subq %rcx, %rax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x2, %rax
addq %rax, %rdi
movslq -0x24(%rbp), %rdx
xorl %esi, %esi
callq 0xb2b0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)