//
// sub_C974C from 0xc974c to 0xc986c (288 bytes)
//
// 2 xrefs:
// > sub_C825C @ 0xc84a8
// > sub_C94F0 @ 0xc9554
//
// 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:47 +0000
//
__int64 __fastcall sub_C974C(__int64 a1, int *a2, unsigned int *a3, __int64 a4)
{
int v6; // w9
int v7; // w8
unsigned int v8; // w21
__int64 v10; // x9
_BOOL4 v11; // w9
if ( a4 && (*(_BYTE *)(a4 + 124) & 1) != 0 )
v6 = *(__int16 *)(a1 + 432);
else
v6 = *(__int16 *)(a1 + 424) - *(__int16 *)(a1 + 432);
v7 = *(unsigned __int16 *)(a1 + 280);
if ( *(_WORD *)(a1 + 280) )
{
v8 = *(_DWORD *)(a1 + 196);
if ( !a2 )
goto LABEL_8;
goto LABEL_7;
}
if ( *(_QWORD *)(a1 + 312) )
{
v7 = *(_DWORD *)(a1 + 328);
v8 = *(_DWORD *)(a1 + 332);
if ( !a2 )
goto LABEL_8;
LABEL_7:
*a2 = v7;
goto LABEL_8;
}
if ( v6 > 1 )
{
v8 = *a3;
if ( !*a3 )
v8 = *(_DWORD *)(*(_QWORD *)(a1 + 168) + 70460LL);
if ( v8 == 1 )
{
v7 = *(_DWORD *)(*(_QWORD *)(a1 + 168) + 1748LL);
if ( a2 )
goto LABEL_7;
}
else
{
v7 = sub_65A10(v8);
if ( a2 )
goto LABEL_7;
}
goto LABEL_8;
}
if ( !a4 )
{
LABEL_30:
v7 = *(_DWORD *)(a1 + 448);
v11 = v7 == 0;
if ( !v7 )
v7 = 1;
v8 = 2 * v11;
if ( a2 )
goto LABEL_7;
goto LABEL_8;
}
if ( !*(_QWORD *)(a4 + 64) )
{
v10 = *(_QWORD *)(a4 + 88);
v7 = *(_DWORD *)(v10 + 328);
if ( v7 )
{
v8 = *(_DWORD *)(v10 + 332);
if ( a2 )
goto LABEL_7;
goto LABEL_8;
}
goto LABEL_30;
}
v7 = *(__int16 *)(a4 + 58);
if ( !*(_WORD *)(a4 + 58) )
goto LABEL_30;
v8 = 0;
if ( a2 )
goto LABEL_7;
LABEL_8:
if ( a3 )
*a3 = v8;
return 0;
}