//
// sub_7CAA94 from 0x7caa94 to 0x7cabe4 (336 bytes)
//
// 1 xrefs:
// > ??> @ 0xac0a70
//
// 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
//
int __fastcall sub_7CAA94(void *a1, unsigned __int8 *a2, int a3, int a4, int a5, int a6)
{
int v6; // r3
int v8; // r3
_DWORD v9[2]; // [sp+Ch] [bp-8h] BYREF
if ( a3 > 4 )
{
ERR_put_error(13, 166, 128, "crypto/asn1/x_long.c", 113);
return 0;
}
if ( a3 )
{
if ( (*a2 & 0x80u) != 0 )
{
if ( a3 > 0 )
{
v8 = (unsigned __int8)~*a2;
if ( a3 != 1 )
{
v8 = (unsigned __int8)~a2[1] | (v8 << 8);
if ( a3 != 2 )
{
v8 = (unsigned __int8)~a2[2] | (v8 << 8);
if ( a3 == 4 )
v8 = (unsigned __int8)~a2[3] | (v8 << 8);
}
}
v6 = ~v8;
}
else
{
v6 = -1;
}
goto LABEL_9;
}
if ( a3 > 0 )
{
v6 = *a2;
if ( a3 != 1 )
{
v6 = a2[1] | (v6 << 8);
if ( a3 != 2 )
{
v6 = a2[2] | (v6 << 8);
if ( a3 == 4 )
v6 = a2[3] | (v6 << 8);
}
}
LABEL_9:
v9[0] = v6;
goto LABEL_10;
}
}
v6 = 0;
v9[0] = 0;
LABEL_10:
if ( *(_DWORD *)(a6 + 20) == v6 )
{
ERR_put_error(13, 166, 128, "crypto/asn1/x_long.c", 135);
return 0;
}
else
{
memcpy(a1, v9, 4u);
return 1;
}
}