//
// ChanceTriggerGameObject::remapChanceObjects from 0x1001c2c70 to 0x1001c2db1 (321 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::applyRemap @ 0x10012d14e
//
// 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 ChanceTriggerGameObject::remapChanceObjects(
ChanceTriggerGameObject *a1,
std::unordered_map *const a2)
{
std::__vector_base::pointer begin; // r8
std::__vector_base::pointer end; // rdi
unsigned __int64 value; // r10
unsigned __int64 v5; // rax
std::__hash_node_base, void *> *> **v6; // r9
std::__hash_node_base, void *> *> *v7; // rcx
std::__hash_node_base, void *> *> *v8; // rsi
std::__hash_node_base, void *> *>::__next_pointer v9; // r10
unsigned __int64 m_groupID; // rcx
unsigned __int64 v11; // rsi
std::__hash_node_base, void *> *> *v12; // rax
std::__hash_node_base, void *> *>::__next_pointer next; // r11
unsigned __int64 v14; // rax
begin = a1->m_chanceObjects.__begin_;
end = a1->m_chanceObjects.__end_;
if ( begin == end )
return;
value = a2->__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
v5 = value - 1;
if ( !value )
return;
v6 = a2->__table_.__bucket_list_.__ptr_.__value_;
if ( ((value - 1) & value) != 0 )
{
while ( 1 )
{
m_groupID = begin->m_groupID;
v11 = m_groupID;
if ( value <= m_groupID )
{
if ( !((value | m_groupID) >> 32) )
{
v11 = (unsigned int)m_groupID % (unsigned int)value;
v12 = v6[v11];
if ( !v12 )
goto LABEL_14;
LABEL_19:
next = v12->__next_;
while ( 2 )
{
if ( !next )
goto LABEL_14;
v14 = (unsigned __int64)next[1].__next_;
if ( v14 == m_groupID )
{
if ( LODWORD(next[2].__next_) == (_DWORD)m_groupID )
{
begin->m_groupID = HIDWORD(next[2].__next_);
goto LABEL_14;
}
}
else if ( v14 < value )
{
LABEL_27:
if ( v14 != v11 )
goto LABEL_14;
}
else
{
if ( (value | v14) >> 32 )
{
v14 %= value;
goto LABEL_27;
}
if ( (unsigned int)v14 % (unsigned int)value != v11 )
goto LABEL_14;
}
next = next->__next_;
continue;
}
}
v11 = m_groupID % value;
}
v12 = v6[v11];
if ( v12 )
goto LABEL_19;
LABEL_14:
if ( ++begin == end )
return;
}
}
do
{
v7 = (std::__hash_node_base, void *> *> *)begin->m_groupID;
v8 = v6[(unsigned __int64)v7 & v5];
if ( v8 )
{
while ( 1 )
{
v8 = v8->__next_;
if ( !v8 )
break;
v9 = v8[1].__next_;
if ( v9 == v7 )
{
if ( LODWORD(v8[2].__next_) == (_DWORD)v7 )
{
begin->m_groupID = HIDWORD(v8[2].__next_);
break;
}
}
else if ( (v5 & (unsigned __int64)v9) != ((unsigned __int64)v7 & v5) )
{
break;
}
}
}
++begin;
}
while ( begin != end );
}