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

Module iter.
  Module adapters.
    Module step_by.
      (* StructRecord
        {
          name := "StepBy";
          const_params := [];
          ty_params := [ "I" ];
          fields :=
            [ ("iter", I); ("step_minus_one", Ty.path "usize"); ("first_take", Ty.path "bool") ];
        } *)
      
      Module Impl_core_clone_Clone_where_core_clone_Clone_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        (* Clone *)
        Definition clone (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              Value.StructRecord
                "core::iter::adapters::step_by::StepBy"
                [
                  ("iter",
                    M.call_closure (|
                      M.get_trait_method (| "core::clone::Clone", I, [], "clone", [] |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::step_by::StepBy",
                          "iter"
                        |)
                      ]
                    |));
                  ("step_minus_one",
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::clone::Clone",
                        Ty.path "usize",
                        [],
                        "clone",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::step_by::StepBy",
                          "step_minus_one"
                        |)
                      ]
                    |));
                  ("first_take",
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::clone::Clone",
                        Ty.path "bool",
                        [],
                        "clone",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::step_by::StepBy",
                          "first_take"
                        |)
                      ]
                    |))
                ]))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::clone::Clone"
            (Self I)
            (* Trait polymorphic types *) []
            (* Instance *) [ ("clone", InstanceField.Method (clone I)) ].
      End Impl_core_clone_Clone_where_core_clone_Clone_I_for_core_iter_adapters_step_by_StepBy_I.
      
      Module Impl_core_fmt_Debug_where_core_fmt_Debug_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        (* Debug *)
        Definition fmt (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let f := M.alloc (| f |) in
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "core::fmt::Formatter",
                  "debug_struct_field3_finish",
                  []
                |),
                [
                  M.read (| f |);
                  M.read (| Value.String "StepBy" |);
                  M.read (| Value.String "iter" |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::step_by::StepBy",
                    "iter"
                  |);
                  M.read (| Value.String "step_minus_one" |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::step_by::StepBy",
                    "step_minus_one"
                  |);
                  M.read (| Value.String "first_take" |);
                  M.alloc (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::iter::adapters::step_by::StepBy",
                      "first_take"
                    |)
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::fmt::Debug"
            (Self I)
            (* Trait polymorphic types *) []
            (* Instance *) [ ("fmt", InstanceField.Method (fmt I)) ].
      End Impl_core_fmt_Debug_where_core_fmt_Debug_I_for_core_iter_adapters_step_by_StepBy_I.
      
      Module Impl_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        (*
            pub(in crate::iter) fn new(iter: I, step: usize) -> StepBy<I> {
                assert!(step != 0);
                let iter = <I as SpecRangeSetup<I>>::setup(iter, step);
                StepBy { iter, step_minus_one: step - 1, first_take: true }
            }
        *)
        Definition new (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ iter; step ] =>
            ltac:(M.monadic
              (let iter := M.alloc (| iter |) in
              let step := M.alloc (| step |) in
              M.read (|
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                UnOp.not (|
                                  BinOp.ne (|
                                    M.read (| step |),
                                    Value.Integer IntegerKind.Usize 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: step != 0" |) ]
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                let~ iter :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::adapters::step_by::SpecRangeSetup",
                        I,
                        [ I ],
                        "setup",
                        []
                      |),
                      [ M.read (| iter |); M.read (| step |) ]
                    |)
                  |) in
                M.alloc (|
                  Value.StructRecord
                    "core::iter::adapters::step_by::StepBy"
                    [
                      ("iter", M.read (| iter |));
                      ("step_minus_one",
                        BinOp.Wrap.sub (| M.read (| step |), Value.Integer IntegerKind.Usize 1 |));
                      ("first_take", Value.Bool true)
                    ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_new :
          forall (I : Ty.t),
          M.IsAssociatedFunction (Self I) "new" (new I).
        
        (*
            fn original_step(&self) -> NonZero<usize> {
                // SAFETY: By type invariant, `step_minus_one` cannot be `MAX`, which
                // means the addition cannot overflow and the result cannot be zero.
                unsafe { NonZero::new_unchecked(intrinsics::unchecked_add(self.step_minus_one, 1)) }
            }
        *)
        Definition original_step
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_associated_function (|
                  Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ],
                  "new_unchecked",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_function (| "core::intrinsics::unchecked_add", [ Ty.path "usize" ] |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::step_by::StepBy",
                          "step_minus_one"
                        |)
                      |);
                      Value.Integer IntegerKind.Usize 1
                    ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_original_step :
          forall (I : Ty.t),
          M.IsAssociatedFunction (Self I) "original_step" (original_step I).
        (*
            fn next_back_index(&self) -> usize {
                let rem = self.iter.len() % self.original_step();
                if self.first_take { if rem == 0 { self.step_minus_one } else { rem - 1 } } else { rem }
            }
        *)
        Definition next_back_index
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.read (|
                let~ rem :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::arith::Rem",
                        Ty.path "usize",
                        [ Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ] ],
                        "rem",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::exact_size::ExactSizeIterator",
                            I,
                            [],
                            "len",
                            []
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "core::iter::adapters::step_by::StepBy",
                              "iter"
                            |)
                          ]
                        |);
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                            "original_step",
                            []
                          |),
                          [ M.read (| self |) ]
                        |)
                      ]
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "core::iter::adapters::step_by::StepBy",
                              "first_take"
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        M.match_operator (|
                          M.alloc (| Value.Tuple [] |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ :=
                                  M.use
                                    (M.alloc (|
                                      BinOp.eq (|
                                        M.read (| rem |),
                                        Value.Integer IntegerKind.Usize 0
                                      |)
                                    |)) in
                                let _ :=
                                  M.is_constant_or_break_match (|
                                    M.read (| γ |),
                                    Value.Bool true
                                  |) in
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "core::iter::adapters::step_by::StepBy",
                                  "step_minus_one"
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (M.alloc (|
                                  BinOp.Wrap.sub (|
                                    M.read (| rem |),
                                    Value.Integer IntegerKind.Usize 1
                                  |)
                                |)))
                          ]
                        |)));
                    fun γ => ltac:(M.monadic rem)
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_next_back_index :
          forall (I : Ty.t),
          M.IsAssociatedFunction (Self I) "next_back_index" (next_back_index I).
      End Impl_core_iter_adapters_step_by_StepBy_I.
      
      Module Impl_core_iter_traits_iterator_Iterator_where_core_iter_traits_iterator_Iterator_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        (*     type Item = I::Item; *)
        Definition _Item (I : Ty.t) : Ty.t := Ty.associated.
        
        (*
            fn next(&mut self) -> Option<Self::Item> {
                self.spec_next()
            }
        *)
        Definition next (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_next",
                  []
                |),
                [ M.read (| self |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn size_hint(&self) -> (usize, Option<usize>) {
                self.spec_size_hint()
            }
        *)
        Definition size_hint (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_size_hint",
                  []
                |),
                [ M.read (| self |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn nth(&mut self, n: usize) -> Option<Self::Item> {
                self.spec_nth(n)
            }
        *)
        Definition nth (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_nth",
                  []
                |),
                [ M.read (| self |); M.read (| n |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn try_fold<Acc, F, R>(&mut self, acc: Acc, f: F) -> R
            where
                F: FnMut(Acc, Self::Item) -> R,
                R: Try<Output = Acc>,
            {
                self.spec_try_fold(acc, f)
            }
        *)
        Definition try_fold (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; acc; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let acc := M.alloc (| acc |) in
              let f := M.alloc (| f |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_try_fold",
                  [ Acc; F; R ]
                |),
                [ M.read (| self |); M.read (| acc |); M.read (| f |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn fold<Acc, F>(self, acc: Acc, f: F) -> Acc
            where
                F: FnMut(Acc, Self::Item) -> Acc,
            {
                self.spec_fold(acc, f)
            }
        *)
        Definition fold (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F ], [ self; acc; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let acc := M.alloc (| acc |) in
              let f := M.alloc (| f |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_fold",
                  [ Acc; F ]
                |),
                [ M.read (| self |); M.read (| acc |); M.read (| f |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::iterator::Iterator"
            (Self I)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("Item", InstanceField.Ty (_Item I));
              ("next", InstanceField.Method (next I));
              ("size_hint", InstanceField.Method (size_hint I));
              ("nth", InstanceField.Method (nth I));
              ("try_fold", InstanceField.Method (try_fold I));
              ("fold", InstanceField.Method (fold I))
            ].
      End Impl_core_iter_traits_iterator_Iterator_where_core_iter_traits_iterator_Iterator_I_for_core_iter_adapters_step_by_StepBy_I.
      
      
      Module Impl_core_iter_traits_double_ended_DoubleEndedIterator_where_core_iter_traits_double_ended_DoubleEndedIterator_I_where_core_iter_traits_exact_size_ExactSizeIterator_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        (*
            fn next_back(&mut self) -> Option<Self::Item> {
                self.spec_next_back()
            }
        *)
        Definition next_back (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByBackImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_next_back",
                  []
                |),
                [ M.read (| self |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
                self.spec_nth_back(n)
            }
        *)
        Definition nth_back (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByBackImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_nth_back",
                  []
                |),
                [ M.read (| self |); M.read (| n |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn try_rfold<Acc, F, R>(&mut self, init: Acc, f: F) -> R
            where
                F: FnMut(Acc, Self::Item) -> R,
                R: Try<Output = Acc>,
            {
                self.spec_try_rfold(init, f)
            }
        *)
        Definition try_rfold (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByBackImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_try_rfold",
                  [ Acc; F; R ]
                |),
                [ M.read (| self |); M.read (| init |); M.read (| f |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn rfold<Acc, F>(self, init: Acc, f: F) -> Acc
            where
                Self: Sized,
                F: FnMut(Acc, Self::Item) -> Acc,
            {
                self.spec_rfold(init, f)
            }
        *)
        Definition rfold (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::adapters::step_by::StepByBackImpl",
                  Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                  [ I ],
                  "spec_rfold",
                  [ Acc; F ]
                |),
                [ M.read (| self |); M.read (| init |); M.read (| f |) ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::double_ended::DoubleEndedIterator"
            (Self I)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("next_back", InstanceField.Method (next_back I));
              ("nth_back", InstanceField.Method (nth_back I));
              ("try_rfold", InstanceField.Method (try_rfold I));
              ("rfold", InstanceField.Method (rfold I))
            ].
      End Impl_core_iter_traits_double_ended_DoubleEndedIterator_where_core_iter_traits_double_ended_DoubleEndedIterator_I_where_core_iter_traits_exact_size_ExactSizeIterator_I_for_core_iter_adapters_step_by_StepBy_I.
      
      Module Impl_core_iter_traits_exact_size_ExactSizeIterator_where_core_iter_traits_exact_size_ExactSizeIterator_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::exact_size::ExactSizeIterator"
            (Self I)
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_iter_traits_exact_size_ExactSizeIterator_where_core_iter_traits_exact_size_ExactSizeIterator_I_for_core_iter_adapters_step_by_StepBy_I.
      
      Module Impl_core_iter_traits_marker_TrustedLen_where_core_iter_traits_iterator_Iterator_I_where_core_iter_adapters_zip_TrustedRandomAccess_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::marker::TrustedLen"
            (Self I)
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_iter_traits_marker_TrustedLen_where_core_iter_traits_iterator_Iterator_I_where_core_iter_adapters_zip_TrustedRandomAccess_I_for_core_iter_adapters_step_by_StepBy_I.
      
      (* Trait *)
      (* Empty module 'SpecRangeSetup' *)
      
      Module Impl_core_iter_adapters_step_by_SpecRangeSetup_T_for_T.
        Definition Self (T : Ty.t) : Ty.t := T.
        
        (*
            default fn setup(inner: T, _step: usize) -> T {
                inner
            }
        *)
        Definition setup (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self T in
          match ε, τ, α with
          | [], [], [ inner; _step ] =>
            ltac:(M.monadic
              (let inner := M.alloc (| inner |) in
              let _step := M.alloc (| _step |) in
              M.read (| inner |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (T : Ty.t),
          M.IsTraitInstance
            "core::iter::adapters::step_by::SpecRangeSetup"
            (Self T)
            (* Trait polymorphic types *) [ (* T *) T ]
            (* Instance *) [ ("setup", InstanceField.Method (setup T)) ].
      End Impl_core_iter_adapters_step_by_SpecRangeSetup_T_for_T.
      
      (* Trait *)
      (* Empty module 'StepByImpl' *)
      
      (* Trait *)
      (* Empty module 'StepByBackImpl' *)
      
      Module Impl_core_iter_adapters_step_by_StepByImpl_where_core_iter_traits_iterator_Iterator_I_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        (*     type Item = I::Item; *)
        Definition _Item (I : Ty.t) : Ty.t := Ty.associated.
        
        (*
            default fn spec_next(&mut self) -> Option<I::Item> {
                let step_size = if self.first_take { 0 } else { self.step_minus_one };
                self.first_take = false;
                self.iter.nth(step_size)
            }
        *)
        Definition spec_next (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.read (|
                let~ step_size :=
                  M.copy (|
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "core::iter::adapters::step_by::StepBy",
                                  "first_take"
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            M.alloc (| Value.Integer IntegerKind.Usize 0 |)));
                        fun γ =>
                          ltac:(M.monadic
                            (M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "core::iter::adapters::step_by::StepBy",
                              "step_minus_one"
                            |)))
                      ]
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "core::iter::adapters::step_by::StepBy",
                      "first_take"
                    |),
                    Value.Bool false
                  |) in
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      I,
                      [],
                      "nth",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |);
                      M.read (| step_size |)
                    ]
                  |)
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            default fn spec_size_hint(&self) -> (usize, Option<usize>) {
                #[inline]
                fn first_size(step: NonZero<usize>) -> impl Fn(usize) -> usize {
                    move |n| if n == 0 { 0 } else { 1 + (n - 1) / step }
                }
        
                #[inline]
                fn other_size(step: NonZero<usize>) -> impl Fn(usize) -> usize {
                    move |n| n / step
                }
        
                let (low, high) = self.iter.size_hint();
        
                if self.first_take {
                    let f = first_size(self.original_step());
                    (f(low), high.map(f))
                } else {
                    let f = other_size(self.original_step());
                    (f(low), high.map(f))
                }
            }
        *)
        Definition spec_size_hint
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.read (|
                M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        I,
                        [],
                        "size_hint",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::step_by::StepBy",
                          "iter"
                        |)
                      ]
                    |)
                  |),
                  [
                    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 low := M.copy (| γ0_0 |) in
                        let high := M.copy (| γ0_1 |) in
                        M.match_operator (|
                          M.alloc (| Value.Tuple [] |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ :=
                                  M.use
                                    (M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::iter::adapters::step_by::StepBy",
                                      "first_take"
                                    |)) in
                                let _ :=
                                  M.is_constant_or_break_match (|
                                    M.read (| γ |),
                                    Value.Bool true
                                  |) in
                                let~ f :=
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Self,
                                        "first_size.spec_size_hint",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::iter::adapters::step_by::StepBy")
                                              []
                                              [ I ],
                                            "original_step",
                                            []
                                          |),
                                          [ M.read (| self |) ]
                                        |)
                                      ]
                                    |)
                                  |) in
                                M.alloc (|
                                  Value.Tuple
                                    [
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::function::Fn",
                                          Ty.associated,
                                          [ Ty.tuple [ Ty.path "usize" ] ],
                                          "call",
                                          []
                                        |),
                                        [ f; Value.Tuple [ M.read (| low |) ] ]
                                      |);
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::option::Option")
                                            []
                                            [ Ty.path "usize" ],
                                          "map",
                                          [ Ty.path "usize"; Ty.associated ]
                                        |),
                                        [ M.read (| high |); M.read (| f |) ]
                                      |)
                                    ]
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let~ f :=
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Self,
                                        "other_size.spec_size_hint",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::iter::adapters::step_by::StepBy")
                                              []
                                              [ I ],
                                            "original_step",
                                            []
                                          |),
                                          [ M.read (| self |) ]
                                        |)
                                      ]
                                    |)
                                  |) in
                                M.alloc (|
                                  Value.Tuple
                                    [
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::function::Fn",
                                          Ty.associated,
                                          [ Ty.tuple [ Ty.path "usize" ] ],
                                          "call",
                                          []
                                        |),
                                        [ f; Value.Tuple [ M.read (| low |) ] ]
                                      |);
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::option::Option")
                                            []
                                            [ Ty.path "usize" ],
                                          "map",
                                          [ Ty.path "usize"; Ty.associated ]
                                        |),
                                        [ M.read (| high |); M.read (| f |) ]
                                      |)
                                    ]
                                |)))
                          ]
                        |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            default fn spec_nth(&mut self, mut n: usize) -> Option<I::Item> {
                if self.first_take {
                    self.first_take = false;
                    let first = self.iter.next();
                    if n == 0 {
                        return first;
                    }
                    n -= 1;
                }
                // n and self.step_minus_one are indices, we need to add 1 to get the amount of elements
                // When calling `.nth`, we need to subtract 1 again to convert back to an index
                let mut step = self.original_step().get();
                // n + 1 could overflow
                // thus, if n is usize::MAX, instead of adding one, we call .nth(step)
                if n == usize::MAX {
                    self.iter.nth(step - 1);
                } else {
                    n += 1;
                }
        
                // overflow handling
                loop {
                    let mul = n.checked_mul(step);
                    {
                        if intrinsics::likely(mul.is_some()) {
                            return self.iter.nth(mul.unwrap() - 1);
                        }
                    }
                    let div_n = usize::MAX / n;
                    let div_step = usize::MAX / step;
                    let nth_n = div_n * n;
                    let nth_step = div_step * step;
                    let nth = if nth_n > nth_step {
                        step -= div_n;
                        nth_n
                    } else {
                        n -= div_step;
                        nth_step
                    };
                    self.iter.nth(nth - 1);
                }
            }
        *)
        Definition spec_nth (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "core::iter::adapters::step_by::StepBy",
                                    "first_take"
                                  |)) 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::iter::adapters::step_by::StepBy",
                                    "first_take"
                                  |),
                                  Value.Bool false
                                |) in
                              let~ first :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      I,
                                      [],
                                      "next",
                                      []
                                    |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::iter::adapters::step_by::StepBy",
                                        "iter"
                                      |)
                                    ]
                                  |)
                                |) in
                              let~ _ :=
                                M.match_operator (|
                                  M.alloc (| Value.Tuple [] |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ :=
                                          M.use
                                            (M.alloc (|
                                              BinOp.eq (|
                                                M.read (| n |),
                                                Value.Integer IntegerKind.Usize 0
                                              |)
                                            |)) in
                                        let _ :=
                                          M.is_constant_or_break_match (|
                                            M.read (| γ |),
                                            Value.Bool true
                                          |) in
                                        M.alloc (|
                                          M.never_to_any (|
                                            M.read (| M.return_ (| M.read (| first |) |) |)
                                          |)
                                        |)));
                                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                  ]
                                |) in
                              let~ _ :=
                                let β := n in
                                M.write (|
                                  β,
                                  BinOp.Wrap.sub (|
                                    M.read (| β |),
                                    Value.Integer IntegerKind.Usize 1
                                  |)
                                |) in
                              M.alloc (| Value.Tuple [] |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    let~ step :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ],
                            "get",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                                "original_step",
                                []
                              |),
                              [ M.read (| self |) ]
                            |)
                          ]
                        |)
                      |) in
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    BinOp.eq (|
                                      M.read (| n |),
                                      M.read (| M.get_constant (| "core::num::MAX" |) |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              let~ _ :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      I,
                                      [],
                                      "nth",
                                      []
                                    |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::iter::adapters::step_by::StepBy",
                                        "iter"
                                      |);
                                      BinOp.Wrap.sub (|
                                        M.read (| step |),
                                        Value.Integer IntegerKind.Usize 1
                                      |)
                                    ]
                                  |)
                                |) in
                              M.alloc (| Value.Tuple [] |)));
                          fun γ =>
                            ltac:(M.monadic
                              (let~ _ :=
                                let β := n in
                                M.write (|
                                  β,
                                  BinOp.Wrap.add (|
                                    M.read (| β |),
                                    Value.Integer IntegerKind.Usize 1
                                  |)
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.never_to_any (|
                        M.read (|
                          M.loop (|
                            ltac:(M.monadic
                              (let~ mul :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "usize",
                                      "checked_mul",
                                      []
                                    |),
                                    [ M.read (| n |); M.read (| step |) ]
                                  |)
                                |) in
                              let~ _ :=
                                M.match_operator (|
                                  M.alloc (| Value.Tuple [] |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ :=
                                          M.use
                                            (M.alloc (|
                                              M.call_closure (|
                                                M.get_function (| "core::intrinsics::likely", [] |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "core::option::Option")
                                                        []
                                                        [ Ty.path "usize" ],
                                                      "is_some",
                                                      []
                                                    |),
                                                    [ mul ]
                                                  |)
                                                ]
                                              |)
                                            |)) in
                                        let _ :=
                                          M.is_constant_or_break_match (|
                                            M.read (| γ |),
                                            Value.Bool true
                                          |) in
                                        M.alloc (|
                                          M.never_to_any (|
                                            M.read (|
                                              M.return_ (|
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::iter::traits::iterator::Iterator",
                                                    I,
                                                    [],
                                                    "nth",
                                                    []
                                                  |),
                                                  [
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| self |),
                                                      "core::iter::adapters::step_by::StepBy",
                                                      "iter"
                                                    |);
                                                    BinOp.Wrap.sub (|
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.apply
                                                            (Ty.path "core::option::Option")
                                                            []
                                                            [ Ty.path "usize" ],
                                                          "unwrap",
                                                          []
                                                        |),
                                                        [ M.read (| mul |) ]
                                                      |),
                                                      Value.Integer IntegerKind.Usize 1
                                                    |)
                                                  ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                  ]
                                |) in
                              let~ div_n :=
                                M.alloc (|
                                  BinOp.Wrap.div (|
                                    M.read (| M.get_constant (| "core::num::MAX" |) |),
                                    M.read (| n |)
                                  |)
                                |) in
                              let~ div_step :=
                                M.alloc (|
                                  BinOp.Wrap.div (|
                                    M.read (| M.get_constant (| "core::num::MAX" |) |),
                                    M.read (| step |)
                                  |)
                                |) in
                              let~ nth_n :=
                                M.alloc (|
                                  BinOp.Wrap.mul (| M.read (| div_n |), M.read (| n |) |)
                                |) in
                              let~ nth_step :=
                                M.alloc (|
                                  BinOp.Wrap.mul (| M.read (| div_step |), M.read (| step |) |)
                                |) in
                              let~ nth :=
                                M.copy (|
                                  M.match_operator (|
                                    M.alloc (| Value.Tuple [] |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ :=
                                            M.use
                                              (M.alloc (|
                                                BinOp.gt (|
                                                  M.read (| nth_n |),
                                                  M.read (| nth_step |)
                                                |)
                                              |)) in
                                          let _ :=
                                            M.is_constant_or_break_match (|
                                              M.read (| γ |),
                                              Value.Bool true
                                            |) in
                                          let~ _ :=
                                            let β := step in
                                            M.write (|
                                              β,
                                              BinOp.Wrap.sub (|
                                                M.read (| β |),
                                                M.read (| div_n |)
                                              |)
                                            |) in
                                          nth_n));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let~ _ :=
                                            let β := n in
                                            M.write (|
                                              β,
                                              BinOp.Wrap.sub (|
                                                M.read (| β |),
                                                M.read (| div_step |)
                                              |)
                                            |) in
                                          nth_step))
                                    ]
                                  |)
                                |) in
                              let~ _ :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      I,
                                      [],
                                      "nth",
                                      []
                                    |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::iter::adapters::step_by::StepBy",
                                        "iter"
                                      |);
                                      BinOp.Wrap.sub (|
                                        M.read (| nth |),
                                        Value.Integer IntegerKind.Usize 1
                                      |)
                                    ]
                                  |)
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)
                        |)
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            default fn spec_try_fold<Acc, F, R>(&mut self, mut acc: Acc, mut f: F) -> R
            where
                F: FnMut(Acc, Self::Item) -> R,
                R: Try<Output = Acc>,
            {
                #[inline]
                fn nth<I: Iterator>(
                    iter: &mut I,
                    step_minus_one: usize,
                ) -> impl FnMut() -> Option<I::Item> + '_ {
                    move || iter.nth(step_minus_one)
                }
        
                if self.first_take {
                    self.first_take = false;
                    match self.iter.next() {
                        None => return try { acc },
                        Some(x) => acc = f(acc, x)?,
                    }
                }
                from_fn(nth(&mut self.iter, self.step_minus_one)).try_fold(acc, f)
            }
        *)
        Definition spec_try_fold
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; acc; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let acc := M.alloc (| acc |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "core::iter::adapters::step_by::StepBy",
                                    "first_take"
                                  |)) 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::iter::adapters::step_by::StepBy",
                                    "first_take"
                                  |),
                                  Value.Bool false
                                |) in
                              M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      I,
                                      [],
                                      "next",
                                      []
                                    |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::iter::adapters::step_by::StepBy",
                                        "iter"
                                      |)
                                    ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let _ :=
                                        M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                      M.alloc (|
                                        M.never_to_any (|
                                          M.read (|
                                            M.return_ (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::try_trait::Try",
                                                  R,
                                                  [],
                                                  "from_output",
                                                  []
                                                |),
                                                [ M.read (| acc |) ]
                                              |)
                                            |)
                                          |)
                                        |)
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ0_0 :=
                                        M.SubPointer.get_struct_tuple_field (|
                                          γ,
                                          "core::option::Option::Some",
                                          0
                                        |) in
                                      let x := M.copy (| γ0_0 |) in
                                      M.write (|
                                        acc,
                                        M.read (|
                                          M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::try_trait::Try",
                                                  R,
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::function::FnMut",
                                                      F,
                                                      [ Ty.tuple [ Acc; Ty.associated ] ],
                                                      "call_mut",
                                                      []
                                                    |),
                                                    [
                                                      f;
                                                      Value.Tuple
                                                        [ M.read (| acc |); M.read (| x |) ]
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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",
                                                              R,
                                                              [ Ty.associated ],
                                                              "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))
                                            ]
                                          |)
                                        |)
                                      |)))
                                ]
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply
                            (Ty.path "core::iter::sources::from_fn::FromFn")
                            []
                            [ Ty.associated ],
                          [],
                          "try_fold",
                          [ Acc; F; R ]
                        |),
                        [
                          M.alloc (|
                            M.call_closure (|
                              M.get_function (|
                                "core::iter::sources::from_fn::from_fn",
                                [ Ty.associated; Ty.associated ]
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (| Self, "nth.spec_try_fold", [] |),
                                  [
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "core::iter::adapters::step_by::StepBy",
                                      "iter"
                                    |);
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "core::iter::adapters::step_by::StepBy",
                                        "step_minus_one"
                                      |)
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          |);
                          M.read (| acc |);
                          M.read (| f |)
                        ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            default fn spec_fold<Acc, F>(mut self, mut acc: Acc, mut f: F) -> Acc
            where
                F: FnMut(Acc, Self::Item) -> Acc,
            {
                #[inline]
                fn nth<I: Iterator>(
                    iter: &mut I,
                    step_minus_one: usize,
                ) -> impl FnMut() -> Option<I::Item> + '_ {
                    move || iter.nth(step_minus_one)
                }
        
                if self.first_take {
                    self.first_take = false;
                    match self.iter.next() {
                        None => return acc,
                        Some(x) => acc = f(acc, x),
                    }
                }
                from_fn(nth(&mut self.iter, self.step_minus_one)).fold(acc, f)
            }
        *)
        Definition spec_fold (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F ], [ self; acc; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let acc := M.alloc (| acc |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.SubPointer.get_struct_record_field (|
                                    self,
                                    "core::iter::adapters::step_by::StepBy",
                                    "first_take"
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              let~ _ :=
                                M.write (|
                                  M.SubPointer.get_struct_record_field (|
                                    self,
                                    "core::iter::adapters::step_by::StepBy",
                                    "first_take"
                                  |),
                                  Value.Bool false
                                |) in
                              M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      I,
                                      [],
                                      "next",
                                      []
                                    |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        self,
                                        "core::iter::adapters::step_by::StepBy",
                                        "iter"
                                      |)
                                    ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let _ :=
                                        M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                      M.alloc (|
                                        M.never_to_any (|
                                          M.read (| M.return_ (| M.read (| acc |) |) |)
                                        |)
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ0_0 :=
                                        M.SubPointer.get_struct_tuple_field (|
                                          γ,
                                          "core::option::Option::Some",
                                          0
                                        |) in
                                      let x := M.copy (| γ0_0 |) in
                                      M.write (|
                                        acc,
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::function::FnMut",
                                            F,
                                            [ Ty.tuple [ Acc; Ty.associated ] ],
                                            "call_mut",
                                            []
                                          |),
                                          [ f; Value.Tuple [ M.read (| acc |); M.read (| x |) ] ]
                                        |)
                                      |)))
                                ]
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply
                            (Ty.path "core::iter::sources::from_fn::FromFn")
                            []
                            [ Ty.associated ],
                          [],
                          "fold",
                          [ Acc; F ]
                        |),
                        [
                          M.call_closure (|
                            M.get_function (|
                              "core::iter::sources::from_fn::from_fn",
                              [ Ty.associated; Ty.associated ]
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (| Self, "nth.spec_fold", [] |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    self,
                                    "core::iter::adapters::step_by::StepBy",
                                    "iter"
                                  |);
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      self,
                                      "core::iter::adapters::step_by::StepBy",
                                      "step_minus_one"
                                    |)
                                  |)
                                ]
                              |)
                            ]
                          |);
                          M.read (| acc |);
                          M.read (| f |)
                        ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByImpl"
            (Self I)
            (* Trait polymorphic types *) [ (* I *) I ]
            (* Instance *)
            [
              ("Item", InstanceField.Ty (_Item I));
              ("spec_next", InstanceField.Method (spec_next I));
              ("spec_size_hint", InstanceField.Method (spec_size_hint I));
              ("spec_nth", InstanceField.Method (spec_nth I));
              ("spec_try_fold", InstanceField.Method (spec_try_fold I));
              ("spec_fold", InstanceField.Method (spec_fold I))
            ].
      End Impl_core_iter_adapters_step_by_StepByImpl_where_core_iter_traits_iterator_Iterator_I_I_for_core_iter_adapters_step_by_StepBy_I.
      
      Module Impl_core_iter_adapters_step_by_StepByBackImpl_where_core_iter_traits_double_ended_DoubleEndedIterator_I_where_core_iter_traits_exact_size_ExactSizeIterator_I_I_for_core_iter_adapters_step_by_StepBy_I.
        Definition Self (I : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ].
        
        (*     type Item = I::Item; *)
        Definition _Item (I : Ty.t) : Ty.t := Ty.associated.
        
        (*
            default fn spec_next_back(&mut self) -> Option<Self::Item> {
                self.iter.nth_back(self.next_back_index())
            }
        *)
        Definition spec_next_back
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::double_ended::DoubleEndedIterator",
                  I,
                  [],
                  "nth_back",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::step_by::StepBy",
                    "iter"
                  |);
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                      "next_back_index",
                      []
                    |),
                    [ M.read (| self |) ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            default fn spec_nth_back(&mut self, n: usize) -> Option<I::Item> {
                // `self.iter.nth_back(usize::MAX)` does the right thing here when `n`
                // is out of bounds because the length of `self.iter` does not exceed
                // `usize::MAX` (because `I: ExactSizeIterator`) and `nth_back` is
                // zero-indexed
                let n = n.saturating_mul(self.original_step().get()).saturating_add(self.next_back_index());
                self.iter.nth_back(n)
            }
        *)
        Definition spec_nth_back
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.read (|
                let~ n :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "usize", "saturating_add", [] |),
                      [
                        M.call_closure (|
                          M.get_associated_function (| Ty.path "usize", "saturating_mul", [] |),
                          [
                            M.read (| n |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [ I ],
                                    "original_step",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                            "next_back_index",
                            []
                          |),
                          [ M.read (| self |) ]
                        |)
                      ]
                    |)
                  |) in
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::double_ended::DoubleEndedIterator",
                      I,
                      [],
                      "nth_back",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |);
                      M.read (| n |)
                    ]
                  |)
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            default fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
            where
                F: FnMut(Acc, Self::Item) -> R,
                R: Try<Output = Acc>,
            {
                #[inline]
                fn nth_back<I: DoubleEndedIterator>(
                    iter: &mut I,
                    step_minus_one: usize,
                ) -> impl FnMut() -> Option<I::Item> + '_ {
                    move || iter.nth_back(step_minus_one)
                }
        
                match self.next_back() {
                    None => try { init },
                    Some(x) => {
                        let acc = f(init, x)?;
                        from_fn(nth_back(&mut self.iter, self.step_minus_one)).try_fold(acc, f)
                    }
                }
            }
        *)
        Definition spec_try_rfold
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::double_ended::DoubleEndedIterator",
                            Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                            [],
                            "next_back",
                            []
                          |),
                          [ M.read (| self |) ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                            M.alloc (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::try_trait::Try",
                                  R,
                                  [],
                                  "from_output",
                                  []
                                |),
                                [ M.read (| init |) ]
                              |)
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::option::Option::Some",
                                0
                              |) in
                            let x := M.copy (| γ0_0 |) in
                            let~ acc :=
                              M.copy (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        R,
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::function::FnMut",
                                            F,
                                            [ Ty.tuple [ Acc; Ty.associated ] ],
                                            "call_mut",
                                            []
                                          |),
                                          [ f; Value.Tuple [ M.read (| init |); M.read (| x |) ] ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    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",
                                                    R,
                                                    [ Ty.associated ],
                                                    "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 (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::iterator::Iterator",
                                  Ty.apply
                                    (Ty.path "core::iter::sources::from_fn::FromFn")
                                    []
                                    [ Ty.associated ],
                                  [],
                                  "try_fold",
                                  [ Acc; F; R ]
                                |),
                                [
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_function (|
                                        "core::iter::sources::from_fn::from_fn",
                                        [ Ty.associated; Ty.associated ]
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Self,
                                            "nth_back.spec_try_rfold",
                                            []
                                          |),
                                          [
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| self |),
                                              "core::iter::adapters::step_by::StepBy",
                                              "iter"
                                            |);
                                            M.read (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| self |),
                                                "core::iter::adapters::step_by::StepBy",
                                                "step_minus_one"
                                              |)
                                            |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |);
                                  M.read (| acc |);
                                  M.read (| f |)
                                ]
                              |)
                            |)))
                      ]
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            default fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
            where
                Self: Sized,
                F: FnMut(Acc, I::Item) -> Acc,
            {
                #[inline]
                fn nth_back<I: DoubleEndedIterator>(
                    iter: &mut I,
                    step_minus_one: usize,
                ) -> impl FnMut() -> Option<I::Item> + '_ {
                    move || iter.nth_back(step_minus_one)
                }
        
                match self.next_back() {
                    None => init,
                    Some(x) => {
                        let acc = f(init, x);
                        from_fn(nth_back(&mut self.iter, self.step_minus_one)).fold(acc, f)
                    }
                }
            }
        *)
        Definition spec_rfold
            (I : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I in
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::double_ended::DoubleEndedIterator",
                        Ty.apply (Ty.path "core::iter::adapters::step_by::StepBy") [] [ I ],
                        [],
                        "next_back",
                        []
                      |),
                      [ self ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                        init));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::option::Option::Some",
                            0
                          |) in
                        let x := M.copy (| γ0_0 |) in
                        let~ acc :=
                          M.alloc (|
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::function::FnMut",
                                F,
                                [ Ty.tuple [ Acc; Ty.associated ] ],
                                "call_mut",
                                []
                              |),
                              [ f; Value.Tuple [ M.read (| init |); M.read (| x |) ] ]
                            |)
                          |) in
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::iter::sources::from_fn::FromFn")
                                []
                                [ Ty.associated ],
                              [],
                              "fold",
                              [ Acc; F ]
                            |),
                            [
                              M.call_closure (|
                                M.get_function (|
                                  "core::iter::sources::from_fn::from_fn",
                                  [ Ty.associated; Ty.associated ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (| Self, "nth_back.spec_rfold", [] |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        self,
                                        "core::iter::adapters::step_by::StepBy",
                                        "iter"
                                      |);
                                      M.read (|
                                        M.SubPointer.get_struct_record_field (|
                                          self,
                                          "core::iter::adapters::step_by::StepBy",
                                          "step_minus_one"
                                        |)
                                      |)
                                    ]
                                  |)
                                ]
                              |);
                              M.read (| acc |);
                              M.read (| f |)
                            ]
                          |)
                        |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I : Ty.t),
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByBackImpl"
            (Self I)
            (* Trait polymorphic types *) [ (* I *) I ]
            (* Instance *)
            [
              ("Item", InstanceField.Ty (_Item I));
              ("spec_next_back", InstanceField.Method (spec_next_back I));
              ("spec_nth_back", InstanceField.Method (spec_nth_back I));
              ("spec_try_rfold", InstanceField.Method (spec_try_rfold I));
              ("spec_rfold", InstanceField.Method (spec_rfold I))
            ].
      End Impl_core_iter_adapters_step_by_StepByBackImpl_where_core_iter_traits_double_ended_DoubleEndedIterator_I_where_core_iter_traits_exact_size_ExactSizeIterator_I_I_for_core_iter_adapters_step_by_StepBy_I.
      
      Module Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u8_for_core_ops_range_Range_u8.
        Definition Self : Ty.t := Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ].
        
        (*
                    fn setup(mut r: Range<$t>, step: usize) -> Range<$t> {
                        let inner_len = r.size_hint().0;
                        // If step exceeds $t::MAX, then the count will be at most 1 and
                        // thus always fit into $t.
                        let yield_count = inner_len.div_ceil(step);
                        // Turn the range end into an iteration counter
                        r.end = yield_count as $t;
                        r
                    }
        *)
        Definition setup (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ r; step ] =>
            ltac:(M.monadic
              (let r := M.alloc (| r |) in
              let step := M.alloc (| step |) in
              M.read (|
                let~ inner_len :=
                  M.copy (|
                    M.SubPointer.get_tuple_field (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ],
                            [],
                            "size_hint",
                            []
                          |),
                          [ r ]
                        |)
                      |),
                      0
                    |)
                  |) in
                let~ yield_count :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "usize", "div_ceil", [] |),
                      [ M.read (| inner_len |); M.read (| step |) ]
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (| r, "core::ops::range::Range", "end" |),
                    M.rust_cast (M.read (| yield_count |))
                  |) in
                r
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::SpecRangeSetup"
            Self
            (* Trait polymorphic types *)
            [ (* T *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ] ]
            (* Instance *) [ ("setup", InstanceField.Method setup) ].
      End Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u8_for_core_ops_range_Range_u8.
      
      Module Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u8_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u8.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ] ].
        
        (*
                    fn spec_next(&mut self) -> Option<$t> {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let val = self.iter.start;
                            // this can only overflow during the last step, after which the value
                            // will not be used
                            self.iter.start = val.wrapping_add(step);
                            self.iter.end = remaining - 1;
                            Some(val)
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next (ε : 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~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u8"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u8",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u8" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| remaining |), Value.Integer IntegerKind.U8 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ val :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |),
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u8", "wrapping_add", [] |),
                              [ M.read (| val |); M.read (| step |) ]
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.U8 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple "core::option::Option::Some" [ M.read (| val |) ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_size_hint(&self) -> (usize, Option<usize>) {
                        let remaining = self.iter.end as usize;
                        (remaining, Some(remaining))
                    }
        *)
        Definition spec_size_hint (ε : 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~ remaining :=
                  M.alloc (|
                    M.rust_cast
                      (M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::iter::adapters::step_by::StepBy",
                            "iter"
                          |),
                          "core::ops::range::Range",
                          "end"
                        |)
                      |))
                  |) in
                M.alloc (|
                  Value.Tuple
                    [
                      M.read (| remaining |);
                      Value.StructTuple "core::option::Option::Some" [ M.read (| remaining |) ]
                    ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth(&mut self, n: usize) -> Option<Self::Item> {
                        self.advance_by(n).ok()?;
                        self.next()
                    }
        *)
        Definition spec_nth (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [
                                      Ty.tuple [];
                                      Ty.apply
                                        (Ty.path "core::num::nonzero::NonZero")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                  "ok",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "u8" ]
                                        ],
                                      [],
                                      "advance_by",
                                      []
                                    |),
                                    [ M.read (| self |); M.read (| n |) ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          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::option::Option")
                                            []
                                            [ Ty.path "u8" ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::option::Option")
                                              []
                                              [ Ty.path "core::convert::Infallible" ]
                                          ],
                                          "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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ] ],
                          [],
                          "next",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_fold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                        where
                            F: FnMut(Acc, Self::Item) -> R,
                            R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "u8" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "u8" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_fold<Acc, F>(self, init: Acc, mut f: F) -> Acc
                        where
                            F: FnMut(Acc, Self::Item) -> Acc
                    {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        let mut acc = init;
                        let mut val = self.iter.start;
                        for _ in 0..remaining {
                            acc = f(acc, val);
                            // this can only overflow during the last step, after which the value
                            // will no longer be used
                            val = val.wrapping_add(step);
                        }
                        acc
                    }
        *)
        Definition spec_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u8"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u8",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u8" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ self ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                let~ acc := M.copy (| init |) in
                let~ val :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "start"
                    |)
                  |) 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 "u8" ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", Value.Integer IntegerKind.U8 0);
                                ("end_", M.read (| remaining |))
                              ]
                          ]
                        |)
                      |),
                      [
                        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 "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~ _ :=
                                            M.write (|
                                              acc,
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::FnMut",
                                                  F,
                                                  [ Ty.tuple [ Acc; Ty.path "u8" ] ],
                                                  "call_mut",
                                                  []
                                                |),
                                                [
                                                  f;
                                                  Value.Tuple [ M.read (| acc |); M.read (| val |) ]
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.write (|
                                              val,
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "u8",
                                                  "wrapping_add",
                                                  []
                                                |),
                                                [ M.read (| val |); M.read (| step |) ]
                                              |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                acc
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ] ]
            (* Instance *)
            [
              ("spec_next", InstanceField.Method spec_next);
              ("spec_size_hint", InstanceField.Method spec_size_hint);
              ("spec_nth", InstanceField.Method spec_nth);
              ("spec_try_fold", InstanceField.Method spec_try_fold);
              ("spec_fold", InstanceField.Method spec_fold)
            ].
      End Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u8_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u8.
      
      Module Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u16_for_core_ops_range_Range_u16.
        Definition Self : Ty.t := Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ].
        
        (*
                    fn setup(mut r: Range<$t>, step: usize) -> Range<$t> {
                        let inner_len = r.size_hint().0;
                        // If step exceeds $t::MAX, then the count will be at most 1 and
                        // thus always fit into $t.
                        let yield_count = inner_len.div_ceil(step);
                        // Turn the range end into an iteration counter
                        r.end = yield_count as $t;
                        r
                    }
        *)
        Definition setup (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ r; step ] =>
            ltac:(M.monadic
              (let r := M.alloc (| r |) in
              let step := M.alloc (| step |) in
              M.read (|
                let~ inner_len :=
                  M.copy (|
                    M.SubPointer.get_tuple_field (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ],
                            [],
                            "size_hint",
                            []
                          |),
                          [ r ]
                        |)
                      |),
                      0
                    |)
                  |) in
                let~ yield_count :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "usize", "div_ceil", [] |),
                      [ M.read (| inner_len |); M.read (| step |) ]
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (| r, "core::ops::range::Range", "end" |),
                    M.rust_cast (M.read (| yield_count |))
                  |) in
                r
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::SpecRangeSetup"
            Self
            (* Trait polymorphic types *)
            [ (* T *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ] ]
            (* Instance *) [ ("setup", InstanceField.Method setup) ].
      End Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u16_for_core_ops_range_Range_u16.
      
      Module Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u16_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u16.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ] ].
        
        (*
                    fn spec_next(&mut self) -> Option<$t> {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let val = self.iter.start;
                            // this can only overflow during the last step, after which the value
                            // will not be used
                            self.iter.start = val.wrapping_add(step);
                            self.iter.end = remaining - 1;
                            Some(val)
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next (ε : 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~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u16"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u16",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u16" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| remaining |), Value.Integer IntegerKind.U16 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ val :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |),
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u16", "wrapping_add", [] |),
                              [ M.read (| val |); M.read (| step |) ]
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.U16 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple "core::option::Option::Some" [ M.read (| val |) ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_size_hint(&self) -> (usize, Option<usize>) {
                        let remaining = self.iter.end as usize;
                        (remaining, Some(remaining))
                    }
        *)
        Definition spec_size_hint (ε : 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~ remaining :=
                  M.alloc (|
                    M.rust_cast
                      (M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::iter::adapters::step_by::StepBy",
                            "iter"
                          |),
                          "core::ops::range::Range",
                          "end"
                        |)
                      |))
                  |) in
                M.alloc (|
                  Value.Tuple
                    [
                      M.read (| remaining |);
                      Value.StructTuple "core::option::Option::Some" [ M.read (| remaining |) ]
                    ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth(&mut self, n: usize) -> Option<Self::Item> {
                        self.advance_by(n).ok()?;
                        self.next()
                    }
        *)
        Definition spec_nth (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [
                                      Ty.tuple [];
                                      Ty.apply
                                        (Ty.path "core::num::nonzero::NonZero")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                  "ok",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "u16" ]
                                        ],
                                      [],
                                      "advance_by",
                                      []
                                    |),
                                    [ M.read (| self |); M.read (| n |) ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          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::option::Option")
                                            []
                                            [ Ty.path "u16" ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::option::Option")
                                              []
                                              [ Ty.path "core::convert::Infallible" ]
                                          ],
                                          "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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ] ],
                          [],
                          "next",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_fold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                        where
                            F: FnMut(Acc, Self::Item) -> R,
                            R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "u16" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "u16" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_fold<Acc, F>(self, init: Acc, mut f: F) -> Acc
                        where
                            F: FnMut(Acc, Self::Item) -> Acc
                    {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        let mut acc = init;
                        let mut val = self.iter.start;
                        for _ in 0..remaining {
                            acc = f(acc, val);
                            // this can only overflow during the last step, after which the value
                            // will no longer be used
                            val = val.wrapping_add(step);
                        }
                        acc
                    }
        *)
        Definition spec_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u16"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u16",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u16" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ self ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                let~ acc := M.copy (| init |) in
                let~ val :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "start"
                    |)
                  |) 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 "u16" ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", Value.Integer IntegerKind.U16 0);
                                ("end_", M.read (| remaining |))
                              ]
                          ]
                        |)
                      |),
                      [
                        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 "u16" ],
                                          [],
                                          "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~ _ :=
                                            M.write (|
                                              acc,
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::FnMut",
                                                  F,
                                                  [ Ty.tuple [ Acc; Ty.path "u16" ] ],
                                                  "call_mut",
                                                  []
                                                |),
                                                [
                                                  f;
                                                  Value.Tuple [ M.read (| acc |); M.read (| val |) ]
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.write (|
                                              val,
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "u16",
                                                  "wrapping_add",
                                                  []
                                                |),
                                                [ M.read (| val |); M.read (| step |) ]
                                              |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                acc
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ] ]
            (* Instance *)
            [
              ("spec_next", InstanceField.Method spec_next);
              ("spec_size_hint", InstanceField.Method spec_size_hint);
              ("spec_nth", InstanceField.Method spec_nth);
              ("spec_try_fold", InstanceField.Method spec_try_fold);
              ("spec_fold", InstanceField.Method spec_fold)
            ].
      End Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u16_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u16.
      
      Module Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u32_for_core_ops_range_Range_u32.
        Definition Self : Ty.t := Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ].
        
        (*
                    fn setup(mut r: Range<$t>, step: usize) -> Range<$t> {
                        let inner_len = r.size_hint().0;
                        // If step exceeds $t::MAX, then the count will be at most 1 and
                        // thus always fit into $t.
                        let yield_count = inner_len.div_ceil(step);
                        // Turn the range end into an iteration counter
                        r.end = yield_count as $t;
                        r
                    }
        *)
        Definition setup (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ r; step ] =>
            ltac:(M.monadic
              (let r := M.alloc (| r |) in
              let step := M.alloc (| step |) in
              M.read (|
                let~ inner_len :=
                  M.copy (|
                    M.SubPointer.get_tuple_field (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ],
                            [],
                            "size_hint",
                            []
                          |),
                          [ r ]
                        |)
                      |),
                      0
                    |)
                  |) in
                let~ yield_count :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "usize", "div_ceil", [] |),
                      [ M.read (| inner_len |); M.read (| step |) ]
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (| r, "core::ops::range::Range", "end" |),
                    M.rust_cast (M.read (| yield_count |))
                  |) in
                r
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::SpecRangeSetup"
            Self
            (* Trait polymorphic types *)
            [ (* T *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ] ]
            (* Instance *) [ ("setup", InstanceField.Method setup) ].
      End Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u32_for_core_ops_range_Range_u32.
      
      Module Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u32_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u32.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ] ].
        
        (*
                    fn spec_next(&mut self) -> Option<$t> {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let val = self.iter.start;
                            // this can only overflow during the last step, after which the value
                            // will not be used
                            self.iter.start = val.wrapping_add(step);
                            self.iter.end = remaining - 1;
                            Some(val)
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next (ε : 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~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u32"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u32",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u32" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| remaining |), Value.Integer IntegerKind.U32 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ val :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |),
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u32", "wrapping_add", [] |),
                              [ M.read (| val |); M.read (| step |) ]
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.U32 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple "core::option::Option::Some" [ M.read (| val |) ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_size_hint(&self) -> (usize, Option<usize>) {
                        let remaining = self.iter.end as usize;
                        (remaining, Some(remaining))
                    }
        *)
        Definition spec_size_hint (ε : 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~ remaining :=
                  M.alloc (|
                    M.rust_cast
                      (M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::iter::adapters::step_by::StepBy",
                            "iter"
                          |),
                          "core::ops::range::Range",
                          "end"
                        |)
                      |))
                  |) in
                M.alloc (|
                  Value.Tuple
                    [
                      M.read (| remaining |);
                      Value.StructTuple "core::option::Option::Some" [ M.read (| remaining |) ]
                    ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth(&mut self, n: usize) -> Option<Self::Item> {
                        self.advance_by(n).ok()?;
                        self.next()
                    }
        *)
        Definition spec_nth (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [
                                      Ty.tuple [];
                                      Ty.apply
                                        (Ty.path "core::num::nonzero::NonZero")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                  "ok",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "u32" ]
                                        ],
                                      [],
                                      "advance_by",
                                      []
                                    |),
                                    [ M.read (| self |); M.read (| n |) ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          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::option::Option")
                                            []
                                            [ Ty.path "u32" ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::option::Option")
                                              []
                                              [ Ty.path "core::convert::Infallible" ]
                                          ],
                                          "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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ] ],
                          [],
                          "next",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_fold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                        where
                            F: FnMut(Acc, Self::Item) -> R,
                            R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "u32" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "u32" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_fold<Acc, F>(self, init: Acc, mut f: F) -> Acc
                        where
                            F: FnMut(Acc, Self::Item) -> Acc
                    {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        let mut acc = init;
                        let mut val = self.iter.start;
                        for _ in 0..remaining {
                            acc = f(acc, val);
                            // this can only overflow during the last step, after which the value
                            // will no longer be used
                            val = val.wrapping_add(step);
                        }
                        acc
                    }
        *)
        Definition spec_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u32"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u32",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u32" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ self ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                let~ acc := M.copy (| init |) in
                let~ val :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "start"
                    |)
                  |) 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 "u32" ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", Value.Integer IntegerKind.U32 0);
                                ("end_", M.read (| remaining |))
                              ]
                          ]
                        |)
                      |),
                      [
                        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 "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~ _ :=
                                            M.write (|
                                              acc,
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::FnMut",
                                                  F,
                                                  [ Ty.tuple [ Acc; Ty.path "u32" ] ],
                                                  "call_mut",
                                                  []
                                                |),
                                                [
                                                  f;
                                                  Value.Tuple [ M.read (| acc |); M.read (| val |) ]
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.write (|
                                              val,
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "u32",
                                                  "wrapping_add",
                                                  []
                                                |),
                                                [ M.read (| val |); M.read (| step |) ]
                                              |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                acc
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ] ]
            (* Instance *)
            [
              ("spec_next", InstanceField.Method spec_next);
              ("spec_size_hint", InstanceField.Method spec_size_hint);
              ("spec_nth", InstanceField.Method spec_nth);
              ("spec_try_fold", InstanceField.Method spec_try_fold);
              ("spec_fold", InstanceField.Method spec_fold)
            ].
      End Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u32_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u32.
      
      Module Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u64_for_core_ops_range_Range_u64.
        Definition Self : Ty.t := Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u64" ].
        
        (*
                    fn setup(mut r: Range<$t>, step: usize) -> Range<$t> {
                        let inner_len = r.size_hint().0;
                        // If step exceeds $t::MAX, then the count will be at most 1 and
                        // thus always fit into $t.
                        let yield_count = inner_len.div_ceil(step);
                        // Turn the range end into an iteration counter
                        r.end = yield_count as $t;
                        r
                    }
        *)
        Definition setup (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ r; step ] =>
            ltac:(M.monadic
              (let r := M.alloc (| r |) in
              let step := M.alloc (| step |) in
              M.read (|
                let~ inner_len :=
                  M.copy (|
                    M.SubPointer.get_tuple_field (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u64" ],
                            [],
                            "size_hint",
                            []
                          |),
                          [ r ]
                        |)
                      |),
                      0
                    |)
                  |) in
                let~ yield_count :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "usize", "div_ceil", [] |),
                      [ M.read (| inner_len |); M.read (| step |) ]
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (| r, "core::ops::range::Range", "end" |),
                    M.rust_cast (M.read (| yield_count |))
                  |) in
                r
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::SpecRangeSetup"
            Self
            (* Trait polymorphic types *)
            [ (* T *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u64" ] ]
            (* Instance *) [ ("setup", InstanceField.Method setup) ].
      End Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_u64_for_core_ops_range_Range_u64.
      
      Module Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u64_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u64.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u64" ] ].
        
        (*
                    fn spec_next(&mut self) -> Option<$t> {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let val = self.iter.start;
                            // this can only overflow during the last step, after which the value
                            // will not be used
                            self.iter.start = val.wrapping_add(step);
                            self.iter.end = remaining - 1;
                            Some(val)
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next (ε : 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~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u64"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u64",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u64" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| remaining |), Value.Integer IntegerKind.U64 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ val :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |),
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u64", "wrapping_add", [] |),
                              [ M.read (| val |); M.read (| step |) ]
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.U64 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple "core::option::Option::Some" [ M.read (| val |) ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_size_hint(&self) -> (usize, Option<usize>) {
                        let remaining = self.iter.end as usize;
                        (remaining, Some(remaining))
                    }
        *)
        Definition spec_size_hint (ε : 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~ remaining :=
                  M.alloc (|
                    M.rust_cast
                      (M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::iter::adapters::step_by::StepBy",
                            "iter"
                          |),
                          "core::ops::range::Range",
                          "end"
                        |)
                      |))
                  |) in
                M.alloc (|
                  Value.Tuple
                    [
                      M.read (| remaining |);
                      Value.StructTuple "core::option::Option::Some" [ M.read (| remaining |) ]
                    ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth(&mut self, n: usize) -> Option<Self::Item> {
                        self.advance_by(n).ok()?;
                        self.next()
                    }
        *)
        Definition spec_nth (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [
                                      Ty.tuple [];
                                      Ty.apply
                                        (Ty.path "core::num::nonzero::NonZero")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                  "ok",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "u64" ]
                                        ],
                                      [],
                                      "advance_by",
                                      []
                                    |),
                                    [ M.read (| self |); M.read (| n |) ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          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::option::Option")
                                            []
                                            [ Ty.path "u64" ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::option::Option")
                                              []
                                              [ Ty.path "core::convert::Infallible" ]
                                          ],
                                          "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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u64" ] ],
                          [],
                          "next",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_fold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                        where
                            F: FnMut(Acc, Self::Item) -> R,
                            R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "u64" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "u64" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_fold<Acc, F>(self, init: Acc, mut f: F) -> Acc
                        where
                            F: FnMut(Acc, Self::Item) -> Acc
                    {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        let mut acc = init;
                        let mut val = self.iter.start;
                        for _ in 0..remaining {
                            acc = f(acc, val);
                            // this can only overflow during the last step, after which the value
                            // will no longer be used
                            val = val.wrapping_add(step);
                        }
                        acc
                    }
        *)
        Definition spec_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "u64"; Ty.path "core::num::error::TryFromIntError" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "u64",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "u64" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ self ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                let~ acc := M.copy (| init |) in
                let~ val :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "start"
                    |)
                  |) 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 "u64" ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start", Value.Integer IntegerKind.U64 0);
                                ("end_", M.read (| remaining |))
                              ]
                          ]
                        |)
                      |),
                      [
                        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 "u64" ],
                                          [],
                                          "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~ _ :=
                                            M.write (|
                                              acc,
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::FnMut",
                                                  F,
                                                  [ Ty.tuple [ Acc; Ty.path "u64" ] ],
                                                  "call_mut",
                                                  []
                                                |),
                                                [
                                                  f;
                                                  Value.Tuple [ M.read (| acc |); M.read (| val |) ]
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.write (|
                                              val,
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "u64",
                                                  "wrapping_add",
                                                  []
                                                |),
                                                [ M.read (| val |); M.read (| step |) ]
                                              |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                acc
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u64" ] ]
            (* Instance *)
            [
              ("spec_next", InstanceField.Method spec_next);
              ("spec_size_hint", InstanceField.Method spec_size_hint);
              ("spec_nth", InstanceField.Method spec_nth);
              ("spec_try_fold", InstanceField.Method spec_try_fold);
              ("spec_fold", InstanceField.Method spec_fold)
            ].
      End Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_u64_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u64.
      
      Module Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_usize_for_core_ops_range_Range_usize.
        Definition Self : Ty.t :=
          Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ].
        
        (*
                    fn setup(mut r: Range<$t>, step: usize) -> Range<$t> {
                        let inner_len = r.size_hint().0;
                        // If step exceeds $t::MAX, then the count will be at most 1 and
                        // thus always fit into $t.
                        let yield_count = inner_len.div_ceil(step);
                        // Turn the range end into an iteration counter
                        r.end = yield_count as $t;
                        r
                    }
        *)
        Definition setup (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ r; step ] =>
            ltac:(M.monadic
              (let r := M.alloc (| r |) in
              let step := M.alloc (| step |) in
              M.read (|
                let~ inner_len :=
                  M.copy (|
                    M.SubPointer.get_tuple_field (|
                      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" ],
                            [],
                            "size_hint",
                            []
                          |),
                          [ r ]
                        |)
                      |),
                      0
                    |)
                  |) in
                let~ yield_count :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "usize", "div_ceil", [] |),
                      [ M.read (| inner_len |); M.read (| step |) ]
                    |)
                  |) in
                let~ _ :=
                  M.write (|
                    M.SubPointer.get_struct_record_field (| r, "core::ops::range::Range", "end" |),
                    M.read (| M.use yield_count |)
                  |) in
                r
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::SpecRangeSetup"
            Self
            (* Trait polymorphic types *)
            [ (* T *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ]
            (* Instance *) [ ("setup", InstanceField.Method setup) ].
      End Impl_core_iter_adapters_step_by_SpecRangeSetup_core_ops_range_Range_usize_for_core_ops_range_Range_usize.
      
      Module Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_usize_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_usize.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ].
        
        (*
                    fn spec_next(&mut self) -> Option<$t> {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let val = self.iter.start;
                            // this can only overflow during the last step, after which the value
                            // will not be used
                            self.iter.start = val.wrapping_add(step);
                            self.iter.end = remaining - 1;
                            Some(val)
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next (ε : 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~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "usize"; Ty.path "core::convert::Infallible" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "usize",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "usize" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (|
                                M.read (| remaining |),
                                Value.Integer IntegerKind.Usize 0
                              |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ val :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |),
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "usize", "wrapping_add", [] |),
                              [ M.read (| val |); M.read (| step |) ]
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.Usize 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple "core::option::Option::Some" [ M.read (| val |) ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_size_hint(&self) -> (usize, Option<usize>) {
                        let remaining = self.iter.end as usize;
                        (remaining, Some(remaining))
                    }
        *)
        Definition spec_size_hint (ε : 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~ remaining :=
                  M.copy (|
                    M.use
                      (M.SubPointer.get_struct_record_field (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::step_by::StepBy",
                          "iter"
                        |),
                        "core::ops::range::Range",
                        "end"
                      |))
                  |) in
                M.alloc (|
                  Value.Tuple
                    [
                      M.read (| remaining |);
                      Value.StructTuple "core::option::Option::Some" [ M.read (| remaining |) ]
                    ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth(&mut self, n: usize) -> Option<Self::Item> {
                        self.advance_by(n).ok()?;
                        self.next()
                    }
        *)
        Definition spec_nth (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::ops::try_trait::Try",
                              Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ],
                              [],
                              "branch",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [
                                      Ty.tuple [];
                                      Ty.apply
                                        (Ty.path "core::num::nonzero::NonZero")
                                        []
                                        [ Ty.path "usize" ]
                                    ],
                                  "ok",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "usize" ]
                                        ],
                                      [],
                                      "advance_by",
                                      []
                                    |),
                                    [ M.read (| self |); M.read (| n |) ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        |),
                        [
                          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::option::Option")
                                            []
                                            [ Ty.path "usize" ],
                                          [
                                            Ty.apply
                                              (Ty.path "core::option::Option")
                                              []
                                              [ Ty.path "core::convert::Infallible" ]
                                          ],
                                          "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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ],
                          [],
                          "next",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_fold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                        where
                            F: FnMut(Acc, Self::Item) -> R,
                            R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "usize" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_fold<Acc, F>(self, init: Acc, mut f: F) -> Acc
                        where
                            F: FnMut(Acc, Self::Item) -> Acc
                    {
                        // if a step size larger than the type has been specified fall back to
                        // t::MAX, in which case remaining will be at most 1.
                        let step = <$t>::try_from(self.original_step().get()).unwrap_or(<$t>::MAX);
                        let remaining = self.iter.end;
                        let mut acc = init;
                        let mut val = self.iter.start;
                        for _ in 0..remaining {
                            acc = f(acc, val);
                            // this can only overflow during the last step, after which the value
                            // will no longer be used
                            val = val.wrapping_add(step);
                        }
                        acc
                    }
        *)
        Definition spec_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ step :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.path "usize"; Ty.path "core::convert::Infallible" ],
                        "unwrap_or",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::convert::TryFrom",
                            Ty.path "usize",
                            [ Ty.path "usize" ],
                            "try_from",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::num::nonzero::NonZero")
                                  []
                                  [ Ty.path "usize" ],
                                "get",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::step_by::StepBy")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::Range")
                                          []
                                          [ Ty.path "usize" ]
                                      ],
                                    "original_step",
                                    []
                                  |),
                                  [ self ]
                                |)
                              ]
                            |)
                          ]
                        |);
                        M.read (| M.get_constant (| "core::num::MAX" |) |)
                      ]
                    |)
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                let~ acc := M.copy (| init |) in
                let~ val :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "start"
                    |)
                  |) 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 (| remaining |))
                              ]
                          ]
                        |)
                      |),
                      [
                        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~ _ :=
                                            M.write (|
                                              acc,
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::FnMut",
                                                  F,
                                                  [ Ty.tuple [ Acc; Ty.path "usize" ] ],
                                                  "call_mut",
                                                  []
                                                |),
                                                [
                                                  f;
                                                  Value.Tuple [ M.read (| acc |); M.read (| val |) ]
                                                ]
                                              |)
                                            |) in
                                          let~ _ :=
                                            M.write (|
                                              val,
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "usize",
                                                  "wrapping_add",
                                                  []
                                                |),
                                                [ M.read (| val |); M.read (| step |) ]
                                              |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                acc
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ]
            (* Instance *)
            [
              ("spec_next", InstanceField.Method spec_next);
              ("spec_size_hint", InstanceField.Method spec_size_hint);
              ("spec_nth", InstanceField.Method spec_nth);
              ("spec_try_fold", InstanceField.Method spec_try_fold);
              ("spec_fold", InstanceField.Method spec_fold)
            ].
      End Impl_core_iter_adapters_step_by_StepByImpl_core_ops_range_Range_usize_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_usize.
      
      Module Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_u8_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u8.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ] ].
        
        (*
                    fn spec_next_back(&mut self) -> Option<Self::Item> {
                        let step = self.original_step().get() as $t;
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let start = self.iter.start;
                            self.iter.end = remaining - 1;
                            Some(start + step * (remaining - 1))
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next_back (ε : 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~ step :=
                  M.alloc (|
                    M.rust_cast
                      (M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ],
                          "get",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::iter::adapters::step_by::StepBy")
                                []
                                [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ]
                                ],
                              "original_step",
                              []
                            |),
                            [ M.read (| self |) ]
                          |)
                        ]
                      |))
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| remaining |), Value.Integer IntegerKind.U8 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ start :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.U8 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple
                            "core::option::Option::Some"
                            [
                              BinOp.Wrap.add (|
                                M.read (| start |),
                                BinOp.Wrap.mul (|
                                  M.read (| step |),
                                  BinOp.Wrap.sub (|
                                    M.read (| remaining |),
                                    Value.Integer IntegerKind.U8 1
                                  |)
                                |)
                              |)
                            ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item> {
                        if self.advance_back_by(n).is_err() {
                            return None;
                        }
                        self.next_back()
                    }
        *)
        Definition spec_nth_back (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.tuple [];
                                            Ty.apply
                                              (Ty.path "core::num::nonzero::NonZero")
                                              []
                                              [ Ty.path "usize" ]
                                          ],
                                        "is_err",
                                        []
                                      |),
                                      [
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::double_ended::DoubleEndedIterator",
                                              Ty.apply
                                                (Ty.path "core::iter::adapters::step_by::StepBy")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::ops::range::Range")
                                                    []
                                                    [ Ty.path "u8" ]
                                                ],
                                              [],
                                              "advance_back_by",
                                              []
                                            |),
                                            [ M.read (| self |); M.read (| n |) ]
                                          |)
                                        |)
                                      ]
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      Value.StructTuple "core::option::Option::None" []
                                    |)
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::double_ended::DoubleEndedIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ] ],
                          [],
                          "next_back",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                    where
                        F: FnMut(Acc, Self::Item) -> R,
                        R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::double_ended::DoubleEndedIterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "u8" ]
                                            ],
                                          [],
                                          "next_back",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "u8" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
                    where
                        F: FnMut(Acc, Self::Item) -> Acc
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x);
                        }
                        accum
                    }
        *)
        Definition spec_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ accum := M.copy (| init |) in
                let~ _ :=
                  M.loop (|
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::double_ended::DoubleEndedIterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "u8" ]
                                        ],
                                      [],
                                      "next_back",
                                      []
                                    |),
                                    [ self ]
                                  |)
                                |) in
                              let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::option::Option::Some",
                                  0
                                |) in
                              let x := M.copy (| γ0_0 |) in
                              let~ _ :=
                                M.write (|
                                  accum,
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::function::FnMut",
                                      F,
                                      [ Ty.tuple [ Acc; Ty.path "u8" ] ],
                                      "call_mut",
                                      []
                                    |),
                                    [ f; Value.Tuple [ M.read (| accum |); M.read (| x |) ] ]
                                  |)
                                |) 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
                accum
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByBackImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u8" ] ]
            (* Instance *)
            [
              ("spec_next_back", InstanceField.Method spec_next_back);
              ("spec_nth_back", InstanceField.Method spec_nth_back);
              ("spec_try_rfold", InstanceField.Method spec_try_rfold);
              ("spec_rfold", InstanceField.Method spec_rfold)
            ].
      End Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_u8_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u8.
      
      Module Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_u16_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u16.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ] ].
        
        (*
                    fn spec_next_back(&mut self) -> Option<Self::Item> {
                        let step = self.original_step().get() as $t;
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let start = self.iter.start;
                            self.iter.end = remaining - 1;
                            Some(start + step * (remaining - 1))
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next_back (ε : 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~ step :=
                  M.alloc (|
                    M.rust_cast
                      (M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ],
                          "get",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::iter::adapters::step_by::StepBy")
                                []
                                [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ]
                                ],
                              "original_step",
                              []
                            |),
                            [ M.read (| self |) ]
                          |)
                        ]
                      |))
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| remaining |), Value.Integer IntegerKind.U16 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ start :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.U16 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple
                            "core::option::Option::Some"
                            [
                              BinOp.Wrap.add (|
                                M.read (| start |),
                                BinOp.Wrap.mul (|
                                  M.read (| step |),
                                  BinOp.Wrap.sub (|
                                    M.read (| remaining |),
                                    Value.Integer IntegerKind.U16 1
                                  |)
                                |)
                              |)
                            ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item> {
                        if self.advance_back_by(n).is_err() {
                            return None;
                        }
                        self.next_back()
                    }
        *)
        Definition spec_nth_back (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.tuple [];
                                            Ty.apply
                                              (Ty.path "core::num::nonzero::NonZero")
                                              []
                                              [ Ty.path "usize" ]
                                          ],
                                        "is_err",
                                        []
                                      |),
                                      [
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::double_ended::DoubleEndedIterator",
                                              Ty.apply
                                                (Ty.path "core::iter::adapters::step_by::StepBy")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::ops::range::Range")
                                                    []
                                                    [ Ty.path "u16" ]
                                                ],
                                              [],
                                              "advance_back_by",
                                              []
                                            |),
                                            [ M.read (| self |); M.read (| n |) ]
                                          |)
                                        |)
                                      ]
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      Value.StructTuple "core::option::Option::None" []
                                    |)
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::double_ended::DoubleEndedIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ] ],
                          [],
                          "next_back",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                    where
                        F: FnMut(Acc, Self::Item) -> R,
                        R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::double_ended::DoubleEndedIterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "u16" ]
                                            ],
                                          [],
                                          "next_back",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "u16" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
                    where
                        F: FnMut(Acc, Self::Item) -> Acc
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x);
                        }
                        accum
                    }
        *)
        Definition spec_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ accum := M.copy (| init |) in
                let~ _ :=
                  M.loop (|
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::double_ended::DoubleEndedIterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "u16" ]
                                        ],
                                      [],
                                      "next_back",
                                      []
                                    |),
                                    [ self ]
                                  |)
                                |) in
                              let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::option::Option::Some",
                                  0
                                |) in
                              let x := M.copy (| γ0_0 |) in
                              let~ _ :=
                                M.write (|
                                  accum,
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::function::FnMut",
                                      F,
                                      [ Ty.tuple [ Acc; Ty.path "u16" ] ],
                                      "call_mut",
                                      []
                                    |),
                                    [ f; Value.Tuple [ M.read (| accum |); M.read (| x |) ] ]
                                  |)
                                |) 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
                accum
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByBackImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u16" ] ]
            (* Instance *)
            [
              ("spec_next_back", InstanceField.Method spec_next_back);
              ("spec_nth_back", InstanceField.Method spec_nth_back);
              ("spec_try_rfold", InstanceField.Method spec_try_rfold);
              ("spec_rfold", InstanceField.Method spec_rfold)
            ].
      End Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_u16_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u16.
      
      Module Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_u32_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u32.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ] ].
        
        (*
                    fn spec_next_back(&mut self) -> Option<Self::Item> {
                        let step = self.original_step().get() as $t;
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let start = self.iter.start;
                            self.iter.end = remaining - 1;
                            Some(start + step * (remaining - 1))
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next_back (ε : 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~ step :=
                  M.alloc (|
                    M.rust_cast
                      (M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ],
                          "get",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::iter::adapters::step_by::StepBy")
                                []
                                [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ]
                                ],
                              "original_step",
                              []
                            |),
                            [ M.read (| self |) ]
                          |)
                        ]
                      |))
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (| M.read (| remaining |), Value.Integer IntegerKind.U32 0 |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ start :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.U32 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple
                            "core::option::Option::Some"
                            [
                              BinOp.Wrap.add (|
                                M.read (| start |),
                                BinOp.Wrap.mul (|
                                  M.read (| step |),
                                  BinOp.Wrap.sub (|
                                    M.read (| remaining |),
                                    Value.Integer IntegerKind.U32 1
                                  |)
                                |)
                              |)
                            ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item> {
                        if self.advance_back_by(n).is_err() {
                            return None;
                        }
                        self.next_back()
                    }
        *)
        Definition spec_nth_back (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.tuple [];
                                            Ty.apply
                                              (Ty.path "core::num::nonzero::NonZero")
                                              []
                                              [ Ty.path "usize" ]
                                          ],
                                        "is_err",
                                        []
                                      |),
                                      [
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::double_ended::DoubleEndedIterator",
                                              Ty.apply
                                                (Ty.path "core::iter::adapters::step_by::StepBy")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::ops::range::Range")
                                                    []
                                                    [ Ty.path "u32" ]
                                                ],
                                              [],
                                              "advance_back_by",
                                              []
                                            |),
                                            [ M.read (| self |); M.read (| n |) ]
                                          |)
                                        |)
                                      ]
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      Value.StructTuple "core::option::Option::None" []
                                    |)
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::double_ended::DoubleEndedIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ] ],
                          [],
                          "next_back",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                    where
                        F: FnMut(Acc, Self::Item) -> R,
                        R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::double_ended::DoubleEndedIterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "u32" ]
                                            ],
                                          [],
                                          "next_back",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "u32" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
                    where
                        F: FnMut(Acc, Self::Item) -> Acc
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x);
                        }
                        accum
                    }
        *)
        Definition spec_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ accum := M.copy (| init |) in
                let~ _ :=
                  M.loop (|
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::double_ended::DoubleEndedIterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "u32" ]
                                        ],
                                      [],
                                      "next_back",
                                      []
                                    |),
                                    [ self ]
                                  |)
                                |) in
                              let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::option::Option::Some",
                                  0
                                |) in
                              let x := M.copy (| γ0_0 |) in
                              let~ _ :=
                                M.write (|
                                  accum,
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::function::FnMut",
                                      F,
                                      [ Ty.tuple [ Acc; Ty.path "u32" ] ],
                                      "call_mut",
                                      []
                                    |),
                                    [ f; Value.Tuple [ M.read (| accum |); M.read (| x |) ] ]
                                  |)
                                |) 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
                accum
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByBackImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "u32" ] ]
            (* Instance *)
            [
              ("spec_next_back", InstanceField.Method spec_next_back);
              ("spec_nth_back", InstanceField.Method spec_nth_back);
              ("spec_try_rfold", InstanceField.Method spec_try_rfold);
              ("spec_rfold", InstanceField.Method spec_rfold)
            ].
      End Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_u32_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_u32.
      
      Module Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_usize_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_usize.
        Definition Self : Ty.t :=
          Ty.apply
            (Ty.path "core::iter::adapters::step_by::StepBy")
            []
            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ].
        
        (*
                    fn spec_next_back(&mut self) -> Option<Self::Item> {
                        let step = self.original_step().get() as $t;
                        let remaining = self.iter.end;
                        if remaining > 0 {
                            let start = self.iter.start;
                            self.iter.end = remaining - 1;
                            Some(start + step * (remaining - 1))
                        } else {
                            None
                        }
                    }
        *)
        Definition spec_next_back (ε : 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~ step :=
                  M.copy (|
                    M.use
                      (M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ],
                            "get",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "core::iter::adapters::step_by::StepBy")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::Range")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                "original_step",
                                []
                              |),
                              [ M.read (| self |) ]
                            |)
                          ]
                        |)
                      |))
                  |) in
                let~ remaining :=
                  M.copy (|
                    M.SubPointer.get_struct_record_field (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::step_by::StepBy",
                        "iter"
                      |),
                      "core::ops::range::Range",
                      "end"
                    |)
                  |) in
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.gt (|
                                M.read (| remaining |),
                                Value.Integer IntegerKind.Usize 0
                              |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ start :=
                          M.copy (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "start"
                            |)
                          |) in
                        let~ _ :=
                          M.write (|
                            M.SubPointer.get_struct_record_field (|
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "core::iter::adapters::step_by::StepBy",
                                "iter"
                              |),
                              "core::ops::range::Range",
                              "end"
                            |),
                            BinOp.Wrap.sub (|
                              M.read (| remaining |),
                              Value.Integer IntegerKind.Usize 1
                            |)
                          |) in
                        M.alloc (|
                          Value.StructTuple
                            "core::option::Option::Some"
                            [
                              BinOp.Wrap.add (|
                                M.read (| start |),
                                BinOp.Wrap.mul (|
                                  M.read (| step |),
                                  BinOp.Wrap.sub (|
                                    M.read (| remaining |),
                                    Value.Integer IntegerKind.Usize 1
                                  |)
                                |)
                              |)
                            ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item> {
                        if self.advance_back_by(n).is_err() {
                            return None;
                        }
                        self.next_back()
                    }
        *)
        Definition spec_nth_back (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [], [ self; n ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let n := M.alloc (| n |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.tuple [];
                                            Ty.apply
                                              (Ty.path "core::num::nonzero::NonZero")
                                              []
                                              [ Ty.path "usize" ]
                                          ],
                                        "is_err",
                                        []
                                      |),
                                      [
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::double_ended::DoubleEndedIterator",
                                              Ty.apply
                                                (Ty.path "core::iter::adapters::step_by::StepBy")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::ops::range::Range")
                                                    []
                                                    [ Ty.path "usize" ]
                                                ],
                                              [],
                                              "advance_back_by",
                                              []
                                            |),
                                            [ M.read (| self |); M.read (| n |) ]
                                          |)
                                        |)
                                      ]
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    M.return_ (|
                                      Value.StructTuple "core::option::Option::None" []
                                    |)
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::double_ended::DoubleEndedIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::step_by::StepBy")
                            []
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ],
                          [],
                          "next_back",
                          []
                        |),
                        [ M.read (| self |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
                    where
                        F: FnMut(Acc, Self::Item) -> R,
                        R: Try<Output = Acc>
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x)?;
                        }
                        try { accum }
                    }
        *)
        Definition spec_try_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F; R ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.catch_return (|
                ltac:(M.monadic
                  (M.read (|
                    let~ accum := M.copy (| init |) in
                    let~ _ :=
                      M.loop (|
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::double_ended::DoubleEndedIterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::step_by::StepBy")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::Range")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                          [],
                                          "next_back",
                                          []
                                        |),
                                        [ M.read (| self |) ]
                                      |)
                                    |) in
                                  let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::option::Option::Some",
                                      0
                                    |) in
                                  let x := M.copy (| γ0_0 |) in
                                  let~ _ :=
                                    M.write (|
                                      accum,
                                      M.read (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                R,
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::function::FnMut",
                                                    F,
                                                    [ Ty.tuple [ Acc; Ty.path "usize" ] ],
                                                    "call_mut",
                                                    []
                                                  |),
                                                  [
                                                    f;
                                                    Value.Tuple
                                                      [ M.read (| accum |); M.read (| x |) ]
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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",
                                                            R,
                                                            [ Ty.associated ],
                                                            "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 [] |)));
                              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 (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          R,
                          [],
                          "from_output",
                          []
                        |),
                        [ M.read (| accum |) ]
                      |)
                    |)
                  |)))
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
                    fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
                    where
                        F: FnMut(Acc, Self::Item) -> Acc
                    {
                        let mut accum = init;
                        while let Some(x) = self.next_back() {
                            accum = f(accum, x);
                        }
                        accum
                    }
        *)
        Definition spec_rfold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          match ε, τ, α with
          | [], [ Acc; F ], [ self; init; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let f := M.alloc (| f |) in
              M.read (|
                let~ accum := M.copy (| init |) in
                let~ _ :=
                  M.loop (|
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::double_ended::DoubleEndedIterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::step_by::StepBy")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::ops::range::Range")
                                            []
                                            [ Ty.path "usize" ]
                                        ],
                                      [],
                                      "next_back",
                                      []
                                    |),
                                    [ self ]
                                  |)
                                |) in
                              let γ0_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ,
                                  "core::option::Option::Some",
                                  0
                                |) in
                              let x := M.copy (| γ0_0 |) in
                              let~ _ :=
                                M.write (|
                                  accum,
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::function::FnMut",
                                      F,
                                      [ Ty.tuple [ Acc; Ty.path "usize" ] ],
                                      "call_mut",
                                      []
                                    |),
                                    [ f; Value.Tuple [ M.read (| accum |); M.read (| x |) ] ]
                                  |)
                                |) 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
                accum
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          M.IsTraitInstance
            "core::iter::adapters::step_by::StepByBackImpl"
            Self
            (* Trait polymorphic types *)
            [ (* I *) Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ]
            (* Instance *)
            [
              ("spec_next_back", InstanceField.Method spec_next_back);
              ("spec_nth_back", InstanceField.Method spec_nth_back);
              ("spec_try_rfold", InstanceField.Method spec_try_rfold);
              ("spec_rfold", InstanceField.Method spec_rfold)
            ].
      End Impl_core_iter_adapters_step_by_StepByBackImpl_core_ops_range_Range_usize_for_core_iter_adapters_step_by_StepBy_core_ops_range_Range_usize.
    End step_by.
  End adapters.
End iter.
