//
// cocos2d::extension::CCTableView::_addCellIfNecessary from 0x1800153d0 to 0x1800154ff (303 bytes)
//
// 4 xrefs:
// > cocos2d::extension::CCTableView::updateCellAtIndex @ 0x180014eed
// > cocos2d::extension::CCTableView::insertCellAtIndex @ 0x1800150af
// > ??> @ 0x180032408
// > ??> @ 0x18004c74c
//
// This function is hookable on this platform (idp: pc, 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 12:15:41 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall cocos2d::extension::CCTableView::_addCellIfNecessary(
cocos2d::extension::CCTableView *this,
struct cocos2d::extension::CCTableViewCell *a2)
{
__int64 v4; // rbx
struct cocos2d::extension::CCSortableObject *v5; // rdx
unsigned int v6; // ebx
_QWORD *v7; // rdi
__int64 *v8; // rsi
__int64 *v9; // rdx
int v10; // ecx
__int64 *v11; // r8
__int64 *v12; // rax
__int64 v13; // rax
__int128 v14; // [rsp+20h] [rbp-38h] BYREF
__int128 v15; // [rsp+30h] [rbp-28h]
v4 = *((_QWORD *)this + 56);
if ( (*(__int64 (__fastcall **)(struct cocos2d::extension::CCTableViewCell *))(*(_QWORD *)a2 + 504LL))(a2) != v4 )
(*(void (__fastcall **)(_QWORD, struct cocos2d::extension::CCTableViewCell *))(**((_QWORD **)this + 56) + 464LL))(
*((_QWORD *)this + 56),
a2);
v5 = (struct cocos2d::extension::CCTableViewCell *)((char *)a2 + 320);
if ( !a2 )
v5 = nullptr;
cocos2d::extension::CCArrayForObjectSorting::insertSortedObject(
*((cocos2d::extension::CCArrayForObjectSorting **)this + 78),
v5);
v6 = *((_DWORD *)a2 + 82);
v7 = *((_QWORD **)this + 74);
v8 = (__int64 *)*v7;
v9 = *(__int64 **)(*v7 + 8LL);
v10 = 0;
v11 = (__int64 *)*v7;
if ( !*((_BYTE *)v9 + 25) )
{
v12 = *(__int64 **)(*v7 + 8LL);
do
{
v9 = v12;
if ( *((_DWORD *)v12 + 7) >= v6 )
{
v10 = 1;
v11 = v12;
}
else
{
v10 = 0;
v12 += 2;
}
v12 = (__int64 *)*v12;
}
while ( !*((_BYTE *)v12 + 25) );
}
*(_QWORD *)&v15 = v9;
DWORD2(v15) = v10;
if ( *((_BYTE *)v11 + 25) || v6 < *((_DWORD *)v11 + 7) )
{
if ( v7[1] == 0x7FFFFFFFFFFFFFFLL )
sub_180004F70();
v13 = sub_18001F040(0x20u);
*(_DWORD *)(v13 + 28) = v6;
*(_QWORD *)v13 = v8;
*(_QWORD *)(v13 + 8) = v8;
*(_QWORD *)(v13 + 16) = v8;
*(_WORD *)(v13 + 24) = 0;
v14 = v15;
sub_1800047F0(v7, (__int64)&v14, v13);
}
}