//
// sub_100668440 from 0x100668440 to 0x10066847f (63 bytes)
//
// 7 xrefs:
// > cocos2d::CCKeyboardDispatcher::removeDelegate @ 0x100203416
// > cocos2d::CCKeyboardDispatcher::addDelegate @ 0x100203548
// > cocos2d::CCTouchDispatcher::removeDelegate @ 0x1004cc196
// > cocos2d::CCMouseDispatcher::removeDelegate @ 0x100570d06
// > cocos2d::CCMouseDispatcher::addDelegate @ 0x100570e38
// > cocos2d::CCKeypadDispatcher::removeDelegate @ 0x1005f95d6
// > cocos2d::CCKeypadDispatcher::addDelegate @ 0x1005f9708
//
// 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
//
unsigned __int64 __fastcall sub_100668440(unsigned int *a1, __int64 a2)
{
__int64 v2; // rcx
unsigned __int64 result; // rax
unsigned int v4; // esi
__int64 v5; // rsi
v2 = *a1;
*(_QWORD *)(*((_QWORD *)a1 + 2) + 8 * v2) = a2;
result = (unsigned int)(v2 + 1);
*a1 = result;
v4 = a1[1];
if ( (unsigned int)result >= v4 )
{
v5 = 2 * v4;
a1[1] = v5;
result = (unsigned __int64)realloc(*((void **)a1 + 2), 8 * v5);
*((_QWORD *)a1 + 2) = result;
}
return result;
}