//
// cocos2d::extension::CCTableView::_addCellIfNecessary from 0x7afe54 to 0x7aff18 (196 bytes)
//
// 2 xrefs:
// > cocos2d::extension::CCTableView::updateCellAtIndex @ 0x7aff6e
// > cocos2d::extension::CCTableView::insertCellAtIndex @ 0x7b0180
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:00:06 +0000
//
_DWORD *__fastcall cocos2d::extension::CCTableView::_addCellIfNecessary(
cocos2d::extension::CCTableView *this,
cocos2d::extension::CCTableViewCell *a2)
{
int v4; // r7
int Container; // r0
int **v6; // r5
_DWORD *result; // r0
int *v8; // r3
_DWORD *v9; // r8
unsigned int v10; // r2
int *v11; // r2
int *v12; // r4
_DWORD *v13; // r0
int v14; // r3
int *v15; // r3
_DWORD v16[2]; // [sp+0h] [bp-8h] BYREF
v16[0] = this;
v16[1] = a2;
v4 = (*(int (__fastcall **)(cocos2d::extension::CCTableViewCell *))(*(_DWORD *)a2 + 256))(a2);
if ( v4 != cocos2d::extension::CCScrollView::getContainer(this) )
{
Container = cocos2d::extension::CCScrollView::getContainer(this);
(*(void (__fastcall **)(int, cocos2d::extension::CCTableViewCell *))(*(_DWORD *)Container + 228))(Container, a2);
}
cocos2d::extension::CCArrayForObjectSorting::insertSortedObject(*((_DWORD *)this + 119), (char *)a2 + 264);
v6 = *((int ***)this + 115);
result = (_DWORD *)cocos2d::extension::CCTableViewCell::getIdx(a2);
v8 = v6[1];
v9 = result;
if ( v8 )
{
while ( 1 )
{
v10 = v8[4];
if ( (unsigned int)result >= v10 )
{
if ( v10 >= (unsigned int)result )
{
v16[0] = v8;
v12 = v16;
goto LABEL_13;
}
v11 = (int *)v8[1];
if ( !v11 )
{
v16[0] = v8;
v12 = v8 + 1;
goto LABEL_13;
}
}
else
{
v11 = (int *)*v8;
if ( !*v8 )
{
v16[0] = v8;
v12 = v8;
goto LABEL_13;
}
}
v8 = v11;
}
}
v12 = (int *)(v6 + 1);
v16[0] = v6 + 1;
LABEL_13:
if ( !*v12 )
{
v13 = (_DWORD *)operator new(0x14u);
v14 = v16[0];
v13[4] = v9;
*v13 = 0;
v13[1] = 0;
v13[2] = v14;
*v12 = (int)v13;
v15 = (int *)**v6;
if ( v15 )
*v6 = v15;
result = std::__tree_balance_after_insert *>(v6[1], (_DWORD *)*v12);
v6[2] = (int *)((char *)v6[2] + 1);
}
return result;
}