CmpFreeKeyValues

char __fastcall CmpFreeKeyValues(__int64 Hive, void *a2, __int64 a3){
  __int64 v5; 
  unsigned int v6; 
  int v8; 
  int v9; 

  v8 = -1;
  v9 = 0;
  if( CmpMarkKeyValuesDirty((PVOID)Hive, a2, a3) )
  {
    if( (*(_BYTE *)(a3 + 2) & 2) != 0 )
      return 1;
    if( !*(_DWORD *)(a3 + 36) )
    {
LABEL_9:
      *(_DWORD *)(a3 + 40) = -1;
      *(_DWORD *)(a3 + 36) = 0;
      if( *(_WORD *)(a3 + 74) )
      {
        HvFreeCell(Hive, *(_DWORD *)(a3 + 48));
        *(_DWORD *)(a3 + 48) = -1;
        *(_WORD *)(a3 + 74) = 0;
      }
      return 1;
    }
    v5 = (*(__int64(__fastcall **)(__int64, _QWORD, int *))(Hive + 8))(Hive, *(unsigned int *)(a3 + 40), &v8);
    if( v5 )
    {
      v6 = 0;
      if( *(_DWORD *)(a3 + 36) )
      {
        while( CmpFreeValue(Hive, *(unsigned int *)(v5 + 4i64 * v6)) )
        {
          if( ++v6 >= *(_DWORD *)(a3 + 36) )
            goto LABEL_8;
        }
        (*(void(__fastcall **)(__int64, int *))(Hive + 16))(Hive, &v8);
        return 0;
      }
LABEL_8:
      (*(void(__fastcall **)(__int64, int *))(Hive + 16))(Hive, &v8);
      HvFreeCell(Hive, *(_DWORD *)(a3 + 40));
      goto LABEL_9;
    }
  }
  return 0;
}

Referenced by:

CmDeleteLayeredKey
CmpSyncKeyValues