//
// sub_10066D860 from 0x10066d860 to 0x10066dae3 (643 bytes)
//
// 3 xrefs:
// > SongInfoObject::getArtistLinks @ 0x100666386
// > SongInfoObject::getArtistLinks @ 0x1006663f2
// > SongInfoObject::getArtistLinks @ 0x10066642a
//
// This function is hookable on this platform (idp: pc, 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:35:02 +0000
//
void **__fastcall sub_10066D860(void **a1, __int64 a2, __int64 a3, unsigned __int64 a4)
{
__int64 v5; // r15
char *v6; // rbx
__int64 v7; // rax
void **v8; // r12
void **v9; // r13
void *v10; // rdi
char *v11; // r12
__int64 v12; // r13
__int64 v13; // r12
__int64 v14; // rax
void **v15; // rbx
void **result; // rax
char *v17; // r13
unsigned __int64 v18; // rax
__int64 v19; // r13
_QWORD *v20; // rax
unsigned __int64 v21; // [rsp+8h] [rbp-38h]
v5 = a2;
v6 = (char *)*a1;
v7 = (__int64)a1[2];
if ( 0x6DB6DB6DB6DB6DB7LL * ((v7 - (__int64)*a1) >> 3) < a4 )
{
if ( !v6 )
goto LABEL_29;
v21 = a4;
v8 = a1;
v9 = (void **)a1[1];
v10 = *a1;
if ( v9 == (void **)v6 )
goto LABEL_28;
while ( 1 )
{
if ( (*(_BYTE *)(v9 - 3) & 1) != 0 )
{
operator delete(*(v9 - 1));
if ( (*(_BYTE *)(v9 - 6) & 1) != 0 )
LABEL_10:
operator delete(*(v9 - 4));
}
else if ( (*(_BYTE *)(v9 - 6) & 1) != 0 )
{
goto LABEL_10;
}
v9 -= 7;
if ( v9 == (void **)v6 )
{
v10 = *v8;
LABEL_28:
v8[1] = v6;
operator delete(v10);
*(_OWORD *)v8 = 0;
v8[2] = nullptr;
v7 = 0;
a4 = v21;
a1 = v8;
LABEL_29:
if ( a4 > 0x492492492492492LL )
goto LABEL_37;
v18 = 0x6DB6DB6DB6DB6DB7LL * (v7 >> 3);
if ( 2 * v18 > a4 )
a4 = 2 * v18;
if ( v18 >= 0x249249249249249LL )
a4 = 0x492492492492492LL;
if ( a4 > 0x492492492492492LL )
LABEL_37:
sub_10066C640();
v15 = a1;
v19 = 7 * a4;
v20 = operator new(56 * a4);
*a1 = v20;
a1[1] = v20;
a1[2] = &v20[v19];
result = (void **)sub_10066D740((__int64)a1, a2, a3, v20);
LABEL_36:
v15[1] = result;
return result;
}
}
}
v11 = (char *)a1[1];
if ( 0x6DB6DB6DB6DB6DB7LL * ((v11 - v6) >> 3) < a4 )
{
v12 = a2 + (_BYTE *)a1[1] - v6;
if ( v11 != v6 )
{
v13 = 0;
do
{
*(_QWORD *)&v6[v13] = *(_QWORD *)(a2 + v13);
std::string::operator=((std::string *)&v6[v13 + 8], (const std::string *)(a2 + v13 + 8));
std::string::operator=((std::string *)&v6[v13 + 32], (const std::string *)(a2 + v13 + 32));
v14 = a2 + v13 + 56;
v13 += 56;
}
while ( v14 != v12 );
v11 = (char *)a1[1];
}
v15 = a1;
result = (void **)sub_10066D740((__int64)a1, v12, a3, v11);
goto LABEL_36;
}
v17 = (char *)*a1;
if ( a2 != a3 )
{
do
{
*(_QWORD *)v6 = *(_QWORD *)v5;
std::string::operator=((std::string *)(v6 + 8), (const std::string *)(v5 + 8));
std::string::operator=((std::string *)(v6 + 32), (const std::string *)(v5 + 32));
v6 += 56;
v17 += 56;
v5 += 56;
}
while ( v5 != a3 );
v11 = (char *)a1[1];
}
while ( v11 != v6 )
{
if ( (*(v11 - 24) & 1) != 0 )
operator delete(*((void **)v11 - 1));
if ( (*(v11 - 48) & 1) != 0 )
operator delete(*((void **)v11 - 4));
v11 -= 56;
}
a1[1] = v17;
return a1;
}