//
// BN_nnmod from 0x10979e8 to 0x1097a60 (120 bytes)
//
// 29 xrefs:
// > ossl_ecdsa_sign_setup @ 0x1012be4
// > ossl_ecdsa_sign_sig @ 0x1013354
// > ossl_ecdsa_verify_sig @ 0x1013c20
// > sub_10150E8 @ 0x1015eb8
// > sub_10150E8 @ 0x1015f14
// > ec_GFp_simple_set_compressed_coordinates @ 0x1016990
// > ec_GFp_simple_set_Jprojective_coordinates_GFp @ 0x1017ad0
// > ec_GFp_simple_set_Jprojective_coordinates_GFp @ 0x1017b34
// > ec_GFp_simple_set_Jprojective_coordinates_GFp @ 0x1017b74
// > ec_GFp_simple_group_set_curve @ 0x1018484
// > ec_GFp_simple_group_set_curve @ 0x10184c0
// > SRP_Verify_B_mod_N @ 0x105cf9c
// > sub_10945E0 @ 0x10946cc
// > BN_mod_exp_mont @ 0x1095478
// > BN_mod_exp_simple @ 0x1095dc8
// > int_bn_mod_inverse @ 0x1096b60
// > int_bn_mod_inverse @ 0x1096c38
// > int_bn_mod_inverse @ 0x1096e70
// > int_bn_mod_inverse @ 0x10971ec
// > BN_kronecker @ 0x1097968
// > BN_mod_add @ 0x1097aac
// > BN_mod_sub @ 0x1097b5c
// > BN_mod_mul @ 0x1097c18
// > BN_mod_lshift1 @ 0x1097d0c
// > BN_mod_lshift @ 0x1097e90
// > BN_mod_sqrt @ 0x10991d0
// > BN_mod_sqrt @ 0x10993e0
// > BN_mod_sqrt @ 0x109958c
// > ??> @ 0xa4a10
//
// 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:17:24 +0000
//
__int64 __fastcall BN_nnmod(__int64 a1, __int64 a2, __int64 a3, int32x2_t *a4)
{
__int64 result; // x0
result = BN_div(0, a1, a2, a3, a4);
if ( (_DWORD)result )
{
result = 1;
if ( *(_DWORD *)(a1 + 16) )
{
if ( *(_DWORD *)(a3 + 16) )
return BN_sub(a1, a1, a3);
else
return (__int64)BN_add(a1, a1, a3);
}
}
return result;
}