//
// sub_100540498 from 0x100540498 to 0x100540544 (172 bytes)
//
// 2 xrefs:
// > sub_100543008 @ 0x100543068
// > sub_100543008 @ 0x1005430d0
//
// 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_100540498(__int64 a1, __int64 a2)
{
__int64 v4; // x8
__int64 v5; // x9
int v6; // w21
__int64 result; // x0
__int64 v8; // x8
v4 = *(_QWORD *)(a1 + 8);
if ( v4 == a2 )
return 1;
v5 = *(_QWORD *)(a1 + 48);
if ( v5 )
v6 = v5 == *(_QWORD *)(v4 + 40);
else
v6 = -1;
if ( *(_DWORD *)v4 == *(_DWORD *)a2 )
{
*(_QWORD *)(a1 + 8) = a2;
result = 1;
}
else
{
(*(void (__fastcall **)(__int64))(v4 + 24))(a1);
*(_QWORD *)(a1 + 8) = a2;
result = (*(__int64 (__fastcall **)(__int64))(a2 + 8))(a1);
}
if ( v6 )
{
if ( v6 != 1 )
return result;
v8 = *(_QWORD *)(a2 + 40);
}
else
{
v8 = *(_QWORD *)(a2 + 32);
}
*(_QWORD *)(a1 + 48) = v8;
return result;
}