//
// sub_1005CD970 from 0x1005cd970 to 0x1005cda80 (272 bytes)
//
// 4 xrefs:
// > sub_10058EFB0 @ 0x10058f0fc
// > FMOD::DSP::reset @ 0x1005ac048
// > sub_1005BF808 @ 0x1005bfbf4
// > sub_10062F108 @ 0x10062f1e8
//
// 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 11:09:29 +0000
//
__int64 __fastcall sub_1005CD970(__int64 a1)
{
__int16 v2; // w8
__int64 result; // x0
int *v4; // x1
__int64 v5; // x20
__int64 v6; // x0
int v7; // w22
__int64 v8; // x21
__int64 v9; // x8
__int64 (__fastcall *v10)(__int64); // x1
int *v11; // [xsp+8h] [xbp-28h] BYREF
v2 = atomic_load((unsigned int *)(a1 + 100));
if ( (v2 & 0x100) != 0 )
{
v5 = *(_QWORD *)(a1 + 168);
if ( v5 )
sub_100568CC4(*(_QWORD *)(a1 + 168), 7u);
v6 = *(_QWORD *)(a1 + 528);
if ( v6 )
{
v7 = *(unsigned __int8 *)(v6 + 1062);
if ( *(_BYTE *)(v6 + 1062) )
v8 = v6 + 532;
else
v8 = 0;
if ( *(_BYTE *)(v6 + 530) )
{
*(_DWORD *)(v6 + 524) = 0;
*(_WORD *)(v6 + 528) = 0;
bzero((void *)v6, 0x208u);
}
if ( v7 )
{
*(_DWORD *)(v8 + 524) = 0;
*(_WORD *)(v8 + 528) = 0;
bzero((void *)v8, 0x208u);
}
}
if ( v5 )
sub_100568CE4(v5, 7u);
v9 = *(_QWORD *)(a1 + 232);
if ( v9 && (v10 = *(__int64 (__fastcall **)(__int64))(v9 + 64)) != nullptr )
{
*(_QWORD *)(a1 + 176) = a1;
return v10(a1 + 176);
}
else
{
return 0;
}
}
else
{
result = sub_100564878(*(_QWORD *)(a1 + 168), &v11, 16, 1);
if ( !(_DWORD)result )
{
*(_BYTE *)v11 = 17;
v4 = v11;
*((_QWORD *)v11 + 1) = a1;
return sub_10056491C(*(_QWORD *)(a1 + 168), (__int64)v4, 1);
}
}
return result;
}