//
// GameToolbox::stringSetupToMap from 0x1000454f8 to 0x1000456f8 (512 bytes)
//
// 1 xrefs:
// > ColorAction::setupFromString @ 0x10000dee4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GameToolbox::stringSetupToMap(
std::string *const a1,
const char *a2,
std::map *a3)
{
int v6; // w9
std::size_t capacitym1; // x23
std::size_t size; // x22
size_t v9; // x0
bool v10; // zf
__int64 v11; // x27
unsigned __int8 *v12; // x8
unsigned __int8 *v13; // x9
size_t v14; // x11
const char *v15; // x12
std::string::size_type v16; // x23
char v17; // w25
std::string *v18; // x0
__int64 v19; // x8
int v20; // w9
std::size_t v21; // x28
std::size_t v22; // x26
size_t v23; // x0
unsigned __int8 *v25; // x8
unsigned __int8 *v26; // x9
size_t v27; // x11
const char *v28; // x12
std::string __p; // [xsp+0h] [xbp-90h] BYREF
void *v30; // [xsp+18h] [xbp-78h] BYREF
__int64 v31; // [xsp+20h] [xbp-70h]
__int64 v32; // [xsp+28h] [xbp-68h]
char v33; // [xsp+37h] [xbp-59h] BYREF
std::allocator __a[8]; // [xsp+38h] [xbp-58h] BYREF
v6 = a1->m_data.m_short.shortStorage.__elems_[22];
if ( v6 >= 0 )
capacitym1 = (std::size_t)a1;
else
capacitym1 = a1->m_data.m_long.capacitym1;
if ( v6 >= 0 )
size = (unsigned __int8)a1->m_data.m_short.shortStorage.__elems_[22];
else
size = a1->m_data.m_long.size;
v9 = strlen(a2);
if ( size )
v10 = v9 == 0;
else
v10 = 1;
if ( v10 )
{
v11 = -1;
}
else
{
v12 = (unsigned __int8 *)(capacitym1 + size);
v13 = (unsigned __int8 *)capacitym1;
LABEL_13:
v14 = v9;
v15 = a2;
while ( *v13 != *(unsigned __int8 *)v15 )
{
++v15;
if ( !--v14 )
{
if ( ++v13 != v12 )
goto LABEL_13;
v13 = (unsigned __int8 *)(capacitym1 + size);
break;
}
}
if ( v13 == v12 )
v11 = -1;
else
v11 = (__int64)&v13[-capacitym1];
}
v16 = 0;
v30 = nullptr;
v31 = 0;
v17 = 1;
v32 = 0;
while ( 1 )
{
if ( v16 == (int)size )
goto LABEL_33;
std::string::basic_string(&__p, (const std::string *)a1, v16, v11 - v16, __a);
if ( (v17 & 1) != 0 )
{
v18 = (std::string *)&v30;
}
else
{
v19 = HIBYTE(v32);
if ( v32 < 0 )
v19 = v31;
if ( !v19 )
goto LABEL_30;
*(_QWORD *)&__a[0].std::__non_trivial_if = &v30;
v18 = (std::string *)(sub_100048D28(a3, &v30, &unk_100635AD4, __a, &v33) + 56);
}
std::string::operator=(v18, &__p);
LABEL_30:
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v17 ^= 1u;
LABEL_33:
if ( v11 == -1 )
break;
v16 = v11 + 1;
v20 = a1->m_data.m_short.shortStorage.__elems_[22];
if ( v20 >= 0 )
v21 = (std::size_t)a1;
else
v21 = a1->m_data.m_long.capacitym1;
if ( v20 >= 0 )
v22 = (unsigned __int8)a1->m_data.m_short.shortStorage.__elems_[22];
else
v22 = a1->m_data.m_long.size;
v23 = strlen(a2);
v11 = -1;
if ( v22 > v16 && v23 != 0 )
{
v25 = (unsigned __int8 *)(v21 + v22);
v26 = (unsigned __int8 *)(v21 + v16);
LABEL_45:
v27 = v23;
v28 = a2;
while ( *v26 != *(unsigned __int8 *)v28 )
{
++v28;
if ( !--v27 )
{
if ( ++v26 != v25 )
goto LABEL_45;
v26 = (unsigned __int8 *)(v21 + v22);
break;
}
}
if ( v26 == v25 )
v11 = -1;
else
v11 = (__int64)&v26[-v21];
}
}
if ( SHIBYTE(v32) < 0 )
operator delete(v30);
}