//
// sub_140486190 from 0x140486190 to 0x140486287 (247 bytes)
//
// 4 xrefs:
// > MusicDownloadManager::createCustomSFXFolder @ 0x14048631e
// > MusicDownloadManager::createCustomSFXPlacement @ 0x1404864f7
// > SFXBrowser::setTextPopupClosed @ 0x14061e963
// > ??> @ 0x140928c1c
//
// 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 11:32:46 +0000
//
_QWORD *__fastcall sub_140486190(_QWORD *a1, char *a2)
{
unsigned __int64 v2; // r10
char *v3; // r8
__int64 v5; // rax
char *v6; // rax
char *v7; // rcx
unsigned __int64 v9; // rcx
char *v10; // r9
__int64 v11; // rax
__int64 v12; // r10
__int64 v13; // rax
__int64 v14; // rdx
unsigned __int64 v15; // rax
size_t v16; // rax
size_t v17; // r10
v2 = *((_QWORD *)a2 + 3);
v3 = a2;
if ( v2 > 0xF )
a2 = *(char **)a2;
v5 = *((_QWORD *)v3 + 2);
if ( !v5 )
goto LABEL_7;
v6 = &a2[v5];
v7 = a2;
if ( a2 >= v6 )
goto LABEL_7;
while ( *v7 == 32 )
{
if ( ++v7 >= v6 )
goto LABEL_7;
}
v9 = v7 - a2;
if ( v9 == -1 )
{
LABEL_7:
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 15;
*(_BYTE *)a1 = 0;
return a1;
}
else
{
v10 = v3;
if ( v2 > 0xF )
v10 = *(char **)v3;
v11 = *((_QWORD *)v3 + 2);
v12 = -1;
if ( v11 )
{
v13 = v11 - 1;
v14 = -1;
if ( v13 != -1 )
v14 = v13;
a2 = &v10[v14];
if ( *a2 == 32 )
{
while ( a2 != v10 )
{
if ( *--a2 != 32 )
goto LABEL_17;
}
}
else
{
LABEL_17:
v12 = a2 - v10;
}
}
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 0;
v15 = *((_QWORD *)v3 + 2);
if ( v15 < v9 )
sub_14003F4D0(v9, a2, v3, v10);
v16 = v15 - v9;
v17 = v12 - v9 + 1;
if ( v16 < v17 )
v17 = v16;
if ( *((_QWORD *)v3 + 3) > 0xFu )
v3 = *(char **)v3;
sub_14003D230(a1, &v3[v9], v17);
return a1;
}
}