//
// i2o_ECPublicKey from 0x7e7c30 to 0x7e7db0 (384 bytes)
//
// 7 xrefs:
// > sub_7E3D80 @ 0x7e41ec
// > sub_7E3D80 @ 0x7e4224
// > sub_7E4E64 @ 0x7e4ed4
// > sub_7E4E64 @ 0x7e4f04
// > sub_7E4E64 @ 0x7e4fdc
// > sub_7E4E64 @ 0x7e500c
// > ??> @ 0x6111c
//
// 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 i2o_ECPublicKey(_DWORD *a1, int *a2)
{
int v4; // r0
bool v5; // zf
int v6; // r5
int v7; // r12
int v9; // r8
if ( a1 )
{
v4 = EC_POINT_point2oct(a1[3], a1[4], a1[7], 0, 0, 0);
v5 = a2 == nullptr;
if ( a2 )
v5 = v4 == 0;
v6 = v4;
v7 = v5;
if ( v5 )
return v6;
if ( *a2 )
{
if ( EC_POINT_point2oct(a1[3], a1[4], a1[7], *a2, v4, v7) )
{
*a2 += v6;
return v6;
}
ERR_put_error(16, 151, 16, "crypto/ec/ec_asn1.c", 1151);
return 0;
}
else
{
v9 = CRYPTO_malloc(v4, "crypto/ec/ec_asn1.c", 1143);
*a2 = v9;
if ( v9 )
{
if ( EC_POINT_point2oct(a1[3], a1[4], a1[7], v9, v6, 0) )
return v6;
ERR_put_error(16, 151, 16, "crypto/ec/ec_asn1.c", 1151);
CRYPTO_free(*a2, "crypto/ec/ec_asn1.c", 1153);
*a2 = 0;
return 0;
}
else
{
ERR_put_error(16, 151, 65, "crypto/ec/ec_asn1.c", 1144);
return 0;
}
}
}
else
{
ERR_put_error(16, 151, 67, "crypto/ec/ec_asn1.c", 1131);
return 0;
}
}