//
// sub_1004EC778 from 0x1004ec778 to 0x1004ec818 (160 bytes)
//
// 1 xrefs:
// > sub_1004EC778 @ 0x1004ec7f8
//
// 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_1004EC778(__int64 a1, int a2)
{
int v3; // w22
__int64 v4; // x20
__int64 v6; // x21
if ( *(int *)(a1 + 128) < 2 )
return -131;
if ( !*(_DWORD *)(a1 + 8) )
return -131;
v3 = *(_DWORD *)(a1 + 64);
if ( v3 <= a2 )
return -131;
if ( (a2 & 0x80000000) == 0 )
return *(_QWORD *)(*(_QWORD *)(a1 + 72) + 8LL * (unsigned int)(a2 + 1))
- *(_QWORD *)(*(_QWORD *)(a1 + 72) + 8LL * (unsigned int)a2);
if ( v3 < 1 )
return 0;
v6 = 0;
v4 = 0;
do
{
v4 += sub_1004EC778(a1, v6);
v6 = (unsigned int)(v6 + 1);
}
while ( v3 != (_DWORD)v6 );
return v4;
}