//
// sub_C9DC2C from 0xc9dc2c to 0xc9de94 (616 bytes)
//
// 3 xrefs:
// > sub_C9DE94 @ 0xc9e064
// > sub_C9E150 @ 0xc9e1c0
// > sub_C9E150 @ 0xc9e428
//
// 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_C9DC2C(int *a1, int *a2, int *a3, int *a4, int *a5, _DWORD *a6)
{
__int64 result; // x0
int v12; // w10
int v13; // w9
int v14; // w8
__int64 v15; // x3
__int64 v16; // x1
int v17; // w7
int v18; // w10
int v19; // w9
int v20; // w8
__int64 v21; // x3
__int64 v22; // x1
int v23; // w7
int v24; // w10
int v25; // w9
int v26; // w8
__int64 v27; // x3
__int64 v28; // x1
int v29; // w7
int v30; // w9
int v31; // w8
int v32; // w7
__int64 v33; // x3
__int64 v34; // x1
int v35; // w6
result = sub_C9DA58(a1, a2, a3, a4, a6);
v12 = *a5;
v13 = *a4;
v14 = a6[3];
v15 = *(_QWORD *)(*(_QWORD *)a6 + 320LL);
v16 = v15 + 80LL * *a4;
v17 = a6[2];
if ( (*(_DWORD *)(v15 + 80LL * v12 + 12) - v14) * (*(_DWORD *)(v15 + 80LL * v12 + 12) - v14)
+ (*(_DWORD *)(v15 + 80LL * v12 + 8) - v17) * (*(_DWORD *)(v15 + 80LL * v12 + 8) - v17) < (*(_DWORD *)(v16 + 12)
- v14)
* (*(_DWORD *)(v16 + 12)
- v14)
+ (*(_DWORD *)(v16 + 8)
- v17)
* (*(_DWORD *)(v16 + 8)
- v17) )
{
*a4 = v12;
*a5 = v13;
v18 = *a4;
v19 = *a3;
v20 = a6[3];
v21 = *(_QWORD *)(*(_QWORD *)a6 + 320LL);
v22 = v21 + 80LL * *a3;
v23 = a6[2];
if ( (*(_DWORD *)(v21 + 80LL * v18 + 12) - v20) * (*(_DWORD *)(v21 + 80LL * v18 + 12) - v20)
+ (*(_DWORD *)(v21 + 80LL * v18 + 8) - v23) * (*(_DWORD *)(v21 + 80LL * v18 + 8) - v23) >= (*(_DWORD *)(v22 + 12)
- v20)
* (*(_DWORD *)(v22 + 12)
- v20)
+ (*(_DWORD *)(v22 + 8)
- v23)
* (*(_DWORD *)(v22 + 8)
- v23) )
{
return (unsigned int)(result + 1);
}
else
{
*a3 = v18;
*a4 = v19;
v24 = *a3;
v25 = *a2;
v26 = a6[3];
v27 = *(_QWORD *)(*(_QWORD *)a6 + 320LL);
v28 = v27 + 80LL * *a2;
v29 = a6[2];
if ( (*(_DWORD *)(v27 + 80LL * v24 + 12) - v26) * (*(_DWORD *)(v27 + 80LL * v24 + 12) - v26)
+ (*(_DWORD *)(v27 + 80LL * v24 + 8) - v29) * (*(_DWORD *)(v27 + 80LL * v24 + 8) - v29) >= (*(_DWORD *)(v28 + 12) - v26) * (*(_DWORD *)(v28 + 12) - v26) + (*(_DWORD *)(v28 + 8) - v29) * (*(_DWORD *)(v28 + 8) - v29) )
{
return (unsigned int)(result + 2);
}
else
{
*a2 = v24;
*a3 = v25;
v30 = *a2;
v31 = *a1;
v32 = a6[3];
v33 = *(_QWORD *)(*(_QWORD *)a6 + 320LL);
v34 = v33 + 80LL * *a1;
v35 = a6[2];
if ( (*(_DWORD *)(v33 + 80LL * v30 + 12) - v32) * (*(_DWORD *)(v33 + 80LL * v30 + 12) - v32)
+ (*(_DWORD *)(v33 + 80LL * v30 + 8) - v35) * (*(_DWORD *)(v33 + 80LL * v30 + 8) - v35) >= (*(_DWORD *)(v34 + 12) - v32) * (*(_DWORD *)(v34 + 12) - v32) + (*(_DWORD *)(v34 + 8) - v35) * (*(_DWORD *)(v34 + 8) - v35) )
{
return (unsigned int)(result + 3);
}
else
{
*a1 = v30;
result = (unsigned int)(result + 4);
*a2 = v31;
}
}
}
}
return result;
}