//
// sub_14018AD60 from 0x14018ad60 to 0x14018adef (143 bytes)
//
// 12 xrefs:
// > GameManager::init @ 0x14017b571
// > EnterEffectInstance::EnterEffectInstance @ 0x1402043b6
// > GJBaseGameLayer::init @ 0x14020760a
// > GJBaseGameLayer::init @ 0x14020761b
// > GJBaseGameLayer::addToSection @ 0x140226672
// > GJBaseGameLayer::addToSection @ 0x14022695e
// > GJBaseGameLayer::addToSection @ 0x140226c24
// > LevelEditorLayer::init @ 0x1402d2421
// > PlayLayer::createObjectsFromSetupFinished @ 0x1403add27
// > ??> @ 0x1406785fc
// > ??> @ 0x14067860c
// > ??> @ 0x1406cb778
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_14018AD60(__int64 *a1, unsigned __int64 a2)
{
char *v2; // rsi
__int64 v4; // r8
unsigned __int64 v5; // rcx
__int64 result; // rax
size_t v7; // rbx
v2 = (char *)a1[1];
v4 = *a1;
v5 = (__int64)&v2[-*a1] >> 2;
if ( a2 >= v5 )
{
if ( a2 > v5 )
{
if ( a2 <= (a1[2] - v4) >> 2 )
{
v7 = 4 * (a2 - v5);
memset(v2, 0, v7);
a1[1] = (__int64)&v2[v7];
return (__int64)&v2[v7];
}
else
{
return sub_14018B410(a1);
}
}
}
else
{
result = v4 + 4 * a2;
a1[1] = result;
}
return result;
}