RebalanceNode
UINT64 __stdcall RebalanceNode(_RTL_BALANCED_LINKS *S){
int Balance;
_RTL_BALANCED_LINKS *RightChild;
__int64 v3;
__int64 v4;
UINT64 result;
int v6;
_RTL_BALANCED_LINKS *LeftChild;
_RTL_BALANCED_LINKS *v8;
char v9;
__int64 v10;
__int64 v11;
char v12;
__int64 v13;
Balance = S->Balance;
if( S->Balance == 1 )
RightChild = S->RightChild;
else
RightChild = S->LeftChild;
if( RightChild->Balance == (_BYTE)Balance )
{
PromoteNode(RightChild);
*(_BYTE *)(v3 + 24) = 0;
*(_BYTE *)(v4 + 24) = 0;
return 0i64;
}
v6 = -Balance;
if( RightChild->Balance == -Balance )
{
if( (_BYTE)Balance == 1 )
LeftChild = RightChild->LeftChild;
else
LeftChild = RightChild->RightChild;
PromoteNode(LeftChild);
PromoteNode(v8);
*(_BYTE *)(v11 + 24) = 0;
*(_BYTE *)(v10 + 24) = 0;
if( LeftChild->Balance == v9 )
{
*(_BYTE *)(v11 + 24) = -v9;
}
else if( LeftChild->Balance == v6 )
{
*(_BYTE *)(v10 + 24) = v9;
}
LeftChild->Balance = 0;
return 0i64;
}
PromoteNode(RightChild);
result = 1i64;
*(_BYTE *)(v13 + 24) = -v12;
return result;
}Referenced by:
DeleteNodeFromTree
RtlInsertElementGenericTableFullAvl