//
// sub_1800ED6C0 from 0x1800ed6c0 to 0x1800ed82f (367 bytes)
//
// 3 xrefs:
// > sub_1800ED830 @ 0x1800edaea
// > sub_1800ED830 @ 0x1800edc47
// > ??> @ 0x180200338
//
// 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 10:54:20 +0000
//
__int64 __fastcall sub_1800ED6C0(float a1, __int64 *a2, float *a3, float a4)
{
float v7; // xmm0_4
int v8; // r9d
int v9; // r11d
int v10; // r8d
__int64 v11; // r10
__int64 v12; // rbx
float v13; // xmm0_4
int v14; // ecx
int v15; // eax
int v16; // ecx
signed int v17; // eax
__m128i v18; // xmm0
int v19; // eax
__int64 v20; // rdx
if ( a4 > -80.691002 )
v7 = powf(10.0, (float)(a4 * 0.1) + 0.0691);
else
v7 = 0.0;
if ( a1 >= v7 )
{
v8 = 0;
*a3 = a1 + *a3;
v9 = *((_DWORD *)a2 + 2);
v10 = v9 - 1;
if ( v9 - 1 < 0 )
{
LABEL_16:
LODWORD(v12) = v8;
}
else
{
v11 = *a2;
while ( a1 <= *(float *)(v11 + 4LL * v10) )
{
v12 = (v10 + v8) / 2;
v13 = *(float *)(v11 + 4 * v12);
if ( v13 >= a1 )
{
v14 = v13 > a1;
if ( v13 <= a1 )
goto LABEL_17;
}
else
{
v14 = -1;
}
v15 = v12 - 1;
if ( v14 <= 0 )
v15 = v10;
v10 = v15;
if ( v14 <= 0 )
v8 = v12 + 1;
if ( v8 > v15 )
goto LABEL_16;
}
LODWORD(v12) = v10 + 1;
}
LABEL_17:
if ( (int)v12 >= 0 && (int)v12 <= v9 )
{
v16 = v9 + 1;
v17 = abs32(*((_DWORD *)a2 + 3));
if ( v9 + 1 <= v17 )
goto LABEL_28;
v18 = _mm_cvtsi32_si128(v17);
v19 = v9 + 1;
v20 = (unsigned int)(int)(float)(_mm_cvtepi32_ps(v18).m128_f32[0] * 1.5);
if ( v16 <= (int)v20 )
v19 = v20;
if ( v19 >= 16 )
{
if ( v16 > (int)v20 )
v20 = (unsigned int)v16;
}
else
{
v20 = 16;
}
if ( !(unsigned int)sub_1800EE430(a2, v20) )
{
LABEL_28:
if ( *((_DWORD *)a2 + 2) - (int)v12 > 0 )
memmove(
(void *)(*a2 + 4LL * (int)v12 + 4),
(const void *)(*a2 + 4LL * (int)v12),
4LL * (*((_DWORD *)a2 + 2) - (int)v12));
*(float *)(*a2 + 4LL * (int)v12) = a1;
++*((_DWORD *)a2 + 2);
}
}
}
return 0;
}