//
// sub_1001D7714 from 0x1001d7714 to 0x1001d7928 (532 bytes)
//
// 2 xrefs:
// > sub_1003FE824 @ 0x1003fe8c8
// > sub_1004C97AC @ 0x1004c989c
//
// 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:00:25 +0000
//
void __fastcall sub_1001D7714(__int64 a1, _QWORD *a2, __int64 **a3, __int64 a4)
{
__int64 v5; // x8
__int64 v6; // x9
int v10; // w8
unsigned __int64 v11; // x27
unsigned __int64 v12; // x28
__int64 **v13; // x26
unsigned int *v14; // x9
__int64 v15; // x1
__int64 v16; // x24
char *v18; // x8
int v19; // w9
int v20; // w9
__int64 v21; // x0
__int64 v22; // x0
__int64 v23; // x25
_QWORD *v24; // x0
_QWORD *v25; // x25
__int64 v26; // x0
__int64 v27; // x25
_QWORD *v28; // x0
std::string v29; // [xsp+8h] [xbp-98h] BYREF
__int64 v30; // [xsp+20h] [xbp-80h] BYREF
char **v31; // [xsp+28h] [xbp-78h] BYREF
char *v32; // [xsp+30h] [xbp-70h] BYREF
__int64 v33; // [xsp+38h] [xbp-68h]
__int64 *v34; // [xsp+48h] [xbp-58h] BYREF
v32 = nullptr;
v33 = 0;
v31 = &v32;
v5 = a2[1];
v6 = v5 - *a2;
if ( v5 != *a2 )
{
v10 = 0;
v11 = 0;
v12 = v6 >> 3;
v13 = a3 + 1;
do
{
v14 = (unsigned int *)(*a2 + 8 * v11);
v16 = *v14;
v15 = v14[1];
if ( (int)v15 < 1 || (int)v16 < 1 )
goto LABEL_30;
v30 = v15 | (v16 << 32);
v18 = v32;
if ( v32 )
{
while ( 1 )
{
v19 = *((_DWORD *)v18 + 8);
if ( (int)v15 >= v19 )
{
if ( v19 < (int)v15 )
goto LABEL_12;
v20 = *((_DWORD *)v18 + 9);
if ( (int)v16 >= v20 )
break;
}
LABEL_13:
v18 = *(char **)v18;
if ( !v18 )
goto LABEL_14;
}
if ( v20 >= (int)v16 )
goto LABEL_29;
LABEL_12:
v18 += 8;
goto LABEL_13;
}
LABEL_14:
v21 = *(_QWORD *)(a1 + 824);
if ( v21 )
{
v22 = cocos2d::CCDictionary::objectForKey_1(v21, v15);
v23 = v22;
if ( v22 )
{
if ( (*(_BYTE *)(v22 + 72) & 1) == 0 && *(_DWORD *)(v22 + 56) == (_DWORD)v16 )
{
if ( !a4 || (sub_1001D7498(a1, v22, a4) & 1) != 0 )
{
MusicDownloadManager::customSFXPathDisplay(a1, v23, &v29);
v34 = &v30;
v24 = sub_10001AB98((__int64 **)&v31, (__int64)&v30, (__int64)&unk_100761731, &v34);
v25 = v24;
if ( *((char *)v24 + 63) < 0 )
operator delete((void *)v24[5]);
*(std::string *)(v25 + 5) = v29;
}
goto LABEL_29;
}
}
}
v26 = sub_1001E728C(a3, &v30);
v27 = v26;
if ( v13 != (__int64 **)v26 )
{
if ( (*(char *)(v26 + 63) & 0x8000000000000000LL) == 0 )
{
if ( !*(_BYTE *)(v26 + 63) )
goto LABEL_29;
LABEL_28:
v29.__r_.__value_.__r.__words[0] = (std::string::size_type)&v30;
v28 = sub_10001AB98((__int64 **)&v31, (__int64)&v30, (__int64)&unk_100761731, (__int64 **)&v29);
std::string::operator=((std::string *)(v28 + 5), (const std::string *)(v27 + 40));
goto LABEL_29;
}
if ( *(_QWORD *)(v26 + 48) )
goto LABEL_28;
}
LABEL_29:
v10 = v33;
LABEL_30:
++v11;
}
while ( v11 < v12 && v10 < 1000 );
}
if ( &v31 != (char ***)a3 )
sub_1001E7314(a3, v31, &v32);
sub_100076C88((__int64)&v31, v32);
}