//
// sub_10054319C from 0x10054319c to 0x100543274 (216 bytes)
//
// 1 xrefs:
// > sub_10054310C @ 0x100543158
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_10054319C(__int64 result, __int64 *a2)
{
__int64 v3; // x19
__int64 v4; // x8
__int64 v5; // x0
__int64 v6; // x10
_QWORD *v7; // x9
__int64 v8; // x8
_QWORD *v9; // x12
_QWORD *v10; // x11
void (*v11)(void); // x8
v3 = result;
v4 = a2[1];
if ( !v4 || v4 > *(_QWORD *)(result + 200) + *(_QWORD *)(result + 208) )
{
sub_1005DEFC4(a2[2], result);
v5 = *a2;
v6 = *(_QWORD *)(v3 + 272);
if ( v6 )
{
v7 = *(_QWORD **)(v3 + 264);
if ( v7 )
{
v8 = v3 + 264;
v9 = (_QWORD *)(v5 + 56);
v10 = (_QWORD *)(v5 + 48);
if ( v6 == v5 + 56 )
{
if ( v7 == v10 )
{
*v10 = 0;
*(_QWORD *)(v5 + 56) = 0;
}
else
{
*v9 = v7;
v7[34] = v9;
}
}
else if ( v7 == v10 )
{
*v10 = v6;
*(_QWORD *)(v6 + 264) = v10;
}
else
{
*(_QWORD *)(v6 + 264) = v7;
*(_QWORD *)(*(_QWORD *)v8 + 272LL) = v6;
}
*(_QWORD *)v8 = 0;
*(_QWORD *)(v3 + 272) = 0;
v5 = *a2;
}
}
*(_DWORD *)(v3 + 160) = 1;
v11 = *(void (**)(void))(v5 + 88);
if ( v11 )
v11();
return sub_1005422E0(v3);
}
return result;
}