//
// sub_B4D84 from 0xb4d84 to 0xb4f54 (464 bytes)
//
// 1 xrefs:
// > sub_B4F74 @ 0xb4f90
//
// 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
//
__int64 __fastcall sub_B4D84(__int64 a1, char a2, int a3, float *a4, float a5, float a6)
{
float v7; // s11
float v13; // s0
float v14; // s13
float v15; // s12
float *v16; // x23
float *v17; // x24
__int64 i; // x26
unsigned __int64 v19; // x28
float v21; // s14
float v22; // s0
unsigned __int64 j; // x9
v7 = a5 + 0.691;
v13 = powf(10.0, (float)(a5 + 0.691) * 0.1);
if ( v7 <= -80.0 )
v14 = 0.0;
else
v14 = v13;
if ( a3 )
{
if ( a4 )
{
v15 = (float)(a6 - a5) / (float)a3;
if ( v15 > 0.0 )
{
memset(a4, 0, 4LL * a3);
v16 = *(float **)a1;
v17 = *(float **)a1;
if ( (a2 & 1) != 0 )
{
while ( v16 <= v17 && &v16[*(int *)(a1 + 8)] > v17 && *v17 < v14 )
{
++v17;
*a4 = *a4 + 1.0;
}
}
for ( i = 0; v16 <= v17; ++i )
{
v19 = (unsigned __int64)&v16[*(int *)(a1 + 8)];
if ( i >= a3 || v19 <= (unsigned __int64)v17 )
break;
v21 = v7 + (float)(v15 * (float)(i + 1));
v22 = powf(10.0, v21 * 0.1);
if ( v21 <= -80.0 )
v22 = 0.0;
while ( v19 > (unsigned __int64)v17 && *v17 < v22 )
{
++v17;
a4[i] = a4[i] + 1.0;
}
++v17;
}
if ( (a2 & 1) != 0 )
{
for ( j = (unsigned __int64)v17; v16 <= v17 && (unsigned __int64)&v16[*(int *)(a1 + 8)] > j; j += 4LL )
a4[a3 - 1] = a4[a3 - 1] + 1.0;
}
}
}
}
return ((__int64 (__fastcall *)())sub_B59E4)();
}