//
// sub_966E30 from 0x966e30 to 0x96711c (748 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::responseToDict @ 0x9671c4
// > MusicDownloadManager::createSongsInfo @ 0x975f18
//
// 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 12:57:36 +0000
//
cocos2d::CCArray *__fastcall sub_966E30(__int64 a1, char *a2)
{
__int64 v4; // x0
unsigned __int8 v5; // w25
cocos2d::CCArray *v6; // x26
int v7; // w4
unsigned __int8 v8; // w24
__int64 v9; // x20
unsigned __int64 v10; // x0
int v11; // w1
unsigned __int64 v12; // x3
unsigned __int8 *v13; // x2
__int64 v14; // x20
__int64 v15; // x25
__int64 v16; // x24
unsigned __int64 v17; // x27
const char *v18; // x1
size_t v19; // x0
cocos2d::CCObject *v20; // x0
unsigned __int8 v21; // w3
__int64 v22; // x28
unsigned __int64 v23; // x0
unsigned __int8 *v24; // x2
unsigned __int64 v25; // x3
unsigned __int64 v27; // x20
__int64 v28; // x0
unsigned __int64 v29; // x21
__int64 v30; // x0
char *v31; // [xsp+68h] [xbp+68h]
__int64 v32[2]; // [xsp+78h] [xbp+78h] BYREF
void *v33; // [xsp+88h] [xbp+88h]
__int64 v34[2]; // [xsp+90h] [xbp+90h] BYREF
void *v35; // [xsp+A0h] [xbp+A0h]
v4 = cocos2d::CCArray::create(_stack_chk_guard);
v5 = *(_BYTE *)a1;
v6 = (cocos2d::CCArray *)v4;
v7 = *(_BYTE *)a1 & 1;
if ( (*(_BYTE *)a1 & 1) != 0 )
{
v8 = *a2;
v9 = *(_QWORD *)(a1 + 16);
v10 = *(_QWORD *)(a1 + 8);
v11 = *a2 & 1;
if ( (*a2 & 1) != 0 )
goto LABEL_3;
}
else
{
v8 = *a2;
v9 = a1 + 1;
v10 = v5 >> 1;
v11 = *a2 & 1;
if ( (*a2 & 1) != 0 )
{
LABEL_3:
v12 = *((_QWORD *)a2 + 1);
v13 = *((unsigned __int8 **)a2 + 2);
if ( v10 >= v12 )
goto LABEL_4;
goto LABEL_8;
}
}
v12 = v8 >> 1;
v13 = (unsigned __int8 *)(a2 + 1);
if ( v10 >= v12 )
{
LABEL_4:
if ( v12 )
{
v29 = v9 + v10;
v30 = std::__search(
v9,
v9 + v10,
v13,
&v13[v12],
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
v5 = *(_BYTE *)a1;
v8 = *a2;
if ( v29 == v30 )
v14 = -1;
else
v14 = v30 - v9;
v7 = v5 & 1;
v11 = *a2 & 1;
}
else
{
v14 = 0;
}
goto LABEL_9;
}
LABEL_8:
v14 = -1;
LABEL_9:
v15 = v5 >> 1;
if ( v7 )
v15 = *(_QWORD *)(a1 + 8);
LODWORD(v16) = v8 >> 1;
if ( v11 )
v16 = *((_QWORD *)a2 + 1);
v17 = 0;
while ( 1 )
{
std::string::basic_string(v32, a1, v17, v14 - v17);
if ( (v32[0] & 1) == 0 )
break;
if ( v17 != v15 || v32[1] )
{
v18 = (const char *)v33;
goto LABEL_18;
}
LABEL_19:
if ( v14 == -1 )
goto LABEL_34;
LABEL_20:
v17 = v14 + (int)v16;
if ( (*(_BYTE *)a1 & 1) != 0 )
{
v21 = *a2;
v22 = *(_QWORD *)(a1 + 16);
v23 = *(_QWORD *)(a1 + 8);
if ( (*a2 & 1) == 0 )
goto LABEL_32;
}
else
{
v21 = *a2;
v22 = a1 + 1;
v23 = *(_BYTE *)a1 >> 1;
if ( (*a2 & 1) == 0 )
{
LABEL_32:
v24 = (unsigned __int8 *)(a2 + 1);
v25 = v21 >> 1;
goto LABEL_23;
}
}
v24 = *((unsigned __int8 **)a2 + 2);
v25 = *((_QWORD *)a2 + 1);
LABEL_23:
v14 = -1;
if ( v17 <= v23 && v23 - v17 >= v25 )
{
v14 = v17;
if ( v25 )
{
v27 = v22 + v23;
v28 = std::__search(
v22 + v17,
v22 + v23,
v24,
&v24[v25],
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
if ( v27 == v28 )
v14 = -1;
else
v14 = v28 - v22;
}
}
if ( (v32[0] & 1) != 0 )
operator delete(v33);
}
if ( v17 == v15 && !((int)LOBYTE(v32[0]) >> 1) )
goto LABEL_19;
v18 = (char *)v32 + 1;
LABEL_18:
v31 = (char *)v18;
v34[0] = 0;
v34[1] = 0;
v35 = nullptr;
v19 = strlen(v18);
std::string::__init(v34, v31, v19);
v20 = (cocos2d::CCObject *)cocos2d::CCString::create(v34);
cocos2d::CCArray::addObject(v6, v20);
if ( (v34[0] & 1) == 0 )
goto LABEL_19;
operator delete(v35);
if ( v14 != -1 )
goto LABEL_20;
LABEL_34:
if ( (v32[0] & 1) != 0 )
operator delete(v33);
return v6;
}