//
// sub_100402C60 from 0x100402c60 to 0x100402d5c (252 bytes)
//
// 1 xrefs:
// > sub_1003F823C @ 0x1003f8a90
//
// 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:04:39 +0000
//
__int64 __fastcall sub_100402C60(__int64 result)
{
__int64 *v1; // x19
unsigned __int64 i; // x20
__int64 v3; // x24
__int64 v4; // x8
__int64 v5; // x10
__int64 v6; // x11
int v7; // w21
__int64 v8; // x12
__int64 v9; // x10
unsigned int *v10; // x9
__int64 v11; // x8
__int64 *v12; // x24
unsigned __int64 v13; // x25
v1 = (__int64 *)result;
for ( i = 0; i != 10000; ++i )
{
if ( *(_BYTE *)(v1[1830] + i) )
{
v3 = *(_QWORD *)(v1[452] + 8 * i);
if ( v3 )
{
result = sub_1000150C8(v1[269], i);
v4 = v1[1813];
v5 = 1LL << i;
v6 = *(_QWORD *)(v4 + 8 * (i >> 6));
if ( (((unsigned int)result ^ ((v6 & (1LL << i)) != 0)) & 1) == 0 )
{
v7 = result;
v8 = v6 & ~v5;
v9 = v6 | v5;
if ( (_DWORD)result )
v9 = v8;
*(_QWORD *)(v4 + 8 * (i >> 6)) = v9;
v10 = *(unsigned int **)(v3 + 56);
v11 = *v10;
if ( (_DWORD)v11 )
{
v12 = *((__int64 **)v10 + 2);
v13 = (unsigned __int64)&v12[v11 - 1];
do
{
result = *v12;
if ( !*v12 )
break;
if ( (*(_BYTE *)(result + 1253) & 1) == 0 )
{
if ( v7 )
result = sub_1002FA8F4(result);
else
result = sub_1002FA910(result);
}
++v12;
}
while ( (unsigned __int64)v12 <= v13 );
}
}
}
--*(_BYTE *)(v1[1830] + i);
}
}
return result;
}