//
// sub_5DFE4 from 0x5dfe4 to 0x5e2ca (742 bytes)
//
// 1 xrefs:
// > sub_5DDC0 @ 0x5de5c
//
// 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:50 +0000
//
int __fastcall sub_5DFE4(_DWORD *a1, int a2, int a3, int a4, int a5)
{
_DWORD *v5; // r5
int v6; // r4
bool v7; // cc
_DWORD *v10; // r9
int v11; // r5
int v12; // r3
int v13; // r0
int v14; // r1
int v15; // r2
int v16; // r1
_DWORD *v17; // r5
int v18; // r3
int v19; // r1
int *v20; // r2
unsigned int v21; // r1
int v22; // t1
int v23; // r0
int *v24; // r9
int v25; // r10
int v26; // r6
int v27; // r8
int v28; // r10
bool v29; // zf
_DWORD *v30; // r0
int v31; // r0
int v32; // r2
int v33; // r1
_DWORD *v34; // r4
_DWORD *v35; // r0
int (__fastcall ***v36)(_DWORD, _DWORD, _DWORD, int, int, _DWORD, int, int, _DWORD, _DWORD, _DWORD, _DWORD); // r4
int v37; // r0
int v38; // r0
int v39; // r0
int v40; // r0
int v41; // r1
int v42; // [sp+34h] [bp-64h]
int v43; // [sp+3Ch] [bp-5Ch]
int v45; // [sp+48h] [bp-50h]
_DWORD v47[10]; // [sp+50h] [bp-48h] BYREF
int v48; // [sp+78h] [bp-20h] BYREF
v6 = 28;
if ( a2 )
{
v7 = a5 < 1;
if ( a5 >= 1 )
{
v5 = a1;
v7 = a4 < 1;
}
if ( !v7 )
{
if ( v5[1] )
{
v5[11] = a5;
v5[4] = a4;
sub_4C6EA(1u, &v48, 1, a3);
v6 = 0;
if ( (*(int (__fastcall **)(_DWORD *, int, int))*v5)(v5, a2, a3) == 41 )
{
v10 = v5;
v11 = *(_DWORD *)(v5[1] + 68752);
memset(v47, 0, 0x24u);
v12 = v11 - 1;
v13 = 7;
v14 = 6;
if ( v11 == 1 )
v13 = 3;
v47[1] = v13;
if ( v11 == 1 )
v14 = 3;
v15 = v10[2];
v29 = v11 == 1;
v47[4] = v14;
v16 = v11 - 1;
v47[2] = 0;
v17 = v10;
v47[0] = v15;
v43 = v12;
v18 = a5;
v47[7] = 0;
if ( !v29 )
v16 = 1;
v47[5] = v16;
v47[8] = v16;
v47[3] = 4 * v15;
v19 = 16 * v15;
v20 = &v47[4];
v47[6] = v19;
v42 = v19;
v21 = 1;
v10[5] = 0;
while ( v13 )
{
if ( v21 > 3 )
goto LABEL_21;
v18 -= *(v20 - 4) * v13;
if ( v18 < 1 )
goto LABEL_21;
v22 = *v20;
v20 += 3;
v13 = v22;
++v21;
}
v10[5] = v21 - 1;
LABEL_21:
v10[5] = v21;
v23 = sub_BD580(
*(int *)((char *)&dword_14C + (_DWORD)off_E8000),
4 * v21 * v10[4],
"../../src/fmod_dsp_convolutionreverb.cpp",
287,
0);
v10[12] = v23;
if ( v23 )
{
v24 = &v47[1];
v25 = 0;
LABEL_23:
if ( v25 >= v17[4] )
{
return 0;
}
else
{
v26 = 0;
v27 = 0;
v45 = v25;
while ( 1 )
{
if ( v27 >= v17[5] )
{
++v25;
v24 = &v47[1];
goto LABEL_23;
}
v28 = v43;
if ( v27 < v43 )
v28 = v27;
v29 = v28 == 0;
if ( v28 )
v29 = v24[1] == 0;
if ( v29 )
{
v34 = nullptr;
v30 = (_DWORD *)sub_BD580(
*(int *)((char *)&dword_14C + (_DWORD)off_E8000),
88,
"../../src/fmod_dsp_convolutionreverb.cpp",
301,
0);
if ( v30 )
{
v34 = v30;
*v30 = &off_E4BE4;
}
v31 = v17[5];
v32 = v17[12];
v33 = v27 + v45 * v31;
}
else
{
v34 = nullptr;
v35 = (_DWORD *)sub_BD580(
*(int *)((char *)&dword_14C + (_DWORD)off_E8000),
108,
"../../src/fmod_dsp_convolutionreverb.cpp",
306,
0);
if ( v35 )
{
v34 = v35;
v35[23] = v35 + 23;
v35[24] = v35 + 23;
v35[25] = 0;
*v35 = &off_E4BB8;
}
v31 = v17[5];
v32 = v17[12];
v33 = v27 + v31 * v45;
}
*(_DWORD *)(v32 + 4 * v33) = v34;
v36 = *(int (__fastcall ****)(_DWORD, _DWORD, _DWORD, int, int, _DWORD, int, int, _DWORD, _DWORD, _DWORD, _DWORD))(v17[12] + 4 * v33);
if ( !v36 )
return 38;
if ( v27 >= v31 - 1 )
{
v37 = (**v36)(
v36,
v17[1],
*(v24 - 1),
v42,
(a5 - v26 - 1) / *(v24 - 1) + 1,
0,
v24[1],
v28,
0,
0,
0,
0);
if ( v37 )
return v37;
v25 = v45;
v39 = *(_DWORD *)(v17[12] + 4 * (v27 + v45 * v17[5]));
v37 = (*(int (__fastcall **)(int, int, int, int, int))(*(_DWORD *)v39 + 4))(
v39,
a2 + (v45 + v17[4] * v26) * v48,
a3,
a4,
a5 - v26);
}
else
{
v37 = (**v36)(v36, v17[1], *(v24 - 1), v42, *v24, 0, v24[1], v28, 0, 0, 0, 0);
if ( v37 )
return v37;
v25 = v45;
v38 = *(_DWORD *)(v17[12] + 4 * (v27 + v45 * v17[5]));
v37 = (*(int (__fastcall **)(int, int, int, int, int))(*(_DWORD *)v38 + 4))(
v38,
a2 + (v45 + v17[4] * v26) * v48,
a3,
a4,
*(v24 - 1) * *v24);
}
if ( v37 )
return v37;
v40 = *(v24 - 1);
++v27;
v41 = *v24;
v24 += 3;
v26 += v40 * v41;
}
}
}
else
{
return 38;
}
}
}
}
}
return v6;
}