CmpCleanupParseContext

UINT64 *__fastcall CmpCleanupParseContext(INT64 a1, CHAR a2){
  UINT64 v4; 
  UINT64 **v5; 
  UINT64 *result; 
  UINT64 v7; 
  UINT64 v8; 

  v4 = *(_QWORD *)(a1 + 88);
  if( v4 )
  {
    if( !a2 )
    {
      CmpLockRegistry();
      v4 = *(_QWORD *)(a1 + 88);
    }
    CmpDereferenceKeyControlBlock(v4);
    if( !a2 )
      CmpUnlockRegistry();
  }
  v5 = (UINT64 **)(a1 + 144);
  result = *v5;
  if( (UINT64 **)(*v5)[1] != v5 )
    goto LABEL_10;
  v7 = *result;
  if( *(UINT64 **)(*result + 8) != result )
    goto LABEL_10;
  *v5 = (UINT64 *)v7;
  *(_QWORD *)(v7 + 8) = v5;
  if( result != (UINT64 *)v5 )
  {
    while( 1 )
    {
      CmpFreeExtraParameter(result);
      result = *v5;
      if( (UINT64 **)(*v5)[1] != v5 )
        break;
      v8 = *result;
      if( *(UINT64 **)(*result + 8) != result )
        break;
      *v5 = (UINT64 *)v8;
      *(_QWORD *)(v8 + 8) = v5;
      if( result == (UINT64 *)v5 )
        return result;
    }
LABEL_10:
    __fastfail(3u);
  }
  return result;
}

Referenced by:

CmCreateKey
CmInitSystem1
CmKeyBodyRemapToVirtual
CmKeyBodyRemapToVirtualForEnum
CmKeyBodyReplicateToVirtual
CmLoadDifferencingKey
CmOpenKey
CmUnloadKey
CmpCreatePredefined
CmpDoBuildVirtualStack
CmpDoReOpenTransKey
CmpLinkHiveToMaster
CmpParseKey
CmpResolveHiveLoadConflict
CmpStartSiloRegistryNamespace
NtNotifyChangeMultipleKeys
NtQueryOpenSubKeys
NtQueryOpenSubKeysEx