//
// sub_C9DA58 from 0xc9da58 to 0xc9dc2c (468 bytes)
//
// 3 xrefs:
// > sub_C9DC2C @ 0xc9dc5c
// > sub_C9DE94 @ 0xc9e090
// > sub_C9E150 @ 0xc9e380
//
// 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_C9DA58(int *a1, int *a2, int *a3, int *a4, _DWORD *a5)
{
__int64 result; // x0
int v10; // w10
int v11; // w9
int v12; // w8
__int64 v13; // x3
__int64 v14; // x1
int v15; // w7
int v16; // w10
int v17; // w9
int v18; // w8
__int64 v19; // x3
__int64 v20; // x1
int v21; // w7
int v22; // w9
int v23; // w8
int v24; // w7
__int64 v25; // x3
__int64 v26; // x1
int v27; // w6
result = sub_C9D858(a1, a2, a3, a5);
v10 = *a4;
v11 = *a3;
v12 = a5[3];
v13 = *(_QWORD *)(*(_QWORD *)a5 + 320LL);
v14 = v13 + 80LL * *a3;
v15 = a5[2];
if ( (*(_DWORD *)(v13 + 80LL * v10 + 12) - v12) * (*(_DWORD *)(v13 + 80LL * v10 + 12) - v12)
+ (*(_DWORD *)(v13 + 80LL * v10 + 8) - v15) * (*(_DWORD *)(v13 + 80LL * v10 + 8) - v15) < (*(_DWORD *)(v14 + 12)
- v12)
* (*(_DWORD *)(v14 + 12)
- v12)
+ (*(_DWORD *)(v14 + 8)
- v15)
* (*(_DWORD *)(v14 + 8)
- v15) )
{
*a3 = v10;
*a4 = v11;
v16 = *a3;
v17 = *a2;
v18 = a5[3];
v19 = *(_QWORD *)(*(_QWORD *)a5 + 320LL);
v20 = v19 + 80LL * *a2;
v21 = a5[2];
if ( (*(_DWORD *)(v19 + 80LL * v16 + 12) - v18) * (*(_DWORD *)(v19 + 80LL * v16 + 12) - v18)
+ (*(_DWORD *)(v19 + 80LL * v16 + 8) - v21) * (*(_DWORD *)(v19 + 80LL * v16 + 8) - v21) >= (*(_DWORD *)(v20 + 12)
- v18)
* (*(_DWORD *)(v20 + 12)
- v18)
+ (*(_DWORD *)(v20 + 8)
- v21)
* (*(_DWORD *)(v20 + 8)
- v21) )
{
return (unsigned int)(result + 1);
}
else
{
*a2 = v16;
*a3 = v17;
v22 = *a2;
v23 = *a1;
v24 = a5[3];
v25 = *(_QWORD *)(*(_QWORD *)a5 + 320LL);
v26 = v25 + 80LL * *a1;
v27 = a5[2];
if ( (*(_DWORD *)(v25 + 80LL * v22 + 12) - v24) * (*(_DWORD *)(v25 + 80LL * v22 + 12) - v24)
+ (*(_DWORD *)(v25 + 80LL * v22 + 8) - v27) * (*(_DWORD *)(v25 + 80LL * v22 + 8) - v27) >= (*(_DWORD *)(v26 + 12) - v24) * (*(_DWORD *)(v26 + 12) - v24) + (*(_DWORD *)(v26 + 8) - v27) * (*(_DWORD *)(v26 + 8) - v27) )
{
return (unsigned int)(result + 2);
}
else
{
*a1 = v22;
result = (unsigned int)(result + 3);
*a2 = v23;
}
}
}
return result;
}