//
// cocos2d::CCCardinalSplineBy::reverse from 0x180026180 to 0x180026555 (981 bytes)
//
// 4 xrefs:
// > ??> @ 0x1800e77c0
// > ??> @ 0x1800e78c0
// > ??> @ 0x1801438a8
// > ??> @ 0x1801af3c4
//
// 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
//
// Hidden C++ exception states: #wind=2
cocos2d::CCCardinalSplineBy *__fastcall cocos2d::CCCardinalSplineBy::reverse(cocos2d::CCCardinalSplineBy *this)
{
cocos2d::CCPointArray *v2; // rdi
cocos2d::CCPointArray_vtbl *v3; // rdx
unsigned int v4; // esi
unsigned int v5; // ebx
cocos2d::CCPointArray_vtbl *v6; // rcx
cocos2d::CCObject *(__stdcall *copyWithZone)(cocos2d::CCPointArray *__hidden, cocos2d::CCZone *); // r8
unsigned __int64 v8; // rcx
unsigned int v9; // eax
unsigned __int64 v10; // rdx
cocos2d::CCPointArray_vtbl *v11; // rax
struct cocos2d::CCPointArray *v12; // r14
cocos2d::CCPointArray_vtbl *v13; // rcx
cocos2d::CCObject *(__stdcall *v14)(cocos2d::CCPointArray *__hidden, cocos2d::CCZone *); // r10
unsigned __int64 v15; // r9
unsigned int v16; // ecx
unsigned __int64 v17; // rdx
cocos2d::CCPointArray_vtbl *v18; // rdi
void **v19; // rcx
void *v20; // rbx
float *v21; // rax
float *v22; // rdi
cocos2d::CCPointArray_vtbl *v23; // rcx
float **v24; // rbx
float **v25; // r9
cocos2d::CCPointArray_vtbl *v26; // rcx
cocos2d::CCObject *(__stdcall *v27)(cocos2d::CCPointArray *__hidden, cocos2d::CCZone *); // r8
unsigned __int64 v28; // rcx
unsigned int v29; // eax
unsigned __int64 v30; // rdx
cocos2d::CCPointArray_vtbl *v31; // rax
_DWORD *v32; // rax
int v33; // xmm6_4
float m_fDuration; // xmm7_4
cocos2d::CCCardinalSplineBy *v35; // rax
cocos2d::CCCardinalSplineBy *v36; // rbx
cocos2d::CCObject *v37; // rcx
float v39; // [rsp+80h] [rbp+38h] BYREF
float v40; // [rsp+84h] [rbp+3Ch]
void *v41; // [rsp+88h] [rbp+40h] BYREF
int v42; // [rsp+90h] [rbp+48h] BYREF
int v43; // [rsp+94h] [rbp+4Ch]
int v44; // [rsp+98h] [rbp+50h] BYREF
v2 = (cocos2d::CCPointArray *)cocos2d::CCObject::copy(*((cocos2d::CCObject **)this + 12));
v3 = v2[1].__vftable;
if ( !(((char *)v3->~CCPointArray - (char *)v3->copyWithZone) >> 3) )
std::vector::_Xlen();
cocos2d::cc_timeval::operator=(&v39, *(_DWORD **)v3->copyWithZone);
v4 = 1;
v5 = 1;
v6 = v2[1].__vftable;
copyWithZone = v6->copyWithZone;
if ( (unsigned int)(((char *)v6->~CCPointArray - (char *)v6->copyWithZone) >> 3) > 1 )
{
do
{
v8 = ((char *)v6->~CCPointArray - (char *)copyWithZone) >> 3;
v9 = 0;
if ( v5 )
v9 = v5;
v10 = v9;
if ( v8 - 1 < v9 )
v10 = (unsigned int)(v8 - 1);
if ( v8 <= v10
|| (cocos2d::cc_timeval::operator=(&v42, *((_DWORD **)copyWithZone + v10)),
cocos2d::CCSize::operator-((float *)&v42, (float *)&v41, &v39),
v11 = v2[1].__vftable,
((char *)v11->~CCPointArray - (char *)v11->copyWithZone) >> 3 <= (unsigned __int64)v5) )
{
std::vector::_Xlen();
}
**((_QWORD **)v11->copyWithZone + v5) = v41;
cocos2d::CCSize::operator=(&v39, &v42);
++v5;
v6 = v2[1].__vftable;
copyWithZone = v6->copyWithZone;
}
while ( v5 < (unsigned int)(((char *)v6->~CCPointArray - (char *)v6->copyWithZone) >> 3) );
}
v12 = cocos2d::CCPointArray::reverse(v2);
cocos2d::CCObject::release(v2);
v13 = v12[1].__vftable;
v14 = v13->copyWithZone;
v15 = ((char *)v13->~CCPointArray - (char *)v13->copyWithZone) >> 3;
v16 = 0;
if ( (_DWORD)v15 != 1 )
v16 = v15 - 1;
v17 = v16;
if ( v15 - 1 < v16 )
v17 = (unsigned int)(v15 - 1);
if ( v15 <= v17 )
std::vector::_Xlen();
cocos2d::cc_timeval::operator=(&v41, *((_DWORD **)v14 + v17));
cocos2d::CCSize::operator=(&v39, &v41);
v18 = v12[1].__vftable;
v19 = (void **)((char *)v18->copyWithZone
+ 8 * (unsigned int)(((char *)v18->~CCPointArray - (char *)v18->copyWithZone) >> 3)
- 8);
v20 = *v19;
memmove(v19, v19 + 1, (char *)v18->~CCPointArray - (char *)(v19 + 1));
v18->~CCPointArray = (void (__stdcall *)(cocos2d::CCPointArray *__hidden))((char *)v18->~CCPointArray - 8);
j_j_free_0(v20);
cocos2d::CCPoint::operator-(&v39, (float *)&v41);
cocos2d::CCSize::operator=(&v39, &v41);
v21 = (float *)operator new(8u);
v41 = v21;
if ( v21 )
v22 = kmVec2Fill(v21, v39, v40);
else
v22 = nullptr;
v41 = v22;
v23 = v12[1].__vftable;
v24 = (float **)v23->copyWithZone;
v25 = (float **)v23->~CCPointArray;
if ( v25 == (float **)v23->isEqual )
{
sub_180015D80((const void **)&v23->copyWithZone, v23->copyWithZone, &v41);
}
else if ( v24 == v25 )
{
*v25 = v22;
v23->~CCPointArray = (void (__stdcall *)(cocos2d::CCPointArray *__hidden))((char *)v23->~CCPointArray + 8);
}
else
{
*v25 = *(v25 - 1);
v23->~CCPointArray = (void (__stdcall *)(cocos2d::CCPointArray *__hidden))((char *)v23->~CCPointArray + 8);
memmove(v24 + 1, v24, (char *)(v25 - 1) - (char *)v24);
*v24 = v22;
}
v26 = v12[1].__vftable;
v27 = v26->copyWithZone;
if ( (unsigned int)(((char *)v26->~CCPointArray - (char *)v26->copyWithZone) >> 3) > 1 )
{
do
{
v28 = ((char *)v26->~CCPointArray - (char *)v27) >> 3;
v29 = 0;
if ( v4 )
v29 = v4;
v30 = v29;
if ( v28 - 1 < v29 )
v30 = (unsigned int)(v28 - 1);
if ( v28 <= v30
|| (cocos2d::cc_timeval::operator=(&v41, *((_DWORD **)v27 + v30)),
cocos2d::CCPoint::operator-((float *)&v41, (float *)&v44),
cocos2d::CCSize::operator=(&v41, &v44),
cocos2d::CCSize::operator+((float *)&v41, (float *)&v42, &v39),
v31 = v12[1].__vftable,
((char *)v31->~CCPointArray - (char *)v31->copyWithZone) >> 3 <= (unsigned __int64)v4) )
{
std::vector::_Xlen();
}
v32 = *((_DWORD **)v31->copyWithZone + v4);
*v32 = v42;
v32[1] = v43;
cocos2d::CCSize::operator=(&v39, &v42);
++v4;
v26 = v12[1].__vftable;
v27 = v26->copyWithZone;
}
while ( v4 < (unsigned int)(((char *)v26->~CCPointArray - (char *)v26->copyWithZone) >> 3) );
}
v33 = *((_DWORD *)this + 27);
m_fDuration = this->m_fDuration;
v35 = (cocos2d::CCCardinalSplineBy *)operator new(0x88u);
v41 = v35;
if ( v35 )
v36 = cocos2d::CCCardinalSplineBy::CCCardinalSplineBy(v35);
else
v36 = nullptr;
if ( v36 )
{
if ( cocos2d::CCActionInterval::initWithDuration(v36, m_fDuration) )
{
cocos2d::CCObject::retain(v12);
v37 = (cocos2d::CCObject *)v36[1].__vftable;
if ( v37 )
cocos2d::CCObject::release(v37);
v36[1].__vftable = (cocos2d::CCCardinalSplineBy_vtbl *)v12;
v36[1].m_nLuaID = v33;
cocos2d::CCObject::autorelease(v36);
}
else
{
cocos2d::CCObject::release(v36);
return nullptr;
}
}
return v36;
}