RtlpTreeDoubleRotateNodes
_RTL_BALANCED_NODE *__stdcall RtlpTreeDoubleRotateNodes(
_RTL_BALANCED_NODE **RootPointer,
_RTL_BALANCED_NODE *Parent,
_RTL_BALANCED_NODE *Middle,
UINT64 NodeRight){
_RTL_BALANCED_NODE *result;
_RTL_BALANCED_NODE **v5;
_RTL_BALANCED_NODE **v6;
_RTL_BALANCED_NODE *v7;
unsigned int v8;
__int64 v9;
_RTL_BALANCED_NODE **v10;
unsigned __int64 v11;
unsigned __int64 v12;
_RTL_BALANCED_NODE **v13;
_RTL_BALANCED_NODE *v14;
unsigned __int64 ParentValue;
unsigned __int64 v16;
result = Middle->Children[0];
if( !(_DWORD)NodeRight )
result = Middle->Children[1];
if( (_RTL_BALANCED_NODE *)(result->ParentValue & 0xFFFFFFFFFFFFFFFCui64) != Middle )
goto LABEL_23;
v5 = &Middle->Children[(unsigned int)NodeRight ^ 1i64];
if( *v5 != result
|| Parent->Children[(unsigned int)NodeRight] != Middle
|| (_RTL_BALANCED_NODE *)(Middle->ParentValue & 0xFFFFFFFFFFFFFFFCui64) != Parent )
{
goto LABEL_23;
}
Parent->Children[(unsigned int)NodeRight] = result;
v6 = &result->Children[(unsigned int)NodeRight];
result->ParentValue = (unsigned __int64)Parent | *(_DWORD *)&result->_bf_0 & 3;
v7 = *v6;
if( *v6 )
{
ParentValue = v7->ParentValue;
if( (_RTL_BALANCED_NODE *)(ParentValue & 0xFFFFFFFFFFFFFFFCui64) != result )
goto LABEL_23;
v7->ParentValue = (unsigned __int64)Middle | ParentValue & 3;
}
*v5 = v7;
v8 = NodeRight ^ 1;
*v6 = Middle;
Middle->ParentValue = (unsigned __int64)result | *(_DWORD *)&Middle->_bf_0 & 3;
if( (_RTL_BALANCED_NODE *)(result->ParentValue & 0xFFFFFFFFFFFFFFFCui64) != Parent
|| (v9 = v8, v10 = &Parent->Children[v8 ^ 1i64], *v10 != result) )
{
LABEL_23:
__fastfail(0x1Du);
}
v11 = Parent->ParentValue & 0xFFFFFFFFFFFFFFFCui64;
if( v11 )
{
if( *(_RTL_BALANCED_NODE **)(v11 + 8) == Parent )
{
*(_QWORD *)(v11 + 8) = result;
}
else
{
if( *(_RTL_BALANCED_NODE **)v11 != Parent )
goto LABEL_23;
*(_QWORD *)v11 = result;
}
}
else
{
if( *RootPointer != Parent )
goto LABEL_23;
*RootPointer = result;
}
v12 = v11 | *(_DWORD *)&result->_bf_0 & 3;
v13 = &result->Children[v9];
result->ParentValue = v12;
v14 = *v13;
if( *v13 )
{
v16 = v14->ParentValue;
if( (_RTL_BALANCED_NODE *)(v16 & 0xFFFFFFFFFFFFFFFCui64) == result )
{
v14->ParentValue = (unsigned __int64)Parent | v16 & 3;
goto LABEL_14;
}
goto LABEL_23;
}
LABEL_14:
*v10 = v14;
*v13 = Parent;
Parent->ParentValue = (unsigned __int64)result | *(_DWORD *)&Parent->_bf_0 & 3;
return result;
}Referenced by:
MiZeroLargePages
RtlAvlInsertNodeEx
RtlAvlRemoveNode