//
// sub_B4BA8 from 0xb4ba8 to 0xb4d84 (476 bytes)
//
// 1 xrefs:
// > sub_B4F54 @ 0xb4f70
//
// 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
//
float __fastcall sub_B4BA8(__int64 *a1, float *a2, float *a3, float a4, float a5, float a6, float a7)
{
__int64 v7; // x22
float v15; // s0
__int64 v16; // x8
float v17; // s0
float v19; // s0
float v20; // s9
__int64 v22; // x9
float v23; // s0
float v24; // s3
int v25; // w12
float v26; // s1
float v27; // s0
int v28; // w10
float v29; // s4
float v30; // s2
float v31; // s10
float v32; // s3
float v33; // s4
float v34; // s11
float v35; // s12
float v36; // s0
float v37; // s0
v7 = *((int *)a1 + 2);
if ( !(_DWORD)v7 )
goto LABEL_13;
v15 = powf(10.0, a5 * -0.1);
if ( a5 >= 80.0 )
v15 = 0.0;
v16 = 0;
v17 = (float)(v15 * a4) / (float)(int)v7;
while ( v16 < v7 && *(float *)(*a1 + 4 * v16) < v17 )
++v16;
if ( a6 > a7 || (_DWORD)v7 == (_DWORD)v16 )
{
LABEL_13:
v19 = -80.0;
v20 = -80.0;
goto LABEL_14;
}
v22 = *a1;
v23 = (float)(~(_DWORD)v16 + v7) * 0.01;
v24 = v23 * a6;
v25 = (int)(float)(v23 * a6);
v27 = v23 * a7;
v28 = (int)v27;
v29 = floorf(v24);
v30 = *(float *)(*a1 + 4LL * (v25 + (int)v16));
if ( v25 + 1 < (int)v7 - (int)v16 )
v30 = *(float *)(v22 + 4LL * (v25 + (int)v16 + 1));
v31 = *(float *)(v22 + 4LL * (v28 + (int)v16));
v32 = v24 - v29;
v33 = floorf(v27);
v34 = v31;
if ( v28 + 1 < (int)v7 - (int)v16 )
v34 = *(float *)(v22 + 4LL * (v28 + (int)v16 + 1));
v35 = v27 - v33;
v26 = *(float *)(*a1 + 4LL * (v25 + (int)v16));
v36 = (float)(v26 - (float)(v32 * v26)) + (float)(v30 * v32);
if ( v36 <= 0.0 )
v20 = -80.691;
else
v20 = (float)(log10f(v36) * 10.0) + -0.691;
v37 = (float)(v31 - (float)(v35 * v31)) + (float)(v34 * v35);
if ( v37 > 0.0 )
{
v19 = (float)(log10f(v37) * 10.0) + -0.691;
if ( v19 <= v20 )
{
v19 = v20;
if ( !a2 )
goto LABEL_16;
LABEL_15:
*a2 = v20;
goto LABEL_16;
}
LABEL_14:
if ( !a2 )
goto LABEL_16;
goto LABEL_15;
}
v19 = fmaxf(v20, -80.691);
if ( a2 )
goto LABEL_15;
LABEL_16:
if ( a3 )
*a3 = v19;
return v19 - v20;
}