//
// sub_1000503A8 from 0x1000503a8 to 0x100050450 (168 bytes)
//
// 1 xrefs:
// > sub_10004BBE8 @ 0x10004bc58
//
// 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 10:57:43 +0000
//
__int64 __fastcall sub_1000503A8(__int64 a1, __int64 a2, _DWORD *a3)
{
__int64 result; // x0
int v4; // w8
unsigned int v6; // w21
__int64 v8; // x8
__int64 v9; // x9
unsigned __int64 v10; // x8
unsigned __int64 v11; // x9
unsigned int v12; // w22
unsigned int v13; // w8
result = (unsigned int)a3[1];
v4 = result - *a3;
if ( (_DWORD)result != *a3 )
{
v6 = v4 + 1;
if ( v4 == -1 )
{
return sub_100050450(a2);
}
else
{
v8 = __clz(v6);
v9 = 31;
if ( ((v6 << v8) & 0x7FFFFFFF) != 0 )
v9 = 32;
v10 = v9 - v8;
v11 = v10 >> 5;
if ( (v10 & 0x1F) != 0 )
++v11;
if ( v11 <= v10 )
v12 = 0xFFFFFFFF >> -(int)((unsigned int)v10 / (unsigned int)v11);
else
v12 = 0;
do
v13 = sub_100050450(a2) & v12;
while ( v13 >= v6 );
return *a3 + v13;
}
}
return result;
}