//
// sub_AF6958 from 0xaf6958 to 0xaf6a48 (240 bytes)
//
// 2 xrefs:
// > sub_AF6958 @ 0xaf6a2c
// > cocos2d::CCClippingNode::visit @ 0xaf7120
//
// 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 sub_AF6958(__int64 *a1, __int64 a2)
{
__int64 result; // x0
__int64 *v5; // x19
__int64 v6; // x2
__int64 v7; // x1
__int64 *v8; // x0
__int64 v9; // x20
unsigned __int64 i; // x20
(*(void (__fastcall **)(__int64 *))(*a1 + 648))(a1);
result = (*(__int64 (__fastcall **)(__int64 *))(*a1 + 472))(a1);
if ( result )
{
result = (*(__int64 (__fastcall **)(__int64 *))(*a1 + 472))(a1);
if ( result )
{
result = **(unsigned int **)((*(__int64 (__fastcall **)(__int64 *))(*a1 + 472))(a1) + 56);
if ( (_DWORD)result )
{
v5 = *(__int64 **)(*(_QWORD *)((*(__int64 (__fastcall **)(__int64 *))(*a1 + 472))(a1) + 56) + 16LL);
v6 = *(_QWORD *)((*(__int64 (__fastcall **)(__int64 *))(*a1 + 472))(a1) + 56);
v7 = *a1;
v8 = a1;
v9 = *(_QWORD *)(v6 + 16);
result = **(unsigned int **)((*(__int64 (__fastcall **)(__int64 *))(v7 + 472))(v8) + 56);
for ( i = v9 + 8LL * (unsigned int)result - 8; i >= (unsigned __int64)v5; result = sub_AF6958(result, a2) )
{
result = *v5;
if ( !*v5 )
break;
++v5;
}
}
}
}
return result;
}