SmFpFree

VOID __fastcall SmFpFree(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
  MDL *v4; 
  int v5; 
  struct _MDL *v7; 
  v4 = (MDL *)a4;
  v5 = a2;
  v7 = (struct _MDL *)a4;
  if( (int)a2 >= 5 )
    v4 = *(MDL **)(a4 + 24);
  if( (int)a2 < 5 )
    v7 = 0i64;
  if( *(_QWORD *)(a1 + 104) == a3 && (unsigned int)SmpFpReleaseResource((volatile INT64 *)a1, a2, (INT64)v4) )
  {
    if( v5 >= 5 )
      MmUnmapReservedMapping(v4, 0x6D526D73u, v7);
    if( !*(_BYTE *)(a1 + 86) )
    {
      _InterlockedExchange64((volatile __int64 *)(a1 + 104), 0i64);
      KeSetEvent((PRKEVENT)(a1 + 8), 0);
    }
  }
  else if( v5 < 5 )
  {
    if( v5 == 2 )
    {
      SmKmFreeMdlForLock(v4);
    }
    else if( v5 == 3 )
    {
      SmAcquireReleaseCharges((unsigned __int64)*(unsigned __int16 *)(a1 + 94) << 12, 1ui64, 1ui64);
    }
    else
    {
      ExFreePoolWithTag(v4, 0);
    }
  }
  else
  {
    MmUnmapLockedPages(v4, v7);
  }
}

Referenced by:

SMKM_STORE::SmStCompareRegionDataCallback
SMKM_STORE::SmStReadThread
SMKM_STORE::SmStUnmapVirtualRegion
SMKM_STORE_MGR::SmIoCtxQueueWork
SMKM_STORE_MGR::SmIoCtxWorkItemComplete
SMKM_STORE_MGR::SmWorkItemFree
SMKM_STORE_MGR::SmWorkItemFreeResource
SMKM_STORE_MGR::SmpPageEvict
ST_STORE::StDmpSinglePageRetrieve
ST_STORE::StMapAndLockRegion
ST_STORE::StUnlockAndUnmapRegion
SmKmStoreHelperCommandCleanup
SmKmStoreHelperCommandProcess
SmKmUnlockMdl