//
// SongInfoObject::updateArtists from 0x834140 to 0x834414 (724 bytes)
//
// 2 xrefs:
// > SongInfoObject::init @ 0x83454c
// > ??> @ 0xa3fc8
//
// 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 __fastcall SongInfoObject::updateArtists(__int64 a1, __int64 a2)
{
_QWORD *v2; // x20
_QWORD *v4; // x0
_QWORD *v5; // x19
__int64 v6; // x0
char *v8; // x19
char *v9; // x24
char *v10; // x0
const char *v11; // x27
int v12; // w0
unsigned __int64 v13; // x22
unsigned __int64 v14; // x1
unsigned __int64 v15; // x20
_QWORD *v16; // x0
__int64 v17; // x0
unsigned int *v18; // x3
int v19; // w1
char *v20; // x19
__int64 v21; // x1
__int64 *v22; // x0
unsigned int *v23; // x1
int v24; // w2
int v25; // [xsp+74h] [xbp+74h] BYREF
const char *v26; // [xsp+78h] [xbp+78h] BYREF
void *v27; // [xsp+80h] [xbp+80h] BYREF
void *p; // [xsp+88h] [xbp+88h]
__int64 v29; // [xsp+90h] [xbp+90h]
v2 = (_QWORD *)(a1 + 384);
sub_D18EA8(a1 + 384, a2);
v4 = *(_QWORD **)(a1 + 448);
if ( v4 )
{
do
{
v5 = (_QWORD *)*v4;
operator delete(v4);
v4 = v5;
}
while ( v5 );
}
memset(*(void **)(a1 + 432), 0, 8LL * *(_QWORD *)(a1 + 440));
v6 = *(_QWORD *)(a1 + 384);
*(_QWORD *)(a1 + 456) = 0;
*(_QWORD *)(a1 + 448) = 0;
if ( !*(_QWORD *)(v6 - 24) )
return _stack_chk_guard;
v27 = nullptr;
p = nullptr;
v29 = 0;
sub_830154(v2, &byte_EEFB80, (__int64)&v27);
v8 = (char *)v27;
v9 = (char *)p;
if ( v27 == p )
goto LABEL_27;
do
{
while ( 1 )
{
sub_D18D28(&v26);
v11 = v26;
v12 = atoi(v26);
v13 = v12;
v14 = *(_QWORD *)(a1 + 440);
v25 = v12;
v15 = v12 % v14;
v16 = sub_8269AC((_QWORD *)(a1 + 432), v15, &v25);
if ( !v16 || !*v16 )
break;
v10 = (char *)(v11 - 24);
if ( v11 - 24 != (const char *)&qword_124B6B0 )
goto LABEL_12;
LABEL_9:
v8 += 8;
if ( v9 == v8 )
goto LABEL_17;
}
v17 = operator new(0x10u);
*(_QWORD *)v17 = 0;
*(_DWORD *)(v17 + 8) = v13;
std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_insert_unique_node(
a1 + 432,
v15,
v13,
(_QWORD *)v17);
v11 = v26;
v10 = (char *)(v26 - 24);
if ( v26 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_9;
LABEL_12:
if ( &pthread_create )
{
v18 = (unsigned int *)(v11 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v11 - 2);
*((_DWORD *)v11 - 2) = v19 - 1;
}
if ( v19 > 0 )
goto LABEL_9;
v8 += 8;
operator delete(v10);
}
while ( v9 != v8 );
LABEL_17:
v20 = (char *)v27;
v9 = (char *)p;
if ( v27 != p )
{
do
{
v21 = *(_QWORD *)v20;
v22 = (__int64 *)(*(_QWORD *)v20 - 24LL);
if ( v22 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v21 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v21 - 8);
*(_DWORD *)(v21 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v22);
}
v20 += 8;
}
while ( v20 != v9 );
v9 = (char *)v27;
}
LABEL_27:
if ( v9 )
operator delete(v9);
return _stack_chk_guard;
}