//
// sub_14012D2A0 from 0x14012d2a0 to 0x14012d3b8 (280 bytes)
//
// 46 xrefs:
// > EditorUI::pasteObjects @ 0x1401139c3
// > GameStatsManager::tryFixPathBug @ 0x1401d49df
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215f0b
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215f76
// > GJBaseGameLayer::addToSection @ 0x14022671b
// > GJBaseGameLayer::addToSection @ 0x140226a9c
// > GJBaseGameLayer::addToSection @ 0x140226cdf
// > GJBaseGameLayer::resetAreaObjectValues @ 0x140227e77
// > GJBaseGameLayer::processAreaActions @ 0x14022915d
// > GJBaseGameLayer::processDynamicObjectActions @ 0x14022e472
// > GJBaseGameLayer::generateVisibilityGroups @ 0x140231ae8
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236b06
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236bdb
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236ced
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236e87
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236f92
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236fed
// > GJBaseGameLayer::preUpdateVisibility @ 0x1402370c3
// > GJBaseGameLayer::processQueuedAudioTriggers @ 0x14023bbaf
// > GJBaseGameLayer::activateSongTrigger @ 0x14024163c
// > GJBaseGameLayer::activateSongEditTrigger @ 0x1402419af
// > GJBaseGameLayer::activateSFXTrigger @ 0x140241cd9
// > GJBaseGameLayer::activateSFXEditTrigger @ 0x140241ec7
// > GJEffectManager::getMoveCommandNode @ 0x14025f150
// > GJEffectManager::registerRotationCommand @ 0x14025f230
// > GJEffectManager::registerRotationCommand @ 0x14025f25e
// > GJEffectManager::getTempGroupCommand @ 0x14025f2e9
// > GJEffectManager::resetTempGroupCommands @ 0x14025f37f
// > GJEffectManager::prepareMoveActions @ 0x14025f836
// > GJEffectManager::prepareMoveActions @ 0x14025f8fd
// > GJEffectManager::prepareMoveActions @ 0x14026025e
// > GJEffectManager::prepareMoveActions @ 0x14026031e
// > GJEffectManager::processCopyColorPulseActions @ 0x14026166b
// > LevelEditorLayer::updateDisabledObjectsLastPos @ 0x1402dfc99
// > sub_1402E5800 @ 0x1402e6354
// > sub_1402E5800 @ 0x1402e6428
// > sub_1402E5800 @ 0x1402e65c5
// > PlayLayer::scanDynamicSaveObjects @ 0x1403b843b
// > PlayLayer::scanDynamicSaveObjects @ 0x1403b856b
// > PlayLayer::scanDynamicSaveObjects @ 0x1403b85db
// > PlayLayer::scanDynamicSaveObjects @ 0x1403b8672
// > SetupSpawnPopup::updateRemapButtons @ 0x14045f90d
// > ??> @ 0x140670cd8
// > ??> @ 0x140670d28
// > ??> @ 0x140670d40
// > ??> @ 0x1406c9cd8
//
// 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
//
_QWORD *__fastcall sub_14012D2A0(const void **a1, _BYTE *a2, _QWORD *a3)
{
_BYTE *v4; // rdx
__int64 v6; // rbp
__int64 v7; // rax
unsigned __int64 v9; // rcx
unsigned __int64 v10; // r12
unsigned __int64 v11; // rdx
unsigned __int64 v12; // rdi
_QWORD *v13; // rsi
_QWORD *v14; // rcx
_BYTE *v15; // r8
_BYTE *v16; // rdx
size_t v17; // r8
v4 = *a1;
v6 = (a2 - (_BYTE *)*a1) >> 3;
v7 = ((_BYTE *)a1[1] - (_BYTE *)*a1) >> 3;
if ( v7 == 0x1FFFFFFFFFFFFFFFLL )
sub_140062A20(a1, v4, 0x1FFFFFFFFFFFFFFFLL);
v9 = ((_BYTE *)a1[2] - v4) >> 3;
v10 = v7 + 1;
v11 = v9 >> 1;
if ( v9 <= 0x1FFFFFFFFFFFFFFFLL - (v9 >> 1) )
{
v12 = v7 + 1;
if ( v11 + v9 >= v10 )
v12 = v11 + v9;
if ( v12 > 0x1FFFFFFFFFFFFFFFLL )
sub_140007AB0(v9, v11, 0x1FFFFFFFFFFFFFFFLL);
}
else
{
v12 = 0x1FFFFFFFFFFFFFFFLL;
}
v13 = sub_14003AA10(8 * v12);
v13[v6] = *a3;
v14 = v13;
v15 = a1[1];
v16 = *a1;
if ( a2 == v15 )
{
v17 = v15 - v16;
}
else
{
memmove(v13, v16, a2 - v16);
v14 = &v13[v6 + 1];
v17 = (_BYTE *)a1[1] - a2;
v16 = a2;
}
memmove(v14, v16, v17);
sub_14012D3C0(a1, v13, v10, v12);
return &v13[v6];
}