//
// ec_GFp_mont_group_copy from 0x1014868 to 0x1014904 (156 bytes)
//
// 3 xrefs:
// > ??> @ 0xdc630
// > ??> @ 0x1539ea0
// > ??> @ 0x153a020
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:16:04 +0000
//
__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;
}