val bn_sub_mod_n: #t:limb_t -> len:size_t{v len > 0} -> bn_sub_mod_n_st t len
let bn_sub_mod_n #t len n a b res =
  push_frame ();
  let c0 = bn_sub_eq_len len a b res in
  let tmp = create len (uint #t 0) in
  let c1 = bn_add_eq_len len res n tmp in
  LowStar.Ignore.ignore c1;
  let c = uint #t 0 -. c0 in
  map2T len res (mask_select c) tmp res;
  pop_frame ()
val bn_sub_mod_n: #t:limb_t -> len:size_t{v len > 0} -> bn_sub_mod_n_st t len
let bn_sub_mod_n #t len n a b res =
push_frame ();
let c0 = bn_sub_eq_len len a b res in
let tmp = create len (uint #t 0) in
let c1 = bn_add_eq_len len res n tmp in
LowStar.Ignore.ignore c1;
let c = uint #t 0 -. c0 in
map2T len res (mask_select c) tmp res;
pop_frame ()
Hacl.Bignum.fst.checked
prims.fst.checked LowStar.Ignore.fsti.checked Lib.ByteBuffer.fsti.checked Hacl.Spec.Bignum.fst.checked Hacl.Bignum.Multiplication.fst.checked Hacl.Bignum.Lib.fst.checked Hacl.Bignum.Karatsuba.fst.checked Hacl.Bignum.Convert.fst.checked Hacl.Bignum.Comparison.fst.checked Hacl.Bignum.Addition.fst.checked FStar.UInt32.fsti.checked FStar.ST.fst.checked FStar.Pervasives.fsti.checked
Hacl.Bignum.fst
Hacl.Bignum.Definitions.limb_t Lib.IntTypes.size_t Prims.b2t Prims.op_GreaterThan Lib.IntTypes.v Lib.IntTypes.U32 Lib.IntTypes.PUB Hacl.Bignum.Definitions.lbignum FStar.HyperStack.ST.pop_frame Prims.unit Lib.Buffer.map2T Lib.Buffer.MUT Hacl.Bignum.Definitions.limb Hacl.Spec.Bignum.Base.mask_select Lib.IntTypes.int_t Lib.IntTypes.SEC Lib.IntTypes.op_Subtraction_Dot Lib.IntTypes.uint LowStar.Ignore.ignore Hacl.Spec.Bignum.Base.carry Hacl.Bignum.bn_add_eq_len Lib.Buffer.lbuffer_t Lib.Buffer.create Lib.Buffer.lbuffer Hacl.Bignum.bn_sub_eq_len FStar.HyperStack.ST.push_frame
module Hacl.Bignum

friend Hacl.Spec.Bignum

#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"

let bn_add1 #t aLen a b1 res =
  Hacl.Bignum.Addition.bn_add1 aLen a b1 res

let bn_sub1 #t aLen a b1 res =
  Hacl.Bignum.Addition.bn_sub1 aLen a b1 res

let bn_add_eq_len #t aLen a b res =
  Hacl.Bignum.Addition.bn_add_eq_len aLen a b res

let bn_sub_eq_len #t aLen a b res =
  Hacl.Bignum.Addition.bn_sub_eq_len aLen a b res

let bn_add #t aLen a bLen b res =
  Hacl.Bignum.Addition.bn_add aLen a bLen b res

let bn_sub #t aLen a bLen b res =
  Hacl.Bignum.Addition.bn_sub aLen a bLen b res

let bn_reduce_once #t len n c0 res =
  push_frame ();
  let tmp = create len (uint #t 0) in
  let c1 = bn_sub_eq_len len res n tmp in
  let c = c0 -. c1 in
  map2T len res (mask_select c) res tmp;
  pop_frame()

let bn_add_mod_n #t len n a b res =
  let c0 = bn_add_eq_len len a b res in
  bn_reduce_once len n c0 res
val bn_sub_mod_n: #t:limb_t -> len:size_t{v len > 0} -> bn_sub_mod_n_st t len
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> Hacl.Bignum.bn_sub_mod_n_st t len