IoGetLowerDeviceObjectWithTag

VOID *__stdcall IoGetLowerDeviceObjectWithTag(INT64 a1, UINT64 a2){
  INT64 v2; 
  unsigned int v4; 
  UINT8 v5; 
  __int64 v6; 
  UINT8 v7; 
  VOID *v8; 
  int v9; 

  v4 = a2;
  v5 = KeAcquireQueuedSpinLock(10i64, a2, v2);
  v6 = *(_QWORD *)(a1 + 312);
  v7 = v5;
  v8 = 0i64;
  v9 = *(_DWORD *)(v6 + 32);
  if( (v9 & 0xF) == 0 || (v9 & 0xE) == 0 && *(_QWORD *)(v6 + 48) )
  {
    if( *(_QWORD *)(v6 + 48) )
    {
      v8 = *(VOID **)(v6 + 48);
      ObfReferenceObjectWithTag(v8, v4);
    }
  }
  KeReleaseQueuedSpinLock(LockQueueIoDatabaseLock, v7);
  return v8;
}

Referenced by:

IoBuildPoDeviceNotifyList
IoGetLowerDeviceObject
IopCheckDeviceFlags
IopSynchronousCall
PiControlGetDeviceStack