//
// sub_1800C2F30 from 0x1800c2f30 to 0x1800c33b9 (1161 bytes)
//
// 3 xrefs:
// > sub_1800C1A30 @ 0x1800c1a3c
// > sub_1800C1A50 @ 0x1800c1a5b
// > ??> @ 0x1801fdd34
//
// 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
//
__int64 __fastcall sub_1800C2F30(__int64 a1, int a2)
{
__int64 v3; // r12
__int64 v4; // r8
int v5; // r15d
int v6; // edi
__int64 v7; // rbp
__int64 v8; // rsi
int v9; // edx
int v10; // r9d
float *v11; // r10
float *v12; // r14
__int64 v13; // r11
unsigned int v14; // eax
__m128i v15; // xmm2
char v16; // r8
__int64 v17; // rdx
float *v18; // rax
__m128i v19; // xmm0
int v20; // r8d
__int64 v21; // rax
__int64 result; // rax
__int64 v23; // r14
int v24; // r9d
__int64 v25; // rdx
__int64 v26; // r8
__int64 v27; // rbp
int v28; // ecx
int v29; // edi
float *v30; // rsi
v3 = a2;
if ( !*(_BYTE *)(a1 + 1121) )
return 0;
FMOD_OS_CriticalSection_Enter(*(struct _RTL_CRITICAL_SECTION **)(a1 + 1192));
v4 = *(_QWORD *)(a1 + 1200);
v5 = 0;
if ( v4 )
{
v6 = 0;
if ( *(int *)(v4 + 32) > 0 )
{
v7 = 0;
v8 = 0;
while ( 1 )
{
v9 = *(_DWORD *)(v8 + *(_QWORD *)(a1 + 1096) + 16);
switch ( v9 )
{
case 16:
v10 = 2;
goto LABEL_21;
case 17:
v10 = 3;
goto LABEL_21;
case 18:
v10 = 4;
goto LABEL_21;
case 24:
v10 = 4;
goto LABEL_21;
case 25:
v10 = 4;
goto LABEL_21;
case 26:
v10 = 4;
goto LABEL_21;
case 27:
v10 = 4;
goto LABEL_21;
}
if ( v9 == 19 )
break;
LABEL_36:
v4 = *(_QWORD *)(a1 + 1200);
++v6;
v8 += 52;
v7 += 3;
if ( v6 >= *(_DWORD *)(v4 + 32) )
goto LABEL_37;
}
v10 = 5;
LABEL_21:
v11 = *(float **)(*(_QWORD *)(a1 + 1088) + 8 * (v3 + v7) + 8);
v12 = (float *)(*(_QWORD *)(a1 + 1208) + 4 * (v6 + (__int64)(*(_DWORD *)(a1 + 1216) * *(_DWORD *)(v4 + 32))));
if ( v10 == 4 )
{
v13 = *(int *)(a1 + 1136);
switch ( v9 )
{
case 24:
v14 = 16;
goto LABEL_30;
case 25:
v14 = 14;
goto LABEL_30;
case 26:
v14 = 12;
goto LABEL_30;
case 27:
v14 = 8;
LABEL_30:
v15 = _mm_cvtsi32_si128(v14);
v16 = v14;
v17 = 0;
if ( (int)v13 >= 16 )
{
v18 = v11 + 8;
do
{
v19 = _mm_loadu_si128((const __m128i *)v18 - 2);
v17 += 16;
v18 += 16;
*((__m128i *)v18 - 6) = _mm_sll_epi32(v19, v15);
*((__m128i *)v18 - 5) = _mm_sll_epi32(_mm_loadu_si128((const __m128i *)v18 - 5), v15);
*((__m128i *)v18 - 4) = _mm_sll_epi32(_mm_loadu_si128((const __m128i *)v18 - 4), v15);
*((__m128i *)v18 - 3) = _mm_sll_epi32(_mm_loadu_si128((const __m128i *)v18 - 3), v15);
}
while ( v17 < (int)(v13 - (v13 & 0xF)) );
}
for ( ; v17 < v13; ++v17 )
LODWORD(v11[v17]) <<= v16;
break;
}
}
sub_180062BA0(v12, v11, 5, v10, *(_DWORD *)(a1 + 1136), *(_DWORD *)(*(_QWORD *)(a1 + 1200) + 32LL), 1, 1.0, 1);
goto LABEL_36;
}
LABEL_37:
*(_DWORD *)(a1 + 1216) = (unsigned int)(*(_DWORD *)(a1 + 1216) + *(_DWORD *)(a1 + 1136)) % *(_DWORD *)(v4 + 36);
}
FMOD_OS_CriticalSection_Leave(*(struct _RTL_CRITICAL_SECTION **)(a1 + 1192));
if ( !*(_QWORD *)(a1 + 1144) )
{
result = (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD))(a1 + 16))(
a1 + 8,
*(_QWORD *)(a1 + 1112),
*(unsigned int *)(a1 + 1136));
if ( (_DWORD)result )
return result;
goto LABEL_44;
}
v20 = *(_DWORD *)(a1 + 1168);
if ( v20 * (*(_DWORD *)(a1 + 1188) - *(_DWORD *)(a1 + 1184)) > *(_DWORD *)(a1 + 1156) * (*(_DWORD *)(a1 + 1180) - 1) )
{
LABEL_42:
sub_1800BCD20(a1 + 1144, *(char **)(a1 + 1112), *(_DWORD *)(a1 + 1136) * v20, 1);
LABEL_44:
if ( *(int *)(a1 + 1128) > 0 )
{
v23 = 73128;
do
{
v24 = *(_DWORD *)(a1 + 88);
v25 = *(int *)(v23 + *(_QWORD *)(a1 + 72));
if ( (int)v25 < v24 && (int)v25 > -1 )
{
v26 = v5 + *(_DWORD *)(a1 + 1124);
v27 = 52 * v26;
v28 = *(_DWORD *)(*(_QWORD *)(a1 + 1096) + 52 * v26 + 16);
switch ( v28 )
{
case 16:
v29 = 2;
goto LABEL_64;
case 17:
v29 = 3;
goto LABEL_64;
case 18:
v29 = 4;
goto LABEL_64;
case 24:
v29 = 4;
goto LABEL_64;
case 25:
v29 = 4;
goto LABEL_64;
case 26:
v29 = 4;
goto LABEL_64;
case 27:
v29 = 4;
goto LABEL_64;
case 19:
v29 = 5;
LABEL_64:
v30 = *(float **)(*(_QWORD *)(a1 + 1088) + 8 * (v3 + 3 * v26) + 8);
sub_180062BA0(
v30,
(float *)(*(_QWORD *)(a1 + 1112) + 4 * v25),
v29,
5,
*(_DWORD *)(a1 + 1136),
1u,
v24,
1.0,
1);
if ( v29 == 4 )
sub_1800C1880(
a1,
(__int64)v30,
18,
*(_DWORD *)(*(_QWORD *)(a1 + 1096) + v27 + 16),
*(_DWORD *)(a1 + 1136));
break;
}
}
++v5;
v23 += 4;
}
while ( v5 < *(_DWORD *)(a1 + 1128) );
}
if ( *(_BYTE *)(a1 + 1120) )
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1104) + 184LL))(*(_QWORD *)(a1 + 1104));
return 0;
}
while ( 1 )
{
v21 = sub_1800BE090(a1 + 1144);
result = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD))(a1 + 16))(a1 + 8, v21, *(unsigned int *)(a1 + 1152));
if ( (_DWORD)result )
return result;
v20 = *(_DWORD *)(a1 + 1168);
if ( v20 * (*(_DWORD *)(a1 + 1188) - *(_DWORD *)(a1 + 1184)) > *(_DWORD *)(a1 + 1156) * (*(_DWORD *)(a1 + 1180) - 1) )
goto LABEL_42;
}
}