//
// sub_BFFD0C from 0xbffd0c to 0xbffe84 (376 bytes)
//
// 3 xrefs:
// > sub_C0021C @ 0xc002e0
// > sub_C0021C @ 0xc0035c
// > sub_C0021C @ 0xc0041c
//
// 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
//
long double __fastcall sub_BFFD0C(__int64 *a1)
{
__int64 v1; // x1
_DWORD *v3; // x2
int v4; // w1
__int64 v5; // x3
int v6; // w0
long double *v7; // x2
long double result; // q0
int v9; // w1
__int64 v10; // x0
__int64 v11; // x2
v1 = a1[35];
if ( !v1 )
{
v9 = *((_DWORD *)a1 + 23);
if ( v9 > 4 )
{
v11 = *a1;
*(_DWORD *)(v11 + 44) = v9;
*(_DWORD *)(v11 + 40) = 27;
*(_DWORD *)(*a1 + 48) = 4;
(*(void (__fastcall **)(__int64 *))*a1)(a1);
v9 = *((_DWORD *)a1 + 23);
}
*((_DWORD *)a1 + 93) = v9;
if ( v9 > 0 )
{
v10 = a1[13];
a1[47] = v10;
if ( v9 != 1 )
{
a1[48] = v10 + 96;
if ( v9 != 2 )
{
a1[49] = v10 + 192;
if ( v9 != 3 )
a1[50] = v10 + 288;
}
}
}
goto LABEL_8;
}
v3 = (_DWORD *)(v1 + 36LL * *(int *)(a1[62] + 44));
v4 = *v3;
*((_DWORD *)a1 + 93) = *v3;
if ( v4 > 0 )
{
v5 = a1[13];
a1[47] = v5 + 96LL * (int)v3[1];
if ( v4 != 1 )
{
a1[48] = v5 + 96LL * (int)v3[2];
if ( v4 != 2 )
{
a1[49] = v5 + 96LL * (int)v3[3];
if ( v4 != 3 )
a1[50] = v5 + 96LL * (int)v3[4];
}
}
}
if ( !*((_DWORD *)a1 + 87) )
{
LABEL_8:
v6 = *((_DWORD *)a1 + 119);
*((_DWORD *)a1 + 115) = 0;
*((_DWORD *)a1 + 117) = 0;
*((_DWORD *)a1 + 118) = 0;
*((_DWORD *)a1 + 116) = v6 * v6 - 1;
return result;
}
v7 = (long double *)(v3 + 5);
result = *v7;
*(long double *)((char *)a1 + 460) = *v7;
return result;
}