//
// LevelTools::getSongObject from 0x605774 to 0x605d60 (1516 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::init @ 0x6dca5c
// > ??> @ 0x32a78
//
// 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
//
// local variable allocation has failed, the output may be wrong!
SongInfoObject *LevelTools::getSongObject(int a1)
{
LevelTools *v2; // x0
SongInfoObject *v3; // x21
void *v4; // x0
void *v5; // x0
void *v6; // x0
void *v7; // x0
void *v8; // x0
void *v9; // x0
void *v10; // x0
void *v11; // x0
void *v12; // x0
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
std::string v32; // [xsp+0h] [xbp-30h]
std::string v33; // [xsp+10h] [xbp-20h]
unsigned int v34; // [xsp+9Ch] [xbp+6Ch]
__int64 v35; // [xsp+D0h] [xbp+A0h] BYREF
__int64 v36; // [xsp+D8h] [xbp+A8h] BYREF
__int64 v37; // [xsp+E0h] [xbp+B0h] BYREF
__int64 v38; // [xsp+E8h] [xbp+B8h] BYREF
__int64 v39; // [xsp+F0h] [xbp+C0h] BYREF
__int64 v40; // [xsp+F8h] [xbp+C8h] BYREF
__int64 v41; // [xsp+100h] [xbp+D0h] BYREF
__int64 v42; // [xsp+108h] [xbp+D8h] BYREF
__int64 v43; // [xsp+110h] [xbp+E0h] BYREF
LevelTools::getAudioTitle(*(LevelTools **)&a1, (__int64)&v35);
v2 = (LevelTools *)LevelTools::artistForAudio(a1);
v34 = (unsigned int)v2;
LevelTools::nameForArtist(v2, (__int64)&v36);
sub_D18D28(&v37, &v35);
sub_D18D28(&v38, &v36);
sub_D153B8((int)&v39, &byte_F288A0);
sub_D153B8((int)&v40, &byte_F288A0);
sub_D153B8((int)&v41, &byte_F288A0);
sub_D153B8((int)&v42, &byte_F288A0);
sub_D153B8((int)&v43, &byte_F288A0);
LODWORD(v32.m_data.m_data) = 0;
LOBYTE(v33.m_data.m_data) = 0;
v3 = (SongInfoObject *)((SongInfoObject *(__fastcall *)(SongInfoObject *__hidden, int, std::string, std::string, int, float, std::string, std::string, std::string, std::string, int, std::string, bool, int))SongInfoObject::create)(
(SongInfoObject *)(unsigned int)a1,
(int)&v37,
(std::string)&v38,
(std::string)v34,
(int)&v39,
0.0,
(std::string)&v40,
(std::string)&v41,
(std::string)&v42,
v32,
(int)&v43,
v33,
0,
-1);
v4 = (void *)(v43 - 24);
if ( (__int64 *)(v43 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v43 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v43 - 8);
*(_DWORD *)(v43 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v4);
}
v5 = (void *)(v42 - 24);
if ( (__int64 *)(v42 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v42 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v42 - 8);
*(_DWORD *)(v42 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v5);
}
v6 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v41 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v6);
}
v7 = (void *)(v40 - 24);
if ( (__int64 *)(v40 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v40 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v40 - 8);
*(_DWORD *)(v40 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v7);
}
v8 = (void *)(v39 - 24);
if ( (__int64 *)(v39 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v39 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v39 - 8);
*(_DWORD *)(v39 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v8);
}
v9 = (void *)(v38 - 24);
if ( (__int64 *)(v38 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v38 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v38 - 8);
*(_DWORD *)(v38 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v9);
}
v10 = (void *)(v37 - 24);
if ( (__int64 *)(v37 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v37 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v37 - 8);
*(_DWORD *)(v37 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v10);
}
v11 = (void *)(v36 - 24);
if ( (__int64 *)(v36 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v36 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(_DWORD *)(v36 - 8);
*(_DWORD *)(v36 - 8) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v11);
}
v12 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v35 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v12);
}
return v3;
}