PopSystemIrpCompletion

NTSTATUS __stdcall PopSystemIrpCompletion(_DEVICE_OBJECT *DeviceObject, _IRP *Irp, VOID *Context){
  _DEVICE_OBJECT *DeviceThatFailedIrp; 
  char v5; 
  INT64 v6; 
  int v7; 
  int v8; 
  _KSEMAPHORE **v9; 
  unsigned __int8 v11; 
  __int64 v12; 
  unsigned __int64 v13; 
  INT64 v14; 
  _IRP *v15; 
  int Status; 
  int v17; 
  __int64 v18[2]; 

  DeviceThatFailedIrp = 0i64;
  v5 = PopErrataDisablePrimaryDeviceFastResume;
  v6 = *((_QWORD *)Context + 27);
  v7 = *(_DWORD *)(*((_QWORD *)&Irp->Tail.IrpExtension + 9 * Irp->StackCount) + 192i64);
  if( (xmmword_140CFB490 & 0x8000) != 0 )
  {
    Status = Irp->IoStatus.Status;
    v17 = 0;
    v18[0] = (__int64)&v15;
    v15 = Irp;
    v18[1] = 16i64;
    EtwTraceKernelEvent((__int64)v18, 1u, 0x80008000, 0x1227u, 0x401802u);
  }
  if( (*(&stru_140CF2E80 + 1836) || v5) && v7 == 1 )
  {
    v11 = ExAcquireSpinLockExclusive((INT64 *)(v6 - 72));
    v12 = *(_QWORD *)(v6 - 80);
    v13 = v11;
    if( v12 )
    {
      if( *(_QWORD *)(v12 + 136) )
      {
        _m_prefetchw((const void *)(v12 + 32));
        v14 = *(unsigned int *)(v12 + 32);
        if( (_InterlockedOr((volatile signed __int32 *)(v12 + 32), 0) & 0x800) != 0 )
        {
          _InterlockedOr((volatile signed __int32 *)(v12 + 32), 0x400u);
          PopDiagTraceIrpPended((INT64)Irp, v14, (NPTEXTMETRIC *)v12);
          ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v6 - 72));
          __writecr8(v13);
          return -1073741802;
        }
      }
    }
    ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v6 - 72));
    __writecr8(v13);
  }
  v8 = 0;
  if( (DWORD1(PopCurrentBroadcast) & 0x800000) == 0 )
    v8 = Irp->IoStatus.Status;
  if( v8 < 0 )
    DeviceThatFailedIrp = IoFindDeviceThatFailedIrp(Irp);
  PopDequeueQuerySetIrp(Irp);
  PopFreeIrp(Irp);
  v9 = (_KSEMAPHORE **)rcx0;
  if( (unsigned __int8)(*(_BYTE *)rcx0 - 2) <= 1u && *((int *)rcx0 + 1) > 1 )
  {
    PopFxIncrementDeviceSleepCount(*(_DEVICE_OBJECT **)(v6 - 128));
    ObfDereferenceObjectWithTag(*(VOID **)(v6 - 128), 0x72496F50ui64);
  }
  PopCompleteNotifyTransitionCommon((INT64)v9, v6, (unsigned int)v8, (INT64)DeviceThatFailedIrp);
  KeReleaseSemaphore(v9[5], 0i64, 1i64, 0);
  return -1073741802;
}

Referenced by:

PoFxReportDevicePoweredOn