PopDirectedDripsBuildBroadcastTreeFull

__int64 __fastcall PopDirectedDripsBuildBroadcastTreeFull(__int64 a1, INT64 a2, char a3, _DWORD *a4){
  int v5; 
  INT64 v8; 
  __int64 v9; 
  INT64 v10; 
  INT64 v11; 
  INT64 v12; 
  __int64 v13; 
  INT64 v14; 
  int v15; 
  INT64 v16; 
  __int64 v17; 
  INT64 v19; 
  INT64 v20[2]; 
  INT64 v21[3]; 
  INT64 v22; 

  LODWORD(v19) = 0;
  LODWORD(v22) = 0;
  v20[1] = (INT64)v20;
  v5 = 0;
  v20[0] = (INT64)v20;
  v21[1] = (INT64)v21;
  v21[0] = (INT64)v21;
  if( (*(_DWORD *)(a1 + 760) & 0x30000) == 0 )
  {
    PopDirectedDripsInsertQueueDevice((__int64)v20, (_QWORD *)(a1 + 728));
    while( 1 )
    {
      do
      {
        v8 = v20[0];
        if( (INT64 *)v20[0] == v20 )
          goto LABEL_22;
        if( *(INT64 **)(v20[0] + 8) != v20 || (v9 = *(_QWORD *)v20[0], *(_QWORD *)(*(_QWORD *)v20[0] + 8i64) != v20[0]) )
LABEL_29:
          __fastfail(3u);
        v20[0] = *(_QWORD *)v20[0];
        *(_QWORD *)(v9 + 8) = v20;
        *(_QWORD *)(v8 + 8) = v8;
        *(_QWORD *)v8 = v8;
        v10 = *(_QWORD *)(v8 - 728 + 80);
      }
      while( (*(_DWORD *)(v8 + 32) & 0x30000) != 0 );
      PopDirectedDripsVisitDevice((INT64)v21, v8, a2, 0i64);
      if( PopDirectedDripsIsLikelySpecialDevice(v8 - 728, &v19) )
      {
        v14 = (unsigned int)v19;
        *(_DWORD *)(v8 + 32) |= 0x40000u;
        PopDirectedDripsDiagTraceProblemDevice(v11, a2, v14);
LABEL_21:
        PopDirectedDripsFlushDeviceQueue();
        goto LABEL_23;
      }
      if( (a3 & 1) == 0 )
      {
        v12 = 8i64;
        goto LABEL_16;
      }
      LODWORD(v22) = 0;
      if( !v10 )
        break;
      if( PopFxIsDirectedPowerTransitionSupported(v10, &v22) )
      {
        PopDirectedDripsMarkDfxDevice((INT64)v20, (INT64)v21, v8, a2);
        v5 |= 1u;
      }
      else
      {
        if( (_DWORD)v22 != 2 )
          break;
        v12 = 4i64;
LABEL_16:
        PopDirectedDripsDiagTraceProblemDevice(v8 - 728, a2, v12);
        if( (a3 & 2) == 0 || PopDirectedDripsBuildPs4BroadcastTree(v8 - 728, (INT64)v21, a2) < 0 )
          goto LABEL_21;
        v13 = *(_QWORD *)(v8 - 728 + 776);
        v5 |= 2u;
        if( v13 )
          *(_DWORD *)(v13 + 152) |= 0x10000u;
      }
    }
    v12 = 1i64;
    goto LABEL_16;
  }
LABEL_22:
  v15 = 0;
LABEL_23:
  while( 1 )
  {
    v16 = v21[0];
    if( (INT64 *)v21[0] == v21 )
      break;
    if( *(INT64 **)(v21[0] + 8) != v21 )
      goto LABEL_29;
    v17 = *(_QWORD *)v21[0];
    if( *(_QWORD *)(*(_QWORD *)v21[0] + 8i64) != v21[0] )
      goto LABEL_29;
    v21[0] = *(_QWORD *)v21[0];
    *(_QWORD *)(v17 + 8) = v21;
    if( v15 < 0 )
      *(_DWORD *)(v16 + 16) = *(_DWORD *)(v16 + 20);
    *(_DWORD *)(v16 + 20) = 0;
    *(_QWORD *)(v16 + 8) = v16;
    *(_QWORD *)v16 = v16;
  }
  if( v15 >= 0 )
    *a4 |= v5;
  return(unsigned int)v15;
}

Referenced by:

PopDirectedDripsBuildBroadcastTreePartial