//
// asn1_primitive_free from 0x9dd20c to 0x9dd340 (308 bytes)
//
// 9 xrefs:
// > asn1_primitive_free @ 0x9dd284
// > asn1_template_free @ 0x9dd444
// > asn1_template_free @ 0x9dd798
// > ASN1_item_free @ 0x9ddb28
// > ASN1_item_free @ 0x9ddd08
// > ASN1_item_ex_free @ 0x9dddec
// > ASN1_item_ex_free @ 0x9de02c
// > ASN1_TYPE_set @ 0xa792c8
// > ??> @ 0x7857c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:07:18 +0000
//
_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;
}