//
// sub_1008C0CD0 from 0x1008c0cd0 to 0x1008c0f32 (610 bytes)
//
// 2 xrefs:
// > DeathMarkerLayer::updateVisibility @ 0x1008bee17
// > DeathMarkerLayer::updateVisibility @ 0x1008bef29
//
// 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:37:29 +0000
//
unsigned __int64 __fastcall sub_1008C0CD0(__int64 a1, unsigned int a2, double a3)
{
unsigned __int64 result; // rax
unsigned __int64 v5; // rdi
unsigned __int64 v6; // r9
__int64 v7; // rcx
__int64 *v8; // r15
unsigned __int64 v9; // rdi
unsigned __int64 v10; // r12
char v11; // r13
__int64 v12; // rcx
__int64 v13; // rax
__int64 v14; // r14
__int64 v15; // rsi
__int64 v16; // rdi
v5 = *(_QWORD *)(a1 + 352);
if ( !v5 )
return result;
v6 = (0x101010101010101LL
* ((((v5 - ((v5 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v5 - ((v5 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v5 - ((v5 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v5 - ((v5 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v6 > 1 )
{
v7 = a2;
if ( v5 <= a2 )
v7 = a2 % (unsigned int)v5;
}
else
{
v7 = ((_DWORD)v5 - 1) & a2;
}
result = *(_QWORD *)(*(_QWORD *)(a1 + 344) + 8 * v7);
if ( !result )
return result;
v8 = *(__int64 **)result;
if ( !*(_QWORD *)result )
return result;
if ( (unsigned int)v6 < 2 )
{
v9 = v5 - 1;
while ( 1 )
{
result = v8[1];
if ( result == a2 )
{
if ( *((_DWORD *)v8 + 4) == a2 )
goto LABEL_25;
}
else
{
result &= v9;
if ( result != v7 )
return result;
}
v8 = (__int64 *)*v8;
if ( !v8 )
return result;
}
}
while ( 1 )
{
result = v8[1];
if ( result == a2 )
break;
if ( result < v5 )
goto LABEL_21;
if ( (v5 | result) >> 32 )
{
result %= v5;
LABEL_21:
if ( result != v7 )
return result;
goto LABEL_16;
}
result = (unsigned int)result % (unsigned int)v5;
if ( result != v7 )
return result;
LABEL_16:
v8 = (__int64 *)*v8;
if ( !v8 )
return result;
}
if ( *((_DWORD *)v8 + 4) != a2 )
goto LABEL_16;
LABEL_25:
result = v8[3];
if ( v8[4] != result )
{
v10 = 0;
v11 = 0;
do
{
while ( 1 )
{
v12 = *(_QWORD *)(a1 + 320);
v13 = 80LL * *(int *)(result + 4 * v10);
v14 = v12 + v13;
v15 = *(_QWORD *)(v12 + v13 + 64);
if ( v15 || (sub_1008BF550(a1, v12 + v13, a3), (v15 = *(_QWORD *)(v14 + 64)) != 0) )
(*(void (__fastcall **)(_QWORD, __int64, bool))(**(_QWORD **)(a1 + 408) + 464LL))(
*(_QWORD *)(a1 + 408),
v15,
*(_DWORD *)(v14 + 48) == 4);
v16 = *(_QWORD *)(v14 + 72);
if ( !v16 )
break;
*(_QWORD *)&a3 = 3204448256LL;
if ( !*(_BYTE *)(a1 + 449) )
*(_QWORD *)&a3 = 1056964608;
(*(void (__fastcall **)(__int64, double))(*(_QWORD *)v16 + 128LL))(v16, a3);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 416) + 456LL))(
*(_QWORD *)(a1 + 416),
*(_QWORD *)(v14 + 72));
++v10;
result = v8[3];
v11 = 1;
if ( v10 >= (__int64)(v8[4] - result) >> 2 )
return sub_1008C0F40(a1);
}
++v10;
result = v8[3];
}
while ( v10 < (__int64)(v8[4] - result) >> 2 );
if ( (v11 & 1) == 0 )
return result;
return sub_1008C0F40(a1);
}
return result;
}