//
// sub_100431F34 from 0x100431f34 to 0x1004320bc (392 bytes)
//
// 2 xrefs:
// > sub_10043279C @ 0x100432a90
// > sub_10043279C @ 0x100432c9c
//
// 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_100431F34(__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_100433604(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;
}