//
// sub_100553200 from 0x100553200 to 0x1005533c5 (453 bytes)
//
// 3 xrefs:
// > PlayLayer::setupHasCompleted @ 0x10007b28f
// > sub_1008C9860 @ 0x1008c9889
// > sub_1008CCC60 @ 0x1008cccd2
//
// 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:04 +0000
//
_QWORD *__fastcall sub_100553200(_QWORD *a1, __int64 a2, int a3)
{
unsigned __int64 v3; // r10
unsigned __int64 v4; // r11
unsigned __int64 v5; // r8
__int64 **v6; // rax
__int64 *v7; // rsi
unsigned __int64 v8; // r10
__int64 v9; // rax
unsigned __int64 v10; // rax
__int64 *v11; // rsi
v3 = *(_QWORD *)(a2 + 328);
if ( !v3 )
{
LABEL_30:
*(_WORD *)a1 = 0;
return a1;
}
v4 = (0x101010101010101LL
* ((((v3 - ((v3 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v3 - ((v3 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v3 - ((v3 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v3 - ((v3 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v4 <= 1 )
{
v5 = a3 & (v3 - 1);
v6 = *(__int64 ***)(*(_QWORD *)(a2 + 320) + 8 * v5);
if ( !v6 )
goto LABEL_30;
goto LABEL_9;
}
v5 = a3;
if ( v3 <= a3 )
{
if ( !((v3 | a3) >> 32) )
{
v5 = a3 % (unsigned int)v3;
v6 = *(__int64 ***)(*(_QWORD *)(a2 + 320) + 8 * v5);
if ( !v6 )
goto LABEL_30;
goto LABEL_9;
}
v5 = a3 % v3;
}
v6 = *(__int64 ***)(*(_QWORD *)(a2 + 320) + 8 * v5);
if ( !v6 )
goto LABEL_30;
LABEL_9:
v7 = *v6;
if ( !*v6 )
goto LABEL_30;
if ( (unsigned int)v4 < 2 )
{
v8 = v3 - 1;
while ( 1 )
{
v9 = v7[1];
if ( v9 == a3 )
{
if ( *((_DWORD *)v7 + 4) == a3 )
goto LABEL_27;
}
else if ( (v8 & v9) != v5 )
{
goto LABEL_30;
}
v7 = (__int64 *)*v7;
if ( !v7 )
goto LABEL_30;
}
}
while ( 1 )
{
v10 = v7[1];
if ( v10 == a3 )
break;
if ( v10 < v3 )
goto LABEL_23;
if ( (v3 | v10) >> 32 )
{
v10 %= v3;
LABEL_23:
if ( v10 != v5 )
goto LABEL_30;
goto LABEL_18;
}
if ( (unsigned int)v10 % (unsigned int)v3 != v5 )
goto LABEL_30;
LABEL_18:
v7 = (__int64 *)*v7;
if ( !v7 )
goto LABEL_30;
}
if ( *((_DWORD *)v7 + 4) != a3 )
goto LABEL_18;
LABEL_27:
if ( (v7[3] & 1) == 0 )
{
v11 = v7 + 3;
a1[2] = v11[2];
*(_OWORD *)a1 = *(_OWORD *)v11;
return a1;
}
sub_10001AD30(a1, (const void *)v7[5], v7[4]);
return a1;
}