//
// sub_1008C3600 from 0x1008c3600 to 0x1008c3767 (359 bytes)
//
// 1 xrefs:
// > DeathMarkerLayer::init @ 0x1008bcb92
//
// 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:31 +0000
//
unsigned __int64 __fastcall sub_1008C3600(_QWORD *a1, unsigned __int64 a2, char a3)
{
unsigned __int64 result; // rax
unsigned __int64 v4; // rcx
unsigned __int64 v5; // r9
_QWORD *v6; // rbx
int v7; // edi
unsigned __int64 v8; // rdx
unsigned __int64 v9; // r14
unsigned __int64 v10; // rsi
unsigned __int64 v11; // rdx
unsigned __int64 v12; // r14
unsigned __int64 v13; // rsi
result = a1[1];
v4 = result + a2;
a1[1] = result + a2;
if ( !result || ((result - 1) ^ (v4 - 1)) >= 0x40 )
{
v5 = 0;
if ( v4 >= 0x41 )
v5 = (v4 - 1) >> 6;
*(_QWORD *)(*a1 + 8 * v5) = 0;
}
if ( a2 )
{
v6 = (_QWORD *)(*a1 + ((result >> 3) & 0xFFFFFFFFFFFFFFF8LL));
v7 = result & 0x3F;
if ( a3 )
{
if ( (result & 0x3F) != 0 )
{
v8 = a2;
if ( (unsigned int)(64 - v7) < a2 )
v8 = (unsigned int)(64 - v7);
*v6 |= 0xFFFFFFFFFFFFFFFFLL >> (64 - (unsigned __int8)v7 - (unsigned __int8)v8) >> result << result;
a2 -= v8;
++v6;
}
v9 = a2 >> 6;
if ( a2 >= 0x40 )
result = (unsigned __int64)memset(v6, 255, 8 * v9);
v10 = a2 & 0x3F;
if ( v10 )
{
result = 0xFFFFFFFFFFFFFFFFLL >> -(char)v10;
v6[v9] |= result;
}
}
else
{
if ( (result & 0x3F) != 0 )
{
v11 = a2;
if ( (unsigned int)(64 - v7) < a2 )
v11 = (unsigned int)(64 - v7);
*v6 &= ~(0xFFFFFFFFFFFFFFFFLL >> (64 - (unsigned __int8)v7 - (unsigned __int8)v11) >> result << result);
a2 -= v11;
++v6;
}
v12 = a2 >> 6;
if ( a2 >= 0x40 )
result = __bzero(v6, 8 * v12);
v13 = a2 & 0x3F;
if ( v13 )
{
result = ~(0xFFFFFFFFFFFFFFFFLL >> -(char)v13);
v6[v12] &= result;
}
}
}
return result;
}