//
// sub_8693EC from 0x8693ec to 0x869774 (904 bytes)
//
// 2 xrefs:
// > CustomSongWidget::updateWithMultiAssets @ 0x86d704
// > CustomSongWidget::updateWithMultiAssets @ 0x86d71c
//
// This function is hookable on this platform (idp: arm, 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:55:41 +0000
//
__int64 __fastcall sub_8693EC(unsigned __int8 *a1, __int64 *a2)
{
int v4; // w19
__int64 v5; // x24
_BYTE *v6; // x20
__int64 v7; // x22
unsigned __int64 v8; // x26
size_t v9; // x0
unsigned __int64 v10; // x19
unsigned __int8 *v11; // x28
size_t v12; // x19
char *v13; // x3
int v14; // w1
size_t v15; // x2
__int64 *v16; // x0
char v17; // w1
size_t v18; // x3
unsigned __int8 *v19; // x2
unsigned __int64 v20; // x0
unsigned __int8 *v21; // x3
unsigned __int8 *v22; // x0
unsigned __int64 v23; // x0
__int64 v24; // x27
char *v25; // x0
__int64 v27; // x1
_BYTE *v28; // x22
std::logic_error *exception; // x19
__int64 v30; // [xsp+60h] [xbp+60h] BYREF
size_t v31; // [xsp+68h] [xbp+68h]
void *v32; // [xsp+70h] [xbp+70h]
v4 = *a1;
if ( (v4 & 1) == 0 )
{
LODWORD(v5) = v4 >> 1;
if ( !(v4 >> 1) )
goto LABEL_3;
v6 = a1 + 1;
v27 = (__int64)&a1[(int)v5 + 1];
if ( a1 + 1 == (unsigned __int8 *)v27 )
{
v7 = -1;
LABEL_52:
v5 = (int)v5;
goto LABEL_5;
}
LABEL_54:
v28 = v6;
if ( *v6 == 44 )
{
v7 = 0;
}
else
{
do
{
if ( (_BYTE *)v27 == ++v28 )
{
v7 = -1;
goto LABEL_59;
}
}
while ( *v28 != 44 );
v7 = v28 - v6;
}
LABEL_59:
LODWORD(v5) = v4 >> 1;
if ( (v4 & 1) != 0 )
{
v5 = *((_QWORD *)a1 + 1);
goto LABEL_5;
}
goto LABEL_52;
}
v5 = *((_QWORD *)a1 + 1);
v6 = *((_BYTE **)a1 + 2);
if ( v5 )
{
v27 = (__int64)&v6[v5];
if ( v6 == &v6[v5] )
goto LABEL_4;
goto LABEL_54;
}
LABEL_3:
v5 = 0;
LABEL_4:
v7 = -1;
LABEL_5:
v8 = 0;
LABEL_6:
v30 = 0;
v9 = v7 - v8;
v31 = 0;
v32 = nullptr;
if ( (v4 & 1) != 0 )
{
LABEL_7:
v10 = *((_QWORD *)a1 + 1);
if ( v8 <= v10 )
{
v11 = *((unsigned __int8 **)a1 + 2);
goto LABEL_9;
}
LABEL_62:
exception = (std::logic_error *)_cxa_allocate_exception(0x10u);
std::logic_error::logic_error(exception, "basic_string");
*(_QWORD *)exception = off_1536D68;
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::logic_error::~logic_error);
}
while ( 1 )
{
v10 = v4 >> 1;
if ( v8 > v10 )
goto LABEL_62;
v11 = a1 + 1;
LABEL_9:
v12 = v10 - v8;
if ( v12 > v9 )
v12 = v9;
if ( v12 > 0xFFFFFFFFFFFFFFEFLL )
sub_62C8BC();
if ( v12 > 0x16 )
{
v23 = (v12 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v24 = v23 | 1;
v25 = (char *)operator new(v23);
v30 = v24;
v13 = v25;
v32 = v25;
v31 = v12;
}
else
{
LOBYTE(v30) = 2 * v12;
v13 = (char *)&v30 + 1;
if ( !v12 )
goto LABEL_14;
}
v13 = (char *)memcpy(v13, &v11[v8], v12);
LABEL_14:
v13[v12] = 0;
v14 = v30 & 1;
v15 = (unsigned __int8)v30 >> 1;
if ( (v30 & 1) != 0 )
v15 = v31;
if ( v15 || v8 != v5 )
break;
LABEL_24:
if ( v7 == -1 )
goto LABEL_46;
LABEL_25:
v4 = *a1;
v8 = v7 + 1;
if ( (v4 & 1) != 0 )
{
v19 = *((unsigned __int8 **)a1 + 2);
v20 = *((_QWORD *)a1 + 1);
}
else
{
v19 = a1 + 1;
v20 = (unsigned __int8)v4 >> 1;
}
v7 = -1;
if ( v8 >= v20 || (v21 = &v19[v8], v22 = &v19[v20], &v19[v8] == v22) )
{
if ( !v14 )
goto LABEL_6;
}
else if ( v19[v8] == 44 )
{
LABEL_42:
v7 = v21 - v19;
if ( !v14 )
goto LABEL_6;
}
else
{
while ( v22 != ++v21 )
{
if ( *v21 == 44 )
goto LABEL_42;
}
v7 = -1;
if ( !v14 )
goto LABEL_6;
}
operator delete(v32);
v4 = *a1;
v30 = 0;
v9 = v7 - v8;
v31 = 0;
v32 = nullptr;
if ( (v4 & 1) != 0 )
goto LABEL_7;
}
v16 = (__int64 *)a2[1];
if ( v16 != (__int64 *)a2[2] )
{
if ( v16 )
{
*v16 = 0;
v16[1] = 0;
v17 = v30;
v16[2] = 0;
if ( (v17 & 1) != 0 )
{
std::string::__init(v16, v32, v31);
}
else
{
v18 = v31;
*v16 = v30;
v16[1] = v18;
v16[2] = (__int64)v32;
}
v16 = (__int64 *)a2[1];
v14 = v30 & 1;
}
a2[1] = (__int64)(v16 + 3);
goto LABEL_24;
}
std::vector::__push_back_slow_path(a2, &v30);
v14 = v30 & 1;
if ( v7 != -1 )
goto LABEL_25;
LABEL_46:
if ( v14 )
operator delete(v32);
return _stack_chk_guard;
}