RtlStateDurationCapture

INT64 __fastcall RtlStateDurationCapture(INT64 a1, _QWORD *a2, UINT64 a3){
  unsigned int v3; 
  int v5; 
  unsigned int v7; 
  int v8; 
  int v9; 
  v3 = 0;
  *(_QWORD *)a1 = *a2;
  v5 = *(_DWORD *)(a1 + 4);
  if( v5 < 0 )
  {
    v7 = v5 & 0x7FFFFFFF;
    *(_DWORD *)(a1 + 4) = v7;
    v8 = *(_DWORD *)a2;
    if( (unsigned int)a3 > *(_DWORD *)a2 )
    {
      *(_DWORD *)a1 = a3;
      v3 = a3 - v8;
      v9 = -1;
      if( (_DWORD)a3 - v8 != -1 && ~v3 >= v7 )
        v9 = v7 + v3;
      *(_DWORD *)(a1 + 4) = v9 & 0x7FFFFFFF;
    }
  }
  return v3;
}

Referenced by:

PoEnergyContextCleanup