MiIssueAsynchronousFlush

unsigned __int64 __fastcall MiIssueAsynchronousFlush(
        _FILE_OBJECT *a1,
        __int64 a2,
        unsigned __int64 a3,
        __int64 a4,
        __int64 a5,
        char a6,
        int a7,
        __int64 a8){
  __int64 v10; 
  unsigned __int64 v11; 
  NTSTATUS v12; 
  unsigned __int8 CurrentIrql; 
  int v15; 
  unsigned __int8 v16; 
  *(_BYTE *)(a2 + 50) = 6;
  *(_WORD *)(a2 + 48) = 0;
  *(_QWORD *)(a2 + 64) = a2 + 56;
  *(_QWORD *)(a2 + 56) = a2 + 56;
  *(_DWORD *)(a2 + 52) = 0;
  v10 = *(_QWORD *)(a2 + 72);
  v11 = a2;
  *(_DWORD *)a2 = 0;
  *(_QWORD *)(a2 + 8) = 0i64;
  *(_QWORD *)(a2 + 16) = v10 + 8 * (((unsigned __int64)*(unsigned int *)(v10 + 40) >> 12) + 6);
  if( a4 )
    _InterlockedAdd((volatile signed __int32 *)(a4 + 16), 1u);
  v12 = IoAsynchronousPageWrite(
          a1,
          v10,
          &a5,
          (void(__fastcall *)(__int64, __int64, _QWORD))MiFlushComplete,
          a2,
          a7,
          0,
          a6,
          a8,
          a2,
          (_QWORD *)(a2 + 24));
  if( (v12 & 0xC0000000) == -1073741824 )
  {
    *(_DWORD *)v11 = v12;
    *(_QWORD *)(v11 + 8) = 0i64;
    CurrentIrql = KeGetCurrentIrql();
    __writecr8(1ui64);
    MiFlushComplete((PVOID)v11, (IO_STATUS_BLOCK *)v11, 0i64);
    __writecr8(CurrentIrql);
    if( a4 )
      *(_DWORD *)(a4 + 20) = v12;
    *(_DWORD *)(v10 + 40) = 0;
  }
  else
  {
    v15 = 0;
    v16 = KeGetCurrentIrql();
    __writecr8(1ui64);
    do
    {
LABEL_9:
      v11 += 264i64;
      if( v11 >= a3 + 2112 )
        v11 = a3;
      if( !*(_QWORD *)(v11 + 16) || *(_DWORD *)(v11 + 52) == 1 )
      {
        __writecr8(v16);
        return v11;
      }
      ++v15;
    }
    while( v15 != 8 );
    __writecr8(v16);
    KeWaitForMultipleObjects(
      (_BYTE *)8,
      (VOID **)(a3 + 2112),
      WaitAny,
      WrPageOut,
      0,
      0,
      0i64,
      (_KWAIT_BLOCK *)(a3 + 2176));
    v11 = a3;
    while( *(int *)v11 >= 0 )
    {
      v11 += 264i64;
      if( !--v15 )
      {
        v16 = KeGetCurrentIrql();
        __writecr8(1ui64);
        goto LABEL_9;
      }
    }
    *(_DWORD *)(*(_QWORD *)(v11 + 72) + 40i64) = 0;
  }
  return 0i64;
}

Referenced by:

MiFlushSectionInternal