//
// sub_100555060 from 0x100555060 to 0x1005551b5 (341 bytes)
//
// 1 xrefs:
// > sub_1008C9860 @ 0x1008c989c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:32:05 +0000
//
__int64 __fastcall sub_100555060(__int64 a1, int a2)
{
unsigned __int64 v2; // r9
__int64 result; // rax
unsigned __int64 v4; // r10
unsigned __int64 v5; // r8
__int64 **v6; // rdx
__int64 *v7; // rdi
unsigned __int64 v8; // r9
unsigned __int64 v9; // rax
__int64 v10; // rdx
v2 = *(_QWORD *)(a1 + 368);
result = 0;
if ( v2 )
{
v4 = (0x101010101010101LL
* ((((v2 - ((v2 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v2 - ((v2 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v2 - ((v2 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v2 - ((v2 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v4 > 1 )
{
v5 = a2;
if ( v2 <= a2 )
{
if ( (v2 | a2) >> 32 )
v5 = a2 % v2;
else
v5 = a2 % (unsigned int)v2;
result = 0;
}
}
else
{
v5 = a2 & (v2 - 1);
}
v6 = *(__int64 ***)(*(_QWORD *)(a1 + 360) + 8 * v5);
if ( v6 )
{
v7 = *v6;
if ( *v6 )
{
if ( (unsigned int)v4 < 2 )
{
v8 = v2 - 1;
while ( 1 )
{
v10 = v7[1];
if ( v10 == a2 )
{
if ( *((_DWORD *)v7 + 4) == a2 )
return *((unsigned int *)v7 + 5);
}
else if ( (v8 & v10) != v5 )
{
return result;
}
v7 = (__int64 *)*v7;
if ( !v7 )
return result;
}
}
while ( 1 )
{
v9 = v7[1];
if ( v9 == a2 )
{
if ( *((_DWORD *)v7 + 4) == a2 )
return *((unsigned int *)v7 + 5);
}
else
{
if ( v9 < v2 )
goto LABEL_19;
if ( (v2 | v9) >> 32 )
{
v9 %= v2;
LABEL_19:
if ( v9 != v5 )
return 0;
goto LABEL_14;
}
if ( (unsigned int)v9 % (unsigned int)v2 != v5 )
return 0;
}
LABEL_14:
v7 = (__int64 *)*v7;
if ( !v7 )
return 0;
}
}
}
}
return result;
}