//
// sub_60D44 from 0x60d44 to 0x60ec6 (386 bytes)
//
// 2 xrefs:
// > ??> @ 0x60d42
// > sub_59514 @ 0x59518
//
// 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:51 +0000
//
int __fastcall sub_60D44(int a1, const char *a2, _DWORD *a3, int a4)
{
int v8; // r0
_DWORD *v9; // r5
int v10; // r0
_DWORD *v11; // r4
int v12; // r0
int v13; // r4
int v14; // r0
unsigned int *v15; // r0
unsigned int v16; // r1
int v17; // r0
bool v18; // zf
int v19; // r0
int v20; // r0
_DWORD *v21; // r0
_DWORD **v23; // [sp+8h] [bp-D8h]
int v24; // [sp+Ch] [bp-D4h] BYREF
_DWORD v25[34]; // [sp+10h] [bp-D0h] BYREF
const void *v26[10]; // [sp+98h] [bp-48h] BYREF
_DWORD *v27; // [sp+C0h] [bp-20h] BYREF
v27 = nullptr;
if ( !a3 )
{
v13 = 31;
goto LABEL_24;
}
v8 = sub_BD580(*(int *)((char *)&dword_14C + (_DWORD)off_E8000), 416, "../../src/fmod_systemi_channel.cpp", 291, 0);
if ( !v8 )
goto LABEL_23;
v9 = (_DWORD *)v8;
sub_48F5C(v8);
v27 = v9;
v10 = *(_DWORD *)(a1 + 68876);
v9[70] = v10;
v9[71] = a1 + 68876;
v11 = nullptr;
*(_DWORD *)(v10 + 4) = v9 + 70;
*(_DWORD *)v9[71] = v9 + 70;
v9[1] = a1;
v9[92] = v9 + 92;
v9[93] = v9 + 92;
v9[94] = 0;
v9[95] = 0;
v9[11] = v9;
v9[72] = v9;
qmemcpy(v26, (const void *)sub_92310(), 0x24u);
v23 = (_DWORD **)(a1 + 68868);
if ( (_DWORD *)(a1 + 68868) == a3 )
{
v26[2] = byte_188 + 128;
qmemcpy(v25, v26[0], 0x84u);
v25[11] = 0;
v11 = v25;
}
v26[1] = "ChanGroup Fader";
v12 = sub_617B8(a1, v26, v11, &v24, 1);
if ( v12 )
{
v13 = v12;
goto LABEL_24;
}
v14 = v24;
v9[14] = v24;
v9[15] = v14;
v9[16] = v14;
v15 = (unsigned int *)(v14 + 92);
v9[2] = 0;
v9[3] = 1;
__dmb(0xBu);
do
v16 = __ldrex(v15);
while ( __strex(v16 | 0x60, v15) );
__dmb(0xBu);
v17 = v24;
*(_DWORD *)(v24 + 360) = v9;
sub_A750C(v17, 1, 1);
v18 = a2 == nullptr;
if ( a2 )
v18 = a4 == 0;
if ( v18 )
{
v9[84] = 0;
goto LABEL_16;
}
v19 = sub_BE3B8(a2);
v9[84] = v19;
if ( !v19 )
{
LABEL_23:
v13 = 38;
goto LABEL_24;
}
LABEL_16:
v27 = nullptr;
if ( !a2
|| strncmp(a2, "ReturnBus", 9u)
|| (v20 = *v9, v9[10] |= 0x40u, (v13 = (*(int (__fastcall **)(_DWORD *))(v20 + 260))(v9)) == 0) )
{
v21 = *v23;
if ( !*v23 || v21 == v9 || (v13 = sub_49540(v21, v9, 1, 0)) == 0 )
{
v13 = 0;
*a3 = v9;
}
}
LABEL_24:
sub_60EE0(&v27);
return v13;
}