//
// sub_1006D4854 from 0x1006d4854 to 0x1006d48b4 (96 bytes)
//
// 5 xrefs:
// > sub_1006D6808 @ 0x1006d6a38
// > sub_1006D6808 @ 0x1006d6b78
// > sub_1006D6808 @ 0x1006d6b88
// > sub_1006D6808 @ 0x1006d6bec
// > sub_1006D6E1C @ 0x1006d6fd8
//
// 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:12:28 +0000
//
unsigned __int64 __fastcall sub_1006D4854(__int64 *a1, unsigned __int64 a2)
{
__int64 v3; // x9
unsigned __int64 result; // x0
__int64 v5; // x8
__int64 v6; // x9
__int128 v7; // t2
__int64 v8; // x10
if ( !a2 )
return -1;
v3 = *((int *)a1 + 2);
if ( (int)v3 < 1 )
return 0;
result = 0;
v5 = *a1;
v6 = v3 - 1;
do
{
*((_QWORD *)&v7 + 1) = result;
*(_QWORD *)&v7 = *(_QWORD *)(v5 + 8 * v6);
result = ((unsigned int)v7 | ((unsigned __int64)(unsigned int)((unsigned __int64)(v7 >> 32) % a2) << 32)) % a2;
v8 = v6-- + 1;
}
while ( v8 > 1 );
return result;
}