//
// ec_GFp_mont_group_copy from 0xd96508 to 0xd965a4 (156 bytes)
//
// 3 xrefs:
// > ??> @ 0xa7fb8
// > ??> @ 0x1222118
// > ??> @ 0x1222298
//
// 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_mont_group_copy(__int64 a1, __int64 a2)
{
__int64 v4; // x0
__int64 v5; // x0
unsigned __int64 *v6; // x0
BN_MONT_CTX_free(*(_QWORD *)(a1 + 120));
*(_QWORD *)(a1 + 120) = 0;
BN_clear_free(*(_BYTE **)(a1 + 128));
*(_QWORD *)(a1 + 128) = 0;
if ( !(unsigned int)ec_GFp_simple_group_copy(a1, a2) )
return 0;
if ( !*(_QWORD *)(a2 + 120) )
goto LABEL_5;
v4 = BN_MONT_CTX_new();
*(_QWORD *)(a1 + 120) = v4;
if ( v4 )
{
if ( !BN_MONT_CTX_copy(v4, *(int **)(a2 + 120)) )
{
LABEL_8:
BN_MONT_CTX_free(*(_QWORD *)(a1 + 120));
*(_QWORD *)(a1 + 120) = 0;
return 0;
}
LABEL_5:
v5 = *(_QWORD *)(a2 + 128);
if ( !v5 )
return 1;
v6 = BN_dup(v5);
*(_QWORD *)(a1 + 128) = v6;
if ( v6 )
return 1;
goto LABEL_8;
}
return 0;
}