ViAvlAcquireTableLockAtDpcLevelSafe

VOID __fastcall ViAvlAcquireTableLockAtDpcLevelSafe(INT64 a1, INT64 a2){
  char v2; 
  INT64 *v5; 
  v2 = *(_BYTE *)(a2 + 9);
  if( (v2 & 2) == 0 )
    goto LABEL_2;
  if( *(_QWORD *)a2 != a1 )
  {
    ViAvlReleaseTableLockFromDpcLevel(*(_QWORD *)a2, a2);
    v2 = *(_BYTE *)(a2 + 9);
  }
  if( (v2 & 2) == 0 )
  {
LABEL_2:
    v5 = (INT64 *)(a1 + 128);
    if( (v2 & 4) != 0 )
      ExAcquireSpinLockExclusiveAtDpcLevel(v5);
    else
      ExAcquireSpinLockSharedAtDpcLevel((PEX_SPIN_LOCK)v5);
    *(_BYTE *)(a2 + 9) |= 2u;
    *(_QWORD *)a2 = a1;
  }
}

Referenced by:

VfAvlDeleteTreeNode
VfAvlEnumerateNodes
VfAvlInsertReservedTreeNode
VfAvlLookupTreeNode