//
// asn1_enc_restore from 0xd70574 to 0xd70644 (208 bytes)
//
// 2 xrefs:
// > ASN1_item_ex_i2d @ 0xd6dea8
// > ??> @ 0x99ca8
//
// 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_restore(_DWORD *a1, void **a2, __int64 *a3, __int64 a4)
{
__int64 v6; // x4
__int64 v7; // x1
__int64 v8; // x1
__int64 v9; // x20
if ( !a3 )
return (unsigned int)a3;
v6 = *a3;
if ( !*a3 )
return 0;
v7 = *(_QWORD *)(a4 + 32);
if ( v7 )
{
LODWORD(a3) = *(_DWORD *)(v7 + 8) & 2;
if ( (_DWORD)a3 )
{
v8 = *(int *)(v7 + 32);
LODWORD(a3) = 0;
v9 = v6 + v8;
if ( v6 + v8 )
{
if ( !*(_DWORD *)(v9 + 16) )
{
if ( a2 )
{
memcpy(*a2, *(const void **)(v6 + v8), *(_QWORD *)(v9 + 8));
*a2 = (char *)*a2 + *(_QWORD *)(v9 + 8);
}
LODWORD(a3) = 1;
if ( a1 )
*a1 = *(_QWORD *)(v9 + 8);
}
}
}
return (unsigned int)a3;
}
return 0;
}