//
// sub_1005C882C from 0x1005c882c to 0x1005c8918 (236 bytes)
//
// 1 xrefs:
// > sub_1005C5C98 @ 0x1005c5e60
//
// 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_1005C882C(_WORD *a1, int a2, const void *a3, unsigned int a4)
{
_BYTE *v7; // x21
int v8; // w22
int v9; // w23
if ( a2 - 11 >= (int)a4 )
{
*a1 = 512;
v7 = a1 + 1;
v8 = a2 - 3 - a4;
if ( (int)sub_1005E01C8(a1 + 1, (unsigned int)v8) < 1 )
{
return 0;
}
else if ( v8 < 1 )
{
LABEL_10:
*v7 = 0;
memcpy(v7 + 1, a3, a4);
return 1;
}
else
{
v9 = 0;
do
{
while ( *v7 )
{
++v7;
if ( ++v9 >= v8 )
goto LABEL_10;
}
}
while ( (int)sub_1005E01C8(v7, 1) >= 1 );
return 0;
}
}
else
{
sub_1005E0E48(4, 109, 110, "rsa_pk1.c", 153);
return 0;
}
}