//
// sub_469BE4 from 0x469be4 to 0x469d7e (410 bytes)
//
// 7 xrefs:
// > DrawGridLayer::loadTimeMarkers @ 0x469e28
// > LevelEditorLayer::lockedLayerForObjectString @ 0x46a098
// > LevelEditorLayer::lockedLayerForObjectString @ 0x46a0cc
// > LevelEditorLayer::createObjectsFromString @ 0x46e7c0
// > LevelSettingsObject::objectFromDict @ 0x474f2e
// > LevelEditorLayer::createObjectsFromSetup @ 0x4758f2
// > LevelEditorLayer::init @ 0x47615e
//
// 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:48:59 +0000
//
int __fastcall sub_469BE4(unsigned __int8 *a1, char *a2, int *a3)
{
int v5; // r4
bool v7; // zf
unsigned __int8 *v8; // r8
size_t v9; // r0
int v10; // r4
unsigned __int8 *v11; // r4
unsigned __int8 *first_of; // r0
int v13; // r10
unsigned int v14; // r9
int v15; // r3
int v16; // r3
int *v17; // r0
int v18; // r4
unsigned __int8 *v19; // r10
unsigned int v20; // r4
size_t v21; // r0
unsigned __int8 *v22; // r4
unsigned __int8 *v23; // r0
unsigned int v25; // r2
unsigned int v26; // r1
int v27; // [sp+8h] [bp-34h]
int v28[3]; // [sp+14h] [bp-28h] BYREF
_DWORD v29[2]; // [sp+20h] [bp-1Ch] BYREF
int *v30; // [sp+28h] [bp-14h]
v5 = *a1;
v7 = (v5 & 1) == 0;
if ( (v5 & 1) != 0 )
{
v8 = *((unsigned __int8 **)a1 + 2);
}
else
{
v8 = a1 + 1;
v5 >>= 1;
}
if ( !v7 )
v5 = *((_DWORD *)a1 + 1);
v9 = strlen(a2);
if ( v5
&& v9
&& (v11 = &v8[v5],
first_of = std::__find_first_of_ce(
v8,
v11,
(int)a2,
(int)&a2[v9],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
first_of != v11) )
{
v10 = first_of - v8;
}
else
{
v10 = -1;
}
v13 = *a1;
v14 = 0;
if ( (v13 & 1) != 0 )
v15 = *((_DWORD *)a1 + 1);
else
v15 = v13 >> 1;
v27 = v15;
while ( 1 )
{
std::string::basic_string(v28, a1, v14, v10 - v14);
if ( (v28[0] & 1) != 0 )
v16 = v28[1];
else
v16 = (int)LOBYTE(v28[0]) >> 1;
if ( v16 || v14 != v27 )
{
v17 = (int *)a3[1];
if ( v17 == (int *)a3[2] )
{
v25 = -1431655765 * (((int)v17 - *a3) >> 2);
v26 = v25 + 1;
if ( v25 + 1 > 0x15555555 )
sub_387C60();
if ( v25 > 0xAAAAAA9 )
{
v26 = 357913941;
}
else if ( v26 < 1431655766 * (((int)v17 - *a3) >> 2) )
{
v26 = 1431655766 * (((int)v17 - *a3) >> 2);
}
std::__split_buffer::__split_buffer(v29, v26, v25, (int)(a3 + 2));
if ( v30 )
std::string::basic_string(v30, (int)v28);
v30 += 3;
std::vector::__swap_out_circular_buffer(a3, v29);
std::__split_buffer::~__split_buffer((int)v29);
}
else
{
if ( v17 )
std::string::basic_string(v17, (int)v28);
a3[1] += 12;
}
}
if ( v10 == -1 )
break;
v14 = v10 + 1;
v18 = *a1;
if ( (v18 & 1) != 0 )
{
v19 = *((unsigned __int8 **)a1 + 2);
v20 = *((_DWORD *)a1 + 1);
}
else
{
v19 = a1 + 1;
v20 = v18 >> 1;
}
v21 = strlen(a2);
if ( v14 >= v20
|| !v21
|| (v22 = &v19[v20],
v23 = std::__find_first_of_ce(
&v19[v14],
v22,
(int)a2,
(int)&a2[v21],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
v23 == v22) )
{
v10 = -1;
}
else
{
v10 = v23 - v19;
}
std::string::~string((int)v28);
}
return std::string::~string((int)v28);
}