RtlpHeapAddListEntry

INT64 __fastcall RtlpHeapAddListEntry(INT64 a1, INT64 a2, INT64 a3, INT64 a4, INT64 a5, INT64 a6){
  __int64 v6; 
  unsigned int v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  INT64 result; 
  v6 = *(_QWORD *)(a2 + 48);
  ++*(_DWORD *)(a2 + 16);
  v9 = a5 - *(_DWORD *)(a2 + 24);
  v10 = 2 * v9;
  if( !*(_DWORD *)(a2 + 12) )
    v10 = v9;
  v11 = (unsigned int)v10;
  v12 = *(_QWORD *)(v6 + 8 * v10);
  if( (_DWORD)a5 == *(_DWORD *)(a2 + 8) - 1 )
    ++*(_DWORD *)(a2 + 20);
  if( !v12 || (result = RtlpHeapListCompare(a1, v12, a6, 1), (int)result <= 0) )
  {
    result = *(_QWORD *)(a2 + 48);
    *(_QWORD *)(result + 8 * v11) = a4;
  }
  if( !v12 )
  {
    result = *(_QWORD *)(a2 + 40);
    *(_DWORD *)(result + 4 * ((unsigned __int64)v9 >> 5)) |= 1 << (v9 & 0x1F);
  }
  return result;
}

Referenced by:

RtlZeroHeap
RtlpCreateSplitBlock
RtlpFreeHeap
RtlpInsertFreeBlock
RtlpPopulateListIndex