//
// sub_1005CE2F0 from 0x1005ce2f0 to 0x1005ce819 (1321 bytes)
//
// 3 xrefs:
// > processFMODAudioState @ 0x1005ef80f
// > processFMODAudioState @ 0x1005ef81b
// > processFMODAudioState @ 0x1005ef827
//
// This function is hookable on this platform (idp: pc, 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 12:32:51 +0000
//
void __fastcall sub_1005CE2F0(__int64 *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rcx
__int64 v4; // rcx
int v5; // r14d
char *v6; // rdi
const char *v7; // rdi
int v8; // ecx
signed int v9; // r14d
signed int v10; // r12d
__int64 v11; // rax
char *v12; // rdi
const char *v13; // rdi
int v14; // r15d
__int64 v15; // rax
signed int v16; // ebx
signed int v17; // r13d
char *v18; // rdi
const char *v19; // rdi
signed int v20; // r12d
char *v21; // rdi
const char *v22; // rdi
signed int v23; // r13d
char *v24; // rbx
int v25; // r14d
int v26; // r12d
int v27; // r14d
int v28; // r12d
bool v29; // bl
__int64 v30; // r12
float v31; // xmm0_4
char *v32; // rdi
const char *v33; // rdi
float v34; // xmm0_4
char *v35; // rdi
const char *v36; // rdi
float v37; // xmm0_4
char *v38; // rdi
const char *v39; // rdi
float v40; // xmm0_4
char *v41; // rdi
const char *v42; // rdi
float v43; // xmm0_4
char *v44; // rax
_BYTE *v45; // rax
__int64 v46; // r13
__int64 v47; // rax
_QWORD *v48; // r14
int v49; // eax
int v50; // eax
char *v51; // rax
__int64 v52; // rcx
void **v53; // rbx
void **v54; // r14
void *v55; // rdi
std::string v56; // [rsp+10h] [rbp-90h] BYREF
int v57; // [rsp+28h] [rbp-78h]
int v58; // [rsp+2Ch] [rbp-74h]
__int64 v59; // [rsp+30h] [rbp-70h]
void *__p; // [rsp+38h] [rbp-68h] BYREF
void **v61; // [rsp+40h] [rbp-60h]
signed int v62; // [rsp+50h] [rbp-50h]
float v63; // [rsp+60h] [rbp-40h]
float v64; // [rsp+64h] [rbp-3Ch]
float v65; // [rsp+68h] [rbp-38h]
float v66; // [rsp+6Ch] [rbp-34h]
char *v67; // [rsp+70h] [rbp-30h]
memset(&v56, 0, sizeof(v56));
v2 = *((int *)a1 + 6);
v3 = *a1;
if ( (int)v2 < (int)(-1431655765 * ((unsigned __int64)(a1[1] - *a1) >> 3)) )
{
*((_DWORD *)a1 + 6) = v2 + 1;
std::string::operator=(&v56, (const std::string *)(v3 + 24 * v2));
}
sub_1005C67B0((__int64)&__p, (unsigned __int8 *)&v56, "|", a1[4]);
v4 = v62;
v5 = 0;
if ( v62 < (int)(-1431655765 * ((unsigned __int64)((char *)v61 - (_BYTE *)__p) >> 3)) )
{
++v62;
v6 = (char *)__p + 24 * v4;
if ( (*v6 & 1) != 0 )
v7 = *((const char **)v6 + 2);
else
v7 = v6 + 1;
v5 = atoi(v7);
}
sub_10001ADF0(a2, *(_QWORD **)(a2 + 8));
*(_QWORD *)a2 = a2 + 8;
*(_OWORD *)(a2 + 8) = 0;
if ( v5 > 0 )
{
v8 = 0;
v58 = v5;
while ( 1 )
{
v9 = v62;
v10 = -1431655765 * ((unsigned __int64)((char *)v61 - (_BYTE *)__p) >> 3);
v67 = (char *)__p;
v57 = v8;
if ( v62 >= v10 )
break;
v11 = v62;
v9 = ++v62;
v12 = (char *)__p + 24 * v11;
if ( (*v12 & 1) != 0 )
v13 = *((const char **)v12 + 2);
else
v13 = v12 + 1;
v14 = atoi(v13);
v15 = 0;
v16 = v10;
if ( v9 >= v10 )
goto LABEL_14;
v17 = v9 + 1;
v62 = v9 + 1;
v18 = &v67[24 * v9];
if ( (*v18 & 1) != 0 )
v19 = *((const char **)v18 + 2);
else
v19 = v18 + 1;
LODWORD(v15) = atoi(v19);
LABEL_21:
v59 = v15;
v63 = 0.0;
if ( v17 >= v16 )
{
v20 = v17;
v65 = 0.0;
v23 = v16;
v24 = v67;
if ( v20 >= v23 )
goto LABEL_25;
}
else
{
v20 = v17 + 1;
v62 = v17 + 1;
v21 = &v67[24 * v17];
if ( (*v21 & 1) != 0 )
v22 = *((const char **)v21 + 2);
else
v22 = v21 + 1;
v23 = v16;
v31 = atof(v22);
v65 = v31;
v24 = v67;
if ( v20 >= v23 )
{
LABEL_25:
v25 = v20;
LODWORD(v67) = 0;
if ( v20 >= v23 )
goto LABEL_26;
goto LABEL_36;
}
}
v25 = v20 + 1;
v62 = v20 + 1;
v32 = &v24[24 * v20];
if ( (*v32 & 1) != 0 )
v33 = *((const char **)v32 + 2);
else
v33 = v32 + 1;
v34 = atof(v33);
v63 = v34;
LODWORD(v67) = 0;
if ( v25 >= v23 )
{
LABEL_26:
v26 = v25;
v66 = 0.0;
if ( v25 >= v23 )
goto LABEL_27;
goto LABEL_40;
}
LABEL_36:
v26 = v25 + 1;
v62 = v25 + 1;
v35 = &v24[24 * v25];
if ( (*v35 & 1) != 0 )
v36 = *((const char **)v35 + 2);
else
v36 = v35 + 1;
v37 = atof(v36);
v66 = v37;
if ( v26 >= v23 )
{
LABEL_27:
v27 = v26;
v64 = 0.0;
if ( v26 >= v23 )
goto LABEL_28;
goto LABEL_44;
}
LABEL_40:
v27 = v26 + 1;
v62 = v26 + 1;
v38 = &v24[24 * v26];
if ( (*v38 & 1) != 0 )
v39 = *((const char **)v38 + 2);
else
v39 = v38 + 1;
v40 = atof(v39);
*(float *)&v67 = v40;
v64 = 0.0;
if ( v27 >= v23 )
{
LABEL_28:
v28 = v27;
if ( v27 >= v23 )
goto LABEL_29;
goto LABEL_48;
}
LABEL_44:
v28 = v27 + 1;
v62 = v27 + 1;
v41 = &v24[24 * v27];
if ( (*v41 & 1) != 0 )
v42 = *((const char **)v41 + 2);
else
v42 = v41 + 1;
v43 = atof(v42);
v64 = v43;
if ( v28 >= v23 )
{
LABEL_29:
v29 = 0;
v30 = v59;
goto LABEL_55;
}
LABEL_48:
v62 = v28 + 1;
v44 = &v24[24 * v28];
if ( (*v44 & 1) != 0 )
{
v30 = v59;
if ( *((_QWORD *)v44 + 1) == 1 )
{
v45 = *((_BYTE **)v44 + 2);
goto LABEL_53;
}
}
else
{
v30 = v59;
if ( *v44 == 2 )
{
v45 = v44 + 1;
LABEL_53:
v29 = *v45 == 49;
goto LABEL_55;
}
}
v29 = 0;
LABEL_55:
v46 = a2 + 8;
LABEL_56:
while ( 1 )
{
v47 = *(_QWORD *)v46;
v48 = (_QWORD *)v46;
if ( !*(_QWORD *)v46 )
break;
while ( 1 )
{
v46 = v47;
v49 = *(_DWORD *)(v47 + 28);
if ( v14 < v49 )
break;
if ( v14 <= v49 )
{
v50 = *(_DWORD *)(v46 + 32);
if ( (int)v30 < v50 )
goto LABEL_56;
if ( (int)v30 <= v50 )
goto LABEL_66;
}
v47 = *(_QWORD *)(v46 + 8);
if ( !v47 )
{
v48 = (_QWORD *)(v46 + 8);
goto LABEL_63;
}
}
}
LABEL_63:
v51 = (char *)operator new(0x40u);
*(_QWORD *)(v51 + 28) = (v30 << 32) | (unsigned int)v14;
*((float *)v51 + 9) = v65;
*((float *)v51 + 10) = v63;
*((float *)v51 + 11) = v66;
*((_DWORD *)v51 + 12) = (_DWORD)v67;
*((float *)v51 + 13) = v64;
v51[56] = v29;
*(_OWORD *)v51 = 0;
*((_QWORD *)v51 + 2) = v46;
*v48 = v51;
v52 = **(_QWORD **)a2;
if ( v52 )
*(_QWORD *)a2 = v52;
sub_10001B680(*(__int64 **)(a2 + 8), (__int64 *)v51);
++*(_QWORD *)(a2 + 16);
LABEL_66:
v8 = v57 + 1;
if ( v57 + 1 == v58 )
goto LABEL_67;
}
v14 = 0;
v15 = 0;
v16 = -1431655765 * ((unsigned __int64)((char *)v61 - (_BYTE *)__p) >> 3);
LABEL_14:
v17 = v9;
goto LABEL_21;
}
LABEL_67:
v53 = (void **)__p;
if ( __p )
{
v54 = v61;
v55 = __p;
if ( v61 != __p )
{
do
{
if ( (*(_BYTE *)(v54 - 3) & 1) != 0 )
operator delete(*(v54 - 1));
v54 -= 3;
}
while ( v54 != v53 );
v55 = __p;
}
v61 = v53;
operator delete(v55);
}
if ( (*(_BYTE *)&v56.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v56.__r_.__value_.__l.__data_);
}