SmKmStoreDeleteWhenEmpty

UINT64 __stdcall SmKmStoreDeleteWhenEmpty(_SMKM_STORE_LIST *StoreMgr, VOID *Store, UINT64 SetDeleteWhenEmpty){
  __int64 v5; 
  unsigned int v6; 
  int v7; 
  __int64 v9; 
  int v10; 
  _WORK_QUEUE_ITEM WorkItem; 
  __int64 Object; 
  __int64 v13[3]; 
  int v14; 
  int v15; 
  int v16; 
  int v17; 

  v5 = SmKmStoreRefFromStoreIndex((__int64)StoreMgr, *((_DWORD *)Store + 1504) & 0x3FF);
  v6 = 0;
  if( v7 )
  {
    _InterlockedOr8((volatile signed __int8 *)(v5 + 34), 1u);
  }
  else if( (*(_BYTE *)(v5 + 34) & 1) == 0 )
  {
    return v6;
  }
  v16 = 0;
  v17 = 0;
  ST_STORE::StDmGetSpaceStats((__int64)Store + 80, &v16, &v17);
  if( (unsigned int)(v17 + 1023) < 0x400 )
  {
    _m_prefetchw((const void *)(v9 + 34));
    if( (_InterlockedOr8((volatile signed __int8 *)(v9 + 34), 2u) & 2) == 0 )
    {
      WorkItem.List.Blink = 0i64;
      v13[1] = (__int64)v13;
      Object = 393216i64;
      v13[0] = (__int64)v13;
      v15 = 0;
      WorkItem.WorkerRoutine = (void(__fastcall *)(void *))SmKmStoreDeleteWhenEmptyWorker;
      WorkItem.Parameter = &WorkItem;
      v13[2] = (__int64)StoreMgr;
      v14 = v10;
      WorkItem.List.Flink = 0i64;
      ExQueueWorkItem(&WorkItem, DelayedWorkQueue);
      KeWaitForSingleObject((UINT64)&Object, 26, 0, 0, 0i64);
      return 1;
    }
  }
  return v6;
}

Referenced by:

SMKM_STORE_MGR::SmFeEvictComplete
SmProcessDeleteNotification
SmpKeyedStoreCreate