//
// SongInfoObject::getTagsString from 0x833df0 to 0x834140 (848 bytes)
//
// 3 xrefs:
// > CustomSongWidget::onMore @ 0x742c58
// > CustomSongWidget::updateSongInfo @ 0x745008
// > ??> @ 0x530a0
//
// 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
//
__int64 *__usercall SongInfoObject::getTagsString@(
__int64 *__return_ptr a1@,
SongInfoObject *this@,
unsigned __int8 a3@)
{
int v4; // w28
std::_Rb_tree_node_base *p_M_header; // x24
SongInfoObject *M_left; // x19
int v8; // w22
int v9; // w25
int m_uIndexInArray; // w21
MusicDownloadManager *v11; // x0
__int64 v12; // x1
__int64 *v13; // x0
unsigned int *v14; // x1
int v15; // w2
void *v16; // x21
unsigned int *v17; // x19
int v18; // w0
cocos2d::CCString *v19; // x0
size_t v20; // x0
void *v21; // x0
unsigned int *v22; // x1
int v23; // w2
const char *CString; // [xsp+78h] [xbp+78h]
__int64 v26; // [xsp+88h] [xbp+88h] BYREF
__int64 v27; // [xsp+90h] [xbp+90h] BYREF
v4 = a3;
if ( a3 )
{
if ( *((_QWORD *)this->m_shortTagsString.m_data.m_data - 3) )
goto LABEL_3;
}
else if ( *((_QWORD *)this->m_longTagsString.m_data.m_data - 3) )
{
LABEL_3:
sub_D18D28(a1);
return a1;
}
if ( this->m_tags._M_t._M_impl._M_node_count )
{
p_M_header = &this->m_tags._M_t._M_impl._M_header;
sub_D153B8((int)&v26, &byte_F288A0);
M_left = (SongInfoObject *)this->m_tags._M_t._M_impl._M_header._M_left;
if ( M_left != (SongInfoObject *)&this->m_tags._M_t._M_impl._M_header )
{
v8 = 0;
v9 = 1;
while ( 1 )
{
m_uIndexInArray = M_left->m_uIndexInArray;
v11 = MusicDownloadManager::sharedState();
MusicDownloadManager::nameForTagID(v11, m_uIndexInArray, (__int64)&v27);
v12 = v27;
v13 = (__int64 *)(v27 - 24);
if ( *(_QWORD *)(v27 - 24) )
{
if ( !v9 )
sub_D15FD4(&v26, ", ", 2);
sub_D15E14(&v26, &v27);
if ( ++v8 > 3 && v4 )
{
if ( (int)(this->m_tags._M_t._M_impl._M_node_count - v8) > 0 )
{
v19 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)" +%i",
(const char *)((unsigned int)this->m_tags._M_t._M_impl._M_node_count - v8));
CString = cocos2d::CCString::getCString(v19);
v20 = strlen(CString);
sub_D15FD4(&v26, CString, v20);
}
v21 = (void *)(v27 - 24);
if ( (__int64 *)(v27 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v27 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v21);
}
LABEL_40:
sub_D18EA8(&this->m_shortTagsString, &v26);
goto LABEL_24;
}
v12 = v27;
v9 = 0;
v13 = (__int64 *)(v27 - 24);
}
if ( v13 == &qword_124B6B0 )
goto LABEL_9;
if ( &pthread_create )
{
v14 = (unsigned int *)(v12 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v12 - 8);
*(_DWORD *)(v12 - 8) = v15 - 1;
}
if ( v15 > 0 )
{
LABEL_9:
M_left = (SongInfoObject *)sub_CFAB74(M_left);
if ( M_left == (SongInfoObject *)p_M_header )
break;
}
else
{
operator delete(v13);
M_left = (SongInfoObject *)sub_CFAB74(M_left);
if ( M_left == (SongInfoObject *)p_M_header )
break;
}
}
}
if ( v4 )
goto LABEL_40;
sub_D18EA8(&this->m_longTagsString, &v26);
LABEL_24:
sub_D18D28(a1);
v16 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v26 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v16);
}
}
else
{
sub_D153B8((int)a1, &byte_F288A0);
}
return a1;
}