//
// sub_10000CBA8 from 0x10000cba8 to 0x10000cc84 (220 bytes)
//
// 50 xrefs:
// > GJEffectManager::getPersistentStateString @ 0x1000155b8
// > GJEffectManager::getPersistentStateString @ 0x1000156d8
// > GJEffectManager::updateTimers @ 0x100015fd4
// > GJLevelList::parseListLevels @ 0x10009f130
// > GJGameLevel::scoreStringToVector @ 0x1000ad108
// > sub_1000AD17C @ 0x1000ad210
// > GJLevelList::addLevelToList @ 0x1000b14bc
// > CustomSongWidget::onInfo @ 0x1000fb5ac
// > CustomSongWidget::onInfo @ 0x1000fb600
// > FMODAudioEngine::stopAllMusic @ 0x100138d54
// > GJSpecialColorSelect::init @ 0x1001af100
// > GJSpecialColorSelect::init @ 0x1001af114
// > GJSpecialColorSelect::init @ 0x1001af128
// > GJSpecialColorSelect::init @ 0x1001af13c
// > GJSpecialColorSelect::init @ 0x1001af150
// > GJSpecialColorSelect::init @ 0x1001af164
// > GJSpecialColorSelect::init @ 0x1001af178
// > GJSpecialColorSelect::init @ 0x1001af18c
// > GJSpecialColorSelect::init @ 0x1001af1a4
// > GJSpecialColorSelect::init @ 0x1001af1b8
// > GJSpecialColorSelect::init @ 0x1001af1cc
// > GJSpecialColorSelect::init @ 0x1001af1e0
// > GJSpecialColorSelect::init @ 0x1001af1f4
// > GJSpecialColorSelect::init @ 0x1001af20c
// > GJSpecialColorSelect::init @ 0x1001af220
// > GJSpecialColorSelect::init @ 0x1001af234
// > GJSpecialColorSelect::init @ 0x1001af248
// > GJSpecialColorSelect::init @ 0x1001af25c
// > GJSpecialColorSelect::init @ 0x1001af270
// > GJSpecialColorSelect::init @ 0x1001af284
// > GJSpecialColorSelect::init @ 0x1001af298
// > GJSpecialColorSelect::init @ 0x1001af2ac
// > GJSpecialColorSelect::init @ 0x1001af2c0
// > GJBaseGameLayer::addRemapTargets @ 0x1001dfa5c
// > GJBaseGameLayer::addRemapTargets @ 0x1001dfb34
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x1001e040c
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x1001e04a4
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x1001e06a4
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x1001e0754
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x1001fc24c
// > GJBaseGameLayer::activateSFXTrigger @ 0x1002030dc
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x100206980
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x1002069d8
// > SecretRewardsLayer::generateChestItems @ 0x1002eaee4
// > sub_100364710 @ 0x100364778
// > sub_100364710 @ 0x1003647b4
// > sub_100364710 @ 0x1003647e0
// > ChanceTriggerGameObject::getTargetIDs @ 0x1003897e8
// > SpawnTriggerGameObject::updateRemapKeys @ 0x10038eb50
// > SpawnTriggerGameObject::updateRemapKeys @ 0x10038eba0
//
// 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
//
void __fastcall sub_10000CBA8(__int64 a1, int *a2)
{
unsigned __int64 v4; // x8
int *v5; // x21
_DWORD *v6; // x21
const void *v7; // x1
signed __int64 v8; // x2
__int64 v9; // x21
unsigned __int64 v10; // x9
__int64 v11; // x8
bool v12; // cf
__int64 v13; // x8
__int64 v14; // x0
__int64 v15; // x1
_DWORD *v16; // x21
__int64 v17; // x22
int v18; // w8
_DWORD *v19; // x20
void *v20; // x0
v5 = *(int **)(a1 + 8);
v4 = *(_QWORD *)(a1 + 16);
if ( (unsigned __int64)v5 >= v4 )
{
v7 = *(const void **)a1;
v8 = (signed __int64)v5 - *(_QWORD *)a1;
v9 = v8 >> 2;
v10 = (v8 >> 2) + 1;
if ( v10 >> 62 )
sub_10000A5F8();
v11 = v4 - (_QWORD)v7;
if ( v11 >> 1 > v10 )
v10 = v11 >> 1;
v12 = (unsigned __int64)v11 >= 0x7FFFFFFFFFFFFFFCLL;
v13 = 0x3FFFFFFFFFFFFFFFLL;
if ( !v12 )
v13 = v10;
if ( v13 )
{
v14 = sub_1000179E8(a1, v13);
v13 = v15;
v7 = *(const void **)a1;
v8 = *(_QWORD *)(a1 + 8) - *(_QWORD *)a1;
}
else
{
v14 = 0;
}
v16 = (_DWORD *)(v14 + 4 * v9);
v17 = v14 + 4 * v13;
v18 = *a2;
v19 = &v16[-(v8 >> 2)];
*v16 = v18;
v6 = v16 + 1;
memcpy(v19, v7, v8);
v20 = *(void **)a1;
*(_QWORD *)a1 = v19;
*(_QWORD *)(a1 + 8) = v6;
*(_QWORD *)(a1 + 16) = v17;
if ( v20 )
operator delete(v20);
}
else
{
*v5 = *a2;
v6 = v5 + 1;
}
*(_QWORD *)(a1 + 8) = v6;
}