//
// d2i_ASN1_UINTEGER from 0xe0a420 to 0xe0a608 (488 bytes)
//
// 1 xrefs:
// > ??> @ 0xac428
//
// 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 d2i_ASN1_UINTEGER(__int64 *a1, _BYTE **a2, __int64 a3)
{
__int64 v5; // x19
__int64 v6; // x0
_BYTE *v7; // x3
__int16 v8; // w2
void *v10; // x23
signed __int64 v11; // x2
_BYTE *v12; // x1
int v14; // [xsp+58h] [xbp+58h] BYREF
int v15; // [xsp+5Ch] [xbp+5Ch] BYREF
_BYTE *v16; // [xsp+60h] [xbp+60h] BYREF
signed __int64 v17; // [xsp+68h] [xbp+68h] BYREF
if ( a1 && (v5 = *a1) != 0 )
{
v16 = *a2;
if ( (ASN1_get_object(&v16, &v17, &v14, &v15, a3) & 0x80) != 0 )
{
ERR_put_error(13, 150, 102, (__int64)"crypto/asn1/a_int.c", 464);
LABEL_11:
if ( *a1 != v5 )
goto LABEL_12;
return 0;
}
if ( v14 != 2 )
{
ERR_put_error(13, 150, 115, (__int64)"crypto/asn1/a_int.c", 464);
goto LABEL_11;
}
}
else
{
v6 = ASN1_INTEGER_new();
v5 = v6;
if ( !v6 )
return 0;
v7 = *a2;
*(_DWORD *)(v6 + 4) = 2;
v16 = v7;
if ( (ASN1_get_object(&v16, &v17, &v14, &v15, a3) & 0x80) != 0 )
{
v8 = 102;
goto LABEL_10;
}
if ( v14 != 2 )
{
v8 = 115;
goto LABEL_10;
}
}
v10 = CRYPTO_malloc((void *)((int)v17 + 1), (__int64)"crypto/asn1/a_int.c", 441);
if ( !v10 )
{
v8 = 65;
LABEL_10:
ERR_put_error(13, 150, v8, (__int64)"crypto/asn1/a_int.c", 464);
if ( !a1 )
{
LABEL_12:
ASN1_INTEGER_free(v5);
return 0;
}
goto LABEL_11;
}
v11 = v17;
*(_DWORD *)(v5 + 4) = 2;
if ( v11 )
{
v12 = v16;
if ( !*v16 && v11 != 1 )
{
v12 = v16 + 1;
--v11;
++v16;
v17 = v11;
}
memcpy(v10, v12, (int)v11);
v16 += v17;
}
CRYPTO_free(*(void **)(v5 + 8), (__int64)"crypto/asn1/a_int.c", 456);
*(_QWORD *)(v5 + 8) = v10;
*(_DWORD *)v5 = v17;
if ( a1 )
*a1 = v5;
*a2 = v16;
return v5;
}