//
// sub_10059E66C from 0x10059e66c to 0x10059e870 (516 bytes)
//
// 1 xrefs:
// > sub_1005E51AC @ 0x1005e51d0
//
// 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_10059E66C(_QWORD *a1, int a2, unsigned __int8 *a3)
{
__int64 v6; // x8
__int64 v7; // x9
unsigned __int64 v8; // x9
unsigned __int8 *v9; // x10
unsigned __int8 *v10; // x10
int v11; // w11
int v12; // t1
unsigned __int8 *v13; // x10
unsigned __int8 v14; // t1
int v15; // w12
unsigned __int8 *v16; // x10
unsigned __int8 v17; // t1
int v18; // w11
unsigned __int8 v19; // t1
int v20; // w12
__int64 v21; // x20
__int64 result; // x0
__int64 v23; // [xsp+0h] [xbp-30h] BYREF
memcpy(a1, &unk_100675B70, 0x1048u);
v6 = 0;
v7 = a2;
if ( a2 > 72 )
v7 = 72;
v8 = (unsigned __int64)&a3[v7];
v9 = a3;
do
{
v12 = *v9;
v10 = v9 + 1;
v11 = v12;
if ( (unsigned __int64)v10 >= v8 )
v10 = a3;
v14 = *v10;
v13 = v10 + 1;
v15 = v14 | (v11 << 8);
if ( (unsigned __int64)v13 >= v8 )
v13 = a3;
v17 = *v13;
v16 = v13 + 1;
v18 = v17 | (v15 << 8);
if ( (unsigned __int64)v16 >= v8 )
v16 = a3;
v19 = *v16;
v9 = v16 + 1;
v20 = v19 | (v18 << 8);
if ( (unsigned __int64)v9 >= v8 )
v9 = a3;
*(_DWORD *)((char *)a1 + v6) ^= v20;
v6 += 4;
}
while ( v6 != 72 );
v23 = 0;
sub_10059E954(&v23, a1);
*a1 = v23;
sub_10059E954(&v23, a1);
a1[1] = v23;
sub_10059E954(&v23, a1);
a1[2] = v23;
sub_10059E954(&v23, a1);
a1[3] = v23;
sub_10059E954(&v23, a1);
a1[4] = v23;
sub_10059E954(&v23, a1);
a1[5] = v23;
sub_10059E954(&v23, a1);
a1[6] = v23;
sub_10059E954(&v23, a1);
a1[7] = v23;
sub_10059E954(&v23, a1);
v21 = 0;
a1[8] = v23;
do
{
result = sub_10059E954(&v23, a1);
a1[v21 + 9] = v23;
++v21;
}
while ( v21 < 512 );
return result;
}