//
// sub_1005CA11C from 0x1005ca11c to 0x1005ca238 (284 bytes)
//
// 1 xrefs:
// > sub_1005C5FEC @ 0x1005c6298
//
// 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_1005CA11C(void *a1, __int64 a2, unsigned __int8 *a3, int a4, int a5)
{
int v5; // w8
unsigned __int8 *v6; // x1
int v7; // w8
int v8; // w9
unsigned __int8 *v9; // x10
int v10; // w10
__int64 v11; // x2
__int64 v12; // x4
__int64 v13; // x19
if ( a5 == a4 && (v5 = *a3, (v5 & 0xFE) == 0x6A) )
{
v6 = a3 + 1;
if ( v5 == 107 )
{
if ( a5 < 4 )
{
LABEL_18:
v11 = 138;
v12 = 131;
goto LABEL_10;
}
v7 = 0;
v8 = a5 - 3;
while ( 1 )
{
v9 = a3;
a3 = v6;
v6 = v9 + 2;
v10 = *a3;
if ( v10 != 187 )
break;
if ( v8 <= ++v7 )
goto LABEL_14;
}
if ( v10 != 186 )
{
v11 = 138;
v12 = 123;
goto LABEL_10;
}
LABEL_14:
if ( !v7 )
goto LABEL_18;
v13 = (unsigned int)(v8 - v7);
}
else
{
v13 = (unsigned int)(a5 - 2);
}
if ( v6[(int)v13] == 204 )
{
memcpy(a1, v6, (unsigned int)v13);
return v13;
}
v11 = 139;
v12 = 139;
}
else
{
v11 = 137;
v12 = 112;
}
LABEL_10:
sub_1005E0E48(4, 128, v11, "rsa_x931.c", v12);
return 0xFFFFFFFFLL;
}