//
// sub_1008C6180 from 0x1008c6180 to 0x1008c6340 (448 bytes)
//
// 2 xrefs:
// > sub_1008C50A0 @ 0x1008c5758
// > sub_1008C6340 @ 0x1008c641f
//
// This function is hookable on this platform (idp: pc, 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:37:32 +0000
//
int *__fastcall sub_1008C6180(int *a1, int *a2, int *a3, int *a4, int *a5, _DWORD *a6)
{
__int64 v11; // rcx
__int64 v12; // rdx
int *result; // rax
int v14; // edi
int v15; // r8d
int v16; // r9d
int v17; // esi
int v18; // r11d
int v19; // r10d
__int64 v20; // rcx
__int64 v21; // rdx
int v22; // r8d
int v23; // r9d
int v24; // edi
int v25; // esi
int v26; // r11d
int v27; // r10d
__int64 v28; // rcx
__int64 v29; // rdx
int v30; // r8d
int v31; // r9d
int v32; // edi
int v33; // esi
int v34; // r11d
int v35; // r10d
__int64 v36; // rcx
__int64 v37; // rdx
int v38; // r8d
int v39; // r9d
int v40; // edi
int v41; // esi
int v42; // r11d
int v43; // eax
sub_1008C6020(a1, a2, a3, a4, a6);
v11 = *a5;
v12 = *a4;
result = *(int **)(*(_QWORD *)a6 + 320LL);
v14 = a6[2];
v15 = result[20 * v11 + 2] - v14;
v16 = a6[3];
v17 = result[20 * v11 + 3] - v16;
v18 = result[20 * v12 + 2] - v14;
v19 = result[20 * v12 + 3] - v16;
if ( v15 * v15 + v17 * v17 < (unsigned int)(v18 * v18 + v19 * v19) )
{
*a4 = v11;
*a5 = v12;
v20 = *a4;
v21 = *a3;
v22 = a6[2];
v23 = a6[3];
v24 = result[20 * v20 + 2] - v22;
v25 = result[20 * v20 + 3] - v23;
v26 = result[20 * v21 + 2] - v22;
v27 = result[20 * v21 + 3] - v23;
if ( v24 * v24 + v25 * v25 < (unsigned int)(v26 * v26 + v27 * v27) )
{
*a3 = v20;
*a4 = v21;
v28 = *a3;
v29 = *a2;
v30 = a6[2];
v31 = a6[3];
v32 = result[20 * v28 + 2] - v30;
v33 = result[20 * v28 + 3] - v31;
v34 = result[20 * v29 + 2] - v30;
v35 = result[20 * v29 + 3] - v31;
if ( v32 * v32 + v33 * v33 < (unsigned int)(v34 * v34 + v35 * v35) )
{
*a2 = v28;
*a3 = v29;
v36 = *a2;
v37 = *a1;
v38 = a6[2];
v39 = a6[3];
v40 = result[20 * v36 + 2] - v38;
v41 = result[20 * v36 + 3] - v39;
v42 = result[20 * v37 + 2];
v43 = result[20 * v37 + 3] - v39;
result = (int *)(unsigned int)((v42 - v38) * (v42 - v38) + v43 * v43);
if ( v40 * v40 + v41 * v41 < (unsigned int)result )
{
*a1 = v36;
*a2 = v37;
return a1;
}
}
}
}
return result;
}