//
// sub_1005B4E30 from 0x1005b4e30 to 0x1005b4f84 (340 bytes)
//
// 1 xrefs:
// > sub_1005B53D0 @ 0x1005b543c
//
// 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_1005B4E30(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
int v10; // w26
int *v11; // x0
int *v12; // x19
__int64 v13; // x8
__int64 v14; // x21
__int64 v15; // x10
__int64 v17; // x9
int v18; // w11
unsigned __int64 v19; // x12
int v20; // w13
v10 = sub_1005AAC20(a4) + 1;
v11 = (int *)sub_100588710((unsigned int)(4 * v10), (__int64)"bn_gf2m.c", 553);
v12 = v11;
if ( v11 )
{
LODWORD(v13) = *(_DWORD *)(a4 + 8);
if ( (_DWORD)v13 )
{
v14 = 0;
LABEL_4:
v13 = (int)v13;
v15 = 8LL * ((int)v13 - 1);
while ( v13-- >= 1 )
{
v17 = *(_QWORD *)(*(_QWORD *)a4 + v15);
v15 -= 8;
if ( v17 )
{
v18 = 0;
v19 = 0x8000000000000000LL;
do
{
if ( (v19 & v17) != 0 )
{
if ( (int)v14 < v10 )
v11[(int)v14] = (((_DWORD)v13 << 6) | 0x3F) + v18;
v14 = (unsigned int)(v14 + 1);
}
v19 >>= 1;
v20 = v18 + 63;
--v18;
}
while ( v20 > 0 );
goto LABEL_4;
}
}
if ( (int)v14 < v10 )
{
v11[(int)v14] = -1;
v14 = (unsigned int)(v14 + 1);
}
if ( (_DWORD)v14 && (int)v14 <= v10 )
{
v14 = sub_1005B4934(a1, a2, a3, v11, a5);
LABEL_22:
sub_100588C44(v12);
return v14;
}
}
else
{
v14 = 0;
}
sub_1005E0E48(3, 133, 106, "bn_gf2m.c", 557);
goto LABEL_22;
}
return 0;
}