//
// GameToolbox::stringSetupToMap from 0x6a4d40 to 0x6a50f4 (948 bytes)
//
// 5 xrefs:
// > GJBaseGameLayer::parseRecording @ 0x9de3b4
// > ColorAction::setupFromString @ 0xa10664
// > GJEffectManager::loadPersistentStateString @ 0xa12bf8
// > GJEffectManager::loadPersistentStateString @ 0xa12cc4
// > ??> @ 0x91df8
//
// 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:50:44 +0000
//
__int64 __fastcall GameToolbox::stringSetupToMap(unsigned __int8 *a1, char *a2, __int64 a3)
{
int v6; // w25
unsigned __int8 *v7; // x19
__int64 v8; // x24
size_t v9; // x0
__int64 v10; // x19
int v11; // w23
unsigned __int64 v12; // x27
char *v13; // x1
size_t v14; // x2
unsigned __int8 *v15; // x19
unsigned __int64 v16; // x26
size_t v17; // x0
unsigned __int8 *v18; // x2
unsigned __int8 *v19; // x26
char *v20; // x0
int v21; // w4
char *v22; // x1
__int64 v23; // x1
__int64 *v24; // x27
__int64 *v25; // x3
char *v26; // x1
size_t v27; // x2
int v29; // w22
size_t v30; // x0
char *v31; // x0
__int64 v32; // x3
unsigned __int8 *v33; // x2
int v34; // w1
char *v35; // x22
__int64 *v36; // x26
__int64 v37; // x0
__int64 *v38; // x1
__int64 v39; // x0
__int64 v40; // [xsp+70h] [xbp+70h] BYREF
__int64 v41; // [xsp+78h] [xbp+78h] BYREF
__int64 v42; // [xsp+80h] [xbp+80h]
void *v43; // [xsp+88h] [xbp+88h]
__int64 v44; // [xsp+90h] [xbp+90h] BYREF
size_t v45; // [xsp+98h] [xbp+98h]
void *v46; // [xsp+A0h] [xbp+A0h]
v6 = *a1;
if ( (v6 & 1) != 0 )
{
v7 = *((unsigned __int8 **)a1 + 2);
v8 = *((_QWORD *)a1 + 1);
v9 = strlen(a2);
if ( !v9 || !v8 || (v32 = (__int64)&v7[v8], v31 = &a2[v9], v7 == &v7[v8]) )
{
LABEL_4:
v10 = -1;
goto LABEL_5;
}
goto LABEL_45;
}
v29 = v6 >> 1;
v30 = strlen(a2);
LODWORD(v8) = v6 >> 1;
if ( !v30 || !v29 )
goto LABEL_4;
v7 = a1 + 1;
v31 = &a2[v30];
v32 = (__int64)&a1[v29 + 1];
if ( a1 + 1 != (unsigned __int8 *)v32 )
{
LABEL_45:
v33 = v7;
while ( 1 )
{
if ( a2 != v31 )
{
v34 = *v33;
if ( (unsigned __int8)*a2 == v34 )
{
LABEL_58:
v10 = v33 - v7;
LABEL_59:
v29 = v6 >> 1;
if ( (v6 & 1) != 0 )
{
v8 = *((_QWORD *)a1 + 1);
goto LABEL_5;
}
goto LABEL_62;
}
v35 = a2;
while ( v31 != ++v35 )
{
if ( (unsigned __int8)*v35 == v34 )
goto LABEL_58;
}
}
if ( (unsigned __int8 *)v32 == ++v33 )
{
v10 = -1;
goto LABEL_59;
}
}
}
v10 = -1;
LABEL_62:
LODWORD(v8) = v29;
LABEL_5:
v41 = 0;
v42 = 0;
v11 = 1;
v43 = nullptr;
v12 = 0;
LABEL_6:
while ( 2 )
{
if ( v12 == (int)v8 )
goto LABEL_12;
std::string::basic_string(&v44, (__int64)a1, v12, v10 - v12);
if ( v11 )
{
if ( (v44 & 1) != 0 )
{
v13 = (char *)v46;
v14 = v45;
}
else
{
v14 = (unsigned __int8)v44 >> 1;
v13 = (char *)&v44 + 1;
}
std::string::assign(&v41, v13, v14);
goto LABEL_11;
}
v23 = (unsigned __int8)v41 >> 1;
if ( (v41 & 1) != 0 )
v23 = v42;
if ( !v23 )
goto LABEL_11;
v24 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__find_equal(
a3,
&v40,
(__int64)&v41);
v25 = (__int64 *)(*v24 + 56);
if ( !*v24 )
{
v36 = (__int64 *)operator new(0x50u);
std::string::basic_string((unsigned __int64)(v36 + 4), &v41);
v36[7] = 0;
v37 = v40;
v38 = v36;
v36[8] = 0;
v36[9] = 0;
*v36 = 0;
v36[1] = 0;
v36[2] = v37;
*v24 = (__int64)v36;
v39 = **(_QWORD **)a3;
if ( v39 )
{
*(_QWORD *)a3 = v39;
v38 = (__int64 *)*v24;
}
std::__tree_balance_after_insert *>(*(__int64 **)(a3 + 8), v38);
v25 = v36 + 7;
++*(_QWORD *)(a3 + 16);
}
if ( v25 == &v44 )
{
LABEL_11:
v11 ^= 1u;
if ( (v44 & 1) == 0 )
goto LABEL_12;
break;
}
if ( (v44 & 1) != 0 )
{
v26 = (char *)v46;
v27 = v45;
}
else
{
v27 = (unsigned __int8)v44 >> 1;
v26 = (char *)&v44 + 1;
}
std::string::assign(v25, v26, v27);
v11 = 1;
if ( (v44 & 1) == 0 )
{
LABEL_12:
if ( v10 == -1 )
goto LABEL_37;
LABEL_13:
v12 = v10 + 1;
if ( (*a1 & 1) != 0 )
{
v15 = *((unsigned __int8 **)a1 + 2);
v16 = *((_QWORD *)a1 + 1);
}
else
{
v15 = a1 + 1;
v16 = *a1 >> 1;
}
v17 = strlen(a2);
if ( !v17 || v12 >= v16 || (v18 = &v15[v12], v19 = &v15[v16], v20 = &a2[v17], &v15[v12] == v19) )
{
v10 = -1;
continue;
}
while ( 1 )
{
if ( a2 != v20 )
{
v21 = *v18;
if ( (unsigned __int8)*a2 == v21 )
{
LABEL_27:
v10 = v18 - v15;
goto LABEL_6;
}
v22 = a2;
while ( v20 != ++v22 )
{
if ( (unsigned __int8)*v22 == v21 )
goto LABEL_27;
}
}
if ( v19 == ++v18 )
{
v10 = -1;
goto LABEL_6;
}
}
}
break;
}
operator delete(v46);
if ( v10 != -1 )
goto LABEL_13;
LABEL_37:
if ( (v41 & 1) != 0 )
operator delete(v43);
return _stack_chk_guard;
}