FsRtlNotifyCompleteIrp

VOID __fastcall FsRtlNotifyCompleteIrp(IRP *Irp, INT64 a2, UINT64 a3, INT64 a4, INT64 a5){
  int v5; 
  UINT64 v6; 
  __int64 v9; 
  UINT8 *v10; 
  UINT8 *v11; 
  __int64 v12; 
  UINT8 *v13; 
  void *v14; 
  v5 = a4;
  v6 = (unsigned int)a3;
  if( FsRtlNotifySetCancelRoutine((__int64)Irp, a2) || !(_DWORD)a5 )
  {
    if( v5 )
    {
LABEL_21:
      *(_BYTE *)(*((_QWORD *)Irp + 23) + 3i64) |= 1u;
      *((_DWORD *)Irp + 12) = v5;
      IofCompleteRequest(Irp, 1);
      return;
    }
    v9 = *((_QWORD *)Irp + 23);
    if( !(_DWORD)v6 || *(_DWORD *)(v9 + 8) < (unsigned int)v6 )
    {
      v5 = 268;
      goto LABEL_21;
    }
    v10 = *(UINT8 **)(a2 + 80);
    if( !v10 )
    {
LABEL_20:
      *((_QWORD *)Irp + 7) = (unsigned int)v6;
      *(_QWORD *)(a2 + 88) = 0i64;
      goto LABEL_21;
    }
    v11 = (UINT8 *)*((_QWORD *)Irp + 3);
    if( !v11 )
    {
      v12 = *((_QWORD *)Irp + 1);
      if( v12 )
      {
        if( (*(_BYTE *)(v12 + 10) & 5) != 0 )
          v13 = *(UINT8 **)(v12 + 24);
        else
          v13 = (UINT8 *)MmMapLockedPagesSpecifyCache((PMDL)v12, 0, MmCached, 0i64, 0, 0x40000010u);
        if( !v13 )
        {
          v5 = 268;
          LODWORD(v6) = 0;
          goto LABEL_18;
        }
        v10 = *(UINT8 **)(a2 + 80);
        v11 = v13;
      }
      else
      {
        if( (*(_BYTE *)(v9 + 3) & 1) != 0 )
        {
          *((_DWORD *)Irp + 4) |= 0x70u;
          *((_QWORD *)Irp + 3) = *(_QWORD *)(a2 + 80);
LABEL_18:
          PsReturnProcessPagedPoolQuota(*(_QWORD *)(a2 + 120), *(unsigned int *)(a2 + 100));
          v14 = *(void **)(a2 + 80);
          if( v14 != *((void **)Irp + 3) )
          {
            if( v14 )
              ExFreePoolWithTag(v14, 0);
          }
          *(_QWORD *)(a2 + 80) = 0i64;
          *(_DWORD *)(a2 + 100) = 0;
          goto LABEL_20;
        }
        v11 = (UINT8 *)*((_QWORD *)Irp + 14);
      }
    }
    memmove(v11, v10, v6);
    goto LABEL_18;
  }
}

Referenced by:

FsRtlNotifyCompleteIrpList
FsRtlNotifyFilterChangeDirectory
FsRtlNotifyFilterChangeDirectoryLite