//
// asn1_enc_restore from 0x7ca59c to 0x7ca658 (188 bytes)
//
// 2 xrefs:
// > ASN1_item_ex_i2d @ 0x7c7c3c
// > ??> @ 0x5eadc
//
// 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 asn1_enc_restore(_DWORD *a1, void **a2, int *a3, int a4)
{
int v4; // r12
int v5; // r3
int v6; // r2
int v7; // r4
int v8; // r2
if ( !a3 )
return a3;
v4 = *a3;
if ( !*a3 )
return nullptr;
v5 = *(_DWORD *)(a4 + 16);
if ( !v5 )
return nullptr;
a3 = (int *)(*(_DWORD *)(v5 + 4) & 2);
if ( !a3 )
return a3;
v6 = *(_DWORD *)(v5 + 20);
v7 = v4 + v6;
if ( !(v4 + v6) )
return nullptr;
if ( *(_DWORD *)(v7 + 8) )
return nullptr;
if ( a2 )
{
memcpy(*a2, *(const void **)(v4 + v6), *(_DWORD *)(v7 + 4));
*a2 = (char *)*a2 + *(_DWORD *)(v7 + 4);
}
v8 = 1;
if ( a1 )
*a1 = *(_DWORD *)(v7 + 4);
return (int *)v8;
}