//
// sub_8EAEE8 from 0x8eaee8 to 0x8eb16c (644 bytes)
//
// 3 xrefs:
// > sub_8EBBD0 @ 0x8ebce8
// > sub_8EBBD0 @ 0x8ebcec
// > ??> @ 0x8ebe44
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:04:11 +0000
//
int __fastcall sub_8EAEE8(int result, __int16 *a2, int a3)
{
int v4; // r4
int v5; // r3
double v6; // d6
int v7; // r4
int v8; // r3
double v9; // d6
int v12; // [sp+Ch] [bp-20h]
int *v13; // [sp+10h] [bp-1Ch]
v12 = result;
v13 = *(int **)(result + 12);
if ( *(_DWORD *)(result + 4) )
{
while ( a3-- > 0 )
{
v4 = *a2 << 16;
if ( *(_DWORD *)(v12 + 4) )
{
v6 = (double)a2[1];
result = sub_8E6CC0();
v5 = (unsigned __int16)((unsigned __int16)(int)(v6 * 0.012512207 + (double)result * 4.65661288e-10 - 0.5) << 8);
}
else
{
v5 = (unsigned __int16)((unsigned __int16)(int)((double)a2[1] * 0.012512207) << 8);
}
v7 = v4 | v5;
if ( *(_DWORD *)(v12 + 4) )
{
v9 = (double)a2[2];
result = sub_8E6CC0();
v8 = (unsigned __int8)(int)(v9 * 0.012512207 + (double)result * 4.65661288e-10 - 0.5);
}
else
{
v8 = (unsigned __int8)(int)((double)a2[2] * 0.012512207);
}
*v13++ = v7 | v8;
a2 += 3;
}
}
else
{
while ( a3-- > 0 )
{
*v13++ = (*a2 << 16)
| ((unsigned int)(410 * a2[1]) >> 7) & 0xFF00
| (unsigned __int8)((unsigned int)(410 * a2[2]) >> 15);
a2 += 3;
}
}
return result;
}