//
// sub_1005F3238 from 0x1005f3238 to 0x1005f32f0 (184 bytes)
//
// 1 xrefs:
// > ??> @ 0x100862230
//
// 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_1005F3238(__int64 *a1, _BYTE *a2, __int64 a3, __int64 a4)
{
__int64 v5; // x21
unsigned __int64 v7; // x20
int v8; // w0
int v9; // w9
__int64 v10; // x10
bool v11; // cc
v5 = *a1;
if ( *a1 == *(_QWORD *)(a4 + 40) )
return 0xFFFFFFFFLL;
v7 = v5 ^ (v5 >> 63);
v8 = sub_1005AAB38(v7);
v9 = (v8 + 7) >> 3;
if ( a2 )
{
if ( (v8 & 7) == 0 )
*a2++ = v5 >> 63;
LODWORD(v10) = v9 - 1;
if ( v9 >= 1 )
{
v10 = (int)v10;
if ( v5 < 0 )
{
do
{
a2[v10] = ~(_BYTE)v7;
v7 >>= 8;
v11 = v10-- <= 0;
}
while ( !v11 );
}
else
{
do
{
a2[v10] = v7;
v7 >>= 8;
v11 = v10-- <= 0;
}
while ( !v11 );
}
}
}
return (unsigned int)((v8 & 7) == 0) + v9;
}