//
// sub_140119D30 from 0x140119d30 to 0x140119d92 (98 bytes)
//
// 3 xrefs:
// > DeathMarkerLayer::init @ 0x1401159c9
// > sub_140359D20 @ 0x140359ed7
// > ??> @ 0x140916148
//
// 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 11:26:54 +0000
//
unsigned __int64 __fastcall sub_140119D30(__int64 *a1, unsigned __int64 a2)
{
__int64 v2; // r9
unsigned __int64 v3; // r8
unsigned __int64 result; // rax
int v5; // edx
if ( a2 > 0x7FFFFFFFFFFFFFFFLL )
sub_14011AAD0();
v2 = *a1;
v3 = (a2 + 31) >> 5;
result = (a1[1] - *a1) >> 2;
if ( v3 < result )
{
result = v2 + 4 * v3;
if ( result != a1[1] )
a1[1] = result;
}
a1[3] = a2;
v5 = a2 & 0x1F;
if ( v5 )
{
result = (unsigned int)((1 << v5) - 1);
*(_DWORD *)(v2 + 4 * v3 - 4) &= result;
}
return result;
}