//
// GJEffectManager::getPersistentState from 0x1002ebef0 to 0x1002ec25d (877 bytes)
//
// 0 xrefs:
//
// 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 GJEffectManager::getPersistentState(
GJEffectManager *a1,
std::unordered_map *a2,
std::unordered_map *a3)
{
std::__hash_node_base, void *> *>::__next_pointer next; // rdi
std::__hash_node_base, void *> *> *v7; // rbx
unsigned __int64 value; // rsi
std::__hash_node_base, void *> *>::__next_pointer v9; // r12
unsigned __int64 v10; // rsi
std::__hash_node_base *>::__next_pointer v11; // r12
unsigned __int64 v12; // rdi
unsigned __int64 next_low; // rcx
unsigned __int64 v14; // rdx
unsigned __int64 v15; // r8
__int64 v16; // rsi
std::__hash_node_base, void *> *> *v17; // rax
std::__hash_node_base, void *> *>::__next_pointer v18; // r13
unsigned __int64 v19; // rdi
std::__hash_node_base, void *> *>::__next_pointer v20; // rax
unsigned __int64 v21; // rax
__int64 v22; // r15
__int128 v23; // xmm0
__int128 v24; // xmm1
std::__hash_node_base, void *> *> *v25; // rbx
std::__hash_node_base, void *> *> *v26; // rdi
std::__hash_node_base, void *> *>::__next_pointer v27; // [rsp+0h] [rbp-40h] BYREF
std::unordered_map *v28; // [rsp+8h] [rbp-38h]
char v29[41]; // [rsp+17h] [rbp-29h] BYREF
if ( a2->__table_.__p2_.__value_ )
{
next = a2->__table_.__p1_.__value_.__next_;
if ( next )
{
do
{
v7 = next->__next_;
operator delete(next);
next = v7;
}
while ( v7 );
}
a2->__table_.__p1_.__value_.__next_ = nullptr;
value = a2->__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( value )
__bzero(a2->__table_.__bucket_list_.__ptr_.__value_, 8 * value);
a2->__table_.__p2_.__value_ = 0;
}
if ( a3->__table_.__p2_.__value_ )
{
v9 = a3->__table_.__p1_.__value_.__next_;
if ( v9 )
{
do
{
v25 = v9->__next_;
v26 = v9[10].__next_;
if ( v26 )
{
v9[11].__next_ = v26;
operator delete(v26);
}
operator delete(v9);
v9 = v25;
}
while ( v25 );
}
a3->__table_.__p1_.__value_.__next_ = nullptr;
v10 = a3->__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( v10 )
__bzero(a3->__table_.__bucket_list_.__ptr_.__value_, 8 * v10);
a3->__table_.__p2_.__value_ = 0;
}
v28 = a3;
if ( &a1->m_persistentItemCountMap != a2 )
{
a2->__table_.__p3_.__value_ = a1->m_persistentItemCountMap.__table_.__p3_.__value_;
sub_1000C10A0(a2, (__int64 *)a1->m_persistentItemCountMap.__table_.__p1_.__value_.__next_, nullptr);
}
v11 = a1->m_persistentTimerItemSet.__table_.__p1_.__value_.__next_;
if ( !v11 )
return;
v12 = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( !v12 )
return;
LABEL_16:
next_low = SLODWORD(v11[2].__next_);
v14 = ((v12 - ((v12 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v12 - ((v12 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL);
v15 = (0x101010101010101LL * ((v14 + (v14 >> 4)) & 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v15 > 1 )
{
v16 = SLODWORD(v11[2].__next_);
if ( v12 <= next_low )
{
if ( !((v12 | next_low) >> 32) )
{
v16 = (unsigned int)next_low % (unsigned int)v12;
v17 = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_[v16];
if ( !v17 )
goto LABEL_45;
goto LABEL_23;
}
v16 = next_low % v12;
}
v17 = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_[v16];
if ( !v17 )
goto LABEL_45;
goto LABEL_23;
}
v16 = next_low & (v12 - 1);
v17 = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_[v16];
if ( !v17 )
goto LABEL_45;
LABEL_23:
v18 = v17->__next_;
if ( !v17->__next_ )
goto LABEL_45;
if ( (unsigned int)v15 < 2 )
{
v19 = v12 - 1;
while ( 1 )
{
v20 = v18[1].__next_;
if ( v20 == (std::__hash_node_base, void *> *>::__next_pointer)next_low )
{
if ( LODWORD(v18[2].__next_) == (_DWORD)next_low )
goto LABEL_41;
}
else if ( (v19 & (unsigned __int64)v20) != v16 )
{
goto LABEL_45;
}
v18 = v18->__next_;
if ( !v18 )
goto LABEL_45;
}
}
while ( 1 )
{
v21 = (unsigned __int64)v18[1].__next_;
if ( v21 == next_low )
break;
if ( v21 < v12 )
goto LABEL_37;
if ( (v12 | v21) >> 32 )
{
v21 %= v12;
LABEL_37:
if ( v21 != v16 )
goto LABEL_45;
goto LABEL_32;
}
if ( (unsigned int)v21 % (unsigned int)v12 != v16 )
goto LABEL_45;
LABEL_32:
v18 = v18->__next_;
if ( !v18 )
goto LABEL_45;
}
if ( LODWORD(v18[2].__next_) != (_DWORD)next_low )
goto LABEL_32;
LABEL_41:
v27 = v18 + 2;
v22 = sub_1002F7F30(v28, &v18[2], &unk_100819506, &v27, v29);
*(std::__hash_node_base, void *> *> *)(v22 + 72) = v18[9];
v23 = *(_OWORD *)&v18[3].__next_;
v24 = *(_OWORD *)&v18[5].__next_;
*(_OWORD *)(v22 + 56) = *(_OWORD *)&v18[7].__next_;
*(_OWORD *)(v22 + 40) = v24;
*(_OWORD *)(v22 + 24) = v23;
if ( (std::__hash_node_base, void *> *>::__next_pointer)v22 != v18 )
sub_1000C51C0(
(char **)(v22 + 80),
(char *)v18[10].__next_,
(__int64)v18[11].__next_,
((char *)v18[11].__next_ - (char *)v18[10].__next_) >> 2);
*(_BYTE *)(v22 + 104) = v18[13].__next_;
LABEL_45:
while ( 1 )
{
v11 = v11->__next_;
if ( !v11 )
break;
v12 = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( v12 )
goto LABEL_16;
}
}