PnpProcessDeferredRegistrations

__int64 **PnpProcessDeferredRegistrations(){
  _QWORD *v0; 
  __int64 v1; 
  __int64 v2; 
  __int64 v3; 
  _FAST_MUTEX *v4; 
  __int64 v5; 
  __int64 v6; 
  __int64 **v7; 
  __int64 ***v8; 
  __int64 *v9; 
  __int64 **result; 
  __int64 v11; 
  __int64 *v12; 
  __int64 **v13; 
  int v14; 
  int v15; 
  __int128 v16[2]; 

  v14 = 0;
  v15 = 0;
  v13 = &v12;
  v12 = (__int64 *)&v12;
  memset(v16, 0, sizeof(v16));
  ExAcquireFastMutex((PFAST_MUTEX)((char *)&stru_140C452E0 + 128));
  while( 1 )
  {
    v0 = PnpDeferredRegistrationList;
    if( PnpDeferredRegistrationList == &PnpDeferredRegistrationList )
      break;
    if( *((PVOID **)PnpDeferredRegistrationList + 1) != &PnpDeferredRegistrationList
      || (v1 = *(_QWORD *)PnpDeferredRegistrationList,
          *(PVOID *)(*(_QWORD *)PnpDeferredRegistrationList + 8i64) != PnpDeferredRegistrationList) )
    {
LABEL_21:
      __fastfail(3u);
    }
    PnpDeferredRegistrationList = *(PVOID *)PnpDeferredRegistrationList;
    *(_QWORD *)(v1 + 8) = &PnpDeferredRegistrationList;
    v2 = v0[2];
    v3 = v2;
    v4 = *(_FAST_MUTEX **)(v2 + 64);
    if( v4 )
    {
      ExAcquireFastMutex(*(PFAST_MUTEX *)(v2 + 64));
      v3 = v0[2];
    }
    *(_BYTE *)(v3 + 58) = 0;
    ExFreePoolWithTag(v0, 0x37706E50u);
    if( *(_DWORD *)(v2 + 16) == 3 )
    {
      v5 = *(_QWORD *)(v2 + 88);
      if( v5 )
      {
        v6 = *(_QWORD *)(*(_QWORD *)(v5 + 312) + 40i64);
        if( v6 )
        {
          if( (*(_DWORD *)(v6 + 704) & 0x4000) != 0 )
          {
            v7 = v13;
            v8 = (__int64 ***)(v2 + 96);
            if( *v13 != (__int64 *)&v12 )
              goto LABEL_21;
            *(_QWORD *)(v2 + 104) = v13;
            *v8 = &v12;
            *v7 = (__int64 *)v8;
            v13 = (__int64 **)(v2 + 96);
            ++*(_WORD *)(v2 + 56);
          }
        }
      }
    }
    if( v4 )
      KeReleaseGuardedMutex(v4);
    PnpDereferenceNotify((PVOID)v2);
  }
  KeReleaseGuardedMutex((PKGUARDED_MUTEX)((char *)&stru_140C452E0 + 128));
  while( 1 )
  {
    v9 = v12;
    result = &v12;
    if( v12 == (__int64 *)&v12 )
      return result;
    if( (__int64 **)v12[1] != &v12 )
      goto LABEL_21;
    v11 = *v12;
    if( *(__int64 **)(*v12 + 8) != v12 )
      goto LABEL_21;
    v12 = (__int64 *)*v12;
    *(_QWORD *)(v11 + 8) = &v12;
    LODWORD(v16[0]) = 2097153;
    *(GUID *)((char *)v16 + 4) = GUID_TARGET_DEVICE_REMOVE_COMPLETE;
    PnpNotifyTargetDeviceChangeNotifyEntry((__int64)(v9 - 12), (__int64)v16, &v15, &v14);
    HalPutDmaAdapter((PADAPTER_OBJECT)*(v9 - 1));
    *(v9 - 1) = 0i64;
    PnpDereferenceNotify(v9 - 12);
  }
}

Referenced by:

PnpDeviceEventWorker