//
// sub_1005D8308 from 0x1005d8308 to 0x1005d83d0 (200 bytes)
//
// 1 xrefs:
// > sub_1005D7694 @ 0x1005d7a58
//
// 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:09:35 +0000
//
__int64 __fastcall sub_1005D8308(__int64 *a1, int a2, int a3, int a4)
{
int v4; // w8
int v5; // w9
int v6; // w10
__int64 v7; // x12
v4 = 0;
if ( a4 >= 1 && a2 < a3 )
{
v4 = 0;
v5 = 1 << (a2 & 7);
v6 = a2 >> 3;
while ( 1 )
{
if ( a2 >= *((_DWORD *)a1 + 13) )
goto LABEL_19;
v7 = *a1;
if ( ((unsigned __int8)v5 & *(_BYTE *)(*a1 + v6)) != 0 )
break;
if ( (a2 & 0x1F) == 0 && *(_DWORD *)(v7 + v6) == -1 )
{
v4 = 0;
LABEL_18:
v6 += 4;
a2 += 32;
if ( v4 >= a4 )
goto LABEL_19;
goto LABEL_15;
}
++v4;
if ( (a2 & 0x1F) == 0 )
goto LABEL_11;
LABEL_12:
++a2;
LOBYTE(v5) = 2 * v5;
if ( (a2 & 7) == 0 )
{
LOBYTE(v5) = 1;
++v6;
}
if ( v4 >= a4 )
goto LABEL_19;
LABEL_15:
if ( a2 >= a3 )
goto LABEL_19;
}
v4 = 0;
if ( (a2 & 0x1F) != 0 )
goto LABEL_12;
LABEL_11:
if ( *(_DWORD *)(v7 + v6) == -1 )
goto LABEL_18;
goto LABEL_12;
}
LABEL_19:
if ( v4 == a4 )
return (unsigned int)(a2 - a4);
else
return 0xFFFFFFFFLL;
}