//
// sub_4E3120 from 0x4e3120 to 0x4e3288 (360 bytes)
//
// 2 xrefs:
// > CustomSongWidget::updateWithMultiAssets @ 0x4e55f6
// > CustomSongWidget::updateWithMultiAssets @ 0x4e5606
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:51:02 +0000
//
int __fastcall sub_4E3120(unsigned __int8 *a1, int *a2)
{
int v3; // r7
int v5; // r3
int v6; // r2
unsigned __int8 *v7; // r3
unsigned __int8 *v8; // r1
unsigned __int8 *v9; // r4
int v10; // r6
int v11; // r4
int v12; // r7
unsigned int v13; // r6
int v14; // r3
size_t v15; // r2
unsigned int v16; // r3
std::logic_error *exception; // r4
unsigned __int8 *v18; // r1
size_t v19; // r3
unsigned __int8 *v20; // r1
int v21; // r3
int *v22; // r0
int v23; // r3
unsigned int v24; // r3
unsigned __int8 *v25; // r2
unsigned __int8 *v26; // r1
unsigned __int8 *v27; // r3
unsigned __int8 *v28; // r4
int v29; // r0
int v31; // [sp+0h] [bp-14h] BYREF
int v32; // [sp+4h] [bp-10h]
int v33; // [sp+8h] [bp-Ch]
v3 = *a1;
if ( (v3 & 1) == 0 )
{
v5 = v3 >> 1;
if ( !(v3 >> 1) )
{
v11 = -1;
goto LABEL_16;
}
v6 = 1;
LABEL_6:
v7 = (unsigned __int8 *)(v5 + v6);
v8 = (unsigned __int8 *)v6;
while ( 1 )
{
v9 = v8;
if ( v8 == v7 )
break;
v10 = *v8++;
if ( v10 == 44 )
{
v11 = (int)&v9[-v6];
goto LABEL_11;
}
}
v11 = -1;
LABEL_11:
if ( (v3 & 1) != 0 )
goto LABEL_14;
LABEL_16:
v12 = v3 >> 1;
goto LABEL_17;
}
v5 = *((_DWORD *)a1 + 1);
v6 = *((_DWORD *)a1 + 2);
if ( v5 )
goto LABEL_6;
v11 = -1;
LABEL_14:
v12 = *((_DWORD *)a1 + 1);
LABEL_17:
v13 = 0;
while ( 1 )
{
v14 = *a1;
v15 = v11 - v13;
v31 = 0;
v32 = 0;
v33 = 0;
if ( (v14 & 1) != 0 )
{
v16 = *((_DWORD *)a1 + 1);
if ( v13 > v16 )
goto LABEL_22;
v18 = *((unsigned __int8 **)a1 + 2);
}
else
{
v16 = v14 >> 1;
if ( v13 > v16 )
{
LABEL_22:
exception = (std::logic_error *)_cxa_allocate_exception(8u);
std::logic_error::logic_error(exception, "basic_string");
*(_DWORD *)exception = &off_D1548C;
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::length_error::~length_error);
}
v18 = a1 + 1;
}
v19 = v16 - v13;
v20 = &v18[v13];
if ( v15 >= v19 )
v15 = v19;
std::string::__init(&v31, v20, v15);
if ( (v31 & 1) != 0 )
v21 = v32;
else
v21 = (int)(unsigned __int8)v31 >> 1;
if ( v21 || v13 != v12 )
{
v22 = (int *)a2[1];
if ( v22 == (int *)a2[2] )
{
std::vector::__push_back_slow_path(a2, (int)&v31);
}
else
{
if ( v22 )
std::string::basic_string(v22, (int)&v31);
a2[1] += 12;
}
}
if ( v11 == -1 )
return std::string::~string((int)&v31);
v23 = *a1;
v13 = v11 + 1;
if ( (v23 & 1) != 0 )
{
v24 = *((_DWORD *)a1 + 1);
v25 = *((unsigned __int8 **)a1 + 2);
}
else
{
v24 = v23 >> 1;
v25 = a1 + 1;
}
if ( v13 < v24 )
{
v26 = &v25[v13];
v27 = &v25[v24];
while ( 1 )
{
v28 = v26;
if ( v26 == v27 )
break;
v29 = *v26++;
if ( v29 == 44 )
{
v11 = v28 - v25;
goto LABEL_46;
}
}
}
v11 = -1;
LABEL_46:
std::string::~string((int)&v31);
}
}