//
// sub_ECD020 from 0xecd020 to 0xecd104 (228 bytes)
//
// 1 xrefs:
// > sub_ECC314 @ 0xecc5dc
//
// 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 13:11:38 +0000
//
__int64 __fastcall sub_ECD020(__int64 result, _WORD *a2, __int64 a3)
{
__int64 v5; // x25
__int64 i; // x24
double v7; // d0
unsigned int v8; // w3
double v9; // [xsp+50h] [xbp+50h] BYREF
double v10; // [xsp+58h] [xbp+58h] BYREF
v5 = *(_QWORD *)(result + 16);
if ( a3 > 0 )
{
for ( i = 0; i != a3; ++i )
{
while ( 1 )
{
v8 = *(_DWORD *)(v5 + 4 * i);
*a2 = ((v8 >> 12) & 0xFFD) + 13314;
if ( (uv_decode(&v9, &v10, v8 & 0x3FFF) & 0x80000000) != 0 )
break;
a2 += 3;
++i;
v7 = v10 * 32768.0;
*(a2 - 2) = (int)(v9 * 32768.0);
result = (unsigned int)(__int16)(int)v7;
*(a2 - 1) = (int)v7;
if ( i == a3 )
return result;
}
a2 += 3;
*(a2 - 2) = 6898;
result = 15521;
*(a2 - 1) = 15521;
}
}
return result;
}