//
// sub_1004AE3C4 from 0x1004ae3c4 to 0x1004ae46c (168 bytes)
//
// 1 xrefs:
// > sub_1005074CC @ 0x100507664
//
// 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_1004AE3C4(__int64 a1, __int64 a2)
{
__int64 result; // x0
__int64 v5; // [xsp+0h] [xbp-20h] BYREF
__int64 v6; // [xsp+8h] [xbp-18h] BYREF
if ( *(_QWORD *)(a1 + 336) )
{
if ( (unsigned int)sub_10045B79C(a2, &v6, nullptr) )
{
if ( !(unsigned int)sub_100459938(a2, &v5, nullptr) && *(_DWORD *)(v5 + 544) == 1 )
{
result = v5 + 520;
*(_DWORD *)(v5 + 544) = 2;
return result;
}
}
else
{
result = *(_QWORD *)(a1 + 336) + ((__int64)*(int *)(v6 + 464) << 6);
if ( *(_DWORD *)(result + 24) == 1 )
{
*(_DWORD *)(result + 24) = 2;
return result;
}
}
}
return 0;
}