//
// FMODAudioEngine::setup from 0x14005c8c0 to 0x14005cdbe (1278 bytes)
//
// 2 xrefs:
// > LoadingLayer::init @ 0x140469136
// > ??> @ 0x1409108bc
//
// 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 11:25:42 +0000
//
// Hidden C++ exception states: #wind=6
unsigned int __fastcall FMODAudioEngine::setup(__int64 a1)
{
__int64 v2; // r15
__int64 v3; // r14
__int64 v4; // rsi
__int64 v5; // rdi
__int64 v6; // rbx
struct cocos2d::CCObject *v7; // rax
cocos2d::CCArray *v8; // rdi
void *v9; // rcx
__m128i v10; // xmm6
void *v11; // rcx
void *v12; // rcx
void *v13; // rcx
void *v14; // rcx
void *v15; // rcx
unsigned int v16; // ebx
unsigned int result; // eax
cocos2d::CCString *v18; // rax
const char *CString; // rax
size_t v20; // r8
__int64 v21; // rax
_BYTE v22[40]; // [rsp+40h] [rbp-C8h] BYREF
_BYTE v23[24]; // [rsp+68h] [rbp-A0h] BYREF
__m128i v24; // [rsp+80h] [rbp-88h]
void *v25[2]; // [rsp+90h] [rbp-78h] BYREF
__m128i v26; // [rsp+A0h] [rbp-68h]
void *Block[2]; // [rsp+B0h] [rbp-58h] BYREF
__m128i v28; // [rsp+C0h] [rbp-48h]
void *v29[2]; // [rsp+D0h] [rbp-38h] BYREF
__m128i v30; // [rsp+E0h] [rbp-28h]
void *v31[2]; // [rsp+F0h] [rbp-18h] BYREF
__m128i v32; // [rsp+100h] [rbp-8h]
void *v33[2]; // [rsp+110h] [rbp+8h] BYREF
__m128i si128; // [rsp+120h] [rbp+18h]
FMODAudioEngine::setupAudioEngine();
*(_DWORD *)(a1 + 516) = 1065353216;
*(_DWORD *)(a1 + 512) = 1065353216;
*(_OWORD *)v33 = 0;
si128 = 0;
v33[0] = sub_14003D460(0x20u);
si128 = _mm_load_si128((const __m128i *)&xmmword_140836630);
strcpy((char *)v33[0], "highscoreGet02.ogg");
v24 = _mm_load_si128((const __m128i *)&xmmword_140836600);
strcpy(&v23[8], "endStart_02.ogg");
v26 = _mm_load_si128((const __m128i *)&xmmword_1408365F0);
strcpy((char *)v25, "explode_11.ogg");
HIBYTE(v25[1]) = 0;
*(_OWORD *)v31 = 0;
v32 = 0;
v31[0] = sub_14003D460(0x20u);
v32 = _mm_load_si128((const __m128i *)&xmmword_140836610);
strcpy((char *)v31[0], "quitSound_01.ogg");
*(_OWORD *)v29 = 0;
v29[0] = sub_14003D460(0x20u);
v30 = _mm_load_si128((const __m128i *)&xmmword_140836610);
strcpy((char *)v29[0], "playSound_01.ogg");
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
v28 = _mm_load_si128((const __m128i *)&xmmword_140836630);
strcpy((char *)Block[0], "achievement_01.ogg");
v2 = cocos2d::CCString::create(v33);
v3 = cocos2d::CCString::create(&v23[8]);
v4 = cocos2d::CCString::create(v25);
v5 = cocos2d::CCString::create(v31);
v6 = cocos2d::CCString::create(v29);
v7 = (struct cocos2d::CCObject *)cocos2d::CCString::create(Block);
v8 = cocos2d::CCArray::create(v7, v6, v5, v4, v3, v2, 0);
if ( v28.m128i_i64[1] > 0xFuLL )
{
v9 = Block[0];
if ( (unsigned __int64)(v28.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
v10 = _mm_load_si128((const __m128i *)&Size);
v28 = v10;
LOBYTE(Block[0]) = 0;
if ( v30.m128i_i64[1] > 0xFuLL )
{
v11 = v29[0];
if ( (unsigned __int64)(v30.m128i_i64[1] + 1) >= 0x1000 )
{
v11 = *((void **)v29[0] - 1);
if ( (unsigned __int64)((char *)v29[0] - (char *)v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
v30 = v10;
LOBYTE(v29[0]) = 0;
if ( v32.m128i_i64[1] > 0xFuLL )
{
v12 = v31[0];
if ( (unsigned __int64)(v32.m128i_i64[1] + 1) >= 0x1000 )
{
v12 = *((void **)v31[0] - 1);
if ( (unsigned __int64)((char *)v31[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
v32 = v10;
LOBYTE(v31[0]) = 0;
if ( v26.m128i_i64[1] > 0xFuLL )
{
v13 = v25[0];
if ( (unsigned __int64)(v26.m128i_i64[1] + 1) >= 0x1000 )
{
v13 = *((void **)v25[0] - 1);
if ( (unsigned __int64)((char *)v25[0] - (char *)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
v26 = v10;
LOBYTE(v25[0]) = 0;
if ( v24.m128i_i64[1] > 0xFuLL )
{
v14 = *(void **)&v23[8];
if ( (unsigned __int64)(v24.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *(void **)(*(_QWORD *)&v23[8] - 8LL);
if ( (unsigned __int64)(*(_QWORD *)&v23[8] - (_QWORD)v14 - 8LL) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v14);
}
v24 = v10;
v23[8] = 0;
if ( si128.m128i_i64[1] > 0xFuLL )
{
v15 = v33[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v15 = *((void **)v33[0] - 1);
if ( (unsigned __int64)((char *)v33[0] - (char *)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
si128 = v10;
LOBYTE(v33[0]) = 0;
v16 = 0;
result = cocos2d::CCArray::count(v8);
if ( result )
{
do
{
v18 = cocos2d::CCArray::objectAtIndex(v8, v16);
CString = cocos2d::CCString::getCString(v18);
memset(&v22[8], 0, 32);
v20 = -1;
do
++v20;
while ( CString[v20] );
sub_14003D230(&v22[8], CString, v20);
v21 = FMODAudioEngine::preloadEffect(a1, &v22[8]);
if ( v21 )
*(_BYTE *)(v21 + 52) = 1;
++v16;
result = cocos2d::CCArray::count(v8);
}
while ( v16 < result );
}
return result;
}