//
// sub_1005415A0 from 0x1005415a0 to 0x100541630 (144 bytes)
//
// 2 xrefs:
// > sub_100526FF8 @ 0x100527618
// > sub_100527B50 @ 0x100527fac
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_1005415A0(_QWORD *a1, __int64 a2)
{
__int64 v2; // x8
_QWORD *i; // x9
if ( !a1 )
return 0;
if ( a2 == 1 )
{
LODWORD(v2) = 0;
goto LABEL_6;
}
if ( a2 != 2 )
return 0;
v2 = 0x6DB6DB6DB6DB6DB7LL * ((__int64)(*a1 - (_QWORD)(a1 + 14)) >> 3) + 1;
if ( (int)v2 > 7 )
return 0;
LABEL_6:
v2 = (int)v2;
for ( i = &a1[7 * (int)v2 + 14]; !*i || !i[1]; i += 7 )
{
if ( ++v2 >= 8 )
return 0;
}
*a1 = i;
return 1;
}