//
// BN_nnmod from 0x8701d8 to 0x870258 (128 bytes)
//
// 28 xrefs:
// > ossl_ecdsa_sign_setup @ 0x7edcc8
// > ossl_ecdsa_sign_sig @ 0x7ee510
// > ossl_ecdsa_verify_sig @ 0x7eef18
// > sub_7F0594 @ 0x7f14d8
// > sub_7F0594 @ 0x7f15a4
// > ec_GFp_simple_set_compressed_coordinates @ 0x7f22a8
// > ec_GFp_simple_set_Jprojective_coordinates_GFp @ 0x7f3418
// > ec_GFp_simple_set_Jprojective_coordinates_GFp @ 0x7f3480
// > ec_GFp_simple_set_Jprojective_coordinates_GFp @ 0x7f34d4
// > ec_GFp_simple_group_set_curve @ 0x7f3e74
// > ec_GFp_simple_group_set_curve @ 0x7f3ebc
// > SRP_Verify_B_mod_N @ 0x837028
// > BN_mod_exp_recp @ 0x86cee8
// > BN_mod_exp_mont @ 0x86d9d8
// > BN_mod_exp_simple @ 0x86e3d0
// > int_bn_mod_inverse @ 0x86f230
// > int_bn_mod_inverse @ 0x86f328
// > int_bn_mod_inverse @ 0x86f59c
// > BN_kronecker @ 0x870150
// > BN_mod_add @ 0x870290
// > BN_mod_sub @ 0x87030c
// > BN_mod_mul @ 0x8703ac
// > BN_mod_lshift1 @ 0x870454
// > BN_mod_lshift @ 0x8705bc
// > BN_mod_sqrt @ 0x8717e8
// > BN_mod_sqrt @ 0x871a48
// > BN_mod_sqrt @ 0x871c28
// > ??> @ 0x61c5c
//
// 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
//
int __fastcall BN_nnmod(int *a1, int *a2, int *a3, int ***a4, int a5)
{
int result; // r0
int (__fastcall *v8)(int *, int *, int *); // r3
result = BN_div(nullptr, (int)a1, a2, a3, a4);
if ( result )
{
if ( a1[3] )
{
if ( a3[3] )
v8 = BN_sub;
else
v8 = BN_add;
return v8(a1, a1, a3);
}
else
{
return 1;
}
}
return result;
}