PopSnapSystemIdleContext

VOID __fastcall PopSnapSystemIdleContext(_QWORD *a1, _DWORD *a2){
  _OWORD *PoolWithTag; 
  __int64 v5; 
  _OWORD *v6; 
  INT64 *v7; 
  __int128 v8; 
  int *v9; 
  __int64 v10; 
  unsigned __int64 v11; 
  PopAcquireRwLockExclusive(&PopSystemIdleLock);
  PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x148ui64, 0x67696450ui64);
  v5 = 2i64;
  *a1 = PoolWithTag;
  v6 = PoolWithTag;
  v7 = &PopSystemIdleContext;
  do
  {
    *v6 = *(_OWORD *)v7;
    v6[1] = *((_OWORD *)v7 + 1);
    v6[2] = *((_OWORD *)v7 + 2);
    v6[3] = *((_OWORD *)v7 + 3);
    v6[4] = *((_OWORD *)v7 + 4);
    v6[5] = *((_OWORD *)v7 + 5);
    v6[6] = *((_OWORD *)v7 + 6);
    v6 += 8;
    v8 = *((_OWORD *)v7 + 7);
    v7 += 16;
    *(v6 - 1) = v8;
    --v5;
  }
  while( v5 );
  *v6 = *(_OWORD *)v7;
  v6[1] = *((_OWORD *)v7 + 1);
  v6[2] = *((_OWORD *)v7 + 2);
  v6[3] = *((_OWORD *)v7 + 3);
  *((_QWORD *)v6 + 8) = v7[8];
  *a2 = 0;
  if( dword_140C0F2B4 )
  {
    v9 = &dword_140C0F1DC;
    v10 = 4i64;
    do
    {
      if( *((_BYTE *)v9 - 4) )
      {
        if( *v9 )
        {
          if( *v9 == 1 )
            v11 = (*(_QWORD *)(v9 - 3) - *(_QWORD *)(v9 - 5)) / 0x989680ui64;
          else
            LODWORD(v11) = -1;
        }
        else
        {
          LODWORD(v11) = 0;
        }
        if( (unsigned int)v11 > *a2 )
          *a2 = v11;
      }
      v9 += 14;
      --v10;
    }
    while( v10 );
  }
  PopReleaseRwLock((UINT64)&PopSystemIdleLock);
}

Referenced by:

PopArmIdlePhaseWatchdog
PopIdlePhaseWatchdogCallback