//
// sub_97101C from 0x97101c to 0x971298 (636 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::dataLoaded @ 0x979a70
// > MusicDownloadManager::dataLoaded @ 0x979e30
//
// 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:41 +0000
//
__int64 __fastcall sub_97101C(unsigned __int8 *a1, __int64 **a2)
{
unsigned __int64 v3; // x22
int v4; // w26
int v5; // w28
unsigned __int64 v6; // x19
unsigned __int8 *v7; // x27
size_t v8; // x2
unsigned __int8 *v9; // x0
char *v10; // x0
int v11; // w26
size_t v12; // x2
char *v13; // x28
int v14; // w0
_BYTE *v15; // x0
size_t v16; // x22
char *v17; // x26
char *v18; // x26
int v19; // w22
int v22; // [xsp+84h] [xbp+84h] BYREF
int *v23; // [xsp+88h] [xbp+88h] BYREF
__int64 v24; // [xsp+90h] [xbp+90h] BYREF
size_t v25; // [xsp+98h] [xbp+98h]
void *v26; // [xsp+A0h] [xbp+A0h]
__int64 v27[2]; // [xsp+A8h] [xbp+A8h] BYREF
char *v28; // [xsp+B8h] [xbp+B8h]
__int64 v29[2]; // [xsp+C0h] [xbp+C0h] BYREF
char *v30; // [xsp+D0h] [xbp+D0h]
v3 = 0;
LABEL_2:
v4 = *a1;
v5 = v4 & 1;
if ( (v4 & 1) == 0 )
goto LABEL_10;
LABEL_3:
v6 = *((_QWORD *)a1 + 1);
if ( v3 >= v6 )
return _stack_chk_guard;
v7 = *((unsigned __int8 **)a1 + 2);
v8 = v6 - v3;
v9 = &v7[v3];
if ( v6 == v3 )
goto LABEL_7;
while ( 1 )
{
v10 = (char *)memchr(v9, 44, v8);
if ( !v10 || (v6 = v10 - (char *)v7, v10 - (char *)v7 == -1) )
{
LODWORD(v6) = v4 >> 1;
if ( v5 )
{
v6 = *((_QWORD *)a1 + 1);
goto LABEL_7;
}
LABEL_12:
v6 = (int)v6;
}
LABEL_7:
std::string::basic_string(&v24, (__int64)a1, v3, v6 - v3);
v11 = v24 & 1;
if ( v11 )
{
v12 = v25;
v3 = v6 + 1;
v13 = (char *)v26;
if ( !v25 )
goto LABEL_9;
}
else
{
v14 = (int)(unsigned __int8)v24 >> 1;
v3 = v6 + 1;
v13 = (char *)&v24 + 1;
v12 = v14;
if ( !v14 )
goto LABEL_2;
}
v15 = memchr(v13, 58, v12);
if ( v15 )
{
v16 = v15 - v13;
if ( v15 - v13 != -1 )
{
std::string::basic_string(v27, (__int64)&v24, 0, v16);
if ( (v27[0] & 1) != 0 )
{
v17 = v28;
v22 = atoi(v28);
operator delete(v17);
}
else
{
v22 = atoi((const char *)v27 + 1);
}
std::string::basic_string(v29, (__int64)&v24, v16 + 1, 0xFFFFFFFFFFFFFFFFLL);
if ( (v29[0] & 1) != 0 )
{
v18 = v30;
v19 = atoi(v30);
operator delete(v18);
}
else
{
v19 = atoi((const char *)v29 + 1);
}
if ( v19 > 0 && v22 )
{
v23 = &v22;
*(_DWORD *)(std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
a2,
&v22,
(__int64)&unk_1168A28,
&v23)
+ 32) = v19;
}
v11 = v24 & 1;
}
}
v3 = v6 + 1;
if ( !v11 )
goto LABEL_2;
LABEL_9:
operator delete(v26);
v4 = *a1;
v5 = v4 & 1;
if ( (v4 & 1) != 0 )
goto LABEL_3;
LABEL_10:
LODWORD(v6) = v4 >> 1;
if ( v3 >= v4 >> 1 )
return _stack_chk_guard;
v8 = (int)v6 - v3;
v7 = a1 + 1;
v9 = &a1[v3 + 1];
if ( !v8 )
goto LABEL_12;
}
}