PnpRemoveDeviceActionRequestFromQueue

INT64 __fastcall PnpRemoveDeviceActionRequestFromQueue(volatile INT32 *a1){
  UINT64 v1; 
  unsigned __int8 v3; 
  unsigned __int8 v4; 
  unsigned __int64 v5; 
  UINT64 v6; 
  volatile INT32 **v7; 
  __int64 v8; 
  bool v9; 
  unsigned __int8 v10; 
  unsigned __int64 v11; 
  UINT64 v12; 
  unsigned __int8 v13; 
  unsigned __int64 v14; 
  void *v15; 
  v3 = 0;
  KeAcquireSpinLockRaiseToDpc(&PnpSpinLock, v1);
  v5 = v4;
  if( !*((_BYTE *)a1 + 76) )
  {
    v6 = *(_QWORD *)a1;
    v7 = (volatile INT32 **)*((_QWORD *)a1 + 1);
    if( *(volatile INT32 **)(*(_QWORD *)a1 + 8i64) != a1 || *v7 != a1 )
      __fastfail(3u);
    *v7 = (volatile INT32 *)v6;
    v3 = 1;
    *(_QWORD *)(v6 + 8) = v7;
    v8 = *((unsigned int *)a1 + 6);
    KeAcquireSpinLockRaiseToDpc(&qword_140C24C08, v6);
    v9 = dword_140C24C10-- == 1;
    v11 = v10;
    if( v9 )
      PopDirectedDripsClearDisengageReason(4);
    KxReleaseSpinLock(&qword_140C24C08);
    __writecr8(v11);
    KeAcquireSpinLockRaiseToDpc(&qword_140C1E9B0, v12);
    v14 = v13;
    if( !--dword_140C1E9B8 && byte_140C1EA28 )
    {
      qword_140C1EA30 += *(_QWORD *)&KUSER_SHARED_DATA.InterruptTime.LowPart - qword_140C1EA38;
      qword_140C1EA38 = 0i64;
    }
    --*((_DWORD *)qword_140C1E9C0 + v8);
    KxReleaseSpinLock(&qword_140C1E9B0);
    __writecr8(v14);
  }
  KxReleaseSpinLock(&PnpSpinLock);
  __writecr8(v5);
  if( v3 )
  {
    v15 = (void *)*((_QWORD *)a1 + 2);
    if( v15 )
      ObfDereferenceObjectWithTag(v15, 0x746C6644ui64);
    PnpDeleteDeviceActionRequest(a1);
  }
  return v3;
}

Referenced by:

PiControlGetSetDeviceStatus
PiQueueDeviceRequest