//
// sub_1004CDCDC from 0x1004cdcdc to 0x1004cde6c (400 bytes)
//
// 5 xrefs:
// > sub_1004CD5C0 @ 0x1004cd808
// > sub_1004CD5C0 @ 0x1004cda08
// > sub_1004CD5C0 @ 0x1004cda30
// > EditorSoundBrowserLayer::loadEditorSoundsFinished @ 0x1004ce1d8
// > EditorSoundBrowserLayer::loadEditorSoundsFailed @ 0x1004ce2a0
//
// This function is hookable on this platform (idp: arm, 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:06:27 +0000
//
void __fastcall sub_1004CDCDC(__int64 a1)
{
int v2; // w21
int v3; // w20
__int64 v4; // x0
void *v5; // x0
const std::string::value_type *CString; // x0
std::string *v7; // x1
bool v8; // cc
__int64 v9; // x0
__int64 v10; // x20
__int64 v11; // x0
__int64 v12; // x0
std::string v13; // [xsp+18h] [xbp-38h] BYREF
if ( !*(_QWORD *)(a1 + 1064) )
return;
v2 = *(_DWORD *)(a1 + 1052);
v3 = (10 * v2) | 1;
v4 = *(_QWORD *)(a1 + 1104);
if ( v4 )
{
if ( !(unsigned int)sub_1002E757C(v4) )
v3 = 0;
v4 = *(_QWORD *)(a1 + 1104);
v2 = *(_DWORD *)(a1 + 1052);
if ( v4 )
LODWORD(v4) = sub_1002E757C(v4);
}
memset(&v13, 0, sizeof(v13));
if ( (_DWORD)v4 + 10 * v2 )
{
if ( *(_DWORD *)(a1 + 1048) > 1u )
v5 = sub_1003065B0("Page %d", *(_DWORD *)(a1 + 1052) + 1);
else
v5 = sub_1003065B0("%d-%d of %d", v3, (int)v4 + 10 * v2, *(_DWORD *)(a1 + 1112));
CString = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v5);
std::string::assign(&v13, CString);
}
else
{
std::string::assign(&v13, "No results");
}
if ( (v13.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v7 = &v13;
else
v7 = (std::string *)v13.__r_.__value_.__r.__words[0];
(*(void (__fastcall **)(_QWORD, std::string *))(**(_QWORD **)(a1 + 1064) + 928LL))(*(_QWORD *)(a1 + 1064), v7);
if ( *(_DWORD *)(a1 + 1048) <= 1u )
{
v8 = *(_DWORD *)(a1 + 1112) <= 10 * *(_DWORD *)(a1 + 1052) + 10;
goto LABEL_20;
}
v9 = *(_QWORD *)(a1 + 1104);
if ( v9 )
{
v8 = (int)sub_1002E757C(v9) <= 9;
LABEL_20:
v10 = !v8;
goto LABEL_23;
}
v10 = 0;
LABEL_23:
v11 = *(_QWORD *)(a1 + 1072);
if ( v11 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v11 + 344LL))(v11, *(_DWORD *)(a1 + 1052) > 0);
v12 = *(_QWORD *)(a1 + 1080);
if ( v12 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 344LL))(v12, v10);
if ( SHIBYTE(v13.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v13.__r_.__value_.__l.__data_);
}