//
// sub_10065D9C0 from 0x10065d9c0 to 0x10065db6c (428 bytes)
//
// 4 xrefs:
// > MusicDownloadManager::parseMusicLibrary @ 0x10065b813
// > MusicDownloadManager::parseMusicLibrary @ 0x10065c332
// > SongInfoObject::createWithCoder @ 0x100664fa3
// > SongInfoObject::createWithCoder @ 0x100665059
//
// 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:34:55 +0000
//
void __fastcall sub_10065D9C0(std::string *a1, __int64 a2)
{
std::string *v2; // rbx
unsigned int v3; // eax
size_t v4; // r15
std::string::size_type v5; // r13
__int64 v6; // rcx
__int64 v7; // rcx
unsigned __int64 v8; // rdx
void *v9; // rax
__int64 v10; // rbx
const void **v11; // r13
bool v12; // r12
unsigned __int64 v13; // r14
char *v14; // rdi
int v15; // eax
__int64 v16; // rax
unsigned int v17; // eax
unsigned int v18; // eax
std::string *v19; // rbx
std::string::size_type size; // rax
const std::string::value_type *p_s; // rsi
std::string::size_type v22; // rdx
__int64 v23; // [rsp+0h] [rbp-60h]
unsigned __int8 v25; // [rsp+18h] [rbp-48h] BYREF
std::string::value_type __s; // [rsp+19h] [rbp-47h] BYREF
std::string::size_type v27; // [rsp+20h] [rbp-40h]
void *__p; // [rsp+28h] [rbp-38h]
void *__s2; // [rsp+30h] [rbp-30h]
v2 = a1;
v3 = *(unsigned __int8 *)(a2 + 32);
if ( (v3 & 1) != 0 )
{
v4 = *(_QWORD *)(a2 + 40);
if ( !v4 )
return;
}
else
{
v4 = v3 >> 1;
if ( !(v3 >> 1) )
return;
}
v5 = a1[24].__r_.__value_.__r.__words[0];
v6 = a1[24].__r_.__value_.__l.__size_ - v5;
if ( !v6 )
goto LABEL_20;
v7 = v6 >> 3;
v8 = 0x6DB6DB6DB6DB6DB7LL * v7;
if ( (v3 & 1) != 0 )
v9 = *(void **)(a2 + 48);
else
v9 = (void *)(a2 + 33);
__s2 = v9;
v10 = -(__int64)((v8 == 0) + v8);
v11 = (const void **)(v5 + 48);
v12 = 1;
v13 = 1;
v23 = 0x6DB6DB6DB6DB6DB7LL * v7;
while ( 1 )
{
v17 = *((unsigned __int8 *)v11 - 16);
if ( (v17 & 1) == 0 )
break;
if ( *(v11 - 1) == (const void *)v4 )
goto LABEL_17;
LABEL_12:
v12 = v13 < v8;
v16 = v10 + v13++ + 1;
v11 += 7;
if ( v16 == 1 )
goto LABEL_19;
}
if ( v17 >> 1 != v4 )
goto LABEL_12;
LABEL_17:
if ( (v17 & 1) != 0 )
v14 = (char *)*v11;
else
v14 = (char *)v11 - 15;
v15 = memcmp(v14, __s2, v4);
v8 = v23;
if ( v15 )
goto LABEL_12;
LABEL_19:
v2 = a1;
if ( v12 )
return;
LABEL_20:
sub_10065D550((__int64)&v2[24], a2);
v18 = (unsigned int)v2[22].__r_.__value_.__l.0;
if ( (v18 & 1) != 0 )
{
size = v2[22].__r_.__value_.__l.__size_;
v19 = v2 + 22;
if ( !size )
goto LABEL_25;
goto LABEL_24;
}
v19 = v2 + 22;
if ( v18 >> 1 )
LABEL_24:
std::string::append(v19, ";");
LABEL_25:
MusicDownloadManager::linkRowString(&v25, a2);
if ( (v25 & 1) != 0 )
{
p_s = (const std::string::value_type *)__p;
v22 = v27;
}
else
{
v22 = v25 >> 1;
p_s = &__s;
}
std::string::append(v19, p_s, v22);
if ( (v25 & 1) != 0 )
operator delete(__p);
}