RtlpHeapRemoveListEntry

VOID __stdcall RtlpHeapRemoveListEntry(
        _HEAP *Heap,
        _HEAP_LIST_LOOKUP *ListLookup,
        _LIST_ENTRY *ListEntry,
        UINT64 InitialIndex,
        UINT64 Context){
  _LIST_ENTRY **ListHints; 
  unsigned int v7; 
  __int64 v9; 
  __int64 v10; 
  _LIST_ENTRY *v11; 
  unsigned int ArraySize; 
  unsigned int v13; 
  _LIST_ENTRY *v14; 
  _LIST_ENTRY *ListHead; 
  UINT64 Size; 

  ListHints = ListLookup->ListHints;
  v7 = Context - ListLookup->BaseIndex;
  v9 = 2 * v7;
  if( !ListLookup->ExtraItem )
    v9 = v7;
  v10 = (unsigned int)v9;
  v11 = ListHints[v9];
  --ListLookup->ItemCount;
  ArraySize = ListLookup->ArraySize;
  v13 = ArraySize - 1;
  if( (_DWORD)Context == ArraySize - 1 )
    --ListLookup->OutOfRangeItems;
  if( v11 == (_LIST_ENTRY *)InitialIndex )
  {
    v14 = *(_LIST_ENTRY **)InitialIndex;
    ListHead = ListLookup->ListHead;
    if( ListLookup->ExtendedLookup )
      v13 = ArraySize;
    if( (unsigned int)Context >= v13 )
    {
      if( v14 != ListHead )
      {
        ListHints[v10] = v14;
        return;
      }
      ListHints[v10] = 0i64;
    }
    else
    {
      if( v14 != ListHead && !RtlpHeapListCompare(Heap, v14, Size, 1u) )
      {
        ListLookup->ListHints[v10] = v14;
        return;
      }
      ListLookup->ListHints[v10] = 0i64;
    }
    ListLookup->ListsInUseUlong[(unsigned __int64)v7 >> 5] &= ~(1 << (v7 & 0x1F));
  }
}

Referenced by:

RtlZeroHeap
RtlpAllocateHeap
RtlpCoalesceFreeBlocks
RtlpCreateSplitBlock
RtlpPopulateListIndex