//
// sub_8A9A4 from 0x8a9a4 to 0x8aad8 (308 bytes)
//
// 1 xrefs:
// > sub_8AB64 @ 0x8aca4
//
// 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_8A9A4(__int64 a1, __int64 a2, _QWORD *a3, __int64 *a4)
{
__int64 v8; // x0
__int64 v9; // x1
unsigned int *v10; // x22
unsigned int v11; // w8
__int64 v12; // x8
int v13; // w9
__int64 v14; // x0
__int64 v15; // x8
unsigned int *v16; // x9
char v17; // t1
unsigned __int64 v18; // x10
unsigned int *v19; // x11
unsigned __int64 v20; // x12
unsigned __int64 v21; // x13
unsigned int *i; // x9
v8 = sub_E2908(
*(__int64 *)((char *)&qword_1B0 + (_QWORD)off_114000),
*(unsigned int *)(a2 + 12),
"../../src/fmod_codec_fsb5.cpp",
362,
0,
0,
1);
if ( !v8 )
return 38;
v10 = (unsigned int *)v8;
v11 = sub_8B52C(a1, v9, 1, *(unsigned int *)(a2 + 12));
if ( v11 )
return v11;
sub_8B4E0();
v14 = sub_8B500(*(_QWORD *)(v12 + 432), (unsigned int)(4 * v13));
if ( !v14 )
return 38;
v15 = 0;
v16 = v10;
while ( v15 < *(int *)(a2 + 8) )
{
*(_DWORD *)(v14 + 4 * v15) = (_DWORD)v16 - (_DWORD)v10;
v17 = *(_BYTE *)v16;
v16 += 2;
if ( (v17 & 1) != 0 )
{
do
{
v19 = v16 + 1;
v18 = *v16;
v20 = (v18 >> 1) & 0xFFFFFF;
if ( (unsigned int)v18 >> 25 == 6 )
{
v21 = v20 >> 2;
for ( i = v16 + 1; v21; ++i )
{
--v21;
*i = bswap32(*i);
}
}
v16 = (unsigned int *)((char *)v19 + v20);
}
while ( (v18 & 1) != 0 );
}
++v15;
}
v11 = 0;
*a3 = v10;
*a4 = v14;
return v11;
}