CmpArmLazyWriter

void __fastcall CmpArmLazyWriter(_CMP_LAZY_WRITER Writer, UINT64 *EligibleTime, INT64 Immediate){
  char v3; 
  unsigned __int64 v4; 
  UINT64 v5; 
  unsigned __int64 v6; 
  __int64 v7; 
  unsigned __int64 v8; 
  unsigned __int64 v9; 
  int v10; 
  unsigned __int64 v11; 
  UINT64 v12; 
  INT64 v13; 

  v3 = Immediate;
  if( *(&stru_140CF2E80 + 4768) && !(_DWORD)CmpHoldLazyFlush )
  {
    v4 = *(_QWORD *)&KUSER_SHARED_DATA.InterruptTime.LowPart - KUSER_SHARED_DATA.InterruptTimeBias;
    if( EligibleTime )
    {
      v5 = v4 + 10000000i64 * *((unsigned int *)&CmpLazyWriterData + 48 * Writer + 45);
      v6 = *EligibleTime;
      if( *EligibleTime >= v5 )
        v6 = v5;
    }
    else if( (_BYTE)Immediate )
    {
      v6 = v4 + 20000000;
    }
    else
    {
      v6 = 10000000i64 * *((unsigned int *)&CmpLazyWriterData + 48 * Writer + 45) + v4;
    }
    v7 = 192i64 * (int)Writer;
    v8 = (unsigned __int8)KeAcquireSpinLockRaiseToDpc((UINT64 *)((char *)&CmpLazyWriterData + v7 + 152));
    v9 = *(_QWORD *)((char *)&CmpLazyWriterData + v7 + 168) & 7i64;
    if( v9 > 3 )
      goto LABEL_9;
    if( (_DWORD)v9 == 1 )
    {
      if( v3 && (unsigned __int8)KeCancelTimer((INT64)&CmpLazyWriterData.gap0[v7]) )
        goto LABEL_23;
    }
    else
    {
      if( !(_DWORD)v9 )
      {
LABEL_23:
        v11 = 1i64;
LABEL_16:
        *(_QWORD *)((char *)&CmpLazyWriterData + v7 + 168) = v11;
        if( v11 == 1 )
        {
          if( v3 )
          {
            v13 = -20000000i64;
            v12 = 1000i64;
          }
          else
          {
            v12 = *(unsigned int *)((char *)&CmpLazyWriterData + v7 + 184);
            v13 = -10000000i64 * *(int *)((char *)&CmpLazyWriterData + v7 + 180);
          }
          KeSetCoalescableTimer((INT64)&CmpLazyWriterData.gap0[v7], v13, 0i64, v12, (INT64)&CmpLazyWriterData + v7 + 64);
        }
        goto LABEL_9;
      }
      v10 = v9 - 2;
      if( !v10 || v10 == 1 && v6 < (*(_QWORD *)((char *)&CmpLazyWriterData + v7 + 168) & 0xFFFFFFFFFFFFFFF8ui64) )
      {
        v11 = v6 & 0xFFFFFFFFFFFFFFF8ui64 | 3;
        goto LABEL_16;
      }
    }
LABEL_9:
    KxReleaseSpinLock((UINT64 *)((char *)&CmpLazyWriterData + v7 + 152));
    __writecr8(v8);
  }
}

Referenced by:

CmpEnableLazyFlush
CmpFlushHive
CmpRecheckHiveVolumePolicy
HvMarkBaseBlockDirty
HvpMarkDirty