ViDeadlockRemoveThread

VOID __stdcall ViDeadlockRemoveThread(_VI_DEADLOCK_THREAD *Thread, UINT64 DisableConsistencyChecks){
  _QWORD *v3; 
  _LIST_ENTRY *Flink; 
  _LIST_ENTRY *Blink; 
  unsigned __int64 v6; 
  unsigned __int64 v7; 
  unsigned __int64 v8; 
  UINT64 v9; 

  if( *((_DWORD *)ViDeadlockGlobals + 8196) || *((int *)ViDeadlockGlobals + 8282) > 1024 )
    LODWORD(DisableConsistencyChecks) = 1;
  if( !(_DWORD)DisableConsistencyChecks && Thread->NodeCount )
  {
    ViDeadlockPreprocessOptions(
      (UINT64 *)((char *)&qword_140C12D7C + 4),
      (CHAR *)"Terminated thread 0x%p owns lock.",
      0x100Aui64,
      (UINT64)Thread->Thread,
      (UINT64)Thread,
      0i64,
      v9);
    VfReportIssueWithOptions(
      0xC4ui64,
      0x100Au,
      (ULONG_PTR)Thread->Thread,
      (ULONG_PTR)Thread,
      0,
      (UINT64 *)((char *)&qword_140C12D7C + 4));
  }
  v3 = ViDeadlockGlobals;
  --*((_QWORD *)ViDeadlockGlobals + 2051);
  Flink = Thread->ListEntry.Flink;
  if( ($92CCD2AF59176F619141B6C8F8B2A616 *)Flink->Blink != &Thread->24
    || (Blink = Thread->ListEntry.Blink, ($92CCD2AF59176F619141B6C8F8B2A616 *)Blink->Flink != &Thread->24) )
  {
    __fastfail(3u);
  }
  Blink->Flink = Flink;
  Flink->Blink = Blink;
  v6 = (unsigned __int64)Thread->Thread >> 12;
  v7 = 16 * (v6 % 0x3FF);
  v8 = 2 * (v6 % 0x3FF + 1026);
  if( *(_QWORD *)(v7 + v3[2050]) == v7 + v3[2050] )
  {
    v3[v8] = 0i64;
    v3[v8 + 1] = 0i64;
  }
  else
  {
    VfUtilAddressRangeRemove((_VF_ADDRESS_RANGE *)&v3[v8], Thread->Thread->Tcb.gap0, 0x898ui64);
  }
}

Referenced by:

VfDeadlockAcquireResource
VfDeadlockReleaseResource
ViDeadlockEmptyDatabase
ViDeadlockRemoveMemoryRangeThreads