//
// sub_1001AA4EC from 0x1001aa4ec to 0x1001aa59c (176 bytes)
//
// 1 xrefs:
// > TabbedPopupLayer::createTabButtons @ 0x1001aa348
//
// This function is hookable on this platform (idp: arm, 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 11:00:05 +0000
//
__int64 __fastcall sub_1001AA4EC(__int64 result, __int64 a2)
{
signed int v2; // w8
unsigned int *v3; // x19
__int64 v4; // x9
__int64 v5; // x20
int v6; // w0
int v7; // w8
int v8; // w9
int v9; // w8
v2 = *(_DWORD *)(result + 1064);
if ( (v2 & 0x80000000) == 0 )
{
v3 = (unsigned int *)result;
v4 = *(_QWORD *)(result + 1016);
if ( v2 < (int)(954437177 * ((unsigned __int64)(*(_QWORD *)(result + 1024) - v4) >> 3)) )
{
v5 = v4 + 72LL * (unsigned int)v2;
if ( *(int *)(v5 + 56) >= 2 )
{
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
v7 = *(_DWORD *)(v5 + 56);
v8 = *(_DWORD *)(v5 + 52) + v6;
*(_DWORD *)(v5 + 52) = v8;
if ( v8 < 0 )
{
v9 = v7 - 1;
}
else
{
if ( v8 < v7 )
return (*(__int64 (__fastcall **)(unsigned int *, _QWORD))(*(_QWORD *)v3 + 1504LL))(v3, v3[266]);
v9 = 0;
}
*(_DWORD *)(v5 + 52) = v9;
return (*(__int64 (__fastcall **)(unsigned int *, _QWORD))(*(_QWORD *)v3 + 1504LL))(v3, v3[266]);
}
}
}
return result;
}