//
// cocos2d::extension::CCTableView::__indexFromOffset from 0x10041a300 to 0x10041a393 (147 bytes)
//
// 0 xrefs:
//
// 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:30:12 +0000
//
__int64 __fastcall cocos2d::extension::CCTableView::__indexFromOffset(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 v3; // rcx
int v4; // eax
float v5; // xmm0_4
__int64 v6; // rsi
int v7; // edx
int v8; // edi
unsigned int v9; // ecx
float v10; // xmm1_4
v2 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 640) + 40LL))(*(_QWORD *)(a1 + 640), a1);
v3 = 0;
v4 = v2 - 1;
if ( v4 < 0 )
{
return 0;
}
else
{
LOBYTE(v3) = *(_DWORD *)(a1 + 424) != 0;
v5 = *(float *)(a2 + 4 * v3);
v6 = *(_QWORD *)(a1 + 600);
v7 = 0;
while ( 1 )
{
v8 = (v4 - v7) / 2;
v9 = v8 + v7;
v10 = *(float *)(v6 + 4LL * (v8 + v7));
if ( v5 >= v10 && *(float *)(v6 + 4LL * (int)v9 + 4) >= v5 )
break;
if ( v10 <= v5 )
{
v7 += v8 + 1;
if ( v4 < v7 )
return (unsigned int)-(v7 > 0);
}
else
{
v4 = v9 - 1;
if ( (int)(v9 - 1) < v7 )
return (unsigned int)-(v7 > 0);
}
}
}
return v9;
}