//
// GJGameState::getGameObjectPhysics from 0x10010e7c0 to 0x10010e9a7 (487 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
//
GameObjectPhysics *__fastcall GJGameState::getGameObjectPhysics(GJGameState *a1, GameObject *a2)
{
unsigned __int64 m_uniqueID; // rcx
std::unordered_map *p_m_gameObjectPhysics; // r15
unsigned __int64 value; // rdi
unsigned __int64 v7; // r8
__int64 v8; // rsi
std::__hash_node_base, void *> *> *v9; // rax
__int64 next; // rax
unsigned __int64 v11; // rdi
__int64 v12; // rdx
unsigned __int64 v13; // rdx
GameObjectPhysics *result; // rax
__int64 v15; // [rsp+0h] [rbp-50h] BYREF
_BYTE v16[8]; // [rsp+8h] [rbp-48h] BYREF
_BYTE v17[8]; // [rsp+10h] [rbp-40h] BYREF
__int128 v18; // [rsp+18h] [rbp-38h]
int v19; // [rsp+28h] [rbp-28h]
_DWORD v20[7]; // [rsp+34h] [rbp-1Ch] BYREF
m_uniqueID = a2->m_uniqueID;
v20[0] = a2->m_uniqueID;
p_m_gameObjectPhysics = &a1->m_gameObjectPhysics;
value = a1->m_gameObjectPhysics.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( !value )
goto LABEL_27;
v7 = (0x101010101010101LL
* ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v7 > 1 )
{
v8 = m_uniqueID;
if ( value <= m_uniqueID )
{
if ( !((value | m_uniqueID) >> 32) )
{
v8 = (unsigned int)m_uniqueID % (unsigned int)value;
v9 = p_m_gameObjectPhysics->__table_.__bucket_list_.__ptr_.__value_[v8];
if ( !v9 )
goto LABEL_27;
goto LABEL_9;
}
v8 = m_uniqueID % value;
}
v9 = p_m_gameObjectPhysics->__table_.__bucket_list_.__ptr_.__value_[v8];
if ( !v9 )
goto LABEL_27;
goto LABEL_9;
}
v8 = m_uniqueID & (value - 1);
v9 = p_m_gameObjectPhysics->__table_.__bucket_list_.__ptr_.__value_[v8];
if ( !v9 )
goto LABEL_27;
LABEL_9:
next = (__int64)v9->__next_;
if ( next )
{
if ( (unsigned int)v7 < 2 )
{
v11 = value - 1;
while ( 1 )
{
v12 = *(_QWORD *)(next + 8);
if ( v12 == m_uniqueID )
{
if ( *(_DWORD *)(next + 16) == (_DWORD)m_uniqueID )
goto LABEL_28;
}
else if ( (v11 & v12) != v8 )
{
goto LABEL_27;
}
next = *(_QWORD *)next;
if ( !next )
goto LABEL_27;
}
}
do
{
v13 = *(_QWORD *)(next + 8);
if ( v13 == m_uniqueID )
{
if ( *(_DWORD *)(next + 16) == (_DWORD)m_uniqueID )
goto LABEL_28;
}
else
{
if ( v13 >= value )
{
if ( (value | v13) >> 32 )
v13 %= value;
else
v13 = (unsigned int)v13 % (unsigned int)value;
}
if ( v13 != v8 )
break;
}
next = *(_QWORD *)next;
}
while ( next );
}
LABEL_27:
v15 = 0;
sub_10028CC30(v16);
sub_10028CC30(v17);
v18 = 0;
v19 = 0;
next = sub_1001662E0(p_m_gameObjectPhysics, v20, v20, &v15);
*(_QWORD *)(next + 24) = a2;
LABEL_28:
result = (GameObjectPhysics *)(next + 24);
result->m_unkInt1 = a1->m_commandIndex;
return result;
}