//
// sub_585E8 from 0x585e8 to 0x58710 (296 bytes)
//
// 1 xrefs:
// > FMOD::System::setAdvancedSettings @ 0xb7a04
//
// 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 11:40:47 +0000
//
int __fastcall sub_585E8(_DWORD *a1, const void *a2)
{
unsigned int v2; // r12
signed int v3; // r2
int v4; // r3
float v6; // s0
float v7; // s2
unsigned int v8; // r6
unsigned int v9; // r3
unsigned int v10; // r5
bool v11; // cc
if ( !a2 )
return 31;
v3 = *(_DWORD *)a2;
v4 = 31;
if ( (unsigned int)(*(_DWORD *)a2 - 73) > 0x13 || (v3 & 3) != 0 )
return v4;
if ( *((_WORD *)a2 + 5)
|| *((_WORD *)a2 + 3)
|| *((_WORD *)a2 + 7)
|| *((_WORD *)a2 + 9)
|| *((_WORD *)a2 + 11)
|| *((_WORD *)a2 + 13)
|| v3 >= 85 && (*((int *)a2 + 21) < 0 || v3 >= 89 && (unsigned int)(*((_DWORD *)a2 + 22) + 1) > 0x10000) )
{
return 31;
}
v6 = *((float *)a2 + 11);
if ( (LODWORD(v6) & 0x7F800000) == 0x7F800000 )
return 29;
v7 = *((float *)a2 + 15);
if ( v7 >= 0.0001 )
{
v4 = 31;
if ( v7 < 10.0 || v7 > 22050.0 )
return v4;
}
else
{
*((_DWORD *)a2 + 15) = a1[17183];
}
if ( v6 != -1.0 )
{
v4 = 31;
if ( v6 < 0.0 || v6 > 1.0 )
return v4;
}
if ( *((_DWORD *)a2 + 8) > 0x20u )
return 31;
v8 = *((_DWORD *)a2 + 17);
if ( HIWORD(v8) )
return 31;
v9 = *((_DWORD *)a2 + 18);
if ( v9 > 4 )
return 31;
v10 = *((_DWORD *)a2 + 16);
v11 = v10 > 3;
if ( v10 <= 3 )
{
v2 = *((_DWORD *)a2 + 20);
v11 = v2 > 3;
}
if ( v11 )
return 31;
if ( (unsigned int)(*((_DWORD *)a2 + 12) - 1) >= 0x7530 )
*((_DWORD *)a2 + 12) = a1[17180];
if ( !v8 )
*((_DWORD *)a2 + 17) = a1[17185];
if ( !v9 )
*((_DWORD *)a2 + 18) = a1[17186];
if ( !v2 )
*((_DWORD *)a2 + 20) = a1[17188];
qmemcpy(a1 + 17168, a2, v3);
return 0;
}