//
// sub_97D14 from 0x97d14 to 0x97e28 (276 bytes)
//
// 2 xrefs:
// > sub_96AB0 @ 0x96ee8
// > sub_970A8 @ 0x97324
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:14:25 +0000
//
__int64 __fastcall sub_97D14(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v4; // x8
int v7; // w9
__int64 v10; // x11
void *v11; // x0
__int64 v12; // x8
int v13; // w8
__int64 result; // x0
int *v15; // x8
int v16; // w9
v4 = *(_QWORD *)(a1 + 376);
v7 = *(_DWORD *)(v4 + 18628);
if ( !v7 )
{
result = sub_9788C(a1, a2, nullptr, nullptr, nullptr);
if ( (_DWORD)result )
return result;
v4 = *(_QWORD *)(a1 + 376);
v7 = *(_DWORD *)(v4 + 18628);
}
v10 = *(int *)(v4 + 18592);
v11 = (void *)(v4 + 2304 * v10 + 512);
*(_QWORD *)(v4 + 18608) = v11;
*(_DWORD *)(v4 + 18592) = (v10 & 1) == 0;
*(_DWORD *)(v4 + 18600) = 0;
memcpy(v11, (const void *)(a2 + 4), v7);
v12 = *(_QWORD *)(a1 + 376);
if ( *(_DWORD *)(v12 + 18540) )
{
sub_977D8(a1, 16);
v12 = *(_QWORD *)(a1 + 376);
}
v13 = *(_DWORD *)(v12 + 18536);
if ( v13 == 3 )
{
result = sub_9C81C(a1, a3, a4);
}
else if ( v13 == 2 )
{
result = sub_99214(a1, a3, a4);
}
else
{
result = 0;
}
v15 = (int *)(*(_QWORD *)(a1 + 376) + 18628LL);
v16 = *v15;
*v15 = 0;
v15[1] = v16;
return result;
}