//
// sub_1005F09B0 from 0x1005f09b0 to 0x1005f0a50 (160 bytes)
//
// 4 xrefs:
// > sub_1005F40F4 @ 0x1005f4478
// > sub_10060A750 @ 0x10060a768
// > sub_100616518 @ 0x100616524
// > sub_1006165F4 @ 0x100616648
//
// 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_1005F09B0(int *a1)
{
int v1; // w8
int v2; // w9
__int64 v4; // x10
__int64 v5; // x8
__int64 v6; // x8
__int64 v7; // x11
unsigned __int64 v8; // x13
unsigned __int64 v9; // x12
if ( !a1 )
return 0;
v1 = a1[1];
if ( v1 == 266 )
{
v2 = 1;
}
else
{
if ( v1 != 10 )
return -1;
v2 = 0;
}
v4 = *a1;
v5 = 0xFFFFFFFFLL;
if ( (int)v4 <= 8 )
{
v6 = *((_QWORD *)a1 + 1);
if ( !v6 )
return 0;
if ( (int)v4 < 1 )
{
v9 = 0;
}
else
{
v7 = 0;
v8 = 0;
do
{
v9 = *(unsigned __int8 *)(v6 + v7++) | (v8 << 8);
v8 = v9;
}
while ( v7 < v4 );
}
if ( v2 )
return -(__int64)v9;
else
return v9;
}
return v5;
}