//
// SongInfoObject::getTagsString from 0x140346e60 to 0x1403471bd (861 bytes)
//
// 3 xrefs:
// > CustomSongWidget::onMore @ 0x1400ca6a4
// > CustomSongWidget::updateSongInfo @ 0x1400cbaf6
// > ??> @ 0x1406d58f4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall SongInfoObject::getTagsString(_QWORD *a1, __int64 a2, char a3)
{
char v3; // si
char v6; // r13
int v7; // r12d
_QWORD *v8; // rax
_QWORD *v9; // rbx
__int64 *p_m_musicTags; // r8
__int64 v11; // rcx
__int64 v12; // rax
__int64 v13; // rax
unsigned __int64 v14; // rdi
size_t v15; // rsi
void **v16; // rdx
void *v17; // rcx
__int64 **v18; // rax
__int64 i; // rax
__int64 *j; // rcx
void **v21; // rbx
void **v22; // rdx
cocos2d::CCString *v24; // rax
char *CString; // rax
size_t v26; // r8
void *v27; // rcx
__int64 v29; // [rsp+28h] [rbp-58h] BYREF
void *Src[2]; // [rsp+38h] [rbp-48h] BYREF
size_t Size; // [rsp+48h] [rbp-38h]
unsigned __int64 v32; // [rsp+50h] [rbp-30h]
void *v33[2]; // [rsp+58h] [rbp-28h] BYREF
size_t v34; // [rsp+68h] [rbp-18h]
unsigned __int64 v35; // [rsp+70h] [rbp-10h]
v3 = a3;
v29 = a2;
if ( a3 )
{
if ( a1[95] )
{
sub_14003BDB0(a2, (__int64)(a1 + 93));
return a2;
}
}
else if ( a1[91] )
{
sub_14003BDB0(a2, (__int64)(a1 + 89));
return a2;
}
if ( !a1[88] )
{
*(_OWORD *)a2 = 0;
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 0;
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 15;
*(_BYTE *)a2 = 0;
return a2;
}
*(_OWORD *)Src = 0;
Size = 0;
v32 = 15;
LOBYTE(Src[0]) = 0;
v6 = 1;
v7 = 0;
v8 = (_QWORD *)a1[87];
v9 = (_QWORD *)*v8;
if ( (_QWORD *)*v8 == v8 )
{
LABEL_39:
v21 = (void **)(a1 + 89);
if ( v3 )
goto LABEL_40;
goto LABEL_41;
}
while ( 1 )
{
LODWORD(v29) = *((_DWORD *)v9 + 7);
p_m_musicTags = (__int64 *)&MusicDownloadManager::sharedState()->m_musicTags;
v11 = *p_m_musicTags;
v12 = *(_QWORD *)(*p_m_musicTags + 8);
while ( !*(_BYTE *)(v12 + 25) )
{
if ( *(_DWORD *)(v12 + 32) >= (int)v29 )
{
v11 = v12;
v12 = *(_QWORD *)v12;
}
else
{
v12 = *(_QWORD *)(v12 + 16);
}
}
if ( *(_BYTE *)(v11 + 25) || (int)v29 < *(_DWORD *)(v11 + 32) )
{
*(_OWORD *)v33 = 0;
v15 = 0;
v34 = 0;
v14 = 15;
v35 = 15;
LOBYTE(v33[0]) = 0;
}
else
{
v13 = sub_1401D0660(p_m_musicTags, (int *)&v29);
sub_14003BDB0((__int64)v33, v13);
v14 = v35;
v15 = v34;
}
if ( !v15 )
{
v3 = a3;
goto LABEL_27;
}
if ( !v6 )
sub_140041270(Src, ", ", 2u);
v16 = v33;
if ( v14 > 0xF )
v16 = (void **)v33[0];
sub_140041270(Src, v16, v15);
v6 = 0;
++v7;
v3 = a3;
if ( a3 )
{
if ( v7 >= 4 )
break;
}
v14 = v35;
LABEL_27:
if ( v14 > 0xF )
{
v17 = v33[0];
if ( v14 + 1 >= 0x1000 )
{
v17 = *((void **)v33[0] - 1);
if ( (unsigned __int64)((char *)v33[0] - (char *)v17 - 8) > 0x1F )
goto LABEL_55;
}
j_j_free(v17);
}
v18 = (__int64 **)v9[2];
if ( *((_BYTE *)v18 + 25) )
{
for ( i = v9[1]; !*(_BYTE *)(i + 25); i = *(_QWORD *)(i + 8) )
{
if ( v9 != *(_QWORD **)(i + 16) )
break;
v9 = (_QWORD *)i;
}
v9 = (_QWORD *)i;
}
else
{
v9 = (_QWORD *)v9[2];
for ( j = *v18; !*((_BYTE *)j + 25); j = (__int64 *)*j )
v9 = j;
}
if ( v9 == (_QWORD *)a1[87] )
goto LABEL_39;
}
if ( *((_DWORD *)a1 + 176) - v7 > 0 )
{
v24 = cocos2d::CCString::createWithFormat(" +%i", *((_DWORD *)a1 + 176) - v7);
CString = (char *)cocos2d::CCString::getCString(v24);
v26 = -1;
do
++v26;
while ( CString[v26] );
sub_140041270(Src, CString, v26);
}
if ( v35 > 0xF )
{
v27 = v33[0];
if ( v35 + 1 >= 0x1000 )
{
v27 = *((void **)v33[0] - 1);
if ( (unsigned __int64)((char *)v33[0] - (char *)v27 - 8) > 0x1F )
LABEL_55:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v27);
}
LABEL_40:
v21 = (void **)(a1 + 93);
LABEL_41:
if ( v21 != Src )
{
v22 = Src;
if ( v32 > 0xF )
v22 = (void **)Src[0];
sub_14003CCE0(v21, v22, Size);
}
sub_14003BDB0(a2, (__int64)v21);
sub_14003A830((__int64)Src);
return a2;
}