//
// asn1_primitive_free from 0x7c860c to 0x7c8740 (308 bytes)
//
// 9 xrefs:
// > asn1_primitive_free @ 0x7c8684
// > asn1_template_free @ 0x7c8844
// > asn1_template_free @ 0x7c8b98
// > ASN1_item_free @ 0x7c8f28
// > ASN1_item_free @ 0x7c9108
// > ASN1_item_ex_free @ 0x7c91ec
// > ASN1_item_ex_free @ 0x7c942c
// > ASN1_TYPE_set @ 0x8646c8
// > ??> @ 0x5eafc
//
// 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
//
_DWORD *__fastcall asn1_primitive_free(_DWORD *result, int a2, int a3)
{
_DWORD *v3; // r4
int v4; // r12
int (__fastcall *v5)(_DWORD *, int, int, int); // r12
int v6; // r12
_DWORD *v7; // r1
v3 = result;
if ( a2 )
{
v4 = *(_DWORD *)(a2 + 16);
if ( v4 )
{
v5 = *(int (__fastcall **)(_DWORD *, int, int, int))(v4 + 12);
if ( v5 )
return (_DWORD *)v5(result, a2, a3, a2);
}
if ( *(_BYTE *)a2 == 5 )
{
result = (_DWORD *)*result;
if ( *v3 )
goto LABEL_14;
}
else
{
v6 = *(_DWORD *)(a2 + 4);
if ( v6 != 1 )
{
result = (_DWORD *)*result;
if ( !*v3 )
return result;
switch ( v6 )
{
case 5:
goto LABEL_12;
case 6:
LABEL_15:
result = ASN1_OBJECT_free(result);
goto LABEL_12;
case -4:
LABEL_11:
asn1_primitive_free(v3, 0, 0);
result = (_DWORD *)CRYPTO_free(*v3, "crypto/asn1/tasn_fre.c", 199);
LABEL_12:
*v3 = 0;
return result;
}
LABEL_14:
result = (_DWORD *)asn1_string_embed_free((int)result, a3);
goto LABEL_12;
}
*result = *(_DWORD *)(a2 + 20);
}
}
else
{
v7 = (_DWORD *)*result;
result = *(_DWORD **)(*result + 4);
v3 = v7 + 1;
if ( result )
{
switch ( *v7 )
{
case 0xFFFFFFFC:
goto LABEL_11;
case 1:
v7[1] = -1;
break;
case 5:
goto LABEL_12;
case 6:
goto LABEL_15;
default:
goto LABEL_14;
}
}
}
return result;
}