PspStorageFreeSlot

INT64 __stdcall PspStorageFreeSlot(UINT64 StorageSlot){
  unsigned int v1; 
  BOOL(__fastcall *v2)(UINT64); 
  unsigned int v3; 
  v1 = StorageSlot;
  if( (unsigned int)StorageSlot >= 0x20 )
  {
    v1 = StorageSlot - 32;
    v2 = PspStorageExpansionBitmap;
    if( (unsigned int)(StorageSlot - 32) >= 0x100 )
      return 3221225485i64;
  }
  else
  {
    v2 = (BOOL(__fastcall *)(UINT64))&PspStorageBitmap;
  }
  ExAcquirePushLockExclusiveEx((UINT64)&PspStorageBitmapLock, 0i64);
  if( _bittest64(*((const signed __int64 **)v2 + 1), v1) )
  {
    _bittestandreset(*((signed __int32 **)v2 + 1), v1);
    v3 = 0;
  }
  else
  {
    v3 = -1073741811;
  }
  if( (_InterlockedExchangeAdd64((volatile signed __int64 *)&PspStorageBitmapLock, 0xFFFFFFFFFFFFFFFFui64) & 6) == 2 )
    ExfTryToWakePushLock((volatile INT64 *)&PspStorageBitmapLock);
  KeAbPostRelease(&PspStorageBitmapLock);
  return v3;
}

Referenced by:

PsFreeSiloContextSlot
PsUnregisterSiloMonitor
PspInitializeSiloStructures