PopEtStringSet

VOID __stdcall PopEtStringSet(INT64 *a1, INT64 a2){
  signed __int64 v4; 
  unsigned __int64 i; 
  signed __int64 v6; 

  if( *a1 )
    RtlInternEntryDereference(PopEtGlobals + 56, *a1);
  *a1 = a2;
  if( a2 )
  {
    _m_prefetchw((const void *)(a2 + 16));
    v4 = *(_QWORD *)(a2 + 16);
    for( i = v4 + 1; i > 1; i = v4 + 1 )
    {
      v6 = v4;
      v4 = _InterlockedCompareExchange64((volatile signed __int64 *)(a2 + 16), i, v4);
      if( v6 == v4 )
        return;
    }
    if( i != 1 )
      __fastfail(0xEu);
  }
}

Referenced by:

PopEtEnergyContextSetState
PopEtProcessSnapshotCreate
PopEtProcessSnapshotUpdateFromSnapshotContext