//
// cocos2d::extension::CCTableView::__indexFromOffset from 0x180015830 to 0x1800158e4 (180 bytes)
//
// 5 xrefs:
// > cocos2d::extension::CCTableView::_indexFromOffset @ 0x180015804
// > cocos2d::extension::CCTableView::scrollViewDidScroll @ 0x180015db4
// > cocos2d::extension::CCTableView::ccTouchBegan @ 0x1800161ca
// > ??> @ 0x180032408
// > ??> @ 0x18004c7a0
//
// 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
//
__int64 __fastcall cocos2d::extension::CCTableView::__indexFromOffset(__int64 a1, float *a2)
{
int v4; // esi
int v5; // edi
int v6; // eax
float *v7; // rdx
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 = (v8 - v5) / 2 + v5;
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;
}