//
// sub_10057A84C from 0x10057a84c to 0x10057ac48 (1020 bytes)
//
// 1 xrefs:
// > sub_10057A848 @ 0x10057a848
//
// 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:08:26 +0000
//
__int64 __fastcall sub_10057A84C(__int64 a1)
{
_QWORD *v2; // x8
_QWORD *v3; // x10
__int64 v4; // x19
unsigned int v5; // w9
int v6; // w2
__int64 v7; // x8
__int64 v8; // x1
__int64 v9; // x3
__int64 v10; // x4
int v11; // w9
__int64 v12; // x8
__int64 v13; // x5
__int64 v14; // x20
unsigned int v15; // w8
__int16 v16; // w8
__int16 v17; // w8
char v18; // w8
__int64 v19; // x21
__int64 v20; // x0
unsigned int v21; // w8
unsigned int v22; // w8
__int64 v23; // x1
__int64 v24; // x3
__int64 v25; // x4
int v26; // w9
__int64 v27; // x8
__int64 v28; // x5
__int64 v29; // x1
__int64 v30; // x9
__int64 v31; // x0
__int64 v32; // x8
unsigned int v33; // w9
__int64 v34; // x8
unsigned int v35; // w9
__int64 v36; // x8
__int64 v37; // x9
__int64 result; // x0
__int64 v39; // x8
__int64 v40; // [xsp+8h] [xbp-28h] BYREF
sub_1005DBDD8(*(_QWORD *)(a1 + 360));
v2 = *(_QWORD **)(a1 + 336);
if ( v2 == (_QWORD *)(a1 + 336) )
{
sub_1005DBE08(*(_QWORD *)(a1 + 360));
return 0;
}
v3 = (_QWORD *)v2[1];
v40 = v2[2];
*v3 = *v2;
*(_QWORD *)(*v2 + 8LL) = v3;
*v2 = v2;
v2[1] = v2;
sub_1005DBE08(*(_QWORD *)(a1 + 360));
if ( !v40 )
return 0;
v4 = *(_QWORD *)(v40 + 216);
v5 = atomic_load((unsigned int *)(v40 + 272));
if ( v5 != 1 )
{
v15 = atomic_load((unsigned int *)(v40 + 272));
if ( v15 == 7 )
{
v16 = atomic_load((unsigned int *)(v40 + 88));
if ( (v16 & 0x440) == 0 )
{
do
{
sub_1005DB9D4(10);
v17 = atomic_load((unsigned int *)(v40 + 88));
}
while ( (v17 & 0x440) == 0 );
}
v18 = atomic_load((unsigned int *)(v40 + 88));
if ( (v18 & 0x40) == 0 )
{
LODWORD(v14) = (*(__int64 (__fastcall **)(_QWORD, _QWORD, _QWORD, __int64))(**(_QWORD **)(v40 + 376) + 216LL))(
*(_QWORD *)(v40 + 376),
*(unsigned int *)(*(_QWORD *)(v40 + 264) + 284LL),
*(unsigned int *)(*(_QWORD *)(v40 + 264) + 288LL),
1);
v19 = *(_QWORD *)(v40 + 216);
if ( v19 )
sub_100568CC4(v19, 8u);
v20 = *(_QWORD *)(v40 + 376);
v21 = *(_DWORD *)(v20 + 60);
*(_DWORD *)(v20 + 60) = v21 & 0xFFFFBFFF;
if ( (_DWORD)v14 || !*(_QWORD *)(v20 + 192) )
{
if ( (_DWORD)v14 == 30 )
LODWORD(v14) = 0;
if ( !v19 )
goto LABEL_40;
}
else
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v20 + 88LL))(v20, (v21 >> 5) & 1);
LODWORD(v14) = 0;
if ( !v19 )
goto LABEL_40;
}
sub_100568CE4(v19, 8u);
goto LABEL_40;
}
v14 = *(_QWORD *)(v40 + 216);
if ( !v14 )
{
*(_DWORD *)(*(_QWORD *)(v40 + 376) + 60LL) &= ~0x4000u;
goto LABEL_40;
}
sub_100568CC4(*(_QWORD *)(v40 + 216), 8u);
*(_DWORD *)(*(_QWORD *)(v40 + 376) + 60LL) &= ~0x4000u;
sub_100568CE4(v14, 8u);
}
else
{
v22 = atomic_load((unsigned int *)(v40 + 272));
if ( v22 == 5 )
{
LODWORD(v14) = sub_1005EB514(v40, *(unsigned int *)(v40 + 192));
if ( !(_DWORD)v14 )
{
LODWORD(v14) = sub_1005E843C(v40);
if ( !(_DWORD)v14 )
LODWORD(v14) = sub_1005E83A8(v40);
}
goto LABEL_40;
}
}
LABEL_35:
LODWORD(v14) = 0;
goto LABEL_40;
}
v6 = *(_DWORD *)(v40 + 44);
v7 = *(_QWORD *)(v40 + 264);
if ( (v6 & 0x10000800) != 0 )
{
v8 = *(_QWORD *)(v7 + 48);
v9 = *(unsigned int *)(v7 + 8);
v10 = *(unsigned int *)(v7 + 12);
v11 = *(unsigned __int8 *)(v7 + 280);
v12 = v7 + 56;
if ( v11 )
v13 = v12;
else
v13 = 0;
LODWORD(v14) = sub_100565B84(*(_QWORD *)(v40 + 216), v8, v6, v9, v10, v13, 1, &v40);
}
else
{
v23 = *(_QWORD *)v7;
v24 = *(unsigned int *)(v7 + 8);
v25 = *(unsigned int *)(v7 + 12);
v26 = *(unsigned __int8 *)(v7 + 280);
v27 = v7 + 56;
if ( v26 )
v28 = v27;
else
v28 = 0;
LODWORD(v14) = sub_100565B84(*(_QWORD *)(v40 + 216), v23, v6, v24, v25, v28, 1, &v40);
v29 = **(_QWORD **)(v40 + 264);
if ( v29 )
{
sub_1005D7AD8(
*((_QWORD *)off_1009DA5E8 + 54),
v29,
"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_async.cpp",
205,
1);
**(_QWORD **)(v40 + 264) = 0;
}
}
if ( !(_DWORD)v14 )
{
v30 = *(_QWORD *)(v40 + 264);
if ( *(_BYTE *)(v30 + 280) )
{
LODWORD(v14) = 0;
*(_QWORD *)(v40 + 200) = *(_QWORD *)(v30 + 160);
goto LABEL_40;
}
goto LABEL_35;
}
LABEL_40:
v31 = v40;
*(_DWORD *)(*(_QWORD *)(v40 + 264) + 292LL) = v14;
v32 = *(_QWORD *)(v31 + 184);
if ( v32 )
{
*(_BYTE *)(v32 + 92) = 1;
*(_BYTE *)(v31 + 92) = 1;
atomic_store(2 * ((_DWORD)v14 != 0), (unsigned int *)(v31 + 272));
v33 = atomic_load((unsigned int *)(v31 + 272));
atomic_store(v33, (unsigned int *)(v32 + 272));
v31 = v40;
v34 = *(_QWORD *)(v40 + 168);
if ( !v34 )
goto LABEL_45;
LABEL_44:
v35 = atomic_load((unsigned int *)(v31 + 272));
atomic_store(v35, (unsigned int *)(v34 + 272));
goto LABEL_48;
}
*(_BYTE *)(v31 + 92) = 1;
atomic_store(2 * ((_DWORD)v14 != 0), (unsigned int *)(v31 + 272));
v34 = *(_QWORD *)(v31 + 168);
if ( v34 )
goto LABEL_44;
LABEL_45:
if ( (**(unsigned int (__fastcall ***)(__int64))v31)(v31) )
{
v31 = v40;
if ( *(_DWORD *)(v40 + 176) == 1 )
{
v34 = **(_QWORD **)(v40 + 160);
if ( v34 )
goto LABEL_44;
}
}
LABEL_48:
v36 = v40;
v37 = *(_QWORD *)(v40 + 264);
if ( !*(_BYTE *)(v37 + 280) || !*(_QWORD *)(v37 + 128) )
{
LABEL_53:
*(_BYTE *)(v36 + 92) = 0;
v39 = *(_QWORD *)(v36 + 184);
if ( v39 )
{
*(_BYTE *)(v39 + 92) = 0;
return 0;
}
return 0;
}
result = sub_100568D04(v4, 1u);
if ( !(_DWORD)result )
{
(*(void (**)(void))(*(_QWORD *)(v40 + 264) + 128LL))();
result = sub_100568D84(v4);
if ( !(_DWORD)result )
{
v36 = v40;
goto LABEL_53;
}
}
return result;
}