//
// asn1_enc_save from 0xd70488 to 0xd70574 (236 bytes)
//
// 4 xrefs:
// > sub_D6B828 @ 0xd6c048
// > sub_D6C730 @ 0xd6cef4
// > ASN1_item_ex_d2i @ 0xd6d794
// > ??> @ 0x959e8
//
// 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 asn1_enc_save(__int64 *a1, const void *a2, int a3, __int64 a4)
{
__int64 v4; // x21
__int64 v5; // x3
__int64 v6; // x23
__int64 v7; // x25
size_t v8; // x19
void *v10; // x0
if ( !a1 )
return 1;
v4 = *a1;
if ( !*a1 )
return 1;
v5 = *(_QWORD *)(a4 + 32);
if ( !v5 )
return 1;
if ( (*(_DWORD *)(v5 + 8) & 2) == 0 )
return 1;
v6 = *(int *)(v5 + 32);
v7 = v4 + v6;
if ( !(v4 + v6) )
return 1;
v8 = a3;
CRYPTO_free(*(_QWORD *)(v4 + v6), "crypto/asn1/tasn_utl.c", 134);
v10 = (void *)CRYPTO_malloc(v8, "crypto/asn1/tasn_utl.c", 135);
*(_QWORD *)(v4 + v6) = v10;
if ( v10 )
{
memcpy(v10, a2, v8);
*(_QWORD *)(v7 + 8) = v8;
*(_DWORD *)(v7 + 16) = 0;
return 1;
}
return 0;
}