//
// sub_10055809C from 0x10055809c to 0x100558224 (392 bytes)
//
// 2 xrefs:
// > sub_100558904 @ 0x100558bf8
// > sub_100558904 @ 0x100558e04
//
// This function is hookable on this platform (idp: arm, 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 11:07:58 +0000
//
__int64 __fastcall sub_10055809C(__int64 *a1, float *a2, float a3, float a4)
{
float v7; // s1
float v8; // s0
int v9; // w8
int v10; // w9
signed int v11; // w10
__int64 v12; // x11
unsigned int v13; // w20
float v14; // s0
int v15; // w9
int v16; // w9
int v17; // w8
__int64 v18; // x1
int v19; // w8
v7 = a4 + 0.691;
v8 = 0.0;
if ( v7 > -80.0 )
v8 = __exp10f(v7 / 10.0);
if ( v8 > a3 )
return 0;
*a2 = *a2 + a3;
v9 = *((_DWORD *)a1 + 2);
v10 = v9 - 1;
if ( v9 < 1 )
{
v13 = 0;
if ( v9 < 0 )
return 0;
}
else
{
v11 = 0;
v12 = *a1;
while ( *(float *)(v12 + 4LL * v10) >= a3 )
{
v13 = (v10 + v11) / 2;
v14 = *(float *)(v12 + 4LL * (int)v13);
if ( v14 != a3 )
{
if ( v14 <= a3 )
v11 = v13 + 1;
else
v10 = v13 - 1;
v13 = v11;
if ( v11 <= v10 )
continue;
}
goto LABEL_13;
}
v13 = v10 + 1;
LABEL_13:
if ( (v13 & 0x80000000) != 0 || v9 < (int)v13 )
return 0;
}
v15 = *((_DWORD *)a1 + 3);
if ( v15 < 0 )
v15 = -v15;
if ( v15 <= v9 )
{
v16 = (int)(float)((float)v15 * 1.5);
if ( v16 <= v9 + 1 )
v17 = v9 + 1;
else
v17 = v16;
if ( v17 <= 16 )
v18 = 16;
else
v18 = (unsigned int)v17;
if ( (unsigned int)sub_10055976C(a1, v18) )
return 0;
v9 = *((_DWORD *)a1 + 2);
}
v19 = v9 - v13;
if ( v19 > 0 )
memmove((void *)(*a1 + 4LL * v13 + 4), (const void *)(*a1 + 4LL * v13), 4LL * (unsigned int)v19);
*(float *)(*a1 + 4LL * v13) = a3;
++*((_DWORD *)a1 + 2);
return 0;
}