//
// cocos2d::extension::CCTableView::__indexFromOffset from 0x180015c30 to 0x180015ce3 (179 bytes)
//
// 5 xrefs:
// > cocos2d::extension::CCTableView::_indexFromOffset @ 0x180015c04
// > cocos2d::extension::CCTableView::scrollViewDidScroll @ 0x18001615c
// > cocos2d::extension::CCTableView::ccTouchBegan @ 0x180016557
// > ??> @ 0x18002fdf8
// > ??> @ 0x18004a86c
//
// 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
//
__int64 __fastcall cocos2d::extension::CCTableView::__indexFromOffset(__int64 a1, float *a2)
{
int v4; // esi
int v5; // edi
int v6; // eax
float *v7; // r8
int v8; // eax
float v9; // xmm1_4
__int64 v10; // r8
int v11; // r9d
unsigned int v12; // ecx
float v13; // xmm2_4
v4 = 0;
v5 = 0;
v6 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 640) + 32LL))(*(_QWORD *)(a1 + 640), a1);
v7 = a2 + 1;
if ( !*(_DWORD *)(a1 + 432) )
v7 = a2;
v8 = v6 - 1;
v9 = *v7;
if ( v8 < 0 )
return 0;
v10 = *(_QWORD *)(a1 + 600);
while ( 1 )
{
v11 = v8;
v12 = v5 + (v8 - v5) / 2;
v13 = *(float *)(v10 + 4LL * (int)v12);
if ( v9 >= v13 && *(float *)(v10 + 4LL * (int)(v12 + 1)) >= v9 )
break;
v8 = v12 - 1;
if ( v13 <= v9 )
{
v8 = v11;
v5 = v12 + 1;
}
if ( v8 < v5 )
{
LOBYTE(v4) = v5 <= 0;
return (unsigned int)(v4 - 1);
}
}
return v12;
}