(* Generated by coq-of-rust *)
Require Import CoqOfRust.CoqOfRust.

Module num.
  Module bignum.
    (* Trait *)
    (* Empty module 'FullOps' *)
    
    Module Impl_core_num_bignum_FullOps_for_u8.
      Definition Self : Ty.t := Ty.path "u8".
      
      (*
                      fn full_mul_add(self, other: $ty, other2: $ty, carry: $ty) -> ($ty, $ty) {
                          // This cannot overflow;
                          // the output is between `0` and `2^nbits * (2^nbits - 1)`.
                          let v = (self as $bigty) * (other as $bigty) + (other2 as $bigty) +
                                  (carry as $bigty);
                          ((v >> <$ty>::BITS) as $ty, v as $ty)
                      }
      *)
      Definition full_mul_add (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other; other2; carry ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            let other2 := M.alloc (| other2 |) in
            let carry := M.alloc (| carry |) in
            M.read (|
              let~ v :=
                M.alloc (|
                  BinOp.Wrap.add (|
                    BinOp.Wrap.add (|
                      BinOp.Wrap.mul (|
                        M.rust_cast (M.read (| self |)),
                        M.rust_cast (M.read (| other |))
                      |),
                      M.rust_cast (M.read (| other2 |))
                    |),
                    M.rust_cast (M.read (| carry |))
                  |)
                |) in
              M.alloc (|
                Value.Tuple
                  [
                    M.rust_cast
                      (BinOp.Wrap.shr (|
                        M.read (| v |),
                        M.read (| M.get_constant (| "core::num::BITS" |) |)
                      |));
                    M.rust_cast (M.read (| v |))
                  ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      (*
                      fn full_div_rem(self, other: $ty, borrow: $ty) -> ($ty, $ty) {
                          debug_assert!(borrow < other);
                          // This cannot overflow; the output is between `0` and `other * (2^nbits - 1)`.
                          let lhs = ((borrow as $bigty) << <$ty>::BITS) | (self as $bigty);
                          let rhs = other as $bigty;
                          ((lhs / rhs) as $ty, (lhs % rhs) as $ty)
                      }
      *)
      Definition full_div_rem (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other; borrow ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            let borrow := M.alloc (| borrow |) in
            M.read (|
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          BinOp.lt (| M.read (| borrow |), M.read (| other |) |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String "assertion failed: borrow < other"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ lhs :=
                M.alloc (|
                  BinOp.bit_or
                    (BinOp.Wrap.shl (|
                      M.rust_cast (M.read (| borrow |)),
                      M.read (| M.get_constant (| "core::num::BITS" |) |)
                    |))
                    (M.rust_cast (M.read (| self |)))
                |) in
              let~ rhs := M.alloc (| M.rust_cast (M.read (| other |)) |) in
              M.alloc (|
                Value.Tuple
                  [
                    M.rust_cast (BinOp.Wrap.div (| M.read (| lhs |), M.read (| rhs |) |));
                    M.rust_cast (BinOp.Wrap.rem (| M.read (| lhs |), M.read (| rhs |) |))
                  ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::num::bignum::FullOps"
          Self
          (* Trait polymorphic types *) []
          (* Instance *)
          [
            ("full_mul_add", InstanceField.Method full_mul_add);
            ("full_div_rem", InstanceField.Method full_div_rem)
          ].
    End Impl_core_num_bignum_FullOps_for_u8.
    
    Module Impl_core_num_bignum_FullOps_for_u16.
      Definition Self : Ty.t := Ty.path "u16".
      
      (*
                      fn full_mul_add(self, other: $ty, other2: $ty, carry: $ty) -> ($ty, $ty) {
                          // This cannot overflow;
                          // the output is between `0` and `2^nbits * (2^nbits - 1)`.
                          let v = (self as $bigty) * (other as $bigty) + (other2 as $bigty) +
                                  (carry as $bigty);
                          ((v >> <$ty>::BITS) as $ty, v as $ty)
                      }
      *)
      Definition full_mul_add (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other; other2; carry ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            let other2 := M.alloc (| other2 |) in
            let carry := M.alloc (| carry |) in
            M.read (|
              let~ v :=
                M.alloc (|
                  BinOp.Wrap.add (|
                    BinOp.Wrap.add (|
                      BinOp.Wrap.mul (|
                        M.rust_cast (M.read (| self |)),
                        M.rust_cast (M.read (| other |))
                      |),
                      M.rust_cast (M.read (| other2 |))
                    |),
                    M.rust_cast (M.read (| carry |))
                  |)
                |) in
              M.alloc (|
                Value.Tuple
                  [
                    M.rust_cast
                      (BinOp.Wrap.shr (|
                        M.read (| v |),
                        M.read (| M.get_constant (| "core::num::BITS" |) |)
                      |));
                    M.rust_cast (M.read (| v |))
                  ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      (*
                      fn full_div_rem(self, other: $ty, borrow: $ty) -> ($ty, $ty) {
                          debug_assert!(borrow < other);
                          // This cannot overflow; the output is between `0` and `other * (2^nbits - 1)`.
                          let lhs = ((borrow as $bigty) << <$ty>::BITS) | (self as $bigty);
                          let rhs = other as $bigty;
                          ((lhs / rhs) as $ty, (lhs % rhs) as $ty)
                      }
      *)
      Definition full_div_rem (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other; borrow ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            let borrow := M.alloc (| borrow |) in
            M.read (|
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          BinOp.lt (| M.read (| borrow |), M.read (| other |) |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String "assertion failed: borrow < other"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ lhs :=
                M.alloc (|
                  BinOp.bit_or
                    (BinOp.Wrap.shl (|
                      M.rust_cast (M.read (| borrow |)),
                      M.read (| M.get_constant (| "core::num::BITS" |) |)
                    |))
                    (M.rust_cast (M.read (| self |)))
                |) in
              let~ rhs := M.alloc (| M.rust_cast (M.read (| other |)) |) in
              M.alloc (|
                Value.Tuple
                  [
                    M.rust_cast (BinOp.Wrap.div (| M.read (| lhs |), M.read (| rhs |) |));
                    M.rust_cast (BinOp.Wrap.rem (| M.read (| lhs |), M.read (| rhs |) |))
                  ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::num::bignum::FullOps"
          Self
          (* Trait polymorphic types *) []
          (* Instance *)
          [
            ("full_mul_add", InstanceField.Method full_mul_add);
            ("full_div_rem", InstanceField.Method full_div_rem)
          ].
    End Impl_core_num_bignum_FullOps_for_u16.
    
    Module Impl_core_num_bignum_FullOps_for_u32.
      Definition Self : Ty.t := Ty.path "u32".
      
      (*
                      fn full_mul_add(self, other: $ty, other2: $ty, carry: $ty) -> ($ty, $ty) {
                          // This cannot overflow;
                          // the output is between `0` and `2^nbits * (2^nbits - 1)`.
                          let v = (self as $bigty) * (other as $bigty) + (other2 as $bigty) +
                                  (carry as $bigty);
                          ((v >> <$ty>::BITS) as $ty, v as $ty)
                      }
      *)
      Definition full_mul_add (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other; other2; carry ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            let other2 := M.alloc (| other2 |) in
            let carry := M.alloc (| carry |) in
            M.read (|
              let~ v :=
                M.alloc (|
                  BinOp.Wrap.add (|
                    BinOp.Wrap.add (|
                      BinOp.Wrap.mul (|
                        M.rust_cast (M.read (| self |)),
                        M.rust_cast (M.read (| other |))
                      |),
                      M.rust_cast (M.read (| other2 |))
                    |),
                    M.rust_cast (M.read (| carry |))
                  |)
                |) in
              M.alloc (|
                Value.Tuple
                  [
                    M.rust_cast
                      (BinOp.Wrap.shr (|
                        M.read (| v |),
                        M.read (| M.get_constant (| "core::num::BITS" |) |)
                      |));
                    M.rust_cast (M.read (| v |))
                  ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      (*
                      fn full_div_rem(self, other: $ty, borrow: $ty) -> ($ty, $ty) {
                          debug_assert!(borrow < other);
                          // This cannot overflow; the output is between `0` and `other * (2^nbits - 1)`.
                          let lhs = ((borrow as $bigty) << <$ty>::BITS) | (self as $bigty);
                          let rhs = other as $bigty;
                          ((lhs / rhs) as $ty, (lhs % rhs) as $ty)
                      }
      *)
      Definition full_div_rem (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other; borrow ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            let borrow := M.alloc (| borrow |) in
            M.read (|
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          BinOp.lt (| M.read (| borrow |), M.read (| other |) |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String "assertion failed: borrow < other"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ lhs :=
                M.alloc (|
                  BinOp.bit_or
                    (BinOp.Wrap.shl (|
                      M.rust_cast (M.read (| borrow |)),
                      M.read (| M.get_constant (| "core::num::BITS" |) |)
                    |))
                    (M.rust_cast (M.read (| self |)))
                |) in
              let~ rhs := M.alloc (| M.rust_cast (M.read (| other |)) |) in
              M.alloc (|
                Value.Tuple
                  [
                    M.rust_cast (BinOp.Wrap.div (| M.read (| lhs |), M.read (| rhs |) |));
                    M.rust_cast (BinOp.Wrap.rem (| M.read (| lhs |), M.read (| rhs |) |))
                  ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::num::bignum::FullOps"
          Self
          (* Trait polymorphic types *) []
          (* Instance *)
          [
            ("full_mul_add", InstanceField.Method full_mul_add);
            ("full_div_rem", InstanceField.Method full_div_rem)
          ].
    End Impl_core_num_bignum_FullOps_for_u32.
    
    Definition value_SMALL_POW5 : Value.t :=
      M.run
        ltac:(M.monadic
          (M.alloc (|
            Value.Array
              [
                Value.Tuple
                  [ Value.Integer IntegerKind.U64 125; Value.Integer IntegerKind.Usize 3 ];
                Value.Tuple
                  [ Value.Integer IntegerKind.U64 15625; Value.Integer IntegerKind.Usize 6 ];
                Value.Tuple
                  [ Value.Integer IntegerKind.U64 1220703125; Value.Integer IntegerKind.Usize 13 ]
              ]
          |))).
    
    Axiom Digit32 : (Ty.path "core::num::bignum::Digit32") = (Ty.path "u32").
    
    (* StructRecord
      {
        name := "Big32x40";
        const_params := [];
        ty_params := [];
        fields :=
          [
            ("size", Ty.path "usize");
            ("base",
              Ty.apply (Ty.path "array") [ Value.Integer IntegerKind.Usize 40 ] [ Ty.path "u32" ])
          ];
      } *)
    
    Module Impl_core_num_bignum_Big32x40.
      Definition Self : Ty.t := Ty.path "core::num::bignum::Big32x40".
      
      (*
                  pub fn from_small(v: $ty) -> $name {
                      let mut base = [0; $n];
                      base[0] = v;
                      $name { size: 1, base }
                  }
      *)
      Definition from_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ v ] =>
          ltac:(M.monadic
            (let v := M.alloc (| v |) in
            M.read (|
              let~ base :=
                M.alloc (|
                  repeat (| Value.Integer IntegerKind.U32 0, Value.Integer IntegerKind.Usize 40 |)
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_array_field (|
                    base,
                    M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                  |),
                  M.read (| v |)
                |) in
              M.alloc (|
                Value.StructRecord
                  "core::num::bignum::Big32x40"
                  [ ("size", Value.Integer IntegerKind.Usize 1); ("base", M.read (| base |)) ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_from_small : M.IsAssociatedFunction Self "from_small" from_small.
      
      (*
                  pub fn from_u64(mut v: u64) -> $name {
                      let mut base = [0; $n];
                      let mut sz = 0;
                      while v > 0 {
                          base[sz] = v as $ty;
                          v >>= <$ty>::BITS;
                          sz += 1;
                      }
                      $name { size: sz, base }
                  }
      *)
      Definition from_u64 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ v ] =>
          ltac:(M.monadic
            (let v := M.alloc (| v |) in
            M.read (|
              let~ base :=
                M.alloc (|
                  repeat (| Value.Integer IntegerKind.U32 0, Value.Integer IntegerKind.Usize 40 |)
                |) in
              let~ sz := M.alloc (| Value.Integer IntegerKind.Usize 0 |) in
              let~ _ :=
                M.loop (|
                  ltac:(M.monadic
                    (M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  BinOp.gt (| M.read (| v |), Value.Integer IntegerKind.U64 0 |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (| base, sz |),
                                M.rust_cast (M.read (| v |))
                              |) in
                            let~ _ :=
                              let β := v in
                              M.write (|
                                β,
                                BinOp.Wrap.shr (|
                                  M.read (| β |),
                                  M.read (| M.get_constant (| "core::num::BITS" |) |)
                                |)
                              |) in
                            let~ _ :=
                              let β := sz in
                              M.write (|
                                β,
                                BinOp.Wrap.add (|
                                  M.read (| β |),
                                  Value.Integer IntegerKind.Usize 1
                                |)
                              |) in
                            M.alloc (| Value.Tuple [] |)));
                        fun γ =>
                          ltac:(M.monadic
                            (M.alloc (|
                              M.never_to_any (|
                                M.read (|
                                  let~ _ :=
                                    M.alloc (| M.never_to_any (| M.read (| M.break (||) |) |) |) in
                                  M.alloc (| Value.Tuple [] |)
                                |)
                              |)
                            |)))
                      ]
                    |)))
                |) in
              M.alloc (|
                Value.StructRecord
                  "core::num::bignum::Big32x40"
                  [ ("size", M.read (| sz |)); ("base", M.read (| base |)) ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_from_u64 : M.IsAssociatedFunction Self "from_u64" from_u64.
      
      (*
                  pub fn digits(&self) -> &[$ty] {
                      &self.base[..self.size]
                  }
      *)
      Definition digits (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.call_closure (|
              M.get_trait_method (|
                "core::ops::index::Index",
                Ty.apply (Ty.path "array") [ Value.Integer IntegerKind.Usize 40 ] [ Ty.path "u32" ],
                [ Ty.apply (Ty.path "core::ops::range::RangeTo") [] [ Ty.path "usize" ] ],
                "index",
                []
              |),
              [
                M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "core::num::bignum::Big32x40",
                  "base"
                |);
                Value.StructRecord
                  "core::ops::range::RangeTo"
                  [
                    ("end_",
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::num::bignum::Big32x40",
                          "size"
                        |)
                      |))
                  ]
              ]
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_digits : M.IsAssociatedFunction Self "digits" digits.
      
      (*
                  pub fn get_bit(&self, i: usize) -> u8 {
                      let digitbits = <$ty>::BITS as usize;
                      let d = i / digitbits;
                      let b = i % digitbits;
                      ((self.base[d] >> b) & 1) as u8
                  }
      *)
      Definition get_bit (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; i ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let i := M.alloc (| i |) in
            M.read (|
              let~ digitbits :=
                M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
              let~ d := M.alloc (| BinOp.Wrap.div (| M.read (| i |), M.read (| digitbits |) |) |) in
              let~ b := M.alloc (| BinOp.Wrap.rem (| M.read (| i |), M.read (| digitbits |) |) |) in
              M.alloc (|
                M.rust_cast
                  (BinOp.bit_and
                    (BinOp.Wrap.shr (|
                      M.read (|
                        M.SubPointer.get_array_field (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::num::bignum::Big32x40",
                            "base"
                          |),
                          d
                        |)
                      |),
                      M.read (| b |)
                    |))
                    (Value.Integer IntegerKind.U32 1))
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_get_bit : M.IsAssociatedFunction Self "get_bit" get_bit.
      
      (*
                  pub fn is_zero(&self) -> bool {
                      self.digits().iter().all(|&v| v == 0)
                  }
      *)
      Definition is_zero (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.call_closure (|
              M.get_trait_method (|
                "core::iter::traits::iterator::Iterator",
                Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ],
                [],
                "all",
                [
                  Ty.function
                    [ Ty.tuple [ Ty.apply (Ty.path "&") [] [ Ty.path "u32" ] ] ]
                    (Ty.path "bool")
                ]
              |),
              [
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                      "iter",
                      []
                    |),
                    [
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "core::num::bignum::Big32x40",
                          "digits",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    ]
                  |)
                |);
                M.closure
                  (fun γ =>
                    ltac:(M.monadic
                      match γ with
                      | [ α0 ] =>
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| α0 |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ := M.read (| γ |) in
                                  let v := M.copy (| γ |) in
                                  BinOp.eq (| M.read (| v |), Value.Integer IntegerKind.U32 0 |)))
                            ]
                          |)))
                      | _ => M.impossible "wrong number of arguments"
                      end))
              ]
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_is_zero : M.IsAssociatedFunction Self "is_zero" is_zero.
      
      (*
                  pub fn bit_length(&self) -> usize {
                      let digitbits = <$ty>::BITS as usize;
                      let digits = self.digits();
                      // Find the most significant non-zero digit.
                      let msd = digits.iter().rposition(|&x| x != 0);
                      match msd {
                          Some(msd) => msd * digitbits + digits[msd].ilog2() as usize + 1,
                          // There are no non-zero digits, i.e., the number is zero.
                          _ => 0,
                      }
                  }
      *)
      Definition bit_length (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (|
              let~ digitbits :=
                M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
              let~ digits :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "core::num::bignum::Big32x40",
                      "digits",
                      []
                    |),
                    [ M.read (| self |) ]
                  |)
                |) in
              let~ msd :=
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ],
                      [],
                      "rposition",
                      [
                        Ty.function
                          [ Ty.tuple [ Ty.apply (Ty.path "&") [] [ Ty.path "u32" ] ] ]
                          (Ty.path "bool")
                      ]
                    |),
                    [
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                            "iter",
                            []
                          |),
                          [ M.read (| digits |) ]
                        |)
                      |);
                      M.closure
                        (fun γ =>
                          ltac:(M.monadic
                            match γ with
                            | [ α0 ] =>
                              ltac:(M.monadic
                                (M.match_operator (|
                                  M.alloc (| α0 |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ := M.read (| γ |) in
                                        let x := M.copy (| γ |) in
                                        BinOp.ne (|
                                          M.read (| x |),
                                          Value.Integer IntegerKind.U32 0
                                        |)))
                                  ]
                                |)))
                            | _ => M.impossible "wrong number of arguments"
                            end))
                    ]
                  |)
                |) in
              M.match_operator (|
                msd,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::option::Option::Some",
                          0
                        |) in
                      let msd := M.copy (| γ0_0 |) in
                      M.alloc (|
                        BinOp.Wrap.add (|
                          BinOp.Wrap.add (|
                            BinOp.Wrap.mul (| M.read (| msd |), M.read (| digitbits |) |),
                            M.rust_cast
                              (M.call_closure (|
                                M.get_associated_function (| Ty.path "u32", "ilog2", [] |),
                                [
                                  M.read (|
                                    M.SubPointer.get_array_field (| M.read (| digits |), msd |)
                                  |)
                                ]
                              |))
                          |),
                          Value.Integer IntegerKind.Usize 1
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Integer IntegerKind.Usize 0 |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_bit_length : M.IsAssociatedFunction Self "bit_length" bit_length.
      
      (*
                  pub fn add<'a>(&'a mut self, other: &$name) -> &'a mut $name {
                      use crate::{cmp, iter};
      
                      let mut sz = cmp::max(self.size, other.size);
                      let mut carry = false;
                      for (a, b) in iter::zip(&mut self.base[..sz], &other.base[..sz]) {
                          let (v, c) = ( *a).carrying_add( *b, carry);
                          *a = v;
                          carry = c;
                      }
                      if carry {
                          self.base[sz] = 1;
                          sz += 1;
                      }
                      self.size = sz;
                      self
                  }
      *)
      Definition add (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ sz :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (| "core::cmp::max", [ Ty.path "usize" ] |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::num::bignum::Big32x40",
                          "size"
                        |)
                      |);
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| other |),
                          "core::num::bignum::Big32x40",
                          "size"
                        |)
                      |)
                    ]
                  |)
                |) in
              let~ carry := M.alloc (| Value.Bool false |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::zip::Zip")
                            []
                            [
                              Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u32" ];
                              Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "core::iter::adapters::zip::zip",
                              [
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ];
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ]
                              ]
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::index::IndexMut",
                                  Ty.apply
                                    (Ty.path "array")
                                    [ Value.Integer IntegerKind.Usize 40 ]
                                    [ Ty.path "u32" ],
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::RangeTo")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                  "index_mut",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "core::num::bignum::Big32x40",
                                    "base"
                                  |);
                                  Value.StructRecord
                                    "core::ops::range::RangeTo"
                                    [ ("end_", M.read (| sz |)) ]
                                ]
                              |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::index::Index",
                                  Ty.apply
                                    (Ty.path "array")
                                    [ Value.Integer IntegerKind.Usize 40 ]
                                    [ Ty.path "u32" ],
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::RangeTo")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                  "index",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| other |),
                                    "core::num::bignum::Big32x40",
                                    "base"
                                  |);
                                  Value.StructRecord
                                    "core::ops::range::RangeTo"
                                    [ ("end_", M.read (| sz |)) ]
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::zip::Zip")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::IterMut")
                                              []
                                              [ Ty.path "u32" ];
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [ Ty.path "u32" ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let a := M.copy (| γ1_0 |) in
                                        let b := M.copy (| γ1_1 |) in
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path "u32",
                                                "carrying_add",
                                                []
                                              |),
                                              [
                                                M.read (| M.read (| a |) |);
                                                M.read (| M.read (| b |) |);
                                                M.read (| carry |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                let γ0_1 :=
                                                  M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                let v := M.copy (| γ0_0 |) in
                                                let c := M.copy (| γ0_1 |) in
                                                let~ _ :=
                                                  M.write (| M.read (| a |), M.read (| v |) |) in
                                                let~ _ := M.write (| carry, M.read (| c |) |) in
                                                M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use carry in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_array_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::num::bignum::Big32x40",
                                "base"
                              |),
                              sz
                            |),
                            Value.Integer IntegerKind.U32 1
                          |) in
                        let~ _ :=
                          let β := sz in
                          M.write (|
                            β,
                            BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.Usize 1 |)
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |),
                  M.read (| sz |)
                |) in
              M.alloc (| M.read (| self |) |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_add : M.IsAssociatedFunction Self "add" add.
      
      (*
                  pub fn add_small(&mut self, other: $ty) -> &mut $name {
                      let (v, mut carry) = self.base[0].carrying_add(other, false);
                      self.base[0] = v;
                      let mut i = 1;
                      while carry {
                          let (v, c) = self.base[i].carrying_add(0, carry);
                          self.base[i] = v;
                          carry = c;
                          i += 1;
                      }
                      if i > self.size {
                          self.size = i;
                      }
                      self
                  }
      *)
      Definition add_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              M.match_operator (|
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (| Ty.path "u32", "carrying_add", [] |),
                    [
                      M.read (|
                        M.SubPointer.get_array_field (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::num::bignum::Big32x40",
                            "base"
                          |),
                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                        |)
                      |);
                      M.read (| other |);
                      Value.Bool false
                    ]
                  |)
                |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                      let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                      let v := M.copy (| γ0_0 |) in
                      let carry := M.copy (| γ0_1 |) in
                      let~ _ :=
                        M.write (|
                          M.SubPointer.get_array_field (|
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "core::num::bignum::Big32x40",
                              "base"
                            |),
                            M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                          |),
                          M.read (| v |)
                        |) in
                      let~ i := M.alloc (| Value.Integer IntegerKind.Usize 1 |) in
                      let~ _ :=
                        M.loop (|
                          ltac:(M.monadic
                            (M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ := M.use carry in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    M.match_operator (|
                                      M.alloc (|
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.path "u32",
                                            "carrying_add",
                                            []
                                          |),
                                          [
                                            M.read (|
                                              M.SubPointer.get_array_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "core::num::bignum::Big32x40",
                                                  "base"
                                                |),
                                                i
                                              |)
                                            |);
                                            Value.Integer IntegerKind.U32 0;
                                            M.read (| carry |)
                                          ]
                                        |)
                                      |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                                            let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                                            let v := M.copy (| γ0_0 |) in
                                            let c := M.copy (| γ0_1 |) in
                                            let~ _ :=
                                              M.write (|
                                                M.SubPointer.get_array_field (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| self |),
                                                    "core::num::bignum::Big32x40",
                                                    "base"
                                                  |),
                                                  i
                                                |),
                                                M.read (| v |)
                                              |) in
                                            let~ _ := M.write (| carry, M.read (| c |) |) in
                                            let~ _ :=
                                              let β := i in
                                              M.write (|
                                                β,
                                                BinOp.Wrap.add (|
                                                  M.read (| β |),
                                                  Value.Integer IntegerKind.Usize 1
                                                |)
                                              |) in
                                            M.alloc (| Value.Tuple [] |)))
                                      ]
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.alloc (|
                                      M.never_to_any (|
                                        M.read (|
                                          let~ _ :=
                                            M.alloc (|
                                              M.never_to_any (| M.read (| M.break (||) |) |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)
                                        |)
                                      |)
                                    |)))
                              ]
                            |)))
                        |) in
                      let~ _ :=
                        M.match_operator (|
                          M.alloc (| Value.Tuple [] |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ :=
                                  M.use
                                    (M.alloc (|
                                      BinOp.gt (|
                                        M.read (| i |),
                                        M.read (|
                                          M.SubPointer.get_struct_record_field (|
                                            M.read (| self |),
                                            "core::num::bignum::Big32x40",
                                            "size"
                                          |)
                                        |)
                                      |)
                                    |)) in
                                let _ :=
                                  M.is_constant_or_break_match (|
                                    M.read (| γ |),
                                    Value.Bool true
                                  |) in
                                let~ _ :=
                                  M.write (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::num::bignum::Big32x40",
                                      "size"
                                    |),
                                    M.read (| i |)
                                  |) in
                                M.alloc (| Value.Tuple [] |)));
                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                          ]
                        |) in
                      M.alloc (| M.read (| self |) |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_add_small : M.IsAssociatedFunction Self "add_small" add_small.
      
      (*
                  pub fn sub<'a>(&'a mut self, other: &$name) -> &'a mut $name {
                      use crate::{cmp, iter};
      
                      let sz = cmp::max(self.size, other.size);
                      let mut noborrow = true;
                      for (a, b) in iter::zip(&mut self.base[..sz], &other.base[..sz]) {
                          let (v, c) = ( *a).carrying_add(!*b, noborrow);
                          *a = v;
                          noborrow = c;
                      }
                      assert!(noborrow);
                      self.size = sz;
                      self
                  }
      *)
      Definition sub (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ sz :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (| "core::cmp::max", [ Ty.path "usize" ] |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::num::bignum::Big32x40",
                          "size"
                        |)
                      |);
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| other |),
                          "core::num::bignum::Big32x40",
                          "size"
                        |)
                      |)
                    ]
                  |)
                |) in
              let~ noborrow := M.alloc (| Value.Bool true |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::zip::Zip")
                            []
                            [
                              Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u32" ];
                              Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "core::iter::adapters::zip::zip",
                              [
                                Ty.apply
                                  (Ty.path "&mut")
                                  []
                                  [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ];
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ]
                              ]
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::index::IndexMut",
                                  Ty.apply
                                    (Ty.path "array")
                                    [ Value.Integer IntegerKind.Usize 40 ]
                                    [ Ty.path "u32" ],
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::RangeTo")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                  "index_mut",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "core::num::bignum::Big32x40",
                                    "base"
                                  |);
                                  Value.StructRecord
                                    "core::ops::range::RangeTo"
                                    [ ("end_", M.read (| sz |)) ]
                                ]
                              |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::index::Index",
                                  Ty.apply
                                    (Ty.path "array")
                                    [ Value.Integer IntegerKind.Usize 40 ]
                                    [ Ty.path "u32" ],
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::RangeTo")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                  "index",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| other |),
                                    "core::num::bignum::Big32x40",
                                    "base"
                                  |);
                                  Value.StructRecord
                                    "core::ops::range::RangeTo"
                                    [ ("end_", M.read (| sz |)) ]
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::zip::Zip")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::IterMut")
                                              []
                                              [ Ty.path "u32" ];
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [ Ty.path "u32" ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let a := M.copy (| γ1_0 |) in
                                        let b := M.copy (| γ1_1 |) in
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path "u32",
                                                "carrying_add",
                                                []
                                              |),
                                              [
                                                M.read (| M.read (| a |) |);
                                                UnOp.not (| M.read (| M.read (| b |) |) |);
                                                M.read (| noborrow |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                let γ0_1 :=
                                                  M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                let v := M.copy (| γ0_0 |) in
                                                let c := M.copy (| γ0_1 |) in
                                                let~ _ :=
                                                  M.write (| M.read (| a |), M.read (| v |) |) in
                                                let~ _ := M.write (| noborrow, M.read (| c |) |) in
                                                M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| UnOp.not (| M.read (| noborrow |) |) |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.call_closure (|
                              M.get_function (| "core::panicking::panic", [] |),
                              [ M.read (| Value.String "assertion failed: noborrow" |) ]
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |),
                  M.read (| sz |)
                |) in
              M.alloc (| M.read (| self |) |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_sub : M.IsAssociatedFunction Self "sub" sub.
      
      (*
                  pub fn mul_small(&mut self, other: $ty) -> &mut $name {
                      let mut sz = self.size;
                      let mut carry = 0;
                      for a in &mut self.base[..sz] {
                          let (v, c) = ( *a).carrying_mul(other, carry);
                          *a = v;
                          carry = c;
                      }
                      if carry > 0 {
                          self.base[sz] = carry;
                          sz += 1;
                      }
                      self.size = sz;
                      self
                  }
      *)
      Definition mul_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ sz :=
                M.copy (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |)
                |) in
              let~ carry := M.alloc (| Value.Integer IntegerKind.U32 0 |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "&mut")
                            []
                            [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::index::IndexMut",
                              Ty.apply
                                (Ty.path "array")
                                [ Value.Integer IntegerKind.Usize 40 ]
                                [ Ty.path "u32" ],
                              [
                                Ty.apply
                                  (Ty.path "core::ops::range::RangeTo")
                                  []
                                  [ Ty.path "usize" ]
                              ],
                              "index_mut",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::num::bignum::Big32x40",
                                "base"
                              |);
                              Value.StructRecord
                                "core::ops::range::RangeTo"
                                [ ("end_", M.read (| sz |)) ]
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::slice::iter::IterMut")
                                          []
                                          [ Ty.path "u32" ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let a := M.copy (| γ0_0 |) in
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path "u32",
                                                "carrying_mul",
                                                []
                                              |),
                                              [
                                                M.read (| M.read (| a |) |);
                                                M.read (| other |);
                                                M.read (| carry |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                let γ0_1 :=
                                                  M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                let v := M.copy (| γ0_0 |) in
                                                let c := M.copy (| γ0_1 |) in
                                                let~ _ :=
                                                  M.write (| M.read (| a |), M.read (| v |) |) in
                                                let~ _ := M.write (| carry, M.read (| c |) |) in
                                                M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| carry |), Value.Integer IntegerKind.U32 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_array_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::num::bignum::Big32x40",
                                "base"
                              |),
                              sz
                            |),
                            M.read (| carry |)
                          |) in
                        let~ _ :=
                          let β := sz in
                          M.write (|
                            β,
                            BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.Usize 1 |)
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |),
                  M.read (| sz |)
                |) in
              M.alloc (| M.read (| self |) |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_mul_small : M.IsAssociatedFunction Self "mul_small" mul_small.
      
      (*
                  pub fn mul_pow2(&mut self, bits: usize) -> &mut $name {
                      let digitbits = <$ty>::BITS as usize;
                      let digits = bits / digitbits;
                      let bits = bits % digitbits;
      
                      assert!(digits < $n);
                      debug_assert!(self.base[$n - digits..].iter().all(|&v| v == 0));
                      debug_assert!(bits == 0 || (self.base[$n - digits - 1] >> (digitbits - bits)) == 0);
      
                      // shift by `digits * digitbits` bits
                      for i in (0..self.size).rev() {
                          self.base[i + digits] = self.base[i];
                      }
                      for i in 0..digits {
                          self.base[i] = 0;
                      }
      
                      // shift by `bits` bits
                      let mut sz = self.size + digits;
                      if bits > 0 {
                          let last = sz;
                          let overflow = self.base[last - 1] >> (digitbits - bits);
                          if overflow > 0 {
                              self.base[last] = overflow;
                              sz += 1;
                          }
                          for i in (digits + 1..last).rev() {
                              self.base[i] =
                                  (self.base[i] << bits) | (self.base[i - 1] >> (digitbits - bits));
                          }
                          self.base[digits] <<= bits;
                          // self.base[..digits] is zero, no need to shift
                      }
      
                      self.size = sz;
                      self
                  }
      *)
      Definition mul_pow2 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; bits ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let bits := M.alloc (| bits |) in
            M.read (|
              let~ digitbits :=
                M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
              let~ digits :=
                M.alloc (| BinOp.Wrap.div (| M.read (| bits |), M.read (| digitbits |) |) |) in
              let~ bits :=
                M.alloc (| BinOp.Wrap.rem (| M.read (| bits |), M.read (| digitbits |) |) |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              UnOp.not (|
                                BinOp.lt (|
                                  M.read (| digits |),
                                  Value.Integer IntegerKind.Usize 40
                                |)
                              |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.call_closure (|
                              M.get_function (| "core::panicking::panic", [] |),
                              [ M.read (| Value.String "assertion failed: digits < 40" |) ]
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::iterator::Iterator",
                                              Ty.apply
                                                (Ty.path "core::slice::iter::Iter")
                                                []
                                                [ Ty.path "u32" ],
                                              [],
                                              "all",
                                              [
                                                Ty.function
                                                  [
                                                    Ty.tuple
                                                      [ Ty.apply (Ty.path "&") [] [ Ty.path "u32" ]
                                                      ]
                                                  ]
                                                  (Ty.path "bool")
                                              ]
                                            |),
                                            [
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                                                    "iter",
                                                    []
                                                  |),
                                                  [
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::index::Index",
                                                        Ty.apply
                                                          (Ty.path "array")
                                                          [ Value.Integer IntegerKind.Usize 40 ]
                                                          [ Ty.path "u32" ],
                                                        [
                                                          Ty.apply
                                                            (Ty.path "core::ops::range::RangeFrom")
                                                            []
                                                            [ Ty.path "usize" ]
                                                        ],
                                                        "index",
                                                        []
                                                      |),
                                                      [
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| self |),
                                                          "core::num::bignum::Big32x40",
                                                          "base"
                                                        |);
                                                        Value.StructRecord
                                                          "core::ops::range::RangeFrom"
                                                          [
                                                            ("start",
                                                              BinOp.Wrap.sub (|
                                                                Value.Integer IntegerKind.Usize 40,
                                                                M.read (| digits |)
                                                              |))
                                                          ]
                                                      ]
                                                    |)
                                                  ]
                                                |)
                                              |);
                                              M.closure
                                                (fun γ =>
                                                  ltac:(M.monadic
                                                    match γ with
                                                    | [ α0 ] =>
                                                      ltac:(M.monadic
                                                        (M.match_operator (|
                                                          M.alloc (| α0 |),
                                                          [
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (let γ := M.read (| γ |) in
                                                                let v := M.copy (| γ |) in
                                                                BinOp.eq (|
                                                                  M.read (| v |),
                                                                  Value.Integer IntegerKind.U32 0
                                                                |)))
                                                          ]
                                                        |)))
                                                    | _ => M.impossible "wrong number of arguments"
                                                    end))
                                            ]
                                          |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String
                                              "assertion failed: self.base[40 - digits..].iter().all(|&v| v == 0)"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          LogicalOp.or (|
                                            BinOp.eq (|
                                              M.read (| bits |),
                                              Value.Integer IntegerKind.Usize 0
                                            |),
                                            ltac:(M.monadic
                                              (BinOp.eq (|
                                                BinOp.Wrap.shr (|
                                                  M.read (|
                                                    M.SubPointer.get_array_field (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| self |),
                                                        "core::num::bignum::Big32x40",
                                                        "base"
                                                      |),
                                                      M.alloc (|
                                                        BinOp.Wrap.sub (|
                                                          BinOp.Wrap.sub (|
                                                            Value.Integer IntegerKind.Usize 40,
                                                            M.read (| digits |)
                                                          |),
                                                          Value.Integer IntegerKind.Usize 1
                                                        |)
                                                      |)
                                                    |)
                                                  |),
                                                  BinOp.Wrap.sub (|
                                                    M.read (| digitbits |),
                                                    M.read (| bits |)
                                                  |)
                                                |),
                                                Value.Integer IntegerKind.U32 0
                                              |)))
                                          |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String
                                              "assertion failed: bits == 0 || (self.base[40 - digits - 1] >> (digitbits - bits)) == 0"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::rev::Rev")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ],
                              [],
                              "rev",
                              []
                            |),
                            [
                              Value.StructRecord
                                "core::ops::range::Range"
                                [
                                  ("start", Value.Integer IntegerKind.Usize 0);
                                  ("end_",
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::num::bignum::Big32x40",
                                        "size"
                                      |)
                                    |))
                                ]
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::rev::Rev")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::ops::range::Range")
                                              []
                                              [ Ty.path "usize" ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let i := M.copy (| γ0_0 |) in
                                        let~ _ :=
                                          M.write (|
                                            M.SubPointer.get_array_field (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| self |),
                                                "core::num::bignum::Big32x40",
                                                "base"
                                              |),
                                              M.alloc (|
                                                BinOp.Wrap.add (|
                                                  M.read (| i |),
                                                  M.read (| digits |)
                                                |)
                                              |)
                                            |),
                                            M.read (|
                                              M.SubPointer.get_array_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "core::num::bignum::Big32x40",
                                                  "base"
                                                |),
                                                i
                                              |)
                                            |)
                                          |) in
                                        M.alloc (| Value.Tuple [] |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          Value.StructRecord
                            "core::ops::range::Range"
                            [
                              ("start", Value.Integer IntegerKind.Usize 0);
                              ("end_", M.read (| digits |))
                            ]
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "usize" ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let i := M.copy (| γ0_0 |) in
                                        let~ _ :=
                                          M.write (|
                                            M.SubPointer.get_array_field (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| self |),
                                                "core::num::bignum::Big32x40",
                                                "base"
                                              |),
                                              i
                                            |),
                                            Value.Integer IntegerKind.U32 0
                                          |) in
                                        M.alloc (| Value.Tuple [] |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ sz :=
                M.alloc (|
                  BinOp.Wrap.add (|
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::num::bignum::Big32x40",
                        "size"
                      |)
                    |),
                    M.read (| digits |)
                  |)
                |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| bits |), Value.Integer IntegerKind.Usize 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ last := M.copy (| sz |) in
                        let~ overflow :=
                          M.alloc (|
                            BinOp.Wrap.shr (|
                              M.read (|
                                M.SubPointer.get_array_field (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "core::num::bignum::Big32x40",
                                    "base"
                                  |),
                                  M.alloc (|
                                    BinOp.Wrap.sub (|
                                      M.read (| last |),
                                      Value.Integer IntegerKind.Usize 1
                                    |)
                                  |)
                                |)
                              |),
                              BinOp.Wrap.sub (| M.read (| digitbits |), M.read (| bits |) |)
                            |)
                          |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        BinOp.gt (|
                                          M.read (| overflow |),
                                          Value.Integer IntegerKind.U32 0
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  let~ _ :=
                                    M.write (|
                                      M.SubPointer.get_array_field (|
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| self |),
                                          "core::num::bignum::Big32x40",
                                          "base"
                                        |),
                                        last
                                      |),
                                      M.read (| overflow |)
                                    |) in
                                  let~ _ :=
                                    let β := sz in
                                    M.write (|
                                      β,
                                      BinOp.Wrap.add (|
                                        M.read (| β |),
                                        Value.Integer IntegerKind.Usize 1
                                      |)
                                    |) in
                                  M.alloc (| Value.Tuple [] |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        let~ _ :=
                          M.use
                            (M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::iter::traits::collect::IntoIterator",
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::rev::Rev")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "usize" ]
                                      ],
                                    [],
                                    "into_iter",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "usize" ],
                                        [],
                                        "rev",
                                        []
                                      |),
                                      [
                                        Value.StructRecord
                                          "core::ops::range::Range"
                                          [
                                            ("start",
                                              BinOp.Wrap.add (|
                                                M.read (| digits |),
                                                Value.Integer IntegerKind.Usize 1
                                              |));
                                            ("end_", M.read (| last |))
                                          ]
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let iter := M.copy (| γ |) in
                                    M.loop (|
                                      ltac:(M.monadic
                                        (let~ _ :=
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::iter::traits::iterator::Iterator",
                                                  Ty.apply
                                                    (Ty.path "core::iter::adapters::rev::Rev")
                                                    []
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::ops::range::Range")
                                                        []
                                                        [ Ty.path "usize" ]
                                                    ],
                                                  [],
                                                  "next",
                                                  []
                                                |),
                                                [ iter ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let _ :=
                                                    M.is_struct_tuple (|
                                                      γ,
                                                      "core::option::Option::None"
                                                    |) in
                                                  M.alloc (|
                                                    M.never_to_any (| M.read (| M.break (||) |) |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::option::Option::Some",
                                                      0
                                                    |) in
                                                  let i := M.copy (| γ0_0 |) in
                                                  let~ _ :=
                                                    M.write (|
                                                      M.SubPointer.get_array_field (|
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| self |),
                                                          "core::num::bignum::Big32x40",
                                                          "base"
                                                        |),
                                                        i
                                                      |),
                                                      BinOp.bit_or
                                                        (BinOp.Wrap.shl (|
                                                          M.read (|
                                                            M.SubPointer.get_array_field (|
                                                              M.SubPointer.get_struct_record_field (|
                                                                M.read (| self |),
                                                                "core::num::bignum::Big32x40",
                                                                "base"
                                                              |),
                                                              i
                                                            |)
                                                          |),
                                                          M.read (| bits |)
                                                        |))
                                                        (BinOp.Wrap.shr (|
                                                          M.read (|
                                                            M.SubPointer.get_array_field (|
                                                              M.SubPointer.get_struct_record_field (|
                                                                M.read (| self |),
                                                                "core::num::bignum::Big32x40",
                                                                "base"
                                                              |),
                                                              M.alloc (|
                                                                BinOp.Wrap.sub (|
                                                                  M.read (| i |),
                                                                  Value.Integer IntegerKind.Usize 1
                                                                |)
                                                              |)
                                                            |)
                                                          |),
                                                          BinOp.Wrap.sub (|
                                                            M.read (| digitbits |),
                                                            M.read (| bits |)
                                                          |)
                                                        |))
                                                    |) in
                                                  M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |) in
                                        M.alloc (| Value.Tuple [] |)))
                                    |)))
                              ]
                            |)) in
                        let~ _ :=
                          let β :=
                            M.SubPointer.get_array_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::num::bignum::Big32x40",
                                "base"
                              |),
                              digits
                            |) in
                          M.write (| β, BinOp.Wrap.shl (| M.read (| β |), M.read (| bits |) |) |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |),
                  M.read (| sz |)
                |) in
              M.alloc (| M.read (| self |) |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_mul_pow2 : M.IsAssociatedFunction Self "mul_pow2" mul_pow2.
      
      (*
                  pub fn mul_pow5(&mut self, mut e: usize) -> &mut $name {
                      use crate::mem;
                      use crate::num::bignum::SMALL_POW5;
      
                      // There are exactly n trailing zeros on 2^n, and the only relevant digit sizes
                      // are consecutive powers of two, so this is well suited index for the table.
                      let table_index = mem::size_of::<$ty>().trailing_zeros() as usize;
                      let (small_power, small_e) = SMALL_POW5[table_index];
                      let small_power = small_power as $ty;
      
                      // Multiply with the largest single-digit power as long as possible ...
                      while e >= small_e {
                          self.mul_small(small_power);
                          e -= small_e;
                      }
      
                      // ... then finish off the remainder.
                      let mut rest_power = 1;
                      for _ in 0..e {
                          rest_power *= 5;
                      }
                      self.mul_small(rest_power);
      
                      self
                  }
      *)
      Definition mul_pow5 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; e ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let e := M.alloc (| e |) in
            M.read (|
              let~ table_index :=
                M.alloc (|
                  M.rust_cast
                    (M.call_closure (|
                      M.get_associated_function (| Ty.path "usize", "trailing_zeros", [] |),
                      [
                        M.call_closure (|
                          M.get_function (| "core::mem::size_of", [ Ty.path "u32" ] |),
                          []
                        |)
                      ]
                    |))
                |) in
              M.match_operator (|
                M.SubPointer.get_array_field (|
                  M.get_constant (| "core::num::bignum::SMALL_POW5" |),
                  table_index
                |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                      let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                      let small_power := M.copy (| γ0_0 |) in
                      let small_e := M.copy (| γ0_1 |) in
                      let~ small_power := M.alloc (| M.rust_cast (M.read (| small_power |)) |) in
                      let~ _ :=
                        M.loop (|
                          ltac:(M.monadic
                            (M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          BinOp.ge (| M.read (| e |), M.read (| small_e |) |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      M.alloc (|
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.path "core::num::bignum::Big32x40",
                                            "mul_small",
                                            []
                                          |),
                                          [ M.read (| self |); M.read (| small_power |) ]
                                        |)
                                      |) in
                                    let~ _ :=
                                      let β := e in
                                      M.write (|
                                        β,
                                        BinOp.Wrap.sub (| M.read (| β |), M.read (| small_e |) |)
                                      |) in
                                    M.alloc (| Value.Tuple [] |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.alloc (|
                                      M.never_to_any (|
                                        M.read (|
                                          let~ _ :=
                                            M.alloc (|
                                              M.never_to_any (| M.read (| M.break (||) |) |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)
                                        |)
                                      |)
                                    |)))
                              ]
                            |)))
                        |) in
                      let~ rest_power := M.alloc (| Value.Integer IntegerKind.U32 1 |) in
                      let~ _ :=
                        M.use
                          (M.match_operator (|
                            M.alloc (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::collect::IntoIterator",
                                  Ty.apply
                                    (Ty.path "core::ops::range::Range")
                                    []
                                    [ Ty.path "usize" ],
                                  [],
                                  "into_iter",
                                  []
                                |),
                                [
                                  Value.StructRecord
                                    "core::ops::range::Range"
                                    [
                                      ("start", Value.Integer IntegerKind.Usize 0);
                                      ("end_", M.read (| e |))
                                    ]
                                ]
                              |)
                            |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let iter := M.copy (| γ |) in
                                  M.loop (|
                                    ltac:(M.monadic
                                      (let~ _ :=
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::iter::traits::iterator::Iterator",
                                                Ty.apply
                                                  (Ty.path "core::ops::range::Range")
                                                  []
                                                  [ Ty.path "usize" ],
                                                [],
                                                "next",
                                                []
                                              |),
                                              [ iter ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let _ :=
                                                  M.is_struct_tuple (|
                                                    γ,
                                                    "core::option::Option::None"
                                                  |) in
                                                M.alloc (|
                                                  M.never_to_any (| M.read (| M.break (||) |) |)
                                                |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::option::Option::Some",
                                                    0
                                                  |) in
                                                let~ _ :=
                                                  let β := rest_power in
                                                  M.write (|
                                                    β,
                                                    BinOp.Wrap.mul (|
                                                      M.read (| β |),
                                                      Value.Integer IntegerKind.U32 5
                                                    |)
                                                  |) in
                                                M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |) in
                                      M.alloc (| Value.Tuple [] |)))
                                  |)))
                            ]
                          |)) in
                      let~ _ :=
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "core::num::bignum::Big32x40",
                              "mul_small",
                              []
                            |),
                            [ M.read (| self |); M.read (| rest_power |) ]
                          |)
                        |) in
                      M.alloc (| M.read (| self |) |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_mul_pow5 : M.IsAssociatedFunction Self "mul_pow5" mul_pow5.
      
      (*
                  pub fn mul_digits<'a>(&'a mut self, other: &[$ty]) -> &'a mut $name {
                      // the internal routine. works best when aa.len() <= bb.len().
                      fn mul_inner(ret: &mut [$ty; $n], aa: &[$ty], bb: &[$ty]) -> usize {
                          use crate::num::bignum::FullOps;
      
                          let mut retsz = 0;
                          for (i, &a) in aa.iter().enumerate() {
                              if a == 0 {
                                  continue;
                              }
                              let mut sz = bb.len();
                              let mut carry = 0;
                              for (j, &b) in bb.iter().enumerate() {
                                  let (c, v) = a.full_mul_add(b, ret[i + j], carry);
                                  ret[i + j] = v;
                                  carry = c;
                              }
                              if carry > 0 {
                                  ret[i + sz] = carry;
                                  sz += 1;
                              }
                              if retsz < i + sz {
                                  retsz = i + sz;
                              }
                          }
                          retsz
                      }
      
                      let mut ret = [0; $n];
                      let retsz = if self.size < other.len() {
                          mul_inner(&mut ret, &self.digits(), other)
                      } else {
                          mul_inner(&mut ret, other, &self.digits())
                      };
                      self.base = ret;
                      self.size = retsz;
                      self
                  }
      *)
      Definition mul_digits (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ ret :=
                M.alloc (|
                  repeat (| Value.Integer IntegerKind.U32 0, Value.Integer IntegerKind.Usize 40 |)
                |) in
              let~ retsz :=
                M.copy (|
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.lt (|
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::num::bignum::Big32x40",
                                      "size"
                                    |)
                                  |),
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                                      "len",
                                      []
                                    |),
                                    [ M.read (| other |) ]
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (| Self, "mul_inner.mul_digits", [] |),
                              [
                                ret;
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "core::num::bignum::Big32x40",
                                    "digits",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |);
                                M.read (| other |)
                              ]
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (| Self, "mul_inner.mul_digits", [] |),
                              [
                                ret;
                                M.read (| other |);
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "core::num::bignum::Big32x40",
                                    "digits",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |)
                              ]
                            |)
                          |)))
                    ]
                  |)
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "base"
                  |),
                  M.read (| ret |)
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |),
                  M.read (| retsz |)
                |) in
              M.alloc (| M.read (| self |) |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_mul_digits : M.IsAssociatedFunction Self "mul_digits" mul_digits.
      
      (*
                  pub fn div_rem_small(&mut self, other: $ty) -> (&mut $name, $ty) {
                      use crate::num::bignum::FullOps;
      
                      assert!(other > 0);
      
                      let sz = self.size;
                      let mut borrow = 0;
                      for a in self.base[..sz].iter_mut().rev() {
                          let (q, r) = ( *a).full_div_rem(other, borrow);
                          *a = q;
                          borrow = r;
                      }
                      (self, borrow)
                  }
      *)
      Definition div_rem_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              UnOp.not (|
                                BinOp.gt (| M.read (| other |), Value.Integer IntegerKind.U32 0 |)
                              |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.call_closure (|
                              M.get_function (| "core::panicking::panic", [] |),
                              [ M.read (| Value.String "assertion failed: other > 0" |) ]
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ sz :=
                M.copy (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |)
                |) in
              let~ borrow := M.alloc (| Value.Integer IntegerKind.U32 0 |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::rev::Rev")
                            []
                            [ Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u32" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u32" ],
                              [],
                              "rev",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                                  "iter_mut",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::index::IndexMut",
                                      Ty.apply
                                        (Ty.path "array")
                                        [ Value.Integer IntegerKind.Usize 40 ]
                                        [ Ty.path "u32" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::RangeTo")
                                          []
                                          [ Ty.path "usize" ]
                                      ],
                                      "index_mut",
                                      []
                                    |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::num::bignum::Big32x40",
                                        "base"
                                      |);
                                      Value.StructRecord
                                        "core::ops::range::RangeTo"
                                        [ ("end_", M.read (| sz |)) ]
                                    ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::rev::Rev")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::IterMut")
                                              []
                                              [ Ty.path "u32" ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let a := M.copy (| γ0_0 |) in
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::num::bignum::FullOps",
                                                Ty.path "u32",
                                                [],
                                                "full_div_rem",
                                                []
                                              |),
                                              [
                                                M.read (| M.read (| a |) |);
                                                M.read (| other |);
                                                M.read (| borrow |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                let γ0_1 :=
                                                  M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                let q := M.copy (| γ0_0 |) in
                                                let r := M.copy (| γ0_1 |) in
                                                let~ _ :=
                                                  M.write (| M.read (| a |), M.read (| q |) |) in
                                                let~ _ := M.write (| borrow, M.read (| r |) |) in
                                                M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              M.alloc (| Value.Tuple [ M.read (| self |); M.read (| borrow |) ] |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_div_rem_small :
        M.IsAssociatedFunction Self "div_rem_small" div_rem_small.
      
      (*
                  pub fn div_rem(&self, d: &$name, q: &mut $name, r: &mut $name) {
                      // Stupid slow base-2 long division taken from
                      // https://en.wikipedia.org/wiki/Division_algorithm
                      // FIXME use a greater base ($ty) for the long division.
                      assert!(!d.is_zero());
                      let digitbits = <$ty>::BITS as usize;
                      for digit in &mut q.base[..] {
                          *digit = 0;
                      }
                      for digit in &mut r.base[..] {
                          *digit = 0;
                      }
                      r.size = d.size;
                      q.size = 1;
                      let mut q_is_zero = true;
                      let end = self.bit_length();
                      for i in (0..end).rev() {
                          r.mul_pow2(1);
                          r.base[0] |= self.get_bit(i) as $ty;
                          if &*r >= d {
                              r.sub(d);
                              // Set bit `i` of q to 1.
                              let digit_idx = i / digitbits;
                              let bit_idx = i % digitbits;
                              if q_is_zero {
                                  q.size = digit_idx + 1;
                                  q_is_zero = false;
                              }
                              q.base[digit_idx] |= 1 << bit_idx;
                          }
                      }
                      debug_assert!(q.base[q.size..].iter().all(|&d| d == 0));
                      debug_assert!(r.base[r.size..].iter().all(|&d| d == 0));
                  }
      *)
      Definition div_rem (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; d; q; r ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let d := M.alloc (| d |) in
            let q := M.alloc (| q |) in
            let r := M.alloc (| r |) in
            M.read (|
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              UnOp.not (|
                                UnOp.not (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "core::num::bignum::Big32x40",
                                      "is_zero",
                                      []
                                    |),
                                    [ M.read (| d |) ]
                                  |)
                                |)
                              |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.call_closure (|
                              M.get_function (| "core::panicking::panic", [] |),
                              [ M.read (| Value.String "assertion failed: !d.is_zero()" |) ]
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ digitbits :=
                M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "&mut")
                            []
                            [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::index::IndexMut",
                              Ty.apply
                                (Ty.path "array")
                                [ Value.Integer IntegerKind.Usize 40 ]
                                [ Ty.path "u32" ],
                              [ Ty.path "core::ops::range::RangeFull" ],
                              "index_mut",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| q |),
                                "core::num::bignum::Big32x40",
                                "base"
                              |);
                              Value.StructTuple "core::ops::range::RangeFull" []
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::slice::iter::IterMut")
                                          []
                                          [ Ty.path "u32" ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let digit := M.copy (| γ0_0 |) in
                                        let~ _ :=
                                          M.write (|
                                            M.read (| digit |),
                                            Value.Integer IntegerKind.U32 0
                                          |) in
                                        M.alloc (| Value.Tuple [] |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "&mut")
                            []
                            [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::index::IndexMut",
                              Ty.apply
                                (Ty.path "array")
                                [ Value.Integer IntegerKind.Usize 40 ]
                                [ Ty.path "u32" ],
                              [ Ty.path "core::ops::range::RangeFull" ],
                              "index_mut",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| r |),
                                "core::num::bignum::Big32x40",
                                "base"
                              |);
                              Value.StructTuple "core::ops::range::RangeFull" []
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::slice::iter::IterMut")
                                          []
                                          [ Ty.path "u32" ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let digit := M.copy (| γ0_0 |) in
                                        let~ _ :=
                                          M.write (|
                                            M.read (| digit |),
                                            Value.Integer IntegerKind.U32 0
                                          |) in
                                        M.alloc (| Value.Tuple [] |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| r |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |),
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| d |),
                      "core::num::bignum::Big32x40",
                      "size"
                    |)
                  |)
                |) in
              let~ _ :=
                M.write (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| q |),
                    "core::num::bignum::Big32x40",
                    "size"
                  |),
                  Value.Integer IntegerKind.Usize 1
                |) in
              let~ q_is_zero := M.alloc (| Value.Bool true |) in
              let~ end_ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "core::num::bignum::Big32x40",
                      "bit_length",
                      []
                    |),
                    [ M.read (| self |) ]
                  |)
                |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::rev::Rev")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ],
                              [],
                              "rev",
                              []
                            |),
                            [
                              Value.StructRecord
                                "core::ops::range::Range"
                                [
                                  ("start", Value.Integer IntegerKind.Usize 0);
                                  ("end_", M.read (| end_ |))
                                ]
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::rev::Rev")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::ops::range::Range")
                                              []
                                              [ Ty.path "usize" ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let i := M.copy (| γ0_0 |) in
                                        let~ _ :=
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path "core::num::bignum::Big32x40",
                                                "mul_pow2",
                                                []
                                              |),
                                              [ M.read (| r |); Value.Integer IntegerKind.Usize 1 ]
                                            |)
                                          |) in
                                        let~ _ :=
                                          let β :=
                                            M.SubPointer.get_array_field (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| r |),
                                                "core::num::bignum::Big32x40",
                                                "base"
                                              |),
                                              M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                            |) in
                                          M.write (|
                                            β,
                                            BinOp.bit_or
                                              (M.read (| β |))
                                              (M.rust_cast
                                                (M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path "core::num::bignum::Big32x40",
                                                    "get_bit",
                                                    []
                                                  |),
                                                  [ M.read (| self |); M.read (| i |) ]
                                                |)))
                                          |) in
                                        M.match_operator (|
                                          M.alloc (| Value.Tuple [] |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ :=
                                                  M.use
                                                    (M.alloc (|
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::cmp::PartialOrd",
                                                          Ty.apply
                                                            (Ty.path "&")
                                                            []
                                                            [ Ty.path "core::num::bignum::Big32x40"
                                                            ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path "&")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "core::num::bignum::Big32x40"
                                                              ]
                                                          ],
                                                          "ge",
                                                          []
                                                        |),
                                                        [
                                                          M.alloc (| M.read (| r |) |);
                                                          M.alloc (| M.read (| d |) |)
                                                        ]
                                                      |)
                                                    |)) in
                                                let _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ |),
                                                    Value.Bool true
                                                  |) in
                                                let~ _ :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.path "core::num::bignum::Big32x40",
                                                        "sub",
                                                        []
                                                      |),
                                                      [ M.read (| r |); M.read (| d |) ]
                                                    |)
                                                  |) in
                                                let~ digit_idx :=
                                                  M.alloc (|
                                                    BinOp.Wrap.div (|
                                                      M.read (| i |),
                                                      M.read (| digitbits |)
                                                    |)
                                                  |) in
                                                let~ bit_idx :=
                                                  M.alloc (|
                                                    BinOp.Wrap.rem (|
                                                      M.read (| i |),
                                                      M.read (| digitbits |)
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.use q_is_zero in
                                                          let _ :=
                                                            M.is_constant_or_break_match (|
                                                              M.read (| γ |),
                                                              Value.Bool true
                                                            |) in
                                                          let~ _ :=
                                                            M.write (|
                                                              M.SubPointer.get_struct_record_field (|
                                                                M.read (| q |),
                                                                "core::num::bignum::Big32x40",
                                                                "size"
                                                              |),
                                                              BinOp.Wrap.add (|
                                                                M.read (| digit_idx |),
                                                                Value.Integer IntegerKind.Usize 1
                                                              |)
                                                            |) in
                                                          let~ _ :=
                                                            M.write (|
                                                              q_is_zero,
                                                              Value.Bool false
                                                            |) in
                                                          M.alloc (| Value.Tuple [] |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (| Value.Tuple [] |)))
                                                    ]
                                                  |) in
                                                let~ _ :=
                                                  let β :=
                                                    M.SubPointer.get_array_field (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| q |),
                                                        "core::num::bignum::Big32x40",
                                                        "base"
                                                      |),
                                                      digit_idx
                                                    |) in
                                                  M.write (|
                                                    β,
                                                    BinOp.bit_or
                                                      (M.read (| β |))
                                                      (BinOp.Wrap.shl (|
                                                        Value.Integer IntegerKind.U32 1,
                                                        M.read (| bit_idx |)
                                                      |))
                                                  |) in
                                                M.alloc (| Value.Tuple [] |)));
                                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::iterator::Iterator",
                                              Ty.apply
                                                (Ty.path "core::slice::iter::Iter")
                                                []
                                                [ Ty.path "u32" ],
                                              [],
                                              "all",
                                              [
                                                Ty.function
                                                  [
                                                    Ty.tuple
                                                      [ Ty.apply (Ty.path "&") [] [ Ty.path "u32" ]
                                                      ]
                                                  ]
                                                  (Ty.path "bool")
                                              ]
                                            |),
                                            [
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                                                    "iter",
                                                    []
                                                  |),
                                                  [
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::index::Index",
                                                        Ty.apply
                                                          (Ty.path "array")
                                                          [ Value.Integer IntegerKind.Usize 40 ]
                                                          [ Ty.path "u32" ],
                                                        [
                                                          Ty.apply
                                                            (Ty.path "core::ops::range::RangeFrom")
                                                            []
                                                            [ Ty.path "usize" ]
                                                        ],
                                                        "index",
                                                        []
                                                      |),
                                                      [
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| q |),
                                                          "core::num::bignum::Big32x40",
                                                          "base"
                                                        |);
                                                        Value.StructRecord
                                                          "core::ops::range::RangeFrom"
                                                          [
                                                            ("start",
                                                              M.read (|
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| q |),
                                                                  "core::num::bignum::Big32x40",
                                                                  "size"
                                                                |)
                                                              |))
                                                          ]
                                                      ]
                                                    |)
                                                  ]
                                                |)
                                              |);
                                              M.closure
                                                (fun γ =>
                                                  ltac:(M.monadic
                                                    match γ with
                                                    | [ α0 ] =>
                                                      ltac:(M.monadic
                                                        (M.match_operator (|
                                                          M.alloc (| α0 |),
                                                          [
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (let γ := M.read (| γ |) in
                                                                let d := M.copy (| γ |) in
                                                                BinOp.eq (|
                                                                  M.read (| d |),
                                                                  Value.Integer IntegerKind.U32 0
                                                                |)))
                                                          ]
                                                        |)))
                                                    | _ => M.impossible "wrong number of arguments"
                                                    end))
                                            ]
                                          |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String
                                              "assertion failed: q.base[q.size..].iter().all(|&d| d == 0)"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::iterator::Iterator",
                                              Ty.apply
                                                (Ty.path "core::slice::iter::Iter")
                                                []
                                                [ Ty.path "u32" ],
                                              [],
                                              "all",
                                              [
                                                Ty.function
                                                  [
                                                    Ty.tuple
                                                      [ Ty.apply (Ty.path "&") [] [ Ty.path "u32" ]
                                                      ]
                                                  ]
                                                  (Ty.path "bool")
                                              ]
                                            |),
                                            [
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                                                    "iter",
                                                    []
                                                  |),
                                                  [
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::index::Index",
                                                        Ty.apply
                                                          (Ty.path "array")
                                                          [ Value.Integer IntegerKind.Usize 40 ]
                                                          [ Ty.path "u32" ],
                                                        [
                                                          Ty.apply
                                                            (Ty.path "core::ops::range::RangeFrom")
                                                            []
                                                            [ Ty.path "usize" ]
                                                        ],
                                                        "index",
                                                        []
                                                      |),
                                                      [
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| r |),
                                                          "core::num::bignum::Big32x40",
                                                          "base"
                                                        |);
                                                        Value.StructRecord
                                                          "core::ops::range::RangeFrom"
                                                          [
                                                            ("start",
                                                              M.read (|
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| r |),
                                                                  "core::num::bignum::Big32x40",
                                                                  "size"
                                                                |)
                                                              |))
                                                          ]
                                                      ]
                                                    |)
                                                  ]
                                                |)
                                              |);
                                              M.closure
                                                (fun γ =>
                                                  ltac:(M.monadic
                                                    match γ with
                                                    | [ α0 ] =>
                                                      ltac:(M.monadic
                                                        (M.match_operator (|
                                                          M.alloc (| α0 |),
                                                          [
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (let γ := M.read (| γ |) in
                                                                let d := M.copy (| γ |) in
                                                                BinOp.eq (|
                                                                  M.read (| d |),
                                                                  Value.Integer IntegerKind.U32 0
                                                                |)))
                                                          ]
                                                        |)))
                                                    | _ => M.impossible "wrong number of arguments"
                                                    end))
                                            ]
                                          |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String
                                              "assertion failed: r.base[r.size..].iter().all(|&d| d == 0)"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              M.alloc (| Value.Tuple [] |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_div_rem : M.IsAssociatedFunction Self "div_rem" div_rem.
    End Impl_core_num_bignum_Big32x40.
    
    Module Impl_core_cmp_PartialEq_for_core_num_bignum_Big32x40.
      Definition Self : Ty.t := Ty.path "core::num::bignum::Big32x40".
      
      (*
                  fn eq(&self, other: &$name) -> bool {
                      self.base[..] == other.base[..]
                  }
      *)
      Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.call_closure (|
              M.get_trait_method (|
                "core::cmp::PartialEq",
                Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                [ Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ] ],
                "eq",
                []
              |),
              [
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::index::Index",
                    Ty.apply
                      (Ty.path "array")
                      [ Value.Integer IntegerKind.Usize 40 ]
                      [ Ty.path "u32" ],
                    [ Ty.path "core::ops::range::RangeFull" ],
                    "index",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::Big32x40",
                      "base"
                    |);
                    Value.StructTuple "core::ops::range::RangeFull" []
                  ]
                |);
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::index::Index",
                    Ty.apply
                      (Ty.path "array")
                      [ Value.Integer IntegerKind.Usize 40 ]
                      [ Ty.path "u32" ],
                    [ Ty.path "core::ops::range::RangeFull" ],
                    "index",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| other |),
                      "core::num::bignum::Big32x40",
                      "base"
                    |);
                    Value.StructTuple "core::ops::range::RangeFull" []
                  ]
                |)
              ]
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::cmp::PartialEq"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("eq", InstanceField.Method eq) ].
    End Impl_core_cmp_PartialEq_for_core_num_bignum_Big32x40.
    
    Module Impl_core_cmp_Eq_for_core_num_bignum_Big32x40.
      Definition Self : Ty.t := Ty.path "core::num::bignum::Big32x40".
      
      Axiom Implements :
        M.IsTraitInstance "core::cmp::Eq" Self (* Trait polymorphic types *) [] (* Instance *) [].
    End Impl_core_cmp_Eq_for_core_num_bignum_Big32x40.
    
    Module Impl_core_cmp_PartialOrd_for_core_num_bignum_Big32x40.
      Definition Self : Ty.t := Ty.path "core::num::bignum::Big32x40".
      
      (*
                  fn partial_cmp(&self, other: &$name) -> crate::option::Option<crate::cmp::Ordering> {
                      crate::option::Option::Some(self.cmp(other))
                  }
      *)
      Definition partial_cmp (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            Value.StructTuple
              "core::option::Option::Some"
              [
                M.call_closure (|
                  M.get_trait_method (|
                    "core::cmp::Ord",
                    Ty.path "core::num::bignum::Big32x40",
                    [],
                    "cmp",
                    []
                  |),
                  [ M.read (| self |); M.read (| other |) ]
                |)
              ]))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::cmp::PartialOrd"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("partial_cmp", InstanceField.Method partial_cmp) ].
    End Impl_core_cmp_PartialOrd_for_core_num_bignum_Big32x40.
    
    Module Impl_core_cmp_Ord_for_core_num_bignum_Big32x40.
      Definition Self : Ty.t := Ty.path "core::num::bignum::Big32x40".
      
      (*
                  fn cmp(&self, other: &$name) -> crate::cmp::Ordering {
                      use crate::cmp::max;
                      let sz = max(self.size, other.size);
                      let lhs = self.base[..sz].iter().cloned().rev();
                      let rhs = other.base[..sz].iter().cloned().rev();
                      lhs.cmp(rhs)
                  }
      *)
      Definition cmp (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ sz :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (| "core::cmp::max", [ Ty.path "usize" ] |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::num::bignum::Big32x40",
                          "size"
                        |)
                      |);
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| other |),
                          "core::num::bignum::Big32x40",
                          "size"
                        |)
                      |)
                    ]
                  |)
                |) in
              let~ lhs :=
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      Ty.apply
                        (Ty.path "core::iter::adapters::cloned::Cloned")
                        []
                        [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ] ],
                      [],
                      "rev",
                      []
                    |),
                    [
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ],
                          [],
                          "cloned",
                          [ Ty.path "u32" ]
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                              "iter",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::index::Index",
                                  Ty.apply
                                    (Ty.path "array")
                                    [ Value.Integer IntegerKind.Usize 40 ]
                                    [ Ty.path "u32" ],
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::RangeTo")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                  "index",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "core::num::bignum::Big32x40",
                                    "base"
                                  |);
                                  Value.StructRecord
                                    "core::ops::range::RangeTo"
                                    [ ("end_", M.read (| sz |)) ]
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    ]
                  |)
                |) in
              let~ rhs :=
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      Ty.apply
                        (Ty.path "core::iter::adapters::cloned::Cloned")
                        []
                        [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ] ],
                      [],
                      "rev",
                      []
                    |),
                    [
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ],
                          [],
                          "cloned",
                          [ Ty.path "u32" ]
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                              "iter",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::index::Index",
                                  Ty.apply
                                    (Ty.path "array")
                                    [ Value.Integer IntegerKind.Usize 40 ]
                                    [ Ty.path "u32" ],
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::RangeTo")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                  "index",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| other |),
                                    "core::num::bignum::Big32x40",
                                    "base"
                                  |);
                                  Value.StructRecord
                                    "core::ops::range::RangeTo"
                                    [ ("end_", M.read (| sz |)) ]
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    ]
                  |)
                |) in
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.apply
                      (Ty.path "core::iter::adapters::rev::Rev")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::iter::adapters::cloned::Cloned")
                          []
                          [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ] ]
                      ],
                    [],
                    "cmp",
                    [
                      Ty.apply
                        (Ty.path "core::iter::adapters::rev::Rev")
                        []
                        [
                          Ty.apply
                            (Ty.path "core::iter::adapters::cloned::Cloned")
                            []
                            [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ] ]
                        ]
                    ]
                  |),
                  [ M.read (| lhs |); M.read (| rhs |) ]
                |)
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::cmp::Ord"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("cmp", InstanceField.Method cmp) ].
    End Impl_core_cmp_Ord_for_core_num_bignum_Big32x40.
    
    Module Impl_core_clone_Clone_for_core_num_bignum_Big32x40.
      Definition Self : Ty.t := Ty.path "core::num::bignum::Big32x40".
      
      (*
                  fn clone(&self) -> Self {
                      Self { size: self.size, base: self.base }
                  }
      *)
      Definition clone (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            Value.StructRecord
              "core::num::bignum::Big32x40"
              [
                ("size",
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::Big32x40",
                      "size"
                    |)
                  |));
                ("base",
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::Big32x40",
                      "base"
                    |)
                  |))
              ]))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::clone::Clone"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("clone", InstanceField.Method clone) ].
    End Impl_core_clone_Clone_for_core_num_bignum_Big32x40.
    
    Module Impl_core_fmt_Debug_for_core_num_bignum_Big32x40.
      Definition Self : Ty.t := Ty.path "core::num::bignum::Big32x40".
      
      (*
                  fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result {
                      let sz = if self.size < 1 { 1 } else { self.size };
                      let digitlen = <$ty>::BITS as usize / 4;
      
                      write!(f, "{:#x}", self.base[sz - 1])?;
                      for &v in self.base[..sz - 1].iter().rev() {
                          write!(f, "_{:01$x}", v, digitlen)?;
                      }
                      crate::result::Result::Ok(())
                  }
      *)
      Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.catch_return (|
              ltac:(M.monadic
                (M.read (|
                  let~ sz :=
                    M.copy (|
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    BinOp.lt (|
                                      M.read (|
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| self |),
                                          "core::num::bignum::Big32x40",
                                          "size"
                                        |)
                                      |),
                                      Value.Integer IntegerKind.Usize 1
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (| Value.Integer IntegerKind.Usize 1 |)));
                          fun γ =>
                            ltac:(M.monadic
                              (M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::num::bignum::Big32x40",
                                "size"
                              |)))
                        ]
                      |)
                    |) in
                  let~ digitlen :=
                    M.alloc (|
                      BinOp.Wrap.div (|
                        M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)),
                        Value.Integer IntegerKind.Usize 4
                      |)
                    |) in
                  let~ _ :=
                    M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::try_trait::Try",
                            Ty.apply
                              (Ty.path "core::result::Result")
                              []
                              [ Ty.tuple []; Ty.path "core::fmt::Error" ],
                            [],
                            "branch",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "core::fmt::Formatter",
                                "write_fmt",
                                []
                              |),
                              [
                                M.read (| f |);
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "core::fmt::Arguments",
                                    "new_v1_formatted",
                                    []
                                  |),
                                  [
                                    M.alloc (| Value.Array [ M.read (| Value.String "" |) ] |);
                                    M.alloc (|
                                      Value.Array
                                        [
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path "core::fmt::rt::Argument",
                                              "new_lower_hex",
                                              [ Ty.path "u32" ]
                                            |),
                                            [
                                              M.SubPointer.get_array_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "core::num::bignum::Big32x40",
                                                  "base"
                                                |),
                                                M.alloc (|
                                                  BinOp.Wrap.sub (|
                                                    M.read (| sz |),
                                                    Value.Integer IntegerKind.Usize 1
                                                  |)
                                                |)
                                              |)
                                            ]
                                          |)
                                        ]
                                    |);
                                    M.alloc (|
                                      Value.Array
                                        [
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path "core::fmt::rt::Placeholder",
                                              "new",
                                              []
                                            |),
                                            [
                                              Value.Integer IntegerKind.Usize 0;
                                              Value.UnicodeChar 32;
                                              Value.StructTuple
                                                "core::fmt::rt::Alignment::Unknown"
                                                [];
                                              Value.Integer IntegerKind.U32 4;
                                              Value.StructTuple "core::fmt::rt::Count::Implied" [];
                                              Value.StructTuple "core::fmt::rt::Count::Implied" []
                                            ]
                                          |)
                                        ]
                                    |);
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "core::fmt::rt::UnsafeArg",
                                        "new",
                                        []
                                      |),
                                      []
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::ops::control_flow::ControlFlow::Break",
                                0
                              |) in
                            let residual := M.copy (| γ0_0 |) in
                            M.alloc (|
                              M.never_to_any (|
                                M.read (|
                                  M.return_ (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::FromResidual",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.tuple []; Ty.path "core::fmt::Error" ],
                                        [
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.path "core::convert::Infallible";
                                              Ty.path "core::fmt::Error"
                                            ]
                                        ],
                                        "from_residual",
                                        []
                                      |),
                                      [ M.read (| residual |) ]
                                    |)
                                  |)
                                |)
                              |)
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::ops::control_flow::ControlFlow::Continue",
                                0
                              |) in
                            let val := M.copy (| γ0_0 |) in
                            val))
                      ]
                    |) in
                  let~ _ :=
                    M.use
                      (M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::collect::IntoIterator",
                              Ty.apply
                                (Ty.path "core::iter::adapters::rev::Rev")
                                []
                                [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ]
                                ],
                              [],
                              "into_iter",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::iterator::Iterator",
                                  Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u32" ],
                                  [],
                                  "rev",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply (Ty.path "slice") [] [ Ty.path "u32" ],
                                      "iter",
                                      []
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::index::Index",
                                          Ty.apply
                                            (Ty.path "array")
                                            [ Value.Integer IntegerKind.Usize 40 ]
                                            [ Ty.path "u32" ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::ops::range::RangeTo")
                                              []
                                              [ Ty.path "usize" ]
                                          ],
                                          "index",
                                          []
                                        |),
                                        [
                                          M.SubPointer.get_struct_record_field (|
                                            M.read (| self |),
                                            "core::num::bignum::Big32x40",
                                            "base"
                                          |);
                                          Value.StructRecord
                                            "core::ops::range::RangeTo"
                                            [
                                              ("end_",
                                                BinOp.Wrap.sub (|
                                                  M.read (| sz |),
                                                  Value.Integer IntegerKind.Usize 1
                                                |))
                                            ]
                                        ]
                                      |)
                                    ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let iter := M.copy (| γ |) in
                              M.loop (|
                                ltac:(M.monadic
                                  (let~ _ :=
                                    M.match_operator (|
                                      M.alloc (|
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::iter::traits::iterator::Iterator",
                                            Ty.apply
                                              (Ty.path "core::iter::adapters::rev::Rev")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::Iter")
                                                  []
                                                  [ Ty.path "u32" ]
                                              ],
                                            [],
                                            "next",
                                            []
                                          |),
                                          [ iter ]
                                        |)
                                      |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let _ :=
                                              M.is_struct_tuple (|
                                                γ,
                                                "core::option::Option::None"
                                              |) in
                                            M.alloc (|
                                              M.never_to_any (| M.read (| M.break (||) |) |)
                                            |)));
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ0_0 :=
                                              M.SubPointer.get_struct_tuple_field (|
                                                γ,
                                                "core::option::Option::Some",
                                                0
                                              |) in
                                            let γ0_0 := M.read (| γ0_0 |) in
                                            let v := M.copy (| γ0_0 |) in
                                            let~ _ :=
                                              M.match_operator (|
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::Try",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.tuple []; Ty.path "core::fmt::Error" ],
                                                      [],
                                                      "branch",
                                                      []
                                                    |),
                                                    [
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.path "core::fmt::Formatter",
                                                          "write_fmt",
                                                          []
                                                        |),
                                                        [
                                                          M.read (| f |);
                                                          M.call_closure (|
                                                            M.get_associated_function (|
                                                              Ty.path "core::fmt::Arguments",
                                                              "new_v1_formatted",
                                                              []
                                                            |),
                                                            [
                                                              M.alloc (|
                                                                Value.Array
                                                                  [ M.read (| Value.String "_" |) ]
                                                              |);
                                                              M.alloc (|
                                                                Value.Array
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "core::fmt::rt::Argument",
                                                                        "new_lower_hex",
                                                                        [ Ty.path "u32" ]
                                                                      |),
                                                                      [ v ]
                                                                    |);
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "core::fmt::rt::Argument",
                                                                        "from_usize",
                                                                        []
                                                                      |),
                                                                      [ digitlen ]
                                                                    |)
                                                                  ]
                                                              |);
                                                              M.alloc (|
                                                                Value.Array
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "core::fmt::rt::Placeholder",
                                                                        "new",
                                                                        []
                                                                      |),
                                                                      [
                                                                        Value.Integer
                                                                          IntegerKind.Usize
                                                                          0;
                                                                        Value.UnicodeChar 32;
                                                                        Value.StructTuple
                                                                          "core::fmt::rt::Alignment::Unknown"
                                                                          [];
                                                                        Value.Integer
                                                                          IntegerKind.U32
                                                                          8;
                                                                        Value.StructTuple
                                                                          "core::fmt::rt::Count::Implied"
                                                                          [];
                                                                        Value.StructTuple
                                                                          "core::fmt::rt::Count::Param"
                                                                          [
                                                                            Value.Integer
                                                                              IntegerKind.Usize
                                                                              1
                                                                          ]
                                                                      ]
                                                                    |)
                                                                  ]
                                                              |);
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path
                                                                    "core::fmt::rt::UnsafeArg",
                                                                  "new",
                                                                  []
                                                                |),
                                                                []
                                                              |)
                                                            ]
                                                          |)
                                                        ]
                                                      |)
                                                    ]
                                                  |)
                                                |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ0_0 :=
                                                        M.SubPointer.get_struct_tuple_field (|
                                                          γ,
                                                          "core::ops::control_flow::ControlFlow::Break",
                                                          0
                                                        |) in
                                                      let residual := M.copy (| γ0_0 |) in
                                                      M.alloc (|
                                                        M.never_to_any (|
                                                          M.read (|
                                                            M.return_ (|
                                                              M.call_closure (|
                                                                M.get_trait_method (|
                                                                  "core::ops::try_trait::FromResidual",
                                                                  Ty.apply
                                                                    (Ty.path "core::result::Result")
                                                                    []
                                                                    [
                                                                      Ty.tuple [];
                                                                      Ty.path "core::fmt::Error"
                                                                    ],
                                                                  [
                                                                    Ty.apply
                                                                      (Ty.path
                                                                        "core::result::Result")
                                                                      []
                                                                      [
                                                                        Ty.path
                                                                          "core::convert::Infallible";
                                                                        Ty.path "core::fmt::Error"
                                                                      ]
                                                                  ],
                                                                  "from_residual",
                                                                  []
                                                                |),
                                                                [ M.read (| residual |) ]
                                                              |)
                                                            |)
                                                          |)
                                                        |)
                                                      |)));
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ0_0 :=
                                                        M.SubPointer.get_struct_tuple_field (|
                                                          γ,
                                                          "core::ops::control_flow::ControlFlow::Continue",
                                                          0
                                                        |) in
                                                      let val := M.copy (| γ0_0 |) in
                                                      val))
                                                ]
                                              |) in
                                            M.alloc (| Value.Tuple [] |)))
                                      ]
                                    |) in
                                  M.alloc (| Value.Tuple [] |)))
                              |)))
                        ]
                      |)) in
                  M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
                |)))
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::fmt::Debug"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
    End Impl_core_fmt_Debug_for_core_num_bignum_Big32x40.
    
    Module tests.
      (* StructRecord
        {
          name := "Big8x3";
          const_params := [];
          ty_params := [];
          fields :=
            [
              ("size", Ty.path "usize");
              ("base",
                Ty.apply (Ty.path "array") [ Value.Integer IntegerKind.Usize 3 ] [ Ty.path "u8" ])
            ];
        } *)
      
      Module Impl_core_num_bignum_tests_Big8x3.
        Definition Self : Ty.t := Ty.path "core::num::bignum::tests::Big8x3".
        
        (*
                    pub fn from_small(v: $ty) -> $name {
                        let mut base = [0; $n];
                        base[0] = v;
                        $name { size: 1, base }
                    }
        *)
        Definition from_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ v ] =>
            ltac:(M.monadic
              (let v := M.alloc (| v |) in
              M.read (|
                let~ base :=
                  M.alloc (|
                    repeat (| Value.Integer IntegerKind.U8 0, Value.Integer IntegerKind.Usize 3 |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_array_field (|
                      base,
                      M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                    |),
                    M.read (| v |)
                  |) in
                M.alloc (|
                  Value.StructRecord
                    "core::num::bignum::tests::Big8x3"
                    [ ("size", Value.Integer IntegerKind.Usize 1); ("base", M.read (| base |)) ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_from_small : M.IsAssociatedFunction Self "from_small" from_small.
        
        (*
                    pub fn from_u64(mut v: u64) -> $name {
                        let mut base = [0; $n];
                        let mut sz = 0;
                        while v > 0 {
                            base[sz] = v as $ty;
                            v >>= <$ty>::BITS;
                            sz += 1;
                        }
                        $name { size: sz, base }
                    }
        *)
        Definition from_u64 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ v ] =>
            ltac:(M.monadic
              (let v := M.alloc (| v |) in
              M.read (|
                let~ base :=
                  M.alloc (|
                    repeat (| Value.Integer IntegerKind.U8 0, Value.Integer IntegerKind.Usize 3 |)
                  |) in
                let~ sz := M.alloc (| Value.Integer IntegerKind.Usize 0 |) in
                let~ _ :=
                  M.loop (|
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    BinOp.gt (| M.read (| v |), Value.Integer IntegerKind.U64 0 |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              let~ _ :=
                                M.write (|
                                  M.SubPointer.get_array_field (| base, sz |),
                                  M.rust_cast (M.read (| v |))
                                |) in
                              let~ _ :=
                                let β := v in
                                M.write (|
                                  β,
                                  BinOp.Wrap.shr (|
                                    M.read (| β |),
                                    M.read (| M.get_constant (| "core::num::BITS" |) |)
                                  |)
                                |) in
                              let~ _ :=
                                let β := sz in
                                M.write (|
                                  β,
                                  BinOp.Wrap.add (|
                                    M.read (| β |),
                                    Value.Integer IntegerKind.Usize 1
                                  |)
                                |) in
                              M.alloc (| Value.Tuple [] |)));
                          fun γ =>
                            ltac:(M.monadic
                              (M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    let~ _ :=
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |) in
                                    M.alloc (| Value.Tuple [] |)
                                  |)
                                |)
                              |)))
                        ]
                      |)))
                  |) in
                M.alloc (|
                  Value.StructRecord
                    "core::num::bignum::tests::Big8x3"
                    [ ("size", M.read (| sz |)); ("base", M.read (| base |)) ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_from_u64 : M.IsAssociatedFunction Self "from_u64" from_u64.
        
        (*
                    pub fn digits(&self) -> &[$ty] {
                        &self.base[..self.size]
                    }
        *)
        Definition digits (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.apply (Ty.path "array") [ Value.Integer IntegerKind.Usize 3 ] [ Ty.path "u8" ],
                  [ Ty.apply (Ty.path "core::ops::range::RangeTo") [] [ Ty.path "usize" ] ],
                  "index",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::num::bignum::tests::Big8x3",
                    "base"
                  |);
                  Value.StructRecord
                    "core::ops::range::RangeTo"
                    [
                      ("end_",
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::num::bignum::tests::Big8x3",
                            "size"
                          |)
                        |))
                    ]
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_digits : M.IsAssociatedFunction Self "digits" digits.
        
        (*
                    pub fn get_bit(&self, i: usize) -> u8 {
                        let digitbits = <$ty>::BITS as usize;
                        let d = i / digitbits;
                        let b = i % digitbits;
                        ((self.base[d] >> b) & 1) as u8
                    }
        *)
        Definition get_bit (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; i ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let i := M.alloc (| i |) in
              M.read (|
                let~ digitbits :=
                  M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
                let~ d :=
                  M.alloc (| BinOp.Wrap.div (| M.read (| i |), M.read (| digitbits |) |) |) in
                let~ b :=
                  M.alloc (| BinOp.Wrap.rem (| M.read (| i |), M.read (| digitbits |) |) |) in
                M.use
                  (M.alloc (|
                    BinOp.bit_and
                      (BinOp.Wrap.shr (|
                        M.read (|
                          M.SubPointer.get_array_field (|
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "core::num::bignum::tests::Big8x3",
                              "base"
                            |),
                            d
                          |)
                        |),
                        M.read (| b |)
                      |))
                      (Value.Integer IntegerKind.U8 1)
                  |))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_get_bit : M.IsAssociatedFunction Self "get_bit" get_bit.
        
        (*
                    pub fn is_zero(&self) -> bool {
                        self.digits().iter().all(|&v| v == 0)
                    }
        *)
        Definition is_zero (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::iterator::Iterator",
                  Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ],
                  [],
                  "all",
                  [
                    Ty.function
                      [ Ty.tuple [ Ty.apply (Ty.path "&") [] [ Ty.path "u8" ] ] ]
                      (Ty.path "bool")
                  ]
                |),
                [
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                        "iter",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "core::num::bignum::tests::Big8x3",
                            "digits",
                            []
                          |),
                          [ M.read (| self |) ]
                        |)
                      ]
                    |)
                  |);
                  M.closure
                    (fun γ =>
                      ltac:(M.monadic
                        match γ with
                        | [ α0 ] =>
                          ltac:(M.monadic
                            (M.match_operator (|
                              M.alloc (| α0 |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ := M.read (| γ |) in
                                    let v := M.copy (| γ |) in
                                    BinOp.eq (| M.read (| v |), Value.Integer IntegerKind.U8 0 |)))
                              ]
                            |)))
                        | _ => M.impossible "wrong number of arguments"
                        end))
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_is_zero : M.IsAssociatedFunction Self "is_zero" is_zero.
        
        (*
                    pub fn bit_length(&self) -> usize {
                        let digitbits = <$ty>::BITS as usize;
                        let digits = self.digits();
                        // Find the most significant non-zero digit.
                        let msd = digits.iter().rposition(|&x| x != 0);
                        match msd {
                            Some(msd) => msd * digitbits + digits[msd].ilog2() as usize + 1,
                            // There are no non-zero digits, i.e., the number is zero.
                            _ => 0,
                        }
                    }
        *)
        Definition bit_length (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.read (|
                let~ digitbits :=
                  M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
                let~ digits :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "core::num::bignum::tests::Big8x3",
                        "digits",
                        []
                      |),
                      [ M.read (| self |) ]
                    |)
                  |) in
                let~ msd :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ],
                        [],
                        "rposition",
                        [
                          Ty.function
                            [ Ty.tuple [ Ty.apply (Ty.path "&") [] [ Ty.path "u8" ] ] ]
                            (Ty.path "bool")
                        ]
                      |),
                      [
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                              "iter",
                              []
                            |),
                            [ M.read (| digits |) ]
                          |)
                        |);
                        M.closure
                          (fun γ =>
                            ltac:(M.monadic
                              match γ with
                              | [ α0 ] =>
                                ltac:(M.monadic
                                  (M.match_operator (|
                                    M.alloc (| α0 |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ := M.read (| γ |) in
                                          let x := M.copy (| γ |) in
                                          BinOp.ne (|
                                            M.read (| x |),
                                            Value.Integer IntegerKind.U8 0
                                          |)))
                                    ]
                                  |)))
                              | _ => M.impossible "wrong number of arguments"
                              end))
                      ]
                    |)
                  |) in
                M.match_operator (|
                  msd,
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::option::Option::Some",
                            0
                          |) in
                        let msd := M.copy (| γ0_0 |) in
                        M.alloc (|
                          BinOp.Wrap.add (|
                            BinOp.Wrap.add (|
                              BinOp.Wrap.mul (| M.read (| msd |), M.read (| digitbits |) |),
                              M.rust_cast
                                (M.call_closure (|
                                  M.get_associated_function (| Ty.path "u8", "ilog2", [] |),
                                  [
                                    M.read (|
                                      M.SubPointer.get_array_field (| M.read (| digits |), msd |)
                                    |)
                                  ]
                                |))
                            |),
                            Value.Integer IntegerKind.Usize 1
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Integer IntegerKind.Usize 0 |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_bit_length : M.IsAssociatedFunction Self "bit_length" bit_length.
        
        (*
                    pub fn add<'a>(&'a mut self, other: &$name) -> &'a mut $name {
                        use crate::{cmp, iter};
        
                        let mut sz = cmp::max(self.size, other.size);
                        let mut carry = false;
                        for (a, b) in iter::zip(&mut self.base[..sz], &other.base[..sz]) {
                            let (v, c) = ( *a).carrying_add( *b, carry);
                            *a = v;
                            carry = c;
                        }
                        if carry {
                            self.base[sz] = 1;
                            sz += 1;
                        }
                        self.size = sz;
                        self
                    }
        *)
        Definition add (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.read (|
                let~ sz :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_function (| "core::cmp::max", [ Ty.path "usize" ] |),
                      [
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::num::bignum::tests::Big8x3",
                            "size"
                          |)
                        |);
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| other |),
                            "core::num::bignum::tests::Big8x3",
                            "size"
                          |)
                        |)
                      ]
                    |)
                  |) in
                let~ carry := M.alloc (| Value.Bool false |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "core::iter::adapters::zip::Zip")
                              []
                              [
                                Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u8" ];
                                Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ]
                              ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_function (|
                                "core::iter::adapters::zip::zip",
                                [
                                  Ty.apply
                                    (Ty.path "&mut")
                                    []
                                    [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ];
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ]
                                ]
                              |),
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::index::IndexMut",
                                    Ty.apply
                                      (Ty.path "array")
                                      [ Value.Integer IntegerKind.Usize 3 ]
                                      [ Ty.path "u8" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::ops::range::RangeTo")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                    "index_mut",
                                    []
                                  |),
                                  [
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::num::bignum::tests::Big8x3",
                                      "base"
                                    |);
                                    Value.StructRecord
                                      "core::ops::range::RangeTo"
                                      [ ("end_", M.read (| sz |)) ]
                                  ]
                                |);
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::index::Index",
                                    Ty.apply
                                      (Ty.path "array")
                                      [ Value.Integer IntegerKind.Usize 3 ]
                                      [ Ty.path "u8" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::ops::range::RangeTo")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                    "index",
                                    []
                                  |),
                                  [
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| other |),
                                      "core::num::bignum::tests::Big8x3",
                                      "base"
                                    |);
                                    Value.StructRecord
                                      "core::ops::range::RangeTo"
                                      [ ("end_", M.read (| sz |)) ]
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::zip::Zip")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::slice::iter::IterMut")
                                                []
                                                [ Ty.path "u8" ];
                                              Ty.apply
                                                (Ty.path "core::slice::iter::Iter")
                                                []
                                                [ Ty.path "u8" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                          let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                          let a := M.copy (| γ1_0 |) in
                                          let b := M.copy (| γ1_1 |) in
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "u8",
                                                  "carrying_add",
                                                  []
                                                |),
                                                [
                                                  M.read (| M.read (| a |) |);
                                                  M.read (| M.read (| b |) |);
                                                  M.read (| carry |)
                                                ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                  let γ0_1 :=
                                                    M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                  let v := M.copy (| γ0_0 |) in
                                                  let c := M.copy (| γ0_1 |) in
                                                  let~ _ :=
                                                    M.write (| M.read (| a |), M.read (| v |) |) in
                                                  let~ _ := M.write (| carry, M.read (| c |) |) in
                                                  M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.use carry in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_array_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "core::num::bignum::tests::Big8x3",
                                  "base"
                                |),
                                sz
                              |),
                              Value.Integer IntegerKind.U8 1
                            |) in
                          let~ _ :=
                            let β := sz in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.Usize 1 |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |),
                    M.read (| sz |)
                  |) in
                M.alloc (| M.read (| self |) |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_add : M.IsAssociatedFunction Self "add" add.
        
        (*
                    pub fn add_small(&mut self, other: $ty) -> &mut $name {
                        let (v, mut carry) = self.base[0].carrying_add(other, false);
                        self.base[0] = v;
                        let mut i = 1;
                        while carry {
                            let (v, c) = self.base[i].carrying_add(0, carry);
                            self.base[i] = v;
                            carry = c;
                            i += 1;
                        }
                        if i > self.size {
                            self.size = i;
                        }
                        self
                    }
        *)
        Definition add_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.read (|
                M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "u8", "carrying_add", [] |),
                      [
                        M.read (|
                          M.SubPointer.get_array_field (|
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "core::num::bignum::tests::Big8x3",
                              "base"
                            |),
                            M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                          |)
                        |);
                        M.read (| other |);
                        Value.Bool false
                      ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                        let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                        let v := M.copy (| γ0_0 |) in
                        let carry := M.copy (| γ0_1 |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_array_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::num::bignum::tests::Big8x3",
                                "base"
                              |),
                              M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                            |),
                            M.read (| v |)
                          |) in
                        let~ i := M.alloc (| Value.Integer IntegerKind.Usize 1 |) in
                        let~ _ :=
                          M.loop (|
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| Value.Tuple [] |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ := M.use carry in
                                      let _ :=
                                        M.is_constant_or_break_match (|
                                          M.read (| γ |),
                                          Value.Bool true
                                        |) in
                                      M.match_operator (|
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path "u8",
                                              "carrying_add",
                                              []
                                            |),
                                            [
                                              M.read (|
                                                M.SubPointer.get_array_field (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| self |),
                                                    "core::num::bignum::tests::Big8x3",
                                                    "base"
                                                  |),
                                                  i
                                                |)
                                              |);
                                              Value.Integer IntegerKind.U8 0;
                                              M.read (| carry |)
                                            ]
                                          |)
                                        |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let γ0_0 :=
                                                M.SubPointer.get_tuple_field (| γ, 0 |) in
                                              let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                                              let v := M.copy (| γ0_0 |) in
                                              let c := M.copy (| γ0_1 |) in
                                              let~ _ :=
                                                M.write (|
                                                  M.SubPointer.get_array_field (|
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| self |),
                                                      "core::num::bignum::tests::Big8x3",
                                                      "base"
                                                    |),
                                                    i
                                                  |),
                                                  M.read (| v |)
                                                |) in
                                              let~ _ := M.write (| carry, M.read (| c |) |) in
                                              let~ _ :=
                                                let β := i in
                                                M.write (|
                                                  β,
                                                  BinOp.Wrap.add (|
                                                    M.read (| β |),
                                                    Value.Integer IntegerKind.Usize 1
                                                  |)
                                                |) in
                                              M.alloc (| Value.Tuple [] |)))
                                        ]
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (M.alloc (|
                                        M.never_to_any (|
                                          M.read (|
                                            let~ _ :=
                                              M.alloc (|
                                                M.never_to_any (| M.read (| M.break (||) |) |)
                                              |) in
                                            M.alloc (| Value.Tuple [] |)
                                          |)
                                        |)
                                      |)))
                                ]
                              |)))
                          |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        BinOp.gt (|
                                          M.read (| i |),
                                          M.read (|
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| self |),
                                              "core::num::bignum::tests::Big8x3",
                                              "size"
                                            |)
                                          |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  let~ _ :=
                                    M.write (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::num::bignum::tests::Big8x3",
                                        "size"
                                      |),
                                      M.read (| i |)
                                    |) in
                                  M.alloc (| Value.Tuple [] |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| M.read (| self |) |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_add_small : M.IsAssociatedFunction Self "add_small" add_small.
        
        (*
                    pub fn sub<'a>(&'a mut self, other: &$name) -> &'a mut $name {
                        use crate::{cmp, iter};
        
                        let sz = cmp::max(self.size, other.size);
                        let mut noborrow = true;
                        for (a, b) in iter::zip(&mut self.base[..sz], &other.base[..sz]) {
                            let (v, c) = ( *a).carrying_add(!*b, noborrow);
                            *a = v;
                            noborrow = c;
                        }
                        assert!(noborrow);
                        self.size = sz;
                        self
                    }
        *)
        Definition sub (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.read (|
                let~ sz :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_function (| "core::cmp::max", [ Ty.path "usize" ] |),
                      [
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::num::bignum::tests::Big8x3",
                            "size"
                          |)
                        |);
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| other |),
                            "core::num::bignum::tests::Big8x3",
                            "size"
                          |)
                        |)
                      ]
                    |)
                  |) in
                let~ noborrow := M.alloc (| Value.Bool true |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "core::iter::adapters::zip::Zip")
                              []
                              [
                                Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u8" ];
                                Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ]
                              ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_function (|
                                "core::iter::adapters::zip::zip",
                                [
                                  Ty.apply
                                    (Ty.path "&mut")
                                    []
                                    [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ];
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ]
                                ]
                              |),
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::index::IndexMut",
                                    Ty.apply
                                      (Ty.path "array")
                                      [ Value.Integer IntegerKind.Usize 3 ]
                                      [ Ty.path "u8" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::ops::range::RangeTo")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                    "index_mut",
                                    []
                                  |),
                                  [
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::num::bignum::tests::Big8x3",
                                      "base"
                                    |);
                                    Value.StructRecord
                                      "core::ops::range::RangeTo"
                                      [ ("end_", M.read (| sz |)) ]
                                  ]
                                |);
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::index::Index",
                                    Ty.apply
                                      (Ty.path "array")
                                      [ Value.Integer IntegerKind.Usize 3 ]
                                      [ Ty.path "u8" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::ops::range::RangeTo")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                    "index",
                                    []
                                  |),
                                  [
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| other |),
                                      "core::num::bignum::tests::Big8x3",
                                      "base"
                                    |);
                                    Value.StructRecord
                                      "core::ops::range::RangeTo"
                                      [ ("end_", M.read (| sz |)) ]
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::zip::Zip")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::slice::iter::IterMut")
                                                []
                                                [ Ty.path "u8" ];
                                              Ty.apply
                                                (Ty.path "core::slice::iter::Iter")
                                                []
                                                [ Ty.path "u8" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                          let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                          let a := M.copy (| γ1_0 |) in
                                          let b := M.copy (| γ1_1 |) in
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "u8",
                                                  "carrying_add",
                                                  []
                                                |),
                                                [
                                                  M.read (| M.read (| a |) |);
                                                  UnOp.not (| M.read (| M.read (| b |) |) |);
                                                  M.read (| noborrow |)
                                                ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                  let γ0_1 :=
                                                    M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                  let v := M.copy (| γ0_0 |) in
                                                  let c := M.copy (| γ0_1 |) in
                                                  let~ _ :=
                                                    M.write (| M.read (| a |), M.read (| v |) |) in
                                                  let~ _ :=
                                                    M.write (| noborrow, M.read (| c |) |) in
                                                  M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.use (M.alloc (| UnOp.not (| M.read (| noborrow |) |) |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.call_closure (|
                                M.get_function (| "core::panicking::panic", [] |),
                                [ M.read (| Value.String "assertion failed: noborrow" |) ]
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |),
                    M.read (| sz |)
                  |) in
                M.alloc (| M.read (| self |) |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_sub : M.IsAssociatedFunction Self "sub" sub.
        
        (*
                    pub fn mul_small(&mut self, other: $ty) -> &mut $name {
                        let mut sz = self.size;
                        let mut carry = 0;
                        for a in &mut self.base[..sz] {
                            let (v, c) = ( *a).carrying_mul(other, carry);
                            *a = v;
                            carry = c;
                        }
                        if carry > 0 {
                            self.base[sz] = carry;
                            sz += 1;
                        }
                        self.size = sz;
                        self
                    }
        *)
        Definition mul_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.read (|
                let~ sz :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |)
                  |) in
                let~ carry := M.alloc (| Value.Integer IntegerKind.U8 0 |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "&mut")
                              []
                              [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::index::IndexMut",
                                Ty.apply
                                  (Ty.path "array")
                                  [ Value.Integer IntegerKind.Usize 3 ]
                                  [ Ty.path "u8" ],
                                [
                                  Ty.apply
                                    (Ty.path "core::ops::range::RangeTo")
                                    []
                                    [ Ty.path "usize" ]
                                ],
                                "index_mut",
                                []
                              |),
                              [
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "core::num::bignum::tests::Big8x3",
                                  "base"
                                |);
                                Value.StructRecord
                                  "core::ops::range::RangeTo"
                                  [ ("end_", M.read (| sz |)) ]
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::slice::iter::IterMut")
                                            []
                                            [ Ty.path "u8" ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let a := M.copy (| γ0_0 |) in
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "u8",
                                                  "carrying_mul",
                                                  []
                                                |),
                                                [
                                                  M.read (| M.read (| a |) |);
                                                  M.read (| other |);
                                                  M.read (| carry |)
                                                ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                  let γ0_1 :=
                                                    M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                  let v := M.copy (| γ0_0 |) in
                                                  let c := M.copy (| γ0_1 |) in
                                                  let~ _ :=
                                                    M.write (| M.read (| a |), M.read (| v |) |) in
                                                  let~ _ := M.write (| carry, M.read (| c |) |) in
                                                  M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.gt (| M.read (| carry |), Value.Integer IntegerKind.U8 0 |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.write (|
                              M.SubPointer.get_array_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "core::num::bignum::tests::Big8x3",
                                  "base"
                                |),
                                sz
                              |),
                              M.read (| carry |)
                            |) in
                          let~ _ :=
                            let β := sz in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.Usize 1 |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |),
                    M.read (| sz |)
                  |) in
                M.alloc (| M.read (| self |) |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_mul_small : M.IsAssociatedFunction Self "mul_small" mul_small.
        
        (*
                    pub fn mul_pow2(&mut self, bits: usize) -> &mut $name {
                        let digitbits = <$ty>::BITS as usize;
                        let digits = bits / digitbits;
                        let bits = bits % digitbits;
        
                        assert!(digits < $n);
                        debug_assert!(self.base[$n - digits..].iter().all(|&v| v == 0));
                        debug_assert!(bits == 0 || (self.base[$n - digits - 1] >> (digitbits - bits)) == 0);
        
                        // shift by `digits * digitbits` bits
                        for i in (0..self.size).rev() {
                            self.base[i + digits] = self.base[i];
                        }
                        for i in 0..digits {
                            self.base[i] = 0;
                        }
        
                        // shift by `bits` bits
                        let mut sz = self.size + digits;
                        if bits > 0 {
                            let last = sz;
                            let overflow = self.base[last - 1] >> (digitbits - bits);
                            if overflow > 0 {
                                self.base[last] = overflow;
                                sz += 1;
                            }
                            for i in (digits + 1..last).rev() {
                                self.base[i] =
                                    (self.base[i] << bits) | (self.base[i - 1] >> (digitbits - bits));
                            }
                            self.base[digits] <<= bits;
                            // self.base[..digits] is zero, no need to shift
                        }
        
                        self.size = sz;
                        self
                    }
        *)
        Definition mul_pow2 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; bits ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let bits := M.alloc (| bits |) in
              M.read (|
                let~ digitbits :=
                  M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
                let~ digits :=
                  M.alloc (| BinOp.Wrap.div (| M.read (| bits |), M.read (| digitbits |) |) |) in
                let~ bits :=
                  M.alloc (| BinOp.Wrap.rem (| M.read (| bits |), M.read (| digitbits |) |) |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                UnOp.not (|
                                  BinOp.lt (|
                                    M.read (| digits |),
                                    Value.Integer IntegerKind.Usize 3
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.call_closure (|
                                M.get_function (| "core::panicking::panic", [] |),
                                [ M.read (| Value.String "assertion failed: digits < 3" |) ]
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.use (M.alloc (| Value.Bool true |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          UnOp.not (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::iter::traits::iterator::Iterator",
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::Iter")
                                                  []
                                                  [ Ty.path "u8" ],
                                                [],
                                                "all",
                                                [
                                                  Ty.function
                                                    [
                                                      Ty.tuple
                                                        [ Ty.apply (Ty.path "&") [] [ Ty.path "u8" ]
                                                        ]
                                                    ]
                                                    (Ty.path "bool")
                                                ]
                                              |),
                                              [
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "slice")
                                                        []
                                                        [ Ty.path "u8" ],
                                                      "iter",
                                                      []
                                                    |),
                                                    [
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::ops::index::Index",
                                                          Ty.apply
                                                            (Ty.path "array")
                                                            [ Value.Integer IntegerKind.Usize 3 ]
                                                            [ Ty.path "u8" ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path
                                                                "core::ops::range::RangeFrom")
                                                              []
                                                              [ Ty.path "usize" ]
                                                          ],
                                                          "index",
                                                          []
                                                        |),
                                                        [
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| self |),
                                                            "core::num::bignum::tests::Big8x3",
                                                            "base"
                                                          |);
                                                          Value.StructRecord
                                                            "core::ops::range::RangeFrom"
                                                            [
                                                              ("start",
                                                                BinOp.Wrap.sub (|
                                                                  Value.Integer IntegerKind.Usize 3,
                                                                  M.read (| digits |)
                                                                |))
                                                            ]
                                                        ]
                                                      |)
                                                    ]
                                                  |)
                                                |);
                                                M.closure
                                                  (fun γ =>
                                                    ltac:(M.monadic
                                                      match γ with
                                                      | [ α0 ] =>
                                                        ltac:(M.monadic
                                                          (M.match_operator (|
                                                            M.alloc (| α0 |),
                                                            [
                                                              fun γ =>
                                                                ltac:(M.monadic
                                                                  (let γ := M.read (| γ |) in
                                                                  let v := M.copy (| γ |) in
                                                                  BinOp.eq (|
                                                                    M.read (| v |),
                                                                    Value.Integer IntegerKind.U8 0
                                                                  |)))
                                                            ]
                                                          |)))
                                                      | _ =>
                                                        M.impossible "wrong number of arguments"
                                                      end))
                                              ]
                                            |)
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    M.alloc (|
                                      M.never_to_any (|
                                        M.call_closure (|
                                          M.get_function (| "core::panicking::panic", [] |),
                                          [
                                            M.read (|
                                              Value.String
                                                "assertion failed: self.base[3 - digits..].iter().all(|&v| v == 0)"
                                            |)
                                          ]
                                        |)
                                      |)
                                    |)));
                                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.use (M.alloc (| Value.Bool true |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          UnOp.not (|
                                            LogicalOp.or (|
                                              BinOp.eq (|
                                                M.read (| bits |),
                                                Value.Integer IntegerKind.Usize 0
                                              |),
                                              ltac:(M.monadic
                                                (BinOp.eq (|
                                                  BinOp.Wrap.shr (|
                                                    M.read (|
                                                      M.SubPointer.get_array_field (|
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| self |),
                                                          "core::num::bignum::tests::Big8x3",
                                                          "base"
                                                        |),
                                                        M.alloc (|
                                                          BinOp.Wrap.sub (|
                                                            BinOp.Wrap.sub (|
                                                              Value.Integer IntegerKind.Usize 3,
                                                              M.read (| digits |)
                                                            |),
                                                            Value.Integer IntegerKind.Usize 1
                                                          |)
                                                        |)
                                                      |)
                                                    |),
                                                    BinOp.Wrap.sub (|
                                                      M.read (| digitbits |),
                                                      M.read (| bits |)
                                                    |)
                                                  |),
                                                  Value.Integer IntegerKind.U8 0
                                                |)))
                                            |)
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    M.alloc (|
                                      M.never_to_any (|
                                        M.call_closure (|
                                          M.get_function (| "core::panicking::panic", [] |),
                                          [
                                            M.read (|
                                              Value.String
                                                "assertion failed: bits == 0 || (self.base[3 - digits - 1] >> (digitbits - bits)) == 0"
                                            |)
                                          ]
                                        |)
                                      |)
                                    |)));
                                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "core::iter::adapters::rev::Rev")
                              []
                              [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ]
                              ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::iterator::Iterator",
                                Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ],
                                [],
                                "rev",
                                []
                              |),
                              [
                                Value.StructRecord
                                  "core::ops::range::Range"
                                  [
                                    ("start", Value.Integer IntegerKind.Usize 0);
                                    ("end_",
                                      M.read (|
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| self |),
                                          "core::num::bignum::tests::Big8x3",
                                          "size"
                                        |)
                                      |))
                                  ]
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::rev::Rev")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let i := M.copy (| γ0_0 |) in
                                          let~ _ :=
                                            M.write (|
                                              M.SubPointer.get_array_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "core::num::bignum::tests::Big8x3",
                                                  "base"
                                                |),
                                                M.alloc (|
                                                  BinOp.Wrap.add (|
                                                    M.read (| i |),
                                                    M.read (| digits |)
                                                  |)
                                                |)
                                              |),
                                              M.read (|
                                                M.SubPointer.get_array_field (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| self |),
                                                    "core::num::bignum::tests::Big8x3",
                                                    "base"
                                                  |),
                                                  i
                                                |)
                                              |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", Value.Integer IntegerKind.Usize 0);
                                ("end_", M.read (| digits |))
                              ]
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "usize" ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let i := M.copy (| γ0_0 |) in
                                          let~ _ :=
                                            M.write (|
                                              M.SubPointer.get_array_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| self |),
                                                  "core::num::bignum::tests::Big8x3",
                                                  "base"
                                                |),
                                                i
                                              |),
                                              Value.Integer IntegerKind.U8 0
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ sz :=
                  M.alloc (|
                    BinOp.Wrap.add (|
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::num::bignum::tests::Big8x3",
                          "size"
                        |)
                      |),
                      M.read (| digits |)
                    |)
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.gt (| M.read (| bits |), Value.Integer IntegerKind.Usize 0 |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ last := M.copy (| sz |) in
                          let~ overflow :=
                            M.alloc (|
                              BinOp.Wrap.shr (|
                                M.read (|
                                  M.SubPointer.get_array_field (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::num::bignum::tests::Big8x3",
                                      "base"
                                    |),
                                    M.alloc (|
                                      BinOp.Wrap.sub (|
                                        M.read (| last |),
                                        Value.Integer IntegerKind.Usize 1
                                      |)
                                    |)
                                  |)
                                |),
                                BinOp.Wrap.sub (| M.read (| digitbits |), M.read (| bits |) |)
                              |)
                            |) in
                          let~ _ :=
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          BinOp.gt (|
                                            M.read (| overflow |),
                                            Value.Integer IntegerKind.U8 0
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.SubPointer.get_struct_record_field (|
                                            M.read (| self |),
                                            "core::num::bignum::tests::Big8x3",
                                            "base"
                                          |),
                                          last
                                        |),
                                        M.read (| overflow |)
                                      |) in
                                    let~ _ :=
                                      let β := sz in
                                      M.write (|
                                        β,
                                        BinOp.Wrap.add (|
                                          M.read (| β |),
                                          Value.Integer IntegerKind.Usize 1
                                        |)
                                      |) in
                                    M.alloc (| Value.Tuple [] |)));
                                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                              ]
                            |) in
                          let~ _ :=
                            M.use
                              (M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::collect::IntoIterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::rev::Rev")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "usize" ]
                                        ],
                                      [],
                                      "into_iter",
                                      []
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "usize" ],
                                          [],
                                          "rev",
                                          []
                                        |),
                                        [
                                          Value.StructRecord
                                            "core::ops::range::Range"
                                            [
                                              ("start",
                                                BinOp.Wrap.add (|
                                                  M.read (| digits |),
                                                  Value.Integer IntegerKind.Usize 1
                                                |));
                                              ("end_", M.read (| last |))
                                            ]
                                        ]
                                      |)
                                    ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let iter := M.copy (| γ |) in
                                      M.loop (|
                                        ltac:(M.monadic
                                          (let~ _ :=
                                            M.match_operator (|
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::iter::traits::iterator::Iterator",
                                                    Ty.apply
                                                      (Ty.path "core::iter::adapters::rev::Rev")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::ops::range::Range")
                                                          []
                                                          [ Ty.path "usize" ]
                                                      ],
                                                    [],
                                                    "next",
                                                    []
                                                  |),
                                                  [ iter ]
                                                |)
                                              |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let _ :=
                                                      M.is_struct_tuple (|
                                                        γ,
                                                        "core::option::Option::None"
                                                      |) in
                                                    M.alloc (|
                                                      M.never_to_any (| M.read (| M.break (||) |) |)
                                                    |)));
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ0_0 :=
                                                      M.SubPointer.get_struct_tuple_field (|
                                                        γ,
                                                        "core::option::Option::Some",
                                                        0
                                                      |) in
                                                    let i := M.copy (| γ0_0 |) in
                                                    let~ _ :=
                                                      M.write (|
                                                        M.SubPointer.get_array_field (|
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| self |),
                                                            "core::num::bignum::tests::Big8x3",
                                                            "base"
                                                          |),
                                                          i
                                                        |),
                                                        BinOp.bit_or
                                                          (BinOp.Wrap.shl (|
                                                            M.read (|
                                                              M.SubPointer.get_array_field (|
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| self |),
                                                                  "core::num::bignum::tests::Big8x3",
                                                                  "base"
                                                                |),
                                                                i
                                                              |)
                                                            |),
                                                            M.read (| bits |)
                                                          |))
                                                          (BinOp.Wrap.shr (|
                                                            M.read (|
                                                              M.SubPointer.get_array_field (|
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| self |),
                                                                  "core::num::bignum::tests::Big8x3",
                                                                  "base"
                                                                |),
                                                                M.alloc (|
                                                                  BinOp.Wrap.sub (|
                                                                    M.read (| i |),
                                                                    Value.Integer
                                                                      IntegerKind.Usize
                                                                      1
                                                                  |)
                                                                |)
                                                              |)
                                                            |),
                                                            BinOp.Wrap.sub (|
                                                              M.read (| digitbits |),
                                                              M.read (| bits |)
                                                            |)
                                                          |))
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                              ]
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                      |)))
                                ]
                              |)) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_array_field (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "core::num::bignum::tests::Big8x3",
                                  "base"
                                |),
                                digits
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.shl (| M.read (| β |), M.read (| bits |) |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |),
                    M.read (| sz |)
                  |) in
                M.alloc (| M.read (| self |) |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_mul_pow2 : M.IsAssociatedFunction Self "mul_pow2" mul_pow2.
        
        (*
                    pub fn mul_pow5(&mut self, mut e: usize) -> &mut $name {
                        use crate::mem;
                        use crate::num::bignum::SMALL_POW5;
        
                        // There are exactly n trailing zeros on 2^n, and the only relevant digit sizes
                        // are consecutive powers of two, so this is well suited index for the table.
                        let table_index = mem::size_of::<$ty>().trailing_zeros() as usize;
                        let (small_power, small_e) = SMALL_POW5[table_index];
                        let small_power = small_power as $ty;
        
                        // Multiply with the largest single-digit power as long as possible ...
                        while e >= small_e {
                            self.mul_small(small_power);
                            e -= small_e;
                        }
        
                        // ... then finish off the remainder.
                        let mut rest_power = 1;
                        for _ in 0..e {
                            rest_power *= 5;
                        }
                        self.mul_small(rest_power);
        
                        self
                    }
        *)
        Definition mul_pow5 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; e ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let e := M.alloc (| e |) in
              M.read (|
                let~ table_index :=
                  M.alloc (|
                    M.rust_cast
                      (M.call_closure (|
                        M.get_associated_function (| Ty.path "usize", "trailing_zeros", [] |),
                        [
                          M.call_closure (|
                            M.get_function (| "core::mem::size_of", [ Ty.path "u8" ] |),
                            []
                          |)
                        ]
                      |))
                  |) in
                M.match_operator (|
                  M.SubPointer.get_array_field (|
                    M.get_constant (| "core::num::bignum::SMALL_POW5" |),
                    table_index
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                        let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                        let small_power := M.copy (| γ0_0 |) in
                        let small_e := M.copy (| γ0_1 |) in
                        let~ small_power := M.alloc (| M.rust_cast (M.read (| small_power |)) |) in
                        let~ _ :=
                          M.loop (|
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| Value.Tuple [] |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ :=
                                        M.use
                                          (M.alloc (|
                                            BinOp.ge (| M.read (| e |), M.read (| small_e |) |)
                                          |)) in
                                      let _ :=
                                        M.is_constant_or_break_match (|
                                          M.read (| γ |),
                                          Value.Bool true
                                        |) in
                                      let~ _ :=
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path "core::num::bignum::tests::Big8x3",
                                              "mul_small",
                                              []
                                            |),
                                            [ M.read (| self |); M.read (| small_power |) ]
                                          |)
                                        |) in
                                      let~ _ :=
                                        let β := e in
                                        M.write (|
                                          β,
                                          BinOp.Wrap.sub (| M.read (| β |), M.read (| small_e |) |)
                                        |) in
                                      M.alloc (| Value.Tuple [] |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (M.alloc (|
                                        M.never_to_any (|
                                          M.read (|
                                            let~ _ :=
                                              M.alloc (|
                                                M.never_to_any (| M.read (| M.break (||) |) |)
                                              |) in
                                            M.alloc (| Value.Tuple [] |)
                                          |)
                                        |)
                                      |)))
                                ]
                              |)))
                          |) in
                        let~ rest_power := M.alloc (| Value.Integer IntegerKind.U8 1 |) in
                        let~ _ :=
                          M.use
                            (M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::iter::traits::collect::IntoIterator",
                                    Ty.apply
                                      (Ty.path "core::ops::range::Range")
                                      []
                                      [ Ty.path "usize" ],
                                    [],
                                    "into_iter",
                                    []
                                  |),
                                  [
                                    Value.StructRecord
                                      "core::ops::range::Range"
                                      [
                                        ("start", Value.Integer IntegerKind.Usize 0);
                                        ("end_", M.read (| e |))
                                      ]
                                  ]
                                |)
                              |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let iter := M.copy (| γ |) in
                                    M.loop (|
                                      ltac:(M.monadic
                                        (let~ _ :=
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::iter::traits::iterator::Iterator",
                                                  Ty.apply
                                                    (Ty.path "core::ops::range::Range")
                                                    []
                                                    [ Ty.path "usize" ],
                                                  [],
                                                  "next",
                                                  []
                                                |),
                                                [ iter ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let _ :=
                                                    M.is_struct_tuple (|
                                                      γ,
                                                      "core::option::Option::None"
                                                    |) in
                                                  M.alloc (|
                                                    M.never_to_any (| M.read (| M.break (||) |) |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::option::Option::Some",
                                                      0
                                                    |) in
                                                  let~ _ :=
                                                    let β := rest_power in
                                                    M.write (|
                                                      β,
                                                      BinOp.Wrap.mul (|
                                                        M.read (| β |),
                                                        Value.Integer IntegerKind.U8 5
                                                      |)
                                                    |) in
                                                  M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |) in
                                        M.alloc (| Value.Tuple [] |)))
                                    |)))
                              ]
                            |)) in
                        let~ _ :=
                          M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "core::num::bignum::tests::Big8x3",
                                "mul_small",
                                []
                              |),
                              [ M.read (| self |); M.read (| rest_power |) ]
                            |)
                          |) in
                        M.alloc (| M.read (| self |) |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_mul_pow5 : M.IsAssociatedFunction Self "mul_pow5" mul_pow5.
        
        (*
                    pub fn mul_digits<'a>(&'a mut self, other: &[$ty]) -> &'a mut $name {
                        // the internal routine. works best when aa.len() <= bb.len().
                        fn mul_inner(ret: &mut [$ty; $n], aa: &[$ty], bb: &[$ty]) -> usize {
                            use crate::num::bignum::FullOps;
        
                            let mut retsz = 0;
                            for (i, &a) in aa.iter().enumerate() {
                                if a == 0 {
                                    continue;
                                }
                                let mut sz = bb.len();
                                let mut carry = 0;
                                for (j, &b) in bb.iter().enumerate() {
                                    let (c, v) = a.full_mul_add(b, ret[i + j], carry);
                                    ret[i + j] = v;
                                    carry = c;
                                }
                                if carry > 0 {
                                    ret[i + sz] = carry;
                                    sz += 1;
                                }
                                if retsz < i + sz {
                                    retsz = i + sz;
                                }
                            }
                            retsz
                        }
        
                        let mut ret = [0; $n];
                        let retsz = if self.size < other.len() {
                            mul_inner(&mut ret, &self.digits(), other)
                        } else {
                            mul_inner(&mut ret, other, &self.digits())
                        };
                        self.base = ret;
                        self.size = retsz;
                        self
                    }
        *)
        Definition mul_digits (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.read (|
                let~ ret :=
                  M.alloc (|
                    repeat (| Value.Integer IntegerKind.U8 0, Value.Integer IntegerKind.Usize 3 |)
                  |) in
                let~ retsz :=
                  M.copy (|
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  BinOp.lt (|
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::num::bignum::tests::Big8x3",
                                        "size"
                                      |)
                                    |),
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                        "len",
                                        []
                                      |),
                                      [ M.read (| other |) ]
                                    |)
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            M.alloc (|
                              M.call_closure (|
                                M.get_associated_function (| Self, "mul_inner.mul_digits", [] |),
                                [
                                  ret;
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "core::num::bignum::tests::Big8x3",
                                      "digits",
                                      []
                                    |),
                                    [ M.read (| self |) ]
                                  |);
                                  M.read (| other |)
                                ]
                              |)
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (M.alloc (|
                              M.call_closure (|
                                M.get_associated_function (| Self, "mul_inner.mul_digits", [] |),
                                [
                                  ret;
                                  M.read (| other |);
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "core::num::bignum::tests::Big8x3",
                                      "digits",
                                      []
                                    |),
                                    [ M.read (| self |) ]
                                  |)
                                ]
                              |)
                            |)))
                      ]
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "base"
                    |),
                    M.read (| ret |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |),
                    M.read (| retsz |)
                  |) in
                M.alloc (| M.read (| self |) |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_mul_digits : M.IsAssociatedFunction Self "mul_digits" mul_digits.
        
        (*
                    pub fn div_rem_small(&mut self, other: $ty) -> (&mut $name, $ty) {
                        use crate::num::bignum::FullOps;
        
                        assert!(other > 0);
        
                        let sz = self.size;
                        let mut borrow = 0;
                        for a in self.base[..sz].iter_mut().rev() {
                            let (q, r) = ( *a).full_div_rem(other, borrow);
                            *a = q;
                            borrow = r;
                        }
                        (self, borrow)
                    }
        *)
        Definition div_rem_small (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.read (|
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                UnOp.not (|
                                  BinOp.gt (| M.read (| other |), Value.Integer IntegerKind.U8 0 |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.call_closure (|
                                M.get_function (| "core::panicking::panic", [] |),
                                [ M.read (| Value.String "assertion failed: other > 0" |) ]
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ sz :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |)
                  |) in
                let~ borrow := M.alloc (| Value.Integer IntegerKind.U8 0 |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "core::iter::adapters::rev::Rev")
                              []
                              [ Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u8" ]
                              ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::iterator::Iterator",
                                Ty.apply (Ty.path "core::slice::iter::IterMut") [] [ Ty.path "u8" ],
                                [],
                                "rev",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                    "iter_mut",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::index::IndexMut",
                                        Ty.apply
                                          (Ty.path "array")
                                          [ Value.Integer IntegerKind.Usize 3 ]
                                          [ Ty.path "u8" ],
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::RangeTo")
                                            []
                                            [ Ty.path "usize" ]
                                        ],
                                        "index_mut",
                                        []
                                      |),
                                      [
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| self |),
                                          "core::num::bignum::tests::Big8x3",
                                          "base"
                                        |);
                                        Value.StructRecord
                                          "core::ops::range::RangeTo"
                                          [ ("end_", M.read (| sz |)) ]
                                      ]
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::rev::Rev")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::slice::iter::IterMut")
                                                []
                                                [ Ty.path "u8" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let a := M.copy (| γ0_0 |) in
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::num::bignum::FullOps",
                                                  Ty.path "u8",
                                                  [],
                                                  "full_div_rem",
                                                  []
                                                |),
                                                [
                                                  M.read (| M.read (| a |) |);
                                                  M.read (| other |);
                                                  M.read (| borrow |)
                                                ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ0_0 :=
                                                    M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                  let γ0_1 :=
                                                    M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                  let q := M.copy (| γ0_0 |) in
                                                  let r := M.copy (| γ0_1 |) in
                                                  let~ _ :=
                                                    M.write (| M.read (| a |), M.read (| q |) |) in
                                                  let~ _ := M.write (| borrow, M.read (| r |) |) in
                                                  M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                M.alloc (| Value.Tuple [ M.read (| self |); M.read (| borrow |) ] |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_div_rem_small :
          M.IsAssociatedFunction Self "div_rem_small" div_rem_small.
        
        (*
                    pub fn div_rem(&self, d: &$name, q: &mut $name, r: &mut $name) {
                        // Stupid slow base-2 long division taken from
                        // https://en.wikipedia.org/wiki/Division_algorithm
                        // FIXME use a greater base ($ty) for the long division.
                        assert!(!d.is_zero());
                        let digitbits = <$ty>::BITS as usize;
                        for digit in &mut q.base[..] {
                            *digit = 0;
                        }
                        for digit in &mut r.base[..] {
                            *digit = 0;
                        }
                        r.size = d.size;
                        q.size = 1;
                        let mut q_is_zero = true;
                        let end = self.bit_length();
                        for i in (0..end).rev() {
                            r.mul_pow2(1);
                            r.base[0] |= self.get_bit(i) as $ty;
                            if &*r >= d {
                                r.sub(d);
                                // Set bit `i` of q to 1.
                                let digit_idx = i / digitbits;
                                let bit_idx = i % digitbits;
                                if q_is_zero {
                                    q.size = digit_idx + 1;
                                    q_is_zero = false;
                                }
                                q.base[digit_idx] |= 1 << bit_idx;
                            }
                        }
                        debug_assert!(q.base[q.size..].iter().all(|&d| d == 0));
                        debug_assert!(r.base[r.size..].iter().all(|&d| d == 0));
                    }
        *)
        Definition div_rem (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; d; q; r ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let d := M.alloc (| d |) in
              let q := M.alloc (| q |) in
              let r := M.alloc (| r |) in
              M.read (|
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                UnOp.not (|
                                  UnOp.not (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "core::num::bignum::tests::Big8x3",
                                        "is_zero",
                                        []
                                      |),
                                      [ M.read (| d |) ]
                                    |)
                                  |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.call_closure (|
                                M.get_function (| "core::panicking::panic", [] |),
                                [ M.read (| Value.String "assertion failed: !d.is_zero()" |) ]
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ digitbits :=
                  M.alloc (| M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)) |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "&mut")
                              []
                              [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::index::IndexMut",
                                Ty.apply
                                  (Ty.path "array")
                                  [ Value.Integer IntegerKind.Usize 3 ]
                                  [ Ty.path "u8" ],
                                [ Ty.path "core::ops::range::RangeFull" ],
                                "index_mut",
                                []
                              |),
                              [
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| q |),
                                  "core::num::bignum::tests::Big8x3",
                                  "base"
                                |);
                                Value.StructTuple "core::ops::range::RangeFull" []
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::slice::iter::IterMut")
                                            []
                                            [ Ty.path "u8" ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let digit := M.copy (| γ0_0 |) in
                                          let~ _ :=
                                            M.write (|
                                              M.read (| digit |),
                                              Value.Integer IntegerKind.U8 0
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "&mut")
                              []
                              [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::index::IndexMut",
                                Ty.apply
                                  (Ty.path "array")
                                  [ Value.Integer IntegerKind.Usize 3 ]
                                  [ Ty.path "u8" ],
                                [ Ty.path "core::ops::range::RangeFull" ],
                                "index_mut",
                                []
                              |),
                              [
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| r |),
                                  "core::num::bignum::tests::Big8x3",
                                  "base"
                                |);
                                Value.StructTuple "core::ops::range::RangeFull" []
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::slice::iter::IterMut")
                                            []
                                            [ Ty.path "u8" ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let digit := M.copy (| γ0_0 |) in
                                          let~ _ :=
                                            M.write (|
                                              M.read (| digit |),
                                              Value.Integer IntegerKind.U8 0
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| r |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |),
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| d |),
                        "core::num::bignum::tests::Big8x3",
                        "size"
                      |)
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| q |),
                      "core::num::bignum::tests::Big8x3",
                      "size"
                    |),
                    Value.Integer IntegerKind.Usize 1
                  |) in
                let~ q_is_zero := M.alloc (| Value.Bool true |) in
                let~ end_ :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "core::num::bignum::tests::Big8x3",
                        "bit_length",
                        []
                      |),
                      [ M.read (| self |) ]
                    |)
                  |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "core::iter::adapters::rev::Rev")
                              []
                              [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ]
                              ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::iterator::Iterator",
                                Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ],
                                [],
                                "rev",
                                []
                              |),
                              [
                                Value.StructRecord
                                  "core::ops::range::Range"
                                  [
                                    ("start", Value.Integer IntegerKind.Usize 0);
                                    ("end_", M.read (| end_ |))
                                  ]
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::rev::Rev")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let i := M.copy (| γ0_0 |) in
                                          let~ _ :=
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "core::num::bignum::tests::Big8x3",
                                                  "mul_pow2",
                                                  []
                                                |),
                                                [ M.read (| r |); Value.Integer IntegerKind.Usize 1
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            let β :=
                                              M.SubPointer.get_array_field (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| r |),
                                                  "core::num::bignum::tests::Big8x3",
                                                  "base"
                                                |),
                                                M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                              |) in
                                            M.write (|
                                              β,
                                              BinOp.bit_or
                                                (M.read (| β |))
                                                (M.read (|
                                                  M.use
                                                    (M.alloc (|
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.path
                                                            "core::num::bignum::tests::Big8x3",
                                                          "get_bit",
                                                          []
                                                        |),
                                                        [ M.read (| self |); M.read (| i |) ]
                                                      |)
                                                    |))
                                                |))
                                            |) in
                                          M.match_operator (|
                                            M.alloc (| Value.Tuple [] |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ :=
                                                    M.use
                                                      (M.alloc (|
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::cmp::PartialOrd",
                                                            Ty.apply
                                                              (Ty.path "&")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "core::num::bignum::tests::Big8x3"
                                                              ],
                                                            [
                                                              Ty.apply
                                                                (Ty.path "&")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "core::num::bignum::tests::Big8x3"
                                                                ]
                                                            ],
                                                            "ge",
                                                            []
                                                          |),
                                                          [
                                                            M.alloc (| M.read (| r |) |);
                                                            M.alloc (| M.read (| d |) |)
                                                          ]
                                                        |)
                                                      |)) in
                                                  let _ :=
                                                    M.is_constant_or_break_match (|
                                                      M.read (| γ |),
                                                      Value.Bool true
                                                    |) in
                                                  let~ _ :=
                                                    M.alloc (|
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.path
                                                            "core::num::bignum::tests::Big8x3",
                                                          "sub",
                                                          []
                                                        |),
                                                        [ M.read (| r |); M.read (| d |) ]
                                                      |)
                                                    |) in
                                                  let~ digit_idx :=
                                                    M.alloc (|
                                                      BinOp.Wrap.div (|
                                                        M.read (| i |),
                                                        M.read (| digitbits |)
                                                      |)
                                                    |) in
                                                  let~ bit_idx :=
                                                    M.alloc (|
                                                      BinOp.Wrap.rem (|
                                                        M.read (| i |),
                                                        M.read (| digitbits |)
                                                      |)
                                                    |) in
                                                  let~ _ :=
                                                    M.match_operator (|
                                                      M.alloc (| Value.Tuple [] |),
                                                      [
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let γ := M.use q_is_zero in
                                                            let _ :=
                                                              M.is_constant_or_break_match (|
                                                                M.read (| γ |),
                                                                Value.Bool true
                                                              |) in
                                                            let~ _ :=
                                                              M.write (|
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| q |),
                                                                  "core::num::bignum::tests::Big8x3",
                                                                  "size"
                                                                |),
                                                                BinOp.Wrap.add (|
                                                                  M.read (| digit_idx |),
                                                                  Value.Integer IntegerKind.Usize 1
                                                                |)
                                                              |) in
                                                            let~ _ :=
                                                              M.write (|
                                                                q_is_zero,
                                                                Value.Bool false
                                                              |) in
                                                            M.alloc (| Value.Tuple [] |)));
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (M.alloc (| Value.Tuple [] |)))
                                                      ]
                                                    |) in
                                                  let~ _ :=
                                                    let β :=
                                                      M.SubPointer.get_array_field (|
                                                        M.SubPointer.get_struct_record_field (|
                                                          M.read (| q |),
                                                          "core::num::bignum::tests::Big8x3",
                                                          "base"
                                                        |),
                                                        digit_idx
                                                      |) in
                                                    M.write (|
                                                      β,
                                                      BinOp.bit_or
                                                        (M.read (| β |))
                                                        (BinOp.Wrap.shl (|
                                                          Value.Integer IntegerKind.U8 1,
                                                          M.read (| bit_idx |)
                                                        |))
                                                    |) in
                                                  M.alloc (| Value.Tuple [] |)));
                                              fun γ =>
                                                ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.use (M.alloc (| Value.Bool true |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          UnOp.not (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::iter::traits::iterator::Iterator",
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::Iter")
                                                  []
                                                  [ Ty.path "u8" ],
                                                [],
                                                "all",
                                                [
                                                  Ty.function
                                                    [
                                                      Ty.tuple
                                                        [ Ty.apply (Ty.path "&") [] [ Ty.path "u8" ]
                                                        ]
                                                    ]
                                                    (Ty.path "bool")
                                                ]
                                              |),
                                              [
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "slice")
                                                        []
                                                        [ Ty.path "u8" ],
                                                      "iter",
                                                      []
                                                    |),
                                                    [
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::ops::index::Index",
                                                          Ty.apply
                                                            (Ty.path "array")
                                                            [ Value.Integer IntegerKind.Usize 3 ]
                                                            [ Ty.path "u8" ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path
                                                                "core::ops::range::RangeFrom")
                                                              []
                                                              [ Ty.path "usize" ]
                                                          ],
                                                          "index",
                                                          []
                                                        |),
                                                        [
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| q |),
                                                            "core::num::bignum::tests::Big8x3",
                                                            "base"
                                                          |);
                                                          Value.StructRecord
                                                            "core::ops::range::RangeFrom"
                                                            [
                                                              ("start",
                                                                M.read (|
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    M.read (| q |),
                                                                    "core::num::bignum::tests::Big8x3",
                                                                    "size"
                                                                  |)
                                                                |))
                                                            ]
                                                        ]
                                                      |)
                                                    ]
                                                  |)
                                                |);
                                                M.closure
                                                  (fun γ =>
                                                    ltac:(M.monadic
                                                      match γ with
                                                      | [ α0 ] =>
                                                        ltac:(M.monadic
                                                          (M.match_operator (|
                                                            M.alloc (| α0 |),
                                                            [
                                                              fun γ =>
                                                                ltac:(M.monadic
                                                                  (let γ := M.read (| γ |) in
                                                                  let d := M.copy (| γ |) in
                                                                  BinOp.eq (|
                                                                    M.read (| d |),
                                                                    Value.Integer IntegerKind.U8 0
                                                                  |)))
                                                            ]
                                                          |)))
                                                      | _ =>
                                                        M.impossible "wrong number of arguments"
                                                      end))
                                              ]
                                            |)
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    M.alloc (|
                                      M.never_to_any (|
                                        M.call_closure (|
                                          M.get_function (| "core::panicking::panic", [] |),
                                          [
                                            M.read (|
                                              Value.String
                                                "assertion failed: q.base[q.size..].iter().all(|&d| d == 0)"
                                            |)
                                          ]
                                        |)
                                      |)
                                    |)));
                                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.use (M.alloc (| Value.Bool true |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ _ :=
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          UnOp.not (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::iter::traits::iterator::Iterator",
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::Iter")
                                                  []
                                                  [ Ty.path "u8" ],
                                                [],
                                                "all",
                                                [
                                                  Ty.function
                                                    [
                                                      Ty.tuple
                                                        [ Ty.apply (Ty.path "&") [] [ Ty.path "u8" ]
                                                        ]
                                                    ]
                                                    (Ty.path "bool")
                                                ]
                                              |),
                                              [
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "slice")
                                                        []
                                                        [ Ty.path "u8" ],
                                                      "iter",
                                                      []
                                                    |),
                                                    [
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::ops::index::Index",
                                                          Ty.apply
                                                            (Ty.path "array")
                                                            [ Value.Integer IntegerKind.Usize 3 ]
                                                            [ Ty.path "u8" ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path
                                                                "core::ops::range::RangeFrom")
                                                              []
                                                              [ Ty.path "usize" ]
                                                          ],
                                                          "index",
                                                          []
                                                        |),
                                                        [
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| r |),
                                                            "core::num::bignum::tests::Big8x3",
                                                            "base"
                                                          |);
                                                          Value.StructRecord
                                                            "core::ops::range::RangeFrom"
                                                            [
                                                              ("start",
                                                                M.read (|
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    M.read (| r |),
                                                                    "core::num::bignum::tests::Big8x3",
                                                                    "size"
                                                                  |)
                                                                |))
                                                            ]
                                                        ]
                                                      |)
                                                    ]
                                                  |)
                                                |);
                                                M.closure
                                                  (fun γ =>
                                                    ltac:(M.monadic
                                                      match γ with
                                                      | [ α0 ] =>
                                                        ltac:(M.monadic
                                                          (M.match_operator (|
                                                            M.alloc (| α0 |),
                                                            [
                                                              fun γ =>
                                                                ltac:(M.monadic
                                                                  (let γ := M.read (| γ |) in
                                                                  let d := M.copy (| γ |) in
                                                                  BinOp.eq (|
                                                                    M.read (| d |),
                                                                    Value.Integer IntegerKind.U8 0
                                                                  |)))
                                                            ]
                                                          |)))
                                                      | _ =>
                                                        M.impossible "wrong number of arguments"
                                                      end))
                                              ]
                                            |)
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    M.alloc (|
                                      M.never_to_any (|
                                        M.call_closure (|
                                          M.get_function (| "core::panicking::panic", [] |),
                                          [
                                            M.read (|
                                              Value.String
                                                "assertion failed: r.base[r.size..].iter().all(|&d| d == 0)"
                                            |)
                                          ]
                                        |)
                                      |)
                                    |)));
                                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                              ]
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.alloc (| Value.Tuple [] |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_div_rem : M.IsAssociatedFunction Self "div_rem" div_rem.
      End Impl_core_num_bignum_tests_Big8x3.
      
      Module Impl_core_cmp_PartialEq_for_core_num_bignum_tests_Big8x3.
        Definition Self : Ty.t := Ty.path "core::num::bignum::tests::Big8x3".
        
        (*
                    fn eq(&self, other: &$name) -> bool {
                        self.base[..] == other.base[..]
                    }
        *)
        Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::cmp::PartialEq",
                  Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                  [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ],
                  "eq",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::index::Index",
                      Ty.apply
                        (Ty.path "array")
                        [ Value.Integer IntegerKind.Usize 3 ]
                        [ Ty.path "u8" ],
                      [ Ty.path "core::ops::range::RangeFull" ],
                      "index",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::num::bignum::tests::Big8x3",
                        "base"
                      |);
                      Value.StructTuple "core::ops::range::RangeFull" []
                    ]
                  |);
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::index::Index",
                      Ty.apply
                        (Ty.path "array")
                        [ Value.Integer IntegerKind.Usize 3 ]
                        [ Ty.path "u8" ],
                      [ Ty.path "core::ops::range::RangeFull" ],
                      "index",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| other |),
                        "core::num::bignum::tests::Big8x3",
                        "base"
                      |);
                      Value.StructTuple "core::ops::range::RangeFull" []
                    ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::cmp::PartialEq"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [ ("eq", InstanceField.Method eq) ].
      End Impl_core_cmp_PartialEq_for_core_num_bignum_tests_Big8x3.
      
      Module Impl_core_cmp_Eq_for_core_num_bignum_tests_Big8x3.
        Definition Self : Ty.t := Ty.path "core::num::bignum::tests::Big8x3".
        
        Axiom Implements :
          M.IsTraitInstance "core::cmp::Eq" Self (* Trait polymorphic types *) [] (* Instance *) [].
      End Impl_core_cmp_Eq_for_core_num_bignum_tests_Big8x3.
      
      Module Impl_core_cmp_PartialOrd_for_core_num_bignum_tests_Big8x3.
        Definition Self : Ty.t := Ty.path "core::num::bignum::tests::Big8x3".
        
        (*
                    fn partial_cmp(&self, other: &$name) -> crate::option::Option<crate::cmp::Ordering> {
                        crate::option::Option::Some(self.cmp(other))
                    }
        *)
        Definition partial_cmp (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              Value.StructTuple
                "core::option::Option::Some"
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::cmp::Ord",
                      Ty.path "core::num::bignum::tests::Big8x3",
                      [],
                      "cmp",
                      []
                    |),
                    [ M.read (| self |); M.read (| other |) ]
                  |)
                ]))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::cmp::PartialOrd"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [ ("partial_cmp", InstanceField.Method partial_cmp) ].
      End Impl_core_cmp_PartialOrd_for_core_num_bignum_tests_Big8x3.
      
      Module Impl_core_cmp_Ord_for_core_num_bignum_tests_Big8x3.
        Definition Self : Ty.t := Ty.path "core::num::bignum::tests::Big8x3".
        
        (*
                    fn cmp(&self, other: &$name) -> crate::cmp::Ordering {
                        use crate::cmp::max;
                        let sz = max(self.size, other.size);
                        let lhs = self.base[..sz].iter().cloned().rev();
                        let rhs = other.base[..sz].iter().cloned().rev();
                        lhs.cmp(rhs)
                    }
        *)
        Definition cmp (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; other ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let other := M.alloc (| other |) in
              M.read (|
                let~ sz :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_function (| "core::cmp::max", [ Ty.path "usize" ] |),
                      [
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::num::bignum::tests::Big8x3",
                            "size"
                          |)
                        |);
                        M.read (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| other |),
                            "core::num::bignum::tests::Big8x3",
                            "size"
                          |)
                        |)
                      ]
                    |)
                  |) in
                let~ lhs :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        Ty.apply
                          (Ty.path "core::iter::adapters::cloned::Cloned")
                          []
                          [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ] ],
                        [],
                        "rev",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ],
                            [],
                            "cloned",
                            [ Ty.path "u8" ]
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                "iter",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::index::Index",
                                    Ty.apply
                                      (Ty.path "array")
                                      [ Value.Integer IntegerKind.Usize 3 ]
                                      [ Ty.path "u8" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::ops::range::RangeTo")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                    "index",
                                    []
                                  |),
                                  [
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::num::bignum::tests::Big8x3",
                                      "base"
                                    |);
                                    Value.StructRecord
                                      "core::ops::range::RangeTo"
                                      [ ("end_", M.read (| sz |)) ]
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |) in
                let~ rhs :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        Ty.apply
                          (Ty.path "core::iter::adapters::cloned::Cloned")
                          []
                          [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ] ],
                        [],
                        "rev",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ],
                            [],
                            "cloned",
                            [ Ty.path "u8" ]
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                "iter",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::index::Index",
                                    Ty.apply
                                      (Ty.path "array")
                                      [ Value.Integer IntegerKind.Usize 3 ]
                                      [ Ty.path "u8" ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::ops::range::RangeTo")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                    "index",
                                    []
                                  |),
                                  [
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| other |),
                                      "core::num::bignum::tests::Big8x3",
                                      "base"
                                    |);
                                    Value.StructRecord
                                      "core::ops::range::RangeTo"
                                      [ ("end_", M.read (| sz |)) ]
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |) in
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      Ty.apply
                        (Ty.path "core::iter::adapters::rev::Rev")
                        []
                        [
                          Ty.apply
                            (Ty.path "core::iter::adapters::cloned::Cloned")
                            []
                            [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ] ]
                        ],
                      [],
                      "cmp",
                      [
                        Ty.apply
                          (Ty.path "core::iter::adapters::rev::Rev")
                          []
                          [
                            Ty.apply
                              (Ty.path "core::iter::adapters::cloned::Cloned")
                              []
                              [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ] ]
                          ]
                      ]
                    |),
                    [ M.read (| lhs |); M.read (| rhs |) ]
                  |)
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::cmp::Ord"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [ ("cmp", InstanceField.Method cmp) ].
      End Impl_core_cmp_Ord_for_core_num_bignum_tests_Big8x3.
      
      Module Impl_core_clone_Clone_for_core_num_bignum_tests_Big8x3.
        Definition Self : Ty.t := Ty.path "core::num::bignum::tests::Big8x3".
        
        (*
                    fn clone(&self) -> Self {
                        Self { size: self.size, base: self.base }
                    }
        *)
        Definition clone (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              Value.StructRecord
                "core::num::bignum::tests::Big8x3"
                [
                  ("size",
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::num::bignum::tests::Big8x3",
                        "size"
                      |)
                    |));
                  ("base",
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::num::bignum::tests::Big8x3",
                        "base"
                      |)
                    |))
                ]))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::clone::Clone"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [ ("clone", InstanceField.Method clone) ].
      End Impl_core_clone_Clone_for_core_num_bignum_tests_Big8x3.
      
      Module Impl_core_fmt_Debug_for_core_num_bignum_tests_Big8x3.
        Definition Self : Ty.t := Ty.path "core::num::bignum::tests::Big8x3".
        
        (*
                    fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result {
                        let sz = if self.size < 1 { 1 } else { self.size };
                        let digitlen = <$ty>::BITS as usize / 4;
        
                        write!(f, "{:#x}", self.base[sz - 1])?;
                        for &v in self.base[..sz - 1].iter().rev() {
                            write!(f, "_{:01$x}", v, digitlen)?;
                        }
                        crate::result::Result::Ok(())
                    }
        *)
        Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ sz :=
                      M.copy (|
                        M.match_operator (|
                          M.alloc (| Value.Tuple [] |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ :=
                                  M.use
                                    (M.alloc (|
                                      BinOp.lt (|
                                        M.read (|
                                          M.SubPointer.get_struct_record_field (|
                                            M.read (| self |),
                                            "core::num::bignum::tests::Big8x3",
                                            "size"
                                          |)
                                        |),
                                        Value.Integer IntegerKind.Usize 1
                                      |)
                                    |)) in
                                let _ :=
                                  M.is_constant_or_break_match (|
                                    M.read (| γ |),
                                    Value.Bool true
                                  |) in
                                M.alloc (| Value.Integer IntegerKind.Usize 1 |)));
                            fun γ =>
                              ltac:(M.monadic
                                (M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "core::num::bignum::tests::Big8x3",
                                  "size"
                                |)))
                          ]
                        |)
                      |) in
                    let~ digitlen :=
                      M.alloc (|
                        BinOp.Wrap.div (|
                          M.rust_cast (M.read (| M.get_constant (| "core::num::BITS" |) |)),
                          Value.Integer IntegerKind.Usize 4
                        |)
                      |) in
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply
                                (Ty.path "core::result::Result")
                                []
                                [ Ty.tuple []; Ty.path "core::fmt::Error" ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "core::fmt::Formatter",
                                  "write_fmt",
                                  []
                                |),
                                [
                                  M.read (| f |);
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "core::fmt::Arguments",
                                      "new_v1_formatted",
                                      []
                                    |),
                                    [
                                      M.alloc (| Value.Array [ M.read (| Value.String "" |) ] |);
                                      M.alloc (|
                                        Value.Array
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path "core::fmt::rt::Argument",
                                                "new_lower_hex",
                                                [ Ty.path "u8" ]
                                              |),
                                              [
                                                M.SubPointer.get_array_field (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| self |),
                                                    "core::num::bignum::tests::Big8x3",
                                                    "base"
                                                  |),
                                                  M.alloc (|
                                                    BinOp.Wrap.sub (|
                                                      M.read (| sz |),
                                                      Value.Integer IntegerKind.Usize 1
                                                    |)
                                                  |)
                                                |)
                                              ]
                                            |)
                                          ]
                                      |);
                                      M.alloc (|
                                        Value.Array
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path "core::fmt::rt::Placeholder",
                                                "new",
                                                []
                                              |),
                                              [
                                                Value.Integer IntegerKind.Usize 0;
                                                Value.UnicodeChar 32;
                                                Value.StructTuple
                                                  "core::fmt::rt::Alignment::Unknown"
                                                  [];
                                                Value.Integer IntegerKind.U32 4;
                                                Value.StructTuple
                                                  "core::fmt::rt::Count::Implied"
                                                  [];
                                                Value.StructTuple "core::fmt::rt::Count::Implied" []
                                              ]
                                            |)
                                          ]
                                      |);
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "core::fmt::rt::UnsafeArg",
                                          "new",
                                          []
                                        |),
                                        []
                                      |)
                                    ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::ops::control_flow::ControlFlow::Break",
                                  0
                                |) in
                              let residual := M.copy (| γ0_0 |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::FromResidual",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [ Ty.tuple []; Ty.path "core::fmt::Error" ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::result::Result")
                                              []
                                              [
                                                Ty.path "core::convert::Infallible";
                                                Ty.path "core::fmt::Error"
                                              ]
                                          ],
                                          "from_residual",
                                          []
                                        |),
                                        [ M.read (| residual |) ]
                                      |)
                                    |)
                                  |)
                                |)
                              |)));
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::ops::control_flow::ControlFlow::Continue",
                                  0
                                |) in
                              let val := M.copy (| γ0_0 |) in
                              val))
                        ]
                      |) in
                    let~ _ :=
                      M.use
                        (M.match_operator (|
                          M.alloc (|
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::collect::IntoIterator",
                                Ty.apply
                                  (Ty.path "core::iter::adapters::rev::Rev")
                                  []
                                  [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ]
                                  ],
                                [],
                                "into_iter",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::iter::traits::iterator::Iterator",
                                    Ty.apply
                                      (Ty.path "core::slice::iter::Iter")
                                      []
                                      [ Ty.path "u8" ],
                                    [],
                                    "rev",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                        "iter",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "array")
                                              [ Value.Integer IntegerKind.Usize 3 ]
                                              [ Ty.path "u8" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| self |),
                                              "core::num::bignum::tests::Big8x3",
                                              "base"
                                            |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [
                                                ("end_",
                                                  BinOp.Wrap.sub (|
                                                    M.read (| sz |),
                                                    Value.Integer IntegerKind.Usize 1
                                                  |))
                                              ]
                                          ]
                                        |)
                                      ]
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let iter := M.copy (| γ |) in
                                M.loop (|
                                  ltac:(M.monadic
                                    (let~ _ :=
                                      M.match_operator (|
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::iterator::Iterator",
                                              Ty.apply
                                                (Ty.path "core::iter::adapters::rev::Rev")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::slice::iter::Iter")
                                                    []
                                                    [ Ty.path "u8" ]
                                                ],
                                              [],
                                              "next",
                                              []
                                            |),
                                            [ iter ]
                                          |)
                                        |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let _ :=
                                                M.is_struct_tuple (|
                                                  γ,
                                                  "core::option::Option::None"
                                                |) in
                                              M.alloc (|
                                                M.never_to_any (| M.read (| M.break (||) |) |)
                                              |)));
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let γ0_0 :=
                                                M.SubPointer.get_struct_tuple_field (|
                                                  γ,
                                                  "core::option::Option::Some",
                                                  0
                                                |) in
                                              let γ0_0 := M.read (| γ0_0 |) in
                                              let v := M.copy (| γ0_0 |) in
                                              let~ _ :=
                                                M.match_operator (|
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::try_trait::Try",
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [ Ty.tuple []; Ty.path "core::fmt::Error"
                                                          ],
                                                        [],
                                                        "branch",
                                                        []
                                                      |),
                                                      [
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.path "core::fmt::Formatter",
                                                            "write_fmt",
                                                            []
                                                          |),
                                                          [
                                                            M.read (| f |);
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.path "core::fmt::Arguments",
                                                                "new_v1_formatted",
                                                                []
                                                              |),
                                                              [
                                                                M.alloc (|
                                                                  Value.Array
                                                                    [ M.read (| Value.String "_" |)
                                                                    ]
                                                                |);
                                                                M.alloc (|
                                                                  Value.Array
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_associated_function (|
                                                                          Ty.path
                                                                            "core::fmt::rt::Argument",
                                                                          "new_lower_hex",
                                                                          [ Ty.path "u8" ]
                                                                        |),
                                                                        [ v ]
                                                                      |);
                                                                      M.call_closure (|
                                                                        M.get_associated_function (|
                                                                          Ty.path
                                                                            "core::fmt::rt::Argument",
                                                                          "from_usize",
                                                                          []
                                                                        |),
                                                                        [ digitlen ]
                                                                      |)
                                                                    ]
                                                                |);
                                                                M.alloc (|
                                                                  Value.Array
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_associated_function (|
                                                                          Ty.path
                                                                            "core::fmt::rt::Placeholder",
                                                                          "new",
                                                                          []
                                                                        |),
                                                                        [
                                                                          Value.Integer
                                                                            IntegerKind.Usize
                                                                            0;
                                                                          Value.UnicodeChar 32;
                                                                          Value.StructTuple
                                                                            "core::fmt::rt::Alignment::Unknown"
                                                                            [];
                                                                          Value.Integer
                                                                            IntegerKind.U32
                                                                            8;
                                                                          Value.StructTuple
                                                                            "core::fmt::rt::Count::Implied"
                                                                            [];
                                                                          Value.StructTuple
                                                                            "core::fmt::rt::Count::Param"
                                                                            [
                                                                              Value.Integer
                                                                                IntegerKind.Usize
                                                                                1
                                                                            ]
                                                                        ]
                                                                      |)
                                                                    ]
                                                                |);
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path
                                                                      "core::fmt::rt::UnsafeArg",
                                                                    "new",
                                                                    []
                                                                  |),
                                                                  []
                                                                |)
                                                              ]
                                                            |)
                                                          ]
                                                        |)
                                                      ]
                                                    |)
                                                  |),
                                                  [
                                                    fun γ =>
                                                      ltac:(M.monadic
                                                        (let γ0_0 :=
                                                          M.SubPointer.get_struct_tuple_field (|
                                                            γ,
                                                            "core::ops::control_flow::ControlFlow::Break",
                                                            0
                                                          |) in
                                                        let residual := M.copy (| γ0_0 |) in
                                                        M.alloc (|
                                                          M.never_to_any (|
                                                            M.read (|
                                                              M.return_ (|
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "core::ops::try_trait::FromResidual",
                                                                    Ty.apply
                                                                      (Ty.path
                                                                        "core::result::Result")
                                                                      []
                                                                      [
                                                                        Ty.tuple [];
                                                                        Ty.path "core::fmt::Error"
                                                                      ],
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::result::Result")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "core::convert::Infallible";
                                                                          Ty.path "core::fmt::Error"
                                                                        ]
                                                                    ],
                                                                    "from_residual",
                                                                    []
                                                                  |),
                                                                  [ M.read (| residual |) ]
                                                                |)
                                                              |)
                                                            |)
                                                          |)
                                                        |)));
                                                    fun γ =>
                                                      ltac:(M.monadic
                                                        (let γ0_0 :=
                                                          M.SubPointer.get_struct_tuple_field (|
                                                            γ,
                                                            "core::ops::control_flow::ControlFlow::Continue",
                                                            0
                                                          |) in
                                                        let val := M.copy (| γ0_0 |) in
                                                        val))
                                                  ]
                                                |) in
                                              M.alloc (| Value.Tuple [] |)))
                                        ]
                                      |) in
                                    M.alloc (| Value.Tuple [] |)))
                                |)))
                          ]
                        |)) in
                    M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::fmt::Debug"
            Self
            (* Trait polymorphic types *) []
            (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
      End Impl_core_fmt_Debug_for_core_num_bignum_tests_Big8x3.
    End tests.
  End bignum.
End num.
