//
// GJEffectManager::loadPersistentStateString from 0x5cf550 to 0x5cf876 (806 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::parseRecording @ 0x5b0ecc
//
// 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:54:03 +0000
//
_DWORD *__fastcall GJEffectManager::loadPersistentStateString(int a1, unsigned __int8 *a2)
{
int v2; // r9
_DWORD *result; // r0
int v6; // r4
int v7; // r3
int *i; // r4
const char *v9; // r0
const char *v10; // r0
int v11; // r7
unsigned __int8 *j; // r6
const char *v13; // r0
unsigned int v14; // r0
unsigned int v15; // r4
unsigned int v16; // r7
unsigned int v17; // r10
int v18; // r5
_DWORD *v19; // r3
unsigned int v20; // r0
int v21; // r1
float v22; // s13
float v23; // s15
bool v24; // r5
unsigned int v25; // r5
unsigned int v26; // r1
_DWORD *v27; // r3
unsigned int v28; // r0
int v29; // r1
int *v30; // r4
int v31; // [sp+4h] [bp-98h]
unsigned int v32; // [sp+20h] [bp-7Ch] BYREF
int v33; // [sp+24h] [bp-78h] BYREF
int v34; // [sp+28h] [bp-74h]
int v35; // [sp+2Ch] [bp-70h]
unsigned __int8 *v36; // [sp+30h] [bp-6Ch] BYREF
_DWORD v37[2]; // [sp+34h] [bp-68h] BYREF
void *v38[3]; // [sp+3Ch] [bp-60h] BYREF
int *v39; // [sp+48h] [bp-54h] BYREF
int v40; // [sp+4Ch] [bp-50h] BYREF
__int64 v41; // [sp+50h] [bp-4Ch]
char v42; // [sp+58h] [bp-44h]
int v43; // [sp+5Ch] [bp-40h]
char v44; // [sp+60h] [bp-3Ch]
__int64 v45; // [sp+68h] [bp-34h]
char v46; // [sp+70h] [bp-2Ch]
int v47; // [sp+74h] [bp-28h]
int v48; // [sp+78h] [bp-24h]
int v49; // [sp+7Ch] [bp-20h]
char *v50[3]; // [sp+80h] [bp-1Ch] BYREF
char v51; // [sp+8Ch] [bp-10h]
v2 = a1 + 480;
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::clear((_DWORD *)(a1 + 480));
v31 = a1 + 500;
result = std::__hash_table,std::equal_to,std::allocator>::clear((_DWORD *)(a1 + 500));
v6 = *a2;
if ( (v6 & 1) != 0 )
v7 = *((_DWORD *)a2 + 1);
else
v7 = v6 >> 1;
if ( v7 )
{
v33 = 0;
v34 = 0;
v35 = 0;
sub_5C5FAC(a2, "@", &v33);
if ( -1431655765 * ((v34 - v33) >> 2) )
{
v40 = 0;
LODWORD(v41) = 0;
v39 = &v40;
GameToolbox::stringSetupToMap((unsigned __int8 *)v33, "|", (int *)&v39);
for ( i = v39; i != &v40; i = std::__tree_next *>(i) )
{
if ( (i[4] & 1) != 0 )
v9 = (const char *)i[6];
else
v9 = (char *)i + 17;
v38[0] = (void *)atoi(v9);
if ( (i[7] & 1) != 0 )
v10 = (const char *)i[9];
else
v10 = (char *)i + 29;
v11 = atoi(v10);
*std::unordered_map::operator[](v2, (unsigned int *)v38) = v11;
if ( v11 )
*std::unordered_map::operator[](a1 + 460, (unsigned int *)v38) = v11;
}
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::~__tree((int)&v39);
}
if ( (unsigned int)(-1431655765 * ((v34 - v33) >> 2)) > 1 )
{
v37[0] = 0;
v37[1] = 0;
v36 = (unsigned __int8 *)v37;
GameToolbox::stringSetupToMap((unsigned __int8 *)(v33 + 12), "|", (int *)&v36);
for ( j = v36; ; j = (unsigned __int8 *)std::__tree_next *>(j) )
{
if ( j == (unsigned __int8 *)v37 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::~__tree((int)&v36);
return (_DWORD *)std::__vector_base::~__vector_base((int)&v33);
}
v13 = (j[16] & 1) != 0 ? *((const char **)j + 6) : (const char *)(j + 17);
v14 = atoi(v13);
v15 = *(_DWORD *)(a1 + 504);
v16 = v14;
v32 = v14;
if ( v15 )
{
v17 = v15 - 1;
if ( ((v15 - 1) & v15) != 0 )
v18 = v14 % v15;
else
v18 = v14 & v17;
v19 = *(_DWORD **)(*(_DWORD *)(a1 + 500) + 4 * v18);
if ( v19 )
{
while ( 1 )
{
v19 = (_DWORD *)*v19;
if ( !v19 )
break;
v20 = v19[1];
v21 = ((v15 - 1) & v15) != 0 ? v20 % v15 : v17 & v20;
if ( v21 != v18 )
break;
if ( v19[2] == v16 )
goto LABEL_52;
}
}
}
else
{
v18 = 0;
}
std::__hash_table,std::equal_to,std::allocator>::__construct_node_hash(
(int)v38,
v31,
v16,
&v32);
v22 = *(float *)(a1 + 516);
v23 = (float)(unsigned int)(*(_DWORD *)(a1 + 512) + 1);
if ( v23 > (float)((float)v15 * v22) )
break;
if ( !v15 )
{
v24 = 0;
LABEL_39:
v25 = 2 * v15 + !v24;
v26 = (unsigned int)ceilf(v23 / v22);
if ( v26 < v25 )
v26 = v25;
std::__hash_table,std::equal_to,std::allocator>::rehash(v31, v26);
v15 = *(_DWORD *)(a1 + 504);
if ( ((v15 - 1) & v15) != 0 )
v18 = v16 % v15;
else
v18 = (v15 - 1) & v16;
}
v27 = *(_DWORD **)(*(_DWORD *)(a1 + 500) + 4 * v18);
if ( v27 )
{
*(_DWORD *)v38[0] = *v27;
*v27 = v38[0];
}
else
{
*(_DWORD *)v38[0] = *(_DWORD *)(a1 + 508);
*(void **)(a1 + 508) = v38[0];
*(_DWORD *)(*(_DWORD *)(a1 + 500) + 4 * v18) = a1 + 508;
if ( *(_DWORD *)v38[0] )
{
v28 = *(_DWORD *)(*(_DWORD *)v38[0] + 4);
if ( ((v15 - 1) & v15) != 0 )
v29 = v28 % v15;
else
v29 = (v15 - 1) & v28;
*(void **)(*(_DWORD *)(a1 + 500) + 4 * v29) = v38[0];
}
}
++*(_DWORD *)(a1 + 512);
LABEL_52:
v30 = std::unordered_map::operator[](a1 + 564, &v32);
timerItemFromString((int)&v39, j + 28);
*v30 = (int)v39;
*((_QWORD *)v30 + 1) = v41;
*((_BYTE *)v30 + 16) = v42;
v30[5] = v43;
*((_BYTE *)v30 + 24) = v44;
*((_QWORD *)v30 + 4) = v45;
*((_BYTE *)v30 + 40) = v46;
v30[11] = v47;
v30[12] = v48;
v30[13] = v49;
sub_5C2046((char **)v30 + 14, v50);
*((_BYTE *)v30 + 68) = v51;
std::__vector_base::~__vector_base(v50);
}
v24 = v15 > 2 && ((v15 - 1) & v15) == 0;
goto LABEL_39;
}
return (_DWORD *)std::__vector_base::~__vector_base((int)&v33);
}
return result;
}