//
// FMOD::Sound::lock from 0x1004be594 to 0x1004be6f8 (356 bytes)
//
// 1 xrefs:
// > sub_100452FA4 @ 0x100452fa8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
FMOD_RESULT __fastcall FMOD::Sound::lock(
FMOD::Sound *a1,
unsigned int a2,
unsigned int a3,
void **a4,
void **a5,
unsigned int *a6,
unsigned int *a7)
{
__int64 v11; // x25
__int64 v12; // x26
__int64 v14; // x24
unsigned int v15; // w8
unsigned int v16; // w8
__int64 v18; // [xsp+8h] [xbp-168h] BYREF
unsigned int *v19; // [xsp+10h] [xbp-160h] BYREF
_BYTE v20[256]; // [xsp+18h] [xbp-158h] BYREF
v11 = *(_QWORD *)&a3;
v12 = *(_QWORD *)&a2;
v18 = 0;
v14 = sub_1004C3CE0(a1, &v19, &v18);
if ( !(_DWORD)v14 )
{
v15 = atomic_load(v19 + 68);
if ( v15 && (v16 = atomic_load(v19 + 68), v16 != 7) )
{
v14 = 46;
}
else
{
v14 = (*(__int64 (__fastcall **)(unsigned int *, __int64, __int64, void **, void **, unsigned int *, unsigned int *))(*(_QWORD *)v19 + 40LL))(
v19,
v12,
v11,
a4,
a5,
a6,
a7);
if ( !(_DWORD)v14 )
goto LABEL_9;
}
}
if ( (*((_BYTE *)off_1008524C8 + 32) & 0x80) != 0 )
{
sub_1004BE6F8(v20, 256, v12, v11, a4, a5, a6, a7);
sub_10048489C(v14, 5, (__int64)a1, (__int64)"Sound::lock", (__int64)v20);
}
LABEL_9:
if ( v18 )
sub_100442B7C(v18, 0xDu);
return (unsigned int)v14;
}