//
// cocos2d::CCPointArray::insertControlPoint from 0x5b1104 to 0x5b11c4 (192 bytes)
//
// 1 xrefs:
// > cocos2d::CCCardinalSplineBy::reverse @ 0x5b127c
//
// 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 cocos2d::CCPointArray::insertControlPoint(cocos2d::CCPointArray *a1, cocos2d::CCPoint *a2, unsigned int a3)
{
unsigned int v6; // r10
cocos2d::CCPoint *v7; // r8
cocos2d::CCPointArray_vtbl *v8; // r4
void (__fastcall *v9)(cocos2d::CCPointArray *__hidden); // r3
cocos2d::CCObject *(__fastcall *copyWithZone)(cocos2d::CCPointArray *__hidden, cocos2d::CCZone *); // r5
int v11; // r6
void (__fastcall *v12)(cocos2d::CCPointArray *__hidden); // r0
size_t v13; // r2
unsigned int v14; // r0
int v15; // r9
cocos2d::CCObject *(__fastcall *v16)(cocos2d::CCPointArray *__hidden, cocos2d::CCZone *); // r5
int v17; // r0
int v18; // r6
v6 = 4 * a3;
v7 = (cocos2d::CCPoint *)operator new(8u);
cocos2d::CCPoint::CCPoint(v7, a2->x, a2->y);
v8 = a1[1].__vftable;
v9 = v8->~CCPointArray;
copyWithZone = v8->copyWithZone;
v11 = (int)v8->copyWithZone + v6;
if ( v9 == v8->~CCPointArray_0 )
{
v14 = std::vector::_M_check_len(v8, 1u, (int)"vector::_M_insert_aux");
v15 = 4 * v14;
if ( v14 )
{
if ( v14 >= 0x40000000 )
sub_772FB4(v14);
v14 = operator new(4 * v14);
}
v16 = (cocos2d::CCObject *(__fastcall *)(cocos2d::CCPointArray *__hidden, cocos2d::CCZone *))v14;
if ( v14 + v6 )
*(_DWORD *)(v14 + 4 * a3) = v7;
v17 = std::__copy_move::__copy_m(
v8->copyWithZone,
v11,
(void *)v14);
v18 = std::__copy_move::__copy_m(
(void *)v11,
(int)v8->~CCPointArray,
(void *)(v17 + 4));
if ( v8->copyWithZone )
operator delete(v8->copyWithZone);
v8->copyWithZone = v16;
v8->~CCPointArray = (void (__fastcall *)(cocos2d::CCPointArray *__hidden))v18;
v8->~CCPointArray_0 = (void (__fastcall *)(cocos2d::CCPointArray *__hidden))((char *)v16 + v15);
}
else if ( (void (__fastcall *)(cocos2d::CCPointArray *__hidden))v11 == v9 )
{
if ( v11 )
*((_DWORD *)copyWithZone + a3) = v7;
v8->~CCPointArray = (void (__fastcall *)(cocos2d::CCPointArray *__hidden))((char *)v8->~CCPointArray + 4);
}
else
{
*(_DWORD *)v9 = *((_DWORD *)v9 - 1);
v12 = v8->~CCPointArray;
v13 = (size_t)v12 - v11 - 4;
v8->~CCPointArray = (void (__fastcall *)(cocos2d::CCPointArray *__hidden))((char *)v12 + 4);
if ( v13 >> 2 )
memmove((void *)(v11 + 4), (const void *)v11, v13);
*((_DWORD *)copyWithZone + a3) = v7;
}
}