//
// ec_GFp_simple_make_affine from 0xd9add4 to 0xd9aef8 (292 bytes)
//
// 4 xrefs:
// > ??> @ 0x772b0
// > ??> @ 0x12221d8
// > ??> @ 0x1222358
// > ??> @ 0x12224d8
//
// 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 ec_GFp_simple_make_affine(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int v6; // w19
__int64 v8; // x0
__int64 v9; // x1
__int64 v10; // x2
__int64 v11; // x23
unsigned int v12; // w19
__int64 v13; // x0
if ( *(_DWORD *)(a2 + 32) )
return 1;
v8 = EC_POINT_is_at_infinity(a1, (_QWORD *)a2);
v6 = v8;
if ( (_DWORD)v8 )
return 1;
v11 = 0;
if ( a3 )
goto LABEL_6;
v13 = BN_CTX_new(v8, v9, v10);
a3 = v13;
if ( !v13 )
return v6;
v11 = v13;
LABEL_6:
BN_CTX_start(a3);
BN_CTX_get(a3);
if ( BN_CTX_get(a3)
&& (unsigned int)EC_POINT_get_affine_coordinates_GFp(a1, (_QWORD *)a2)
&& (unsigned int)EC_POINT_set_affine_coordinates_GFp(a1, (_QWORD *)a2) )
{
v12 = 1;
if ( !*(_DWORD *)(a2 + 32) )
{
v12 = 0;
ERR_put_error(16, 102, 68, "crypto/ec/ecp_smpl.c", 1188);
}
}
else
{
v12 = 0;
}
BN_CTX_end(a3);
BN_CTX_free(v11);
return v12;
}