//
// BN_usub from 0xa7ebac to 0xa7ec7c (208 bytes)
//
// 12 xrefs:
// > ec_GFp_simple_set_compressed_coordinates @ 0xa0717c
// > ec_GFp_simple_invert @ 0xa094f4
// > BN_add @ 0xa7ecd0
// > BN_add @ 0xa7ed00
// > BN_sub @ 0xa7edcc
// > BN_sub @ 0xa7ee00
// > int_bn_mod_inverse @ 0xa84534
// > int_bn_mod_inverse @ 0xa8461c
// > BN_mod_add_quick @ 0xa84ed0
// > BN_div_recp @ 0xa860b4
// > BN_div_recp @ 0xa860f0
// > ??> @ 0x7bb6c
//
// 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:08:48 +0000
//
int __fastcall BN_usub(_DWORD *a1, int *a2, _DWORD *a3)
{
int v3; // r7
int v4; // r9
int v5; // r4
int result; // r0
int v10; // r6
int v11; // r5
int v12; // r0
int *v13; // lr
_DWORD *i; // r12
int v15; // t1
int v16; // r1
v3 = a2[1];
v4 = a3[1];
v5 = v3 - v4;
if ( v3 - v4 < 0 )
{
ERR_put_error(3, 115, 100, (int)"crypto/bn/bn_add.c", 121);
return 0;
}
else
{
result = bn_wexpand((int)a1, a2[1]);
if ( result )
{
v10 = *a2;
v11 = *a1;
v12 = bn_sub_words(*a1, v10, *a3, v4);
v13 = (int *)(v10 + 4 * v4);
for ( i = (_DWORD *)(v11 + 4 * v4); v5; ++i )
{
v15 = *v13++;
v16 = v15 - v12;
if ( v15 )
v12 = 0;
else
v12 &= 1u;
--v5;
*i = v16;
}
a1[1] = v3;
a1[3] = 0;
bn_correct_top(a1);
return 1;
}
}
return result;
}