//
// sub_8313F8 from 0x8313f8 to 0x831476 (126 bytes)
//
// 1 xrefs:
// > sub_8400E4 @ 0x8406ae
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:02:05 +0000
//
int __fastcall sub_8313F8(int a1, _BYTE *a2)
{
int result; // r0
int (__fastcall *v5)(int, _BYTE *); // r3
*a2 = 0;
if ( *(_BYTE *)(a1 + 625) )
{
if ( *(_BYTE *)(a1 + 627) )
{
result = *(_DWORD *)(*(_DWORD *)(a1 + 664) + 24);
if ( !result )
{
*a2 = 1;
return result;
}
return 0;
}
}
else if ( *(_BYTE *)(a1 + 627) )
{
return 0;
}
result = sub_84C410(a1, 0);
if ( result )
return result;
if ( *(_DWORD *)(a1 + 248) == 2 && !*(_BYTE *)(a1 + 645)
|| *(_BYTE *)(a1 + 629) && *(_BYTE *)(a1 + 618) && *(_DWORD *)(a1 + 1252) != 2 )
{
return 0;
}
v5 = *(int (__fastcall **)(int, _BYTE *))(*(_DWORD *)(a1 + 664) + 20);
if ( v5 )
{
result = v5(a1, a2);
if ( result )
return result;
}
else
{
*a2 = 1;
}
result = 0;
*(_BYTE *)(a1 + 627) = 1;
return result;
}