CmpCleanupDiscardReplaceContext

unsigned int __fastcall CmpCleanupDiscardReplaceContext(ULONG_PTR *a1, __int64 a2){
  __int64 v4; 
  ULONG_PTR *v5; 
  unsigned int result; 
  v4 = *a1;
  if( v4 )
  {
    v5 = a1 + 2;
    if( (ULONG_PTR *)*v5 != v5 )
    {
      result = (unsigned int)CmpEnumerateAllHigherLayerKcbs(
                               v4,
                               (unsigned int(__fastcall *)(ULONG_PTR, __int64))CmpCleanupDiscardReplacePre,
                               (unsigned int(__fastcall *)(ULONG_PTR, __int64, __int64))CmpCleanupDiscardReplacePost,
                               a2,
                               (__int64)a1,
                               1,
                               0);
      if( (ULONG_PTR *)*v5 != v5 )
        return CmpCleanupDiscardReplacePost((_CM_KEY_CONTROL_BLOCK *)*a1, (VOID *)a2);
    }
  }
  return result;
}

Referenced by:

CmDeleteLayeredKey
CmpCleanupLightWeightPrepare
CmpCommitDeleteKeyUoW
CmpLightWeightCommitDeleteKeyUoW
CmpLightWeightPrepareDeleteKeyUoW