//
// sub_1004E5AF8 from 0x1004e5af8 to 0x1004e5bc4 (204 bytes)
//
// 3 xrefs:
// > ??> @ 0x100828e08
// > ??> @ 0x100828e48
// > ??> @ 0x100828e88
//
// 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_1004E5AF8(__int64 result, __int64 a2)
{
__int64 v3; // x20
int v4; // w8
__int64 i; // x21
__int64 v6; // x1
__int64 v7; // x21
if ( a2 )
{
v3 = result;
v4 = *(_DWORD *)(a2 + 8);
if ( v4 >= 1 )
{
for ( i = 0; i < v4; ++i )
{
v6 = *(_QWORD *)(*(_QWORD *)(a2 + 32) + 8 * i);
if ( v6 )
{
sub_100478D80(v3, v6);
v4 = *(_DWORD *)(a2 + 8);
}
}
}
sub_100478D80(v3, *(_QWORD *)(a2 + 32));
if ( *(int *)(a2 + 40) >= 1 )
{
v7 = 0;
do
sub_100478D80(v3, *(_QWORD *)(*(_QWORD *)(a2 + 48) + 8 * v7++));
while ( v7 < *(int *)(a2 + 40) );
}
sub_100478D80(v3, *(_QWORD *)(a2 + 48));
*(_QWORD *)(a2 + 64) = 0;
*(_OWORD *)(a2 + 32) = 0u;
*(_OWORD *)(a2 + 48) = 0u;
*(_OWORD *)a2 = 0u;
*(_OWORD *)(a2 + 16) = 0u;
return sub_100478D80(v3, a2);
}
return result;
}