//
// sub_C9C798 from 0xc9c798 to 0xc9c8dc (324 bytes)
//
// 3 xrefs:
// > sub_C9C8DC @ 0xc9c90c
// > sub_C9CA84 @ 0xc9cc20
// > sub_C9CCB0 @ 0xc9ce60
//
// 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 13:05:57 +0000
//
__int64 __fastcall sub_C9C798(int *a1, int *a2, int *a3, int *a4, __int64 a5)
{
__int64 result; // x0
int v10; // w5
int v11; // w5
int v12; // w5
result = sub_C9C64C(a1, a2, a3, a5);
v10 = *a3;
if ( *(_DWORD *)(*(_QWORD *)(*(_QWORD *)a5 + 320LL) + 80LL * *a4 + 16) > *(_DWORD *)(*(_QWORD *)(*(_QWORD *)a5 + 320LL)
+ 80LL * *a3
+ 16) )
{
*a3 = *a4;
*a4 = v10;
v11 = *a2;
if ( *(_DWORD *)(*(_QWORD *)(*(_QWORD *)a5 + 320LL) + 80LL * *a3 + 16) <= *(_DWORD *)(*(_QWORD *)(*(_QWORD *)a5 + 320LL)
+ 80LL * *a2
+ 16) )
{
return (unsigned int)(result + 1);
}
else
{
*a2 = *a3;
*a3 = v11;
v12 = *a1;
if ( *(_DWORD *)(*(_QWORD *)(*(_QWORD *)a5 + 320LL) + 80LL * *a2 + 16) <= *(_DWORD *)(*(_QWORD *)(*(_QWORD *)a5 + 320LL)
+ 80LL * *a1
+ 16) )
{
return (unsigned int)(result + 2);
}
else
{
*a1 = *a2;
result = (unsigned int)(result + 3);
*a2 = v12;
}
}
}
return result;
}