//
// std::__ndk1::__rotate_gcd> from 0xca1cec to 0xca1e8c (416 bytes)
//
// 3 xrefs:
// > sub_CA1E8C @ 0xca2034
// > sub_CA2CB4 @ 0xca2e5c
// > ??> @ 0xaf120
//
// 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 13:05:59 +0000
//
unsigned __int64 __fastcall std::__rotate_gcd>(
unsigned __int64 a1,
unsigned __int64 a2,
__int64 a3)
{
unsigned __int64 v3; // x10
__int64 v4; // x12
__int64 v5; // x7
__int64 v6; // x9
__int64 v7; // x3
__int64 v8; // x1
_DWORD *i; // x9
int v10; // w11
int v11; // t1
_DWORD *v12; // x3
_DWORD *v13; // x6
_DWORD *v14; // x1
__int64 v15; // x4
__int128 *v17; // x5
unsigned __int64 v18; // x2
unsigned __int64 v19; // x3
__int128 *v20; // x7
unsigned __int64 v21; // x6
unsigned __int64 v22; // x2
__int64 v23; // x4
__int128 v24; // q0
bool v25; // zf
unsigned __int64 v26; // x2
unsigned __int64 v27; // x3
int v28; // w6
int v29; // w4
int v30; // w0
__int64 v31; // x3
__int64 v32; // x2
int v33; // w4
v3 = a2 - a1;
v4 = a3 - a2;
v5 = (__int64)(a2 - a1) >> 2;
v6 = (__int64)(a3 - a2) >> 2;
v7 = v5;
if ( v5 == v6 )
{
if ( a2 == a1 )
return a2;
v17 = (__int128 *)a2;
v18 = (a2 - (a1 + 4)) >> 2;
v19 = v18 + 1;
if ( v18 + 1 > 5 && (a1 >= a2 + 16 || a2 >= a1 + 16) )
{
v20 = (__int128 *)a1;
v21 = 0;
v22 = ((v18 - 3) >> 2) + 1;
v23 = 4 * v22;
do
{
++v21;
v24 = *v20;
*v20++ = *v17;
*v17++ = v24;
}
while ( v21 < v22 );
v25 = v19 == v23;
v26 = a1 + 16 * v22;
v27 = a2 + 4 * v23;
if ( !v25 )
{
v28 = *(_DWORD *)(a1 + 4 * v23);
*(_DWORD *)(a1 + 4 * v23) = *(_DWORD *)(a2 + 4 * v23);
*(_DWORD *)(a2 + 4 * v23) = v28;
if ( a2 != v26 + 4 )
{
v29 = *(_DWORD *)(v26 + 4);
*(_DWORD *)(v26 + 4) = *(_DWORD *)(v27 + 4);
*(_DWORD *)(v27 + 4) = v29;
if ( a2 != v26 + 8 )
{
v30 = *(_DWORD *)(v26 + 8);
*(_DWORD *)(v26 + 8) = *(_DWORD *)(v27 + 8);
*(_DWORD *)(v27 + 8) = v30;
}
}
}
return a2;
}
v31 = 4 * v19;
v32 = 0;
do
{
v33 = *(_DWORD *)(a1 + v32);
*(_DWORD *)(a1 + v32) = *(_DWORD *)(a2 + v32);
*(_DWORD *)(a2 + v32) = v33;
v32 += 4;
}
while ( v32 != v31 );
return a2;
}
else
{
while ( 1 )
{
v8 = v7 % v6;
v7 = v6;
if ( !v8 )
break;
v6 = v8;
}
for ( i = (_DWORD *)(a1 + 4 * v6); i != (_DWORD *)a1; *v12 = v10 )
{
v11 = *--i;
v10 = v11;
v12 = (_DWORD *)((char *)i + v3);
v13 = i;
while ( 1 )
{
v14 = (_DWORD *)((char *)v12 + v3);
v15 = (a3 - (__int64)v12) >> 2;
*v13 = *v12;
v13 = v12;
if ( v5 >= v15 )
v14 = (_DWORD *)(a1 + 4 * (v5 - v15));
if ( v14 == i )
break;
v12 = v14;
}
}
return a1 + v4;
}
}