HvTruncateCurrentLogFileIfRequired

INT64 __fastcall HvTruncateCurrentLogFileIfRequired(INT64 a1){
  INT64 result; 
  __int64 v2; 
  unsigned int v3; 
  _HHIVE *v4; 
  unsigned __int64 v5; 
  INT64 v6; 
  UINT64 v7; 
  result = *(unsigned int *)(a1 + 160);
  if( (result & 1) == 0 && (result & 0x8000) == 0 )
  {
    v2 = *(unsigned int *)(a1 + 164);
    if( (_DWORD)v2 )
    {
      if( *(_QWORD *)(a1 + 8 * v2 + 1536) )
      {
        v3 = HvpLogTypeToLogArrayIndex((unsigned int)v2);
        v5 = *((_QWORD *)&v4[1].ViewMap.ViewTree.Min + v3);
        result = HvGetEffectiveLogSizeCapForHive(v4);
        if( v5 > (unsigned int)result )
        {
          v7 = *(unsigned int *)(v6 + 176);
          if( v5 > v7 )
            return CmpDoFileSetSizeEx(v6, (unsigned int)v2, v7, 0);
        }
      }
    }
  }
  return result;
}

Referenced by:

CmpFlushHive