//
// GameToolbox::stringSetupToMap from 0x3d250c to 0x3d2658 (332 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::parseRecording @ 0x5b0ade
// > ColorAction::setupFromString @ 0x5ceaac
// > GJEffectManager::loadPersistentStateString @ 0x5cf5ca
// > GJEffectManager::loadPersistentStateString @ 0x5cf64e
//
// 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:46:42 +0000
//
int __fastcall GameToolbox::stringSetupToMap(unsigned __int8 *a1, char *a2, int *a3)
{
int v5; // r4
unsigned __int8 *v6; // r8
int v7; // r6
size_t v8; // r0
int v9; // r4
unsigned __int8 *v10; // r6
unsigned __int8 *first_of; // r0
int v12; // r3
int v13; // r10
unsigned int v14; // r6
bool v15; // nf
unsigned __int8 *v16; // r0
int v17; // r3
int v18; // r4
unsigned __int8 *v19; // r11
unsigned int v20; // r4
size_t v21; // r0
unsigned __int8 *v22; // r4
unsigned __int8 *v23; // r0
int v25; // [sp+8h] [bp-34h]
int v27; // [sp+1Ch] [bp-20h] BYREF
int v28; // [sp+20h] [bp-1Ch]
int v29; // [sp+24h] [bp-18h]
int v30[3]; // [sp+28h] [bp-14h] BYREF
v5 = *a1;
if ( (v5 & 1) != 0 )
{
v6 = *((unsigned __int8 **)a1 + 2);
v7 = *((_DWORD *)a1 + 1);
}
else
{
v6 = a1 + 1;
v7 = v5 >> 1;
}
v8 = strlen(a2);
if ( v7
&& v8
&& (v10 = &v6[v7],
first_of = std::__find_first_of_ce(
v6,
v10,
(int)a2,
(int)&a2[v8],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
first_of != v10) )
{
v9 = first_of - v6;
}
else
{
v9 = -1;
}
v12 = *a1;
v13 = 1;
v14 = 0;
v15 = (v12 & 1) != 0;
v27 = 0;
if ( (v12 & 1) == 0 )
v12 >>= 1;
v28 = 0;
if ( v15 )
v12 = *((_DWORD *)a1 + 1);
v29 = 0;
v25 = v12;
while ( 1 )
{
if ( v14 == v25 )
goto LABEL_24;
std::string::basic_string(v30, a1, v14, v9 - v14);
if ( v13 )
{
v16 = (unsigned __int8 *)&v27;
}
else
{
if ( (v27 & 1) != 0 )
v17 = v28;
else
v17 = (int)(unsigned __int8)v27 >> 1;
if ( !v17 )
goto LABEL_18;
v16 = (unsigned __int8 *)std::map::operator[](a3, &v27);
}
std::string::operator=(v16, (unsigned __int8 *)v30);
LABEL_18:
v13 ^= 1u;
std::string::~string((int)v30);
LABEL_24:
if ( v9 == -1 )
return std::string::~string((int)&v27);
v14 = v9 + 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) )
{
v9 = -1;
}
else
{
v9 = v23 - v19;
}
}
}