//
// sub_140480270 from 0x140480270 to 0x1404804f7 (647 bytes)
//
// 3 xrefs:
// > MusicDownloadManager::createSongsInfo @ 0x140483321
// > MusicDownloadManager::responseToDict @ 0x14048368f
// > ??> @ 0x14092885c
//
// 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:32:44 +0000
//
// Hidden C++ exception states: #wind=2
cocos2d::CCArray *__fastcall sub_140480270(__int64 *a1, __int64 *a2)
{
cocos2d::CCArray *v4; // r12
unsigned __int64 v5; // rbx
__int64 v6; // r9
__int64 v7; // rcx
unsigned __int64 v8; // rdx
__int64 v9; // rbp
__int64 v10; // r8
__int64 v11; // r9
__int64 v12; // r14
__int64 v13; // r15
unsigned __int64 v14; // rcx
size_t v15; // r8
size_t v16; // rcx
__int64 *v17; // rax
void **v18; // rdx
size_t v19; // r8
struct cocos2d::CCObject *v20; // rax
void *v21; // rcx
__int64 v22; // r9
__int64 v23; // rcx
void *v24; // rcx
void *v25; // rcx
void *Block[2]; // [rsp+38h] [rbp-80h] BYREF
__int64 v28; // [rsp+48h] [rbp-70h]
unsigned __int64 v29; // [rsp+50h] [rbp-68h]
__int128 v30; // [rsp+58h] [rbp-60h] BYREF
__int128 v31; // [rsp+68h] [rbp-50h]
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v5 = 0;
v6 = (__int64)a2;
if ( (unsigned __int64)a2[3] > 0xF )
v6 = *a2;
v7 = (__int64)a1;
if ( (unsigned __int64)a1[3] > 0xF )
v7 = *a1;
v9 = sub_14003EFB0(v7, a1[2], 0, v6, a2[2]);
v12 = a1[2];
v13 = *((int *)a2 + 4);
while ( 1 )
{
*(_OWORD *)Block = 0;
v28 = 0;
v29 = 0;
v14 = a1[2];
if ( v14 < v5 )
sub_14003F4D0(v14, v8, v10, v11);
v15 = v9 - v5;
v16 = v14 - v5;
if ( v16 < v9 - v5 )
v15 = v16;
v17 = a1;
if ( (unsigned __int64)a1[3] > 0xF )
v17 = (__int64 *)*a1;
sub_14003D230(Block, (char *)v17 + v5, v15);
if ( v28 || v5 != v12 )
{
v18 = Block;
if ( v29 > 0xF )
v18 = (void **)Block[0];
v30 = 0;
v31 = 0;
v19 = -1;
do
++v19;
while ( *((_BYTE *)v18 + v19) );
sub_14003D230(&v30, v18, v19);
v20 = (struct cocos2d::CCObject *)cocos2d::CCString::create(&v30);
cocos2d::CCArray::addObject(v4, v20);
if ( *((_QWORD *)&v31 + 1) > 0xFu )
{
v21 = (void *)v30;
if ( (unsigned __int64)(*((_QWORD *)&v31 + 1) + 1LL) >= 0x1000 )
{
v21 = *(void **)(v30 - 8);
if ( (unsigned __int64)(v30 - (_QWORD)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v21);
}
}
if ( v9 == -1 )
break;
v5 = v13 + v9;
v22 = (__int64)a2;
if ( (unsigned __int64)a2[3] > 0xF )
v22 = *a2;
v23 = (__int64)a1;
if ( (unsigned __int64)a1[3] > 0xF )
v23 = *a1;
v9 = sub_14003EFB0(v23, a1[2], v13 + v9, v22, a2[2]);
v8 = v29;
if ( v29 > 0xF )
{
v24 = Block[0];
if ( v29 + 1 >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
goto LABEL_34;
}
j_j_free(v24);
}
}
if ( v29 > 0xF )
{
v25 = Block[0];
if ( v29 + 1 >= 0x1000 )
{
v25 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v25 - 8) > 0x1F )
LABEL_34:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v25);
}
return v4;
}