//
// sub_C87B6C from 0xc87b6c to 0xc87ca4 (312 bytes)
//
// 6 xrefs:
// > sub_CA1AD0 @ 0xca1ae8
// > sub_CA1C68 @ 0xca1ca8
// > sub_CA1C68 @ 0xca1de8
// > sub_CA1C68 @ 0xca1ea8
// > sub_CA3D38 @ 0xca3d84
// > sub_CA3D38 @ 0xca3e9c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
double __fastcall sub_C87B6C(int *a1, int a2, __int64 a3, _QWORD *a4)
{
int v5; // w3
unsigned int v6; // w23
_DWORD *v8; // x20
int v9; // w19
__int64 v10; // x0
float v11; // s0
double result; // d0
int v13; // [xsp+58h] [xbp+58h] BYREF
int v14; // [xsp+5Ch] [xbp+5Ch] BYREF
v5 = *a1;
*a4 = 0;
a4[1] = 0;
a4[2] = 0;
v6 = a2;
v13 = 0;
v14 = v5;
*(_DWORD *)(a3 + 8) = 0;
*(_DWORD *)(a3 + 12) = 0;
*(_DWORD *)(a3 + 16) = 0;
*(_DWORD *)(a3 + 20) = -1;
*(_QWORD *)a3 = 0;
if ( a2 <= 1 )
{
v6 = 1;
}
else
{
v8 = a1 + 1;
v9 = 1;
while ( 1 )
{
++v9;
if ( *v8 != v5 )
((void (*)(void))off_1260558)();
++v8;
if ( v9 == v6 )
break;
v5 = v14;
}
}
off_1260558(0, v6, &v14, &v13, a3, a4);
v10 = *(unsigned int *)(a3 + 8);
if ( (unsigned int)v10 > 0xFF )
off_1260548(v10);
else
v11 = flt_F55180[(unsigned int)v10];
result = v11;
*(double *)a3 = *(double *)a3 + result;
return result;
}