//
// sub_1002A8F2C from 0x1002a8f2c to 0x1002a8f9c (112 bytes)
//
// 6 xrefs:
// > sub_100289678 @ 0x100289698
// > sub_1002A8EE0 @ 0x1002a8efc
// > sub_1002A8EE0 @ 0x1002a8f08
// > sub_1002A8EE0 @ 0x1002a8f14
// > sub_1002A9318 @ 0x1002a93c0
// > sub_1002A9440 @ 0x1002a946c
//
// 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:02:16 +0000
//
__int64 __fastcall sub_1002A8F2C(__int64 result, __int64 *a2)
{
__int64 v2; // x8
_QWORD *v3; // x1
__int64 v4; // x10
__int64 v5; // t1
__int64 v6; // x11
__int64 v7; // x11
unsigned __int64 v8; // x10
unsigned __int64 v9; // x11
v2 = *a2;
*a2 = 0;
*(_QWORD *)result = v2;
v5 = a2[2];
v3 = a2 + 2;
v4 = v5;
v6 = *(v3 - 1);
*(_QWORD *)(result + 16) = v5;
*(_QWORD *)(result + 8) = v6;
*(v3 - 1) = 0;
v7 = v3[1];
*(_QWORD *)(result + 24) = v7;
*(_DWORD *)(result + 32) = *((_DWORD *)v3 + 4);
if ( v7 )
{
v8 = *(_QWORD *)(v4 + 8);
v9 = *(_QWORD *)(result + 8);
if ( (v9 & (v9 - 1)) != 0 )
{
if ( v8 >= v9 )
v8 %= v9;
}
else
{
v8 &= v9 - 1;
}
*(_QWORD *)(v2 + 8 * v8) = result + 16;
*v3 = 0;
v3[1] = 0;
}
return result;
}