HalpDmaRemoveAdapterFromChannelQueue

char __fastcall HalpDmaRemoveAdapterFromChannelQueue(__int64 a1){
  __int64 v2; 
  __int64 v3; 
  unsigned __int8 CurrentIrql; 
  _QWORD **v5; 
  char v6; 
  _QWORD *v7; 
  _QWORD **v8; 
  _QWORD *v10; 
  v2 = *(_QWORD *)(a1 + 360);
  v3 = *(_QWORD *)(v2 + 56) + 160i64 * *(unsigned int *)(a1 + 372);
  CurrentIrql = KeGetCurrentIrql();
  __writecr8(*(unsigned __int8 *)(v2 + 176));
  KxAcquireSpinLock((UINT64 *)(*(_QWORD *)(a1 + 360) + 168i64));
  v5 = (_QWORD **)(v3 + 144);
  v6 = 0;
  v7 = *v5;
  if( *v5 != v5 )
  {
    while( 1 )
    {
      v8 = (_QWORD **)*v7;
      if( v7 == (_QWORD *)(a1 + 200) )
        break;
      v7 = (_QWORD *)*v7;
      if( v8 == v5 )
        goto LABEL_4;
    }
    v10 = (_QWORD *)v7[1];
    if( v8[1] != v7 || (_QWORD *)*v10 != v7 )
      __fastfail(3u);
    *v10 = v8;
    v6 = 1;
    v8[1] = v10;
  }
LABEL_4:
  KxReleaseSpinLock((UINT64 *)(*(_QWORD *)(a1 + 360) + 168i64));
  __writecr8(CurrentIrql);
  return v6;
}

Referenced by:

HalCancelAdapterChannel
HalCancelAdapterChannelThin
HalpAllocateDmaResourcesInternal