//
// BN_GF2m_add from 0xade184 to 0xade254 (208 bytes)
//
// 35 xrefs:
// > ec_GF2m_simple_set_compressed_coordinates @ 0xa9db88
// > ec_GF2m_simple_set_compressed_coordinates @ 0xa9dba0
// > ec_GF2m_simple_set_compressed_coordinates @ 0xa9dc74
// > ec_GF2m_simple_is_on_curve @ 0xa9ee84
// > ec_GF2m_simple_is_on_curve @ 0xa9eedc
// > ec_GF2m_simple_is_on_curve @ 0xa9ef14
// > ec_GF2m_simple_is_on_curve @ 0xa9ef48
// > ec_GF2m_simple_add @ 0xa9f0d4
// > ec_GF2m_simple_add @ 0xa9f0ec
// > ec_GF2m_simple_add @ 0xa9f150
// > ec_GF2m_simple_add @ 0xa9f168
// > ec_GF2m_simple_add @ 0xa9f180
// > ec_GF2m_simple_add @ 0xa9f198
// > ec_GF2m_simple_add @ 0xa9f1d8
// > ec_GF2m_simple_add @ 0xa9f1f0
// > ec_GF2m_simple_add @ 0xa9f254
// > ec_GF2m_simple_add @ 0xa9f290
// > ec_GF2m_simple_add @ 0xa9f2a8
// > ec_GF2m_simple_invert @ 0xa9f410
// > BN_GF2m_mod_solve_quad_arr @ 0xadeb34
// > BN_GF2m_mod_solve_quad_arr @ 0xadeb4c
// > BN_GF2m_mod_solve_quad_arr @ 0xadebd8
// > BN_GF2m_mod_solve_quad_arr @ 0xadec68
// > sub_AE6010 @ 0xae61b0
// > sub_AE6010 @ 0xae6390
// > sub_AE6010 @ 0xae63f4
// > sub_AE6010 @ 0xae650c
// > sub_AE6010 @ 0xae65f8
// > sub_AE6010 @ 0xae670c
// > sub_AE6010 @ 0xae6774
// > sub_AE6010 @ 0xae67d8
// > sub_AE6010 @ 0xae6818
// > sub_AE6010 @ 0xae68d0
// > sub_AE6010 @ 0xae6910
// > ??> @ 0x842cc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:09:33 +0000
//
int __fastcall BN_GF2m_add(_DWORD *a1, _DWORD *a2, _DWORD *a3)
{
int v3; // r3
_DWORD *v4; // r6
int v5; // r1
_DWORD *v6; // r4
bool v7; // cc
int result; // r0
int v10; // r1
int v11; // r2
int v12; // lr
int v13; // r3
int v14; // r0
int v15; // t1
int v16; // t1
int v17; // r1
int *v18; // lr
_DWORD *v19; // r12
int v20; // t1
v3 = a2[1];
v4 = a2;
v5 = a3[1];
v6 = a3;
v7 = v3 < v5;
if ( v3 >= v5 )
{
v5 = v3;
v6 = v4;
}
if ( !v7 )
v4 = a3;
result = bn_wexpand((int)a1, v5);
if ( result )
{
if ( (int)v4[1] <= 0 )
{
v13 = 0;
}
else
{
v10 = *v6 - 4;
v11 = *v4 - 4;
v12 = *a1 - 4;
v13 = 0;
do
{
v15 = *(_DWORD *)(v11 + 4);
v11 += 4;
v14 = v15;
v16 = *(_DWORD *)(v10 + 4);
v10 += 4;
++v13;
*(_DWORD *)(v12 + 4) = v16 ^ v14;
v12 += 4;
}
while ( v4[1] > v13 );
}
v17 = v6[1];
if ( v13 < v17 )
{
v18 = (int *)(*v6 + 4 * v13);
v19 = (_DWORD *)(*a1 + 4 * v13);
do
{
v20 = *v18++;
*v19++ = v20;
v17 = v6[1];
++v13;
}
while ( v17 > v13 );
}
a1[1] = v17;
bn_correct_top(a1);
return 1;
}
return result;
}