//
// cocos2d::extension::CCTableView::_addCellIfNecessary from 0xd1a4a0 to 0xd1a604 (356 bytes)
//
// 3 xrefs:
// > cocos2d::extension::CCTableView::updateCellAtIndex @ 0xd1a6bc
// > cocos2d::extension::CCTableView::insertCellAtIndex @ 0xd1aa70
// > ??> @ 0x66bb0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:07:08 +0000
//
__int64 __fastcall cocos2d::extension::CCTableView::_addCellIfNecessary(
cocos2d::extension::CCTableView *this,
cocos2d::extension::CCTableViewCell *a2)
{
__int64 v4; // x22
__int64 Container; // x0
__int64 **v6; // x22
cocos2d::extension::CCTableViewCell *v7; // x0
__int64 **v8; // x19
unsigned int Idx; // w20
__int64 *v10; // x0
unsigned int v11; // w1
bool v12; // cc
__int64 *v13; // x1
unsigned int v14; // w1
__int64 v15; // x0
__int64 *v16; // x1
__int64 *v18; // [xsp+30h] [xbp+30h]
v4 = (*(__int64 (__fastcall **)(cocos2d::extension::CCTableViewCell *))(*(_QWORD *)a2 + 512LL))(a2);
if ( v4 != cocos2d::extension::CCScrollView::getContainer(this) )
{
Container = cocos2d::extension::CCScrollView::getContainer(this);
(*(void (__fastcall **)(__int64, cocos2d::extension::CCTableViewCell *))(*(_QWORD *)Container + 456LL))(
Container,
a2);
}
cocos2d::extension::CCArrayForObjectSorting::insertSortedObject(*((_QWORD *)this + 78), (char *)a2 + 320);
v6 = *((__int64 ***)this + 74);
v7 = a2;
v8 = v6 + 1;
Idx = cocos2d::extension::CCTableViewCell::getIdx(v7);
v10 = v6[1];
if ( v10 )
{
v11 = *((_DWORD *)v10 + 7);
v12 = Idx > v11;
if ( Idx >= v11 )
goto LABEL_7;
while ( 1 )
{
v13 = (__int64 *)*v10;
if ( !*v10 )
break;
while ( 1 )
{
v10 = v13;
v14 = *((_DWORD *)v13 + 7);
v12 = Idx > v14;
if ( Idx < v14 )
break;
LABEL_7:
if ( !v12 )
return _stack_chk_guard;
v13 = (__int64 *)v10[1];
if ( !v13 )
{
v18 = v10;
v8 = (__int64 **)(v10 + 1);
goto LABEL_12;
}
}
}
v18 = v10;
v8 = (__int64 **)v10;
}
else
{
v18 = (__int64 *)(v6 + 1);
}
LABEL_12:
v15 = operator new(0x20u);
*(_DWORD *)(v15 + 28) = Idx;
*(_QWORD *)v15 = 0;
*(_QWORD *)(v15 + 8) = 0;
*(_QWORD *)(v15 + 16) = v18;
*v8 = (__int64 *)v15;
v16 = (__int64 *)**v6;
if ( v16 )
{
*v6 = v16;
std::__tree_balance_after_insert *>(v6[1], *v8);
}
else
{
std::__tree_balance_after_insert *>(v6[1], (__int64 *)v15);
}
v6[2] = (__int64 *)((char *)v6[2] + 1);
return _stack_chk_guard;
}