//
// sub_74769C from 0x74769c to 0x7478d0 (564 bytes)
//
// 2 xrefs:
// > CustomSongWidget::updateWithMultiAssets @ 0x748744
// > CustomSongWidget::updateWithMultiAssets @ 0x748764
//
// 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 sub_74769C(_QWORD *a1, __int64 a2)
{
__int64 v4; // x20
unsigned __int64 v5; // x19
__int64 v6; // x3
__int64 v7; // x25
__int64 v8; // x0
void *v9; // x0
unsigned int *v10; // x1
int v11; // w2
void *v12; // x0
unsigned int *v14; // x19
int v15; // w1
__int64 v16; // [xsp+80h] [xbp+80h] BYREF
v4 = sub_D168E0((int)a1, &byte_F804F8, 0, 1u);
v5 = 0;
v6 = v4;
v7 = *(_QWORD *)(*a1 - 24LL);
while ( 1 )
{
sub_D14F84(&v16, a1, v5, v6);
if ( v7 == v5 && !*(_QWORD *)(v16 - 24) )
goto LABEL_9;
v8 = *(_QWORD *)(a2 + 8);
if ( v8 == *(_QWORD *)(a2 + 16) )
break;
if ( v8 )
{
sub_D18D28(v8);
v8 = *(_QWORD *)(a2 + 8);
}
*(_QWORD *)(a2 + 8) = v8 + 8;
LABEL_9:
if ( v4 == -1 )
goto LABEL_17;
LABEL_10:
v5 = v4 + 1;
v4 = sub_D168E0((int)a1, &byte_F804F8, (int)v4 + 1, 1u);
v9 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v16 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
}
v6 = v4 - v5;
if ( *(_QWORD *)(*a1 - 24LL) < v5 )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v5,
*(_QWORD *)(*a1 - 24LL));
}
std::vector::_M_emplace_back_aux(a2, (__int64)&v16);
if ( v4 != -1 )
goto LABEL_10;
LABEL_17:
v12 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v16 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v12);
}
return _stack_chk_guard;
}