//
// TableView::checkFirstCell from 0x100624110 to 0x1006244a0 (912 bytes)
//
// 2 xrefs:
// > TableView::checkBoundaryOfContent @ 0x100622f7e
// > TableView::checkBoundaryOfContent @ 0x100622ffd
//
// 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 __fastcall TableView::checkFirstCell(TableView *a1, TableViewCell *a2)
{
double *v4; // rsi
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
int m_row; // r13d
int m_section; // r12d
char *v11; // r14
int v12; // eax
int v13; // ecx
cocos2d::CCArray *m_cellArray; // rdi
unsigned int v15; // r12d
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // r12
float *v19; // rax
__int64 v20; // rax
__int128 v21; // xmm0
__int128 v22; // xmm1
cocos2d::CCArray *m_indexPathArray; // rdi
unsigned int v24; // r15d
__int64 v25; // rax
TableViewDelegate *m_tableDelegate; // rdi
TableViewDelegate *v27; // rdi
__int64 v28; // [rsp+4h] [rbp-3Ch] BYREF
float v29[2]; // [rsp+Ch] [rbp-34h] BYREF
float v30; // [rsp+14h] [rbp-2Ch]
if ( TableView::checkBoundaryOfCell_1(a1, a2) != 1 )
{
v4 = (double *)((__int64 (__fastcall *)(TableViewCell *))a2->getPosition)(a2);
sub_10028CC60(&v28, v4);
v30 = *((float *)&v28 + 1);
v5 = ((__int64 (__fastcall *)(TableViewCell *))a2->getContentSize)(a2);
v30 = v30 + *(float *)(v5 + 4);
v6 = ((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getContentSize)(a1->m_contentLayer);
v30 = v30 - *(float *)(v6 + 4);
v7 = ((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getPosition)(a1->m_contentLayer);
v30 = v30 + *(float *)(v7 + 4);
v8 = ((__int64 (__fastcall *)(TableView *))a1->getContentSize)(a1);
if ( *(float *)(v8 + 4) > v30 )
{
m_row = a2->m_indexPath.m_row;
m_section = a2->m_indexPath.m_section;
v11 = (char *)operator new(0x40u);
cocos2d::CCObject::CCObject((__int64)v11);
*(_QWORD *)v11 = off_1009829A8;
*((_DWORD *)v11 + 14) = m_row - 1;
*((_DWORD *)v11 + 15) = m_section;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v11);
v12 = ((__int64 (__fastcall *)(TableViewDataSource *, _QWORD, TableView *))a1->m_dataSource->numberOfRowsInSection)(
a1->m_dataSource,
(unsigned int)a2->m_indexPath.m_section,
a1);
v13 = *((_DWORD *)v11 + 14);
if ( v13 >= 0 && v13 < v12 )
{
m_cellArray = a1->m_cellArray;
if ( m_cellArray && (unsigned int)sub_100720070(m_cellArray) && (unsigned int)sub_100720070(a1->m_cellArray) )
{
v15 = 0;
while ( 1 )
{
v16 = sub_1007200C0(a1->m_cellArray, v15);
if ( *(_DWORD *)(v16 + 484) == *((_DWORD *)v11 + 15) && *(_DWORD *)(v16 + 480) == *((_DWORD *)v11 + 14) )
break;
if ( ++v15 >= (unsigned int)sub_100720070(a1->m_cellArray) )
goto LABEL_13;
}
}
else
{
LABEL_13:
v30 = ((float (__fastcall *)(TableViewDelegate *, char *, TableView *))a1->m_tableDelegate->cellHeightForRowAtIndexPath)(
a1->m_tableDelegate,
v11,
a1);
v17 = ((__int64 (__fastcall *)(TableViewDataSource *, char *, TableView *))a1->m_dataSource->cellForRowAtIndexPath)(
a1->m_dataSource,
v11,
a1);
if ( v17 )
{
v18 = v17;
sub_10028CBE0(v29, 0.0, 1.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v18 + 280LL))(v18, v29);
v19 = (float *)((__int64 (__fastcall *)(TableView *))a1->getContentSize)(a1);
sub_10028CBF0(v29, *v19, v30);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v18 + 304LL))(v18, v29);
v30 = *(float *)(((__int64 (__fastcall *)(TableViewCell *))a2->getPosition)(a2) + 4);
v20 = ((__int64 (__fastcall *)(TableViewCell *))a2->getContentSize)(a2);
sub_10028CBE0(v29, 0.0, v30 + *(float *)(v20 + 4));
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v18 + 184LL))(v18, v29);
v21 = *(_OWORD *)(v11 + 8);
v22 = *(_OWORD *)(v11 + 24);
*(_OWORD *)(v18 + 464) = *(_OWORD *)(v11 + 40);
*(_OWORD *)(v18 + 448) = v22;
*(_OWORD *)(v18 + 432) = v21;
*(_QWORD *)(v18 + 480) = *((_QWORD *)v11 + 7);
sub_1007201F0(a1->m_cellArray, v18, 0);
m_indexPathArray = a1->m_indexPathArray;
if ( m_indexPathArray
&& (unsigned int)sub_100720070(m_indexPathArray)
&& (unsigned int)sub_100720070(a1->m_indexPathArray) )
{
v24 = 0;
while ( 1 )
{
v25 = sub_1007200C0(a1->m_indexPathArray, v24);
if ( *(_DWORD *)(v25 + 60) == *((_DWORD *)v11 + 15) && *(_DWORD *)(v25 + 56) == *((_DWORD *)v11 + 14) )
break;
if ( ++v24 >= (unsigned int)sub_100720070(a1->m_indexPathArray) )
goto LABEL_22;
}
}
else
{
LABEL_22:
sub_1007201F0(a1->m_indexPathArray, v11, 0);
}
m_tableDelegate = a1->m_tableDelegate;
if ( m_tableDelegate )
((void (__fastcall *)(TableViewDelegate *, char *, __int64, TableView *))m_tableDelegate->TableViewWillDisplayCellForRowAtIndexPath)(
m_tableDelegate,
v11,
v18,
a1);
((void (__fastcall *)(CCContentLayer *, __int64))a1->m_contentLayer->addChild)(a1->m_contentLayer, v18);
v27 = a1->m_tableDelegate;
if ( v27 )
((void (__fastcall *)(TableViewDelegate *, char *, __int64, TableView *))v27->TableViewDidDisplayCellForRowAtIndexPath)(
v27,
v11,
v18,
a1);
}
}
}
}
}
}