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

Module num.
  Module flt2dec.
    Definition value_MAX_SIG_DIGITS : Value.t :=
      M.run ltac:(M.monadic (M.alloc (| Value.Integer IntegerKind.Usize 17 |))).
    
    (*
    pub fn round_up(d: &mut [u8]) -> Option<u8> {
        match d.iter().rposition(|&c| c != b'9') {
            Some(i) => {
                // d[i+1..n] is all nines
                d[i] += 1;
                for j in i + 1..d.len() {
                    d[j] = b'0';
                }
                None
            }
            None if d.len() > 0 => {
                // 999..999 rounds to 1000..000 with an increased exponent
                d[0] = b'1';
                for j in 1..d.len() {
                    d[j] = b'0';
                }
                Some(b'0')
            }
            None => {
                // an empty buffer rounds up (a bit strange but reasonable)
                Some(b'1')
            }
        }
    }
    *)
    Definition round_up (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ d ] =>
        ltac:(M.monadic
          (let d := M.alloc (| d |) in
          M.read (|
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u8" ],
                    [],
                    "rposition",
                    [
                      Ty.function
                        [ Ty.tuple [ Ty.apply (Ty.path "&") [] [ Ty.path "u8" ] ] ]
                        (Ty.path "bool")
                    ]
                  |),
                  [
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                          "iter",
                          []
                        |),
                        [ M.read (| d |) ]
                      |)
                    |);
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ := M.read (| γ |) in
                                      let c := M.copy (| γ |) in
                                      BinOp.ne (|
                                        M.read (| c |),
                                        M.read (| UnsupportedLiteral |)
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ0_0 :=
                      M.SubPointer.get_struct_tuple_field (|
                        γ,
                        "core::option::Option::Some",
                        0
                      |) in
                    let i := M.copy (| γ0_0 |) in
                    let~ _ :=
                      let β := M.SubPointer.get_array_field (| M.read (| d |), i |) in
                      M.write (|
                        β,
                        BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U8 1 |)
                      |) in
                    let~ _ :=
                      M.use
                        (M.match_operator (|
                          M.alloc (|
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::collect::IntoIterator",
                                Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ],
                                [],
                                "into_iter",
                                []
                              |),
                              [
                                Value.StructRecord
                                  "core::ops::range::Range"
                                  [
                                    ("start",
                                      BinOp.Wrap.add (|
                                        M.read (| i |),
                                        Value.Integer IntegerKind.Usize 1
                                      |));
                                    ("end_",
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                          "len",
                                          []
                                        |),
                                        [ M.read (| d |) ]
                                      |))
                                  ]
                              ]
                            |)
                          |),
                          [
                            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 j := M.copy (| γ0_0 |) in
                                              let~ _ :=
                                                M.write (|
                                                  M.SubPointer.get_array_field (|
                                                    M.read (| d |),
                                                    j
                                                  |),
                                                  M.read (| UnsupportedLiteral |)
                                                |) in
                                              M.alloc (| Value.Tuple [] |)))
                                        ]
                                      |) in
                                    M.alloc (| Value.Tuple [] |)))
                                |)))
                          ]
                        |)) in
                    M.alloc (| Value.StructTuple "core::option::Option::None" [] |)));
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                    let γ :=
                      M.alloc (|
                        BinOp.gt (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                              "len",
                              []
                            |),
                            [ M.read (| d |) ]
                          |),
                          Value.Integer IntegerKind.Usize 0
                        |)
                      |) in
                    let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                    let~ _ :=
                      M.write (|
                        M.SubPointer.get_array_field (|
                          M.read (| d |),
                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                        |),
                        M.read (| UnsupportedLiteral |)
                      |) 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 1);
                                    ("end_",
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                          "len",
                                          []
                                        |),
                                        [ M.read (| d |) ]
                                      |))
                                  ]
                              ]
                            |)
                          |),
                          [
                            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 j := M.copy (| γ0_0 |) in
                                              let~ _ :=
                                                M.write (|
                                                  M.SubPointer.get_array_field (|
                                                    M.read (| d |),
                                                    j
                                                  |),
                                                  M.read (| UnsupportedLiteral |)
                                                |) in
                                              M.alloc (| Value.Tuple [] |)))
                                        ]
                                      |) in
                                    M.alloc (| Value.Tuple [] |)))
                                |)))
                          ]
                        |)) in
                    M.alloc (|
                      Value.StructTuple
                        "core::option::Option::Some"
                        [ M.read (| UnsupportedLiteral |) ]
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                    M.alloc (|
                      Value.StructTuple
                        "core::option::Option::Some"
                        [ M.read (| UnsupportedLiteral |) ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_round_up : M.IsFunction "core::num::flt2dec::round_up" round_up.
    
    (*
    fn digits_to_dec_str<'a>(
        buf: &'a [u8],
        exp: i16,
        frac_digits: usize,
        parts: &'a mut [MaybeUninit<Part<'a>>],
    ) -> &'a [Part<'a>] {
        assert!(!buf.is_empty());
        assert!(buf[0] > b'0');
        assert!(parts.len() >= 4);
    
        // if there is the restriction on the last digit position, `buf` is assumed to be
        // left-padded with the virtual zeroes. the number of virtual zeroes, `nzeroes`,
        // equals to `max(0, exp + frac_digits - buf.len())`, so that the position of
        // the last digit `exp - buf.len() - nzeroes` is no more than `-frac_digits`:
        //
        //                       |<-virtual->|
        //       |<---- buf ---->|  zeroes   |     exp
        //    0. 1 2 3 4 5 6 7 8 9 _ _ _ _ _ _ x 10
        //    |                  |           |
        // 10^exp    10^(exp-buf.len())   10^(exp-buf.len()-nzeroes)
        //
        // `nzeroes` is individually calculated for each case in order to avoid overflow.
    
        if exp <= 0 {
            // the decimal point is before rendered digits: [0.][000...000][1234][____]
            let minus_exp = -(exp as i32) as usize;
            parts[0] = MaybeUninit::new(Part::Copy(b"0."));
            parts[1] = MaybeUninit::new(Part::Zero(minus_exp));
            parts[2] = MaybeUninit::new(Part::Copy(buf));
            if frac_digits > buf.len() && frac_digits - buf.len() > minus_exp {
                parts[3] = MaybeUninit::new(Part::Zero((frac_digits - buf.len()) - minus_exp));
                // SAFETY: we just initialized the elements `..4`.
                unsafe { MaybeUninit::slice_assume_init_ref(&parts[..4]) }
            } else {
                // SAFETY: we just initialized the elements `..3`.
                unsafe { MaybeUninit::slice_assume_init_ref(&parts[..3]) }
            }
        } else {
            let exp = exp as usize;
            if exp < buf.len() {
                // the decimal point is inside rendered digits: [12][.][34][____]
                parts[0] = MaybeUninit::new(Part::Copy(&buf[..exp]));
                parts[1] = MaybeUninit::new(Part::Copy(b"."));
                parts[2] = MaybeUninit::new(Part::Copy(&buf[exp..]));
                if frac_digits > buf.len() - exp {
                    parts[3] = MaybeUninit::new(Part::Zero(frac_digits - (buf.len() - exp)));
                    // SAFETY: we just initialized the elements `..4`.
                    unsafe { MaybeUninit::slice_assume_init_ref(&parts[..4]) }
                } else {
                    // SAFETY: we just initialized the elements `..3`.
                    unsafe { MaybeUninit::slice_assume_init_ref(&parts[..3]) }
                }
            } else {
                // the decimal point is after rendered digits: [1234][____0000] or [1234][__][.][__].
                parts[0] = MaybeUninit::new(Part::Copy(buf));
                parts[1] = MaybeUninit::new(Part::Zero(exp - buf.len()));
                if frac_digits > 0 {
                    parts[2] = MaybeUninit::new(Part::Copy(b"."));
                    parts[3] = MaybeUninit::new(Part::Zero(frac_digits));
                    // SAFETY: we just initialized the elements `..4`.
                    unsafe { MaybeUninit::slice_assume_init_ref(&parts[..4]) }
                } else {
                    // SAFETY: we just initialized the elements `..2`.
                    unsafe { MaybeUninit::slice_assume_init_ref(&parts[..2]) }
                }
            }
        }
    }
    *)
    Definition digits_to_dec_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ buf; exp; frac_digits; parts ] =>
        ltac:(M.monadic
          (let buf := M.alloc (| buf |) in
          let exp := M.alloc (| exp |) in
          let frac_digits := M.alloc (| frac_digits |) in
          let parts := M.alloc (| parts |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              UnOp.not (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                    "is_empty",
                                    []
                                  |),
                                  [ M.read (| buf |) ]
                                |)
                              |)
                            |)
                          |)) 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: !buf.is_empty()" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.gt (|
                                M.read (|
                                  M.SubPointer.get_array_field (|
                                    M.read (| buf |),
                                    M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                  |)
                                |),
                                M.read (| UnsupportedLiteral |)
                              |)
                            |)
                          |)) 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: buf[0] > b'0'" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| parts |) ]
                                |),
                                Value.Integer IntegerKind.Usize 4
                              |)
                            |)
                          |)) 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: parts.len() >= 4" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            M.match_operator (|
              M.alloc (| Value.Tuple [] |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ :=
                      M.use
                        (M.alloc (|
                          BinOp.le (| M.read (| exp |), Value.Integer IntegerKind.I16 0 |)
                        |)) in
                    let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                    let~ minus_exp :=
                      M.alloc (| M.rust_cast (UnOp.neg (| M.rust_cast (M.read (| exp |)) |)) |) in
                    let~ _ :=
                      M.write (|
                        M.SubPointer.get_array_field (|
                          M.read (| parts |),
                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                        |),
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                              []
                              [ Ty.path "core::num::fmt::Part" ],
                            "new",
                            []
                          |),
                          [
                            Value.StructTuple
                              "core::num::fmt::Part::Copy"
                              [ M.read (| UnsupportedLiteral |) ]
                          ]
                        |)
                      |) in
                    let~ _ :=
                      M.write (|
                        M.SubPointer.get_array_field (|
                          M.read (| parts |),
                          M.alloc (| Value.Integer IntegerKind.Usize 1 |)
                        |),
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                              []
                              [ Ty.path "core::num::fmt::Part" ],
                            "new",
                            []
                          |),
                          [
                            Value.StructTuple
                              "core::num::fmt::Part::Zero"
                              [ M.read (| minus_exp |) ]
                          ]
                        |)
                      |) in
                    let~ _ :=
                      M.write (|
                        M.SubPointer.get_array_field (|
                          M.read (| parts |),
                          M.alloc (| Value.Integer IntegerKind.Usize 2 |)
                        |),
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                              []
                              [ Ty.path "core::num::fmt::Part" ],
                            "new",
                            []
                          |),
                          [ Value.StructTuple "core::num::fmt::Part::Copy" [ M.read (| buf |) ] ]
                        |)
                      |) in
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  LogicalOp.and (|
                                    BinOp.gt (|
                                      M.read (| frac_digits |),
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                          "len",
                                          []
                                        |),
                                        [ M.read (| buf |) ]
                                      |)
                                    |),
                                    ltac:(M.monadic
                                      (BinOp.gt (|
                                        BinOp.Wrap.sub (|
                                          M.read (| frac_digits |),
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                              "len",
                                              []
                                            |),
                                            [ M.read (| buf |) ]
                                          |)
                                        |),
                                        M.read (| minus_exp |)
                                      |)))
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 3 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Zero"
                                      [
                                        BinOp.Wrap.sub (|
                                          BinOp.Wrap.sub (|
                                            M.read (| frac_digits |),
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                                "len",
                                                []
                                              |),
                                              [ M.read (| buf |) ]
                                            |)
                                          |),
                                          M.read (| minus_exp |)
                                        |)
                                      ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                    []
                                    [ Ty.path "core::num::fmt::Part" ],
                                  "slice_assume_init_ref",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::index::Index",
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                            []
                                            [ Ty.path "core::num::fmt::Part" ]
                                        ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::RangeTo")
                                          []
                                          [ Ty.path "usize" ]
                                      ],
                                      "index",
                                      []
                                    |),
                                    [
                                      M.read (| parts |);
                                      Value.StructRecord
                                        "core::ops::range::RangeTo"
                                        [ ("end_", Value.Integer IntegerKind.Usize 4) ]
                                    ]
                                  |)
                                ]
                              |)
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (M.alloc (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                    []
                                    [ Ty.path "core::num::fmt::Part" ],
                                  "slice_assume_init_ref",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::index::Index",
                                      Ty.apply
                                        (Ty.path "slice")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                            []
                                            [ Ty.path "core::num::fmt::Part" ]
                                        ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::RangeTo")
                                          []
                                          [ Ty.path "usize" ]
                                      ],
                                      "index",
                                      []
                                    |),
                                    [
                                      M.read (| parts |);
                                      Value.StructRecord
                                        "core::ops::range::RangeTo"
                                        [ ("end_", Value.Integer IntegerKind.Usize 3) ]
                                    ]
                                  |)
                                ]
                              |)
                            |)))
                      ]
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let~ exp := M.alloc (| M.rust_cast (M.read (| exp |)) |) in
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  BinOp.lt (|
                                    M.read (| exp |),
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                        "len",
                                        []
                                      |),
                                      [ M.read (| buf |) ]
                                    |)
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| buf |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", M.read (| exp |)) ]
                                          ]
                                        |)
                                      ]
                                  ]
                                |)
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 1 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 2 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeFrom")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| buf |);
                                            Value.StructRecord
                                              "core::ops::range::RangeFrom"
                                              [ ("start", M.read (| exp |)) ]
                                          ]
                                        |)
                                      ]
                                  ]
                                |)
                              |) in
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          BinOp.gt (|
                                            M.read (| frac_digits |),
                                            BinOp.Wrap.sub (|
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                                  "len",
                                                  []
                                                |),
                                                [ M.read (| buf |) ]
                                              |),
                                              M.read (| exp |)
                                            |)
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 3 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Zero"
                                              [
                                                BinOp.Wrap.sub (|
                                                  M.read (| frac_digits |),
                                                  BinOp.Wrap.sub (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.apply
                                                          (Ty.path "slice")
                                                          []
                                                          [ Ty.path "u8" ],
                                                        "len",
                                                        []
                                                      |),
                                                      [ M.read (| buf |) ]
                                                    |),
                                                    M.read (| exp |)
                                                  |)
                                                |)
                                              ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                            []
                                            [ Ty.path "core::num::fmt::Part" ],
                                          "slice_assume_init_ref",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::index::Index",
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "core::num::fmt::Part" ]
                                                ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::ops::range::RangeTo")
                                                  []
                                                  [ Ty.path "usize" ]
                                              ],
                                              "index",
                                              []
                                            |),
                                            [
                                              M.read (| parts |);
                                              Value.StructRecord
                                                "core::ops::range::RangeTo"
                                                [ ("end_", Value.Integer IntegerKind.Usize 4) ]
                                            ]
                                          |)
                                        ]
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.alloc (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                            []
                                            [ Ty.path "core::num::fmt::Part" ],
                                          "slice_assume_init_ref",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::index::Index",
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "core::num::fmt::Part" ]
                                                ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::ops::range::RangeTo")
                                                  []
                                                  [ Ty.path "usize" ]
                                              ],
                                              "index",
                                              []
                                            |),
                                            [
                                              M.read (| parts |);
                                              Value.StructRecord
                                                "core::ops::range::RangeTo"
                                                [ ("end_", Value.Integer IntegerKind.Usize 3) ]
                                            ]
                                          |)
                                        ]
                                      |)
                                    |)))
                              ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| buf |) ]
                                  ]
                                |)
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 1 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Zero"
                                      [
                                        BinOp.Wrap.sub (|
                                          M.read (| exp |),
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                              "len",
                                              []
                                            |),
                                            [ M.read (| buf |) ]
                                          |)
                                        |)
                                      ]
                                  ]
                                |)
                              |) in
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          BinOp.gt (|
                                            M.read (| frac_digits |),
                                            Value.Integer IntegerKind.Usize 0
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 2 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [ M.read (| UnsupportedLiteral |) ]
                                          ]
                                        |)
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 3 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Zero"
                                              [ M.read (| frac_digits |) ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                            []
                                            [ Ty.path "core::num::fmt::Part" ],
                                          "slice_assume_init_ref",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::index::Index",
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "core::num::fmt::Part" ]
                                                ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::ops::range::RangeTo")
                                                  []
                                                  [ Ty.path "usize" ]
                                              ],
                                              "index",
                                              []
                                            |),
                                            [
                                              M.read (| parts |);
                                              Value.StructRecord
                                                "core::ops::range::RangeTo"
                                                [ ("end_", Value.Integer IntegerKind.Usize 4) ]
                                            ]
                                          |)
                                        ]
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.alloc (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                            []
                                            [ Ty.path "core::num::fmt::Part" ],
                                          "slice_assume_init_ref",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::index::Index",
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "core::num::fmt::Part" ]
                                                ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::ops::range::RangeTo")
                                                  []
                                                  [ Ty.path "usize" ]
                                              ],
                                              "index",
                                              []
                                            |),
                                            [
                                              M.read (| parts |);
                                              Value.StructRecord
                                                "core::ops::range::RangeTo"
                                                [ ("end_", Value.Integer IntegerKind.Usize 2) ]
                                            ]
                                          |)
                                        ]
                                      |)
                                    |)))
                              ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_digits_to_dec_str :
      M.IsFunction "core::num::flt2dec::digits_to_dec_str" digits_to_dec_str.
    
    (*
    fn digits_to_exp_str<'a>(
        buf: &'a [u8],
        exp: i16,
        min_ndigits: usize,
        upper: bool,
        parts: &'a mut [MaybeUninit<Part<'a>>],
    ) -> &'a [Part<'a>] {
        assert!(!buf.is_empty());
        assert!(buf[0] > b'0');
        assert!(parts.len() >= 6);
    
        let mut n = 0;
    
        parts[n] = MaybeUninit::new(Part::Copy(&buf[..1]));
        n += 1;
    
        if buf.len() > 1 || min_ndigits > 1 {
            parts[n] = MaybeUninit::new(Part::Copy(b"."));
            parts[n + 1] = MaybeUninit::new(Part::Copy(&buf[1..]));
            n += 2;
            if min_ndigits > buf.len() {
                parts[n] = MaybeUninit::new(Part::Zero(min_ndigits - buf.len()));
                n += 1;
            }
        }
    
        // 0.1234 x 10^exp = 1.234 x 10^(exp-1)
        let exp = exp as i32 - 1; // avoid underflow when exp is i16::MIN
        if exp < 0 {
            parts[n] = MaybeUninit::new(Part::Copy(if upper { b"E-" } else { b"e-" }));
            parts[n + 1] = MaybeUninit::new(Part::Num(-exp as u16));
        } else {
            parts[n] = MaybeUninit::new(Part::Copy(if upper { b"E" } else { b"e" }));
            parts[n + 1] = MaybeUninit::new(Part::Num(exp as u16));
        }
        // SAFETY: we just initialized the elements `..n + 2`.
        unsafe { MaybeUninit::slice_assume_init_ref(&parts[..n + 2]) }
    }
    *)
    Definition digits_to_exp_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ buf; exp; min_ndigits; upper; parts ] =>
        ltac:(M.monadic
          (let buf := M.alloc (| buf |) in
          let exp := M.alloc (| exp |) in
          let min_ndigits := M.alloc (| min_ndigits |) in
          let upper := M.alloc (| upper |) in
          let parts := M.alloc (| parts |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              UnOp.not (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                    "is_empty",
                                    []
                                  |),
                                  [ M.read (| buf |) ]
                                |)
                              |)
                            |)
                          |)) 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: !buf.is_empty()" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.gt (|
                                M.read (|
                                  M.SubPointer.get_array_field (|
                                    M.read (| buf |),
                                    M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                  |)
                                |),
                                M.read (| UnsupportedLiteral |)
                              |)
                            |)
                          |)) 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: buf[0] > b'0'" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| parts |) ]
                                |),
                                Value.Integer IntegerKind.Usize 6
                              |)
                            |)
                          |)) 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: parts.len() >= 6" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ n := M.alloc (| Value.Integer IntegerKind.Usize 0 |) in
            let~ _ :=
              M.write (|
                M.SubPointer.get_array_field (| M.read (| parts |), n |),
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                      []
                      [ Ty.path "core::num::fmt::Part" ],
                    "new",
                    []
                  |),
                  [
                    Value.StructTuple
                      "core::num::fmt::Part::Copy"
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::index::Index",
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                            [ Ty.apply (Ty.path "core::ops::range::RangeTo") [] [ Ty.path "usize" ]
                            ],
                            "index",
                            []
                          |),
                          [
                            M.read (| buf |);
                            Value.StructRecord
                              "core::ops::range::RangeTo"
                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                          ]
                        |)
                      ]
                  ]
                |)
              |) in
            let~ _ :=
              let β := n in
              M.write (|
                β,
                BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.Usize 1 |)
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            LogicalOp.or (|
                              BinOp.gt (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| buf |) ]
                                |),
                                Value.Integer IntegerKind.Usize 1
                              |),
                              ltac:(M.monadic
                                (BinOp.gt (|
                                  M.read (| min_ndigits |),
                                  Value.Integer IntegerKind.Usize 1
                                |)))
                            |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      let~ _ :=
                        M.write (|
                          M.SubPointer.get_array_field (| M.read (| parts |), n |),
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                []
                                [ Ty.path "core::num::fmt::Part" ],
                              "new",
                              []
                            |),
                            [
                              Value.StructTuple
                                "core::num::fmt::Part::Copy"
                                [ M.read (| UnsupportedLiteral |) ]
                            ]
                          |)
                        |) in
                      let~ _ :=
                        M.write (|
                          M.SubPointer.get_array_field (|
                            M.read (| parts |),
                            M.alloc (|
                              BinOp.Wrap.add (| M.read (| n |), Value.Integer IntegerKind.Usize 1 |)
                            |)
                          |),
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                []
                                [ Ty.path "core::num::fmt::Part" ],
                              "new",
                              []
                            |),
                            [
                              Value.StructTuple
                                "core::num::fmt::Part::Copy"
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::index::Index",
                                      Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::ops::range::RangeFrom")
                                          []
                                          [ Ty.path "usize" ]
                                      ],
                                      "index",
                                      []
                                    |),
                                    [
                                      M.read (| buf |);
                                      Value.StructRecord
                                        "core::ops::range::RangeFrom"
                                        [ ("start", Value.Integer IntegerKind.Usize 1) ]
                                    ]
                                  |)
                                ]
                            ]
                          |)
                        |) in
                      let~ _ :=
                        let β := n in
                        M.write (|
                          β,
                          BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.Usize 2 |)
                        |) in
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    BinOp.gt (|
                                      M.read (| min_ndigits |),
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                          "len",
                                          []
                                        |),
                                        [ M.read (| buf |) ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              let~ _ :=
                                M.write (|
                                  M.SubPointer.get_array_field (| M.read (| parts |), n |),
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                        []
                                        [ Ty.path "core::num::fmt::Part" ],
                                      "new",
                                      []
                                    |),
                                    [
                                      Value.StructTuple
                                        "core::num::fmt::Part::Zero"
                                        [
                                          BinOp.Wrap.sub (|
                                            M.read (| min_ndigits |),
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                                "len",
                                                []
                                              |),
                                              [ M.read (| buf |) ]
                                            |)
                                          |)
                                        ]
                                    ]
                                  |)
                                |) in
                              let~ _ :=
                                let β := n in
                                M.write (|
                                  β,
                                  BinOp.Wrap.add (|
                                    M.read (| β |),
                                    Value.Integer IntegerKind.Usize 1
                                  |)
                                |) in
                              M.alloc (| Value.Tuple [] |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ exp :=
              M.alloc (|
                BinOp.Wrap.sub (| M.rust_cast (M.read (| exp |)), Value.Integer IntegerKind.I32 1 |)
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            BinOp.lt (| M.read (| exp |), Value.Integer IntegerKind.I32 0 |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      let~ _ :=
                        M.write (|
                          M.SubPointer.get_array_field (| M.read (| parts |), n |),
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                []
                                [ Ty.path "core::num::fmt::Part" ],
                              "new",
                              []
                            |),
                            [
                              Value.StructTuple
                                "core::num::fmt::Part::Copy"
                                [
                                  M.read (|
                                    M.match_operator (|
                                      M.alloc (| Value.Tuple [] |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ := M.use upper in
                                            let _ :=
                                              M.is_constant_or_break_match (|
                                                M.read (| γ |),
                                                Value.Bool true
                                              |) in
                                            M.alloc (| M.read (| UnsupportedLiteral |) |)));
                                        fun γ =>
                                          ltac:(M.monadic
                                            (M.alloc (| M.read (| UnsupportedLiteral |) |)))
                                      ]
                                    |)
                                  |)
                                ]
                            ]
                          |)
                        |) in
                      let~ _ :=
                        M.write (|
                          M.SubPointer.get_array_field (|
                            M.read (| parts |),
                            M.alloc (|
                              BinOp.Wrap.add (| M.read (| n |), Value.Integer IntegerKind.Usize 1 |)
                            |)
                          |),
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                []
                                [ Ty.path "core::num::fmt::Part" ],
                              "new",
                              []
                            |),
                            [
                              Value.StructTuple
                                "core::num::fmt::Part::Num"
                                [ M.rust_cast (UnOp.neg (| M.read (| exp |) |)) ]
                            ]
                          |)
                        |) in
                      M.alloc (| Value.Tuple [] |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let~ _ :=
                        M.write (|
                          M.SubPointer.get_array_field (| M.read (| parts |), n |),
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                []
                                [ Ty.path "core::num::fmt::Part" ],
                              "new",
                              []
                            |),
                            [
                              Value.StructTuple
                                "core::num::fmt::Part::Copy"
                                [
                                  M.read (|
                                    M.match_operator (|
                                      M.alloc (| Value.Tuple [] |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ := M.use upper in
                                            let _ :=
                                              M.is_constant_or_break_match (|
                                                M.read (| γ |),
                                                Value.Bool true
                                              |) in
                                            M.alloc (| M.read (| UnsupportedLiteral |) |)));
                                        fun γ =>
                                          ltac:(M.monadic
                                            (M.alloc (| M.read (| UnsupportedLiteral |) |)))
                                      ]
                                    |)
                                  |)
                                ]
                            ]
                          |)
                        |) in
                      let~ _ :=
                        M.write (|
                          M.SubPointer.get_array_field (|
                            M.read (| parts |),
                            M.alloc (|
                              BinOp.Wrap.add (| M.read (| n |), Value.Integer IntegerKind.Usize 1 |)
                            |)
                          |),
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                []
                                [ Ty.path "core::num::fmt::Part" ],
                              "new",
                              []
                            |),
                            [
                              Value.StructTuple
                                "core::num::fmt::Part::Num"
                                [ M.rust_cast (M.read (| exp |)) ]
                            ]
                          |)
                        |) in
                      M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.apply
                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                    []
                    [ Ty.path "core::num::fmt::Part" ],
                  "slice_assume_init_ref",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::index::Index",
                      Ty.apply
                        (Ty.path "slice")
                        []
                        [
                          Ty.apply
                            (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                            []
                            [ Ty.path "core::num::fmt::Part" ]
                        ],
                      [ Ty.apply (Ty.path "core::ops::range::RangeTo") [] [ Ty.path "usize" ] ],
                      "index",
                      []
                    |),
                    [
                      M.read (| parts |);
                      Value.StructRecord
                        "core::ops::range::RangeTo"
                        [
                          ("end_",
                            BinOp.Wrap.add (| M.read (| n |), Value.Integer IntegerKind.Usize 2 |))
                        ]
                    ]
                  |)
                ]
              |)
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_digits_to_exp_str :
      M.IsFunction "core::num::flt2dec::digits_to_exp_str" digits_to_exp_str.
    
    (*
    Enum Sign
    {
      const_params := [];
      ty_params := [];
      variants :=
        [
          {
            name := "Minus";
            item := StructTuple [];
            discriminant := None;
          };
          {
            name := "MinusPlus";
            item := StructTuple [];
            discriminant := None;
          }
        ];
    }
    *)
    
    Module Impl_core_marker_Copy_for_core_num_flt2dec_Sign.
      Definition Self : Ty.t := Ty.path "core::num::flt2dec::Sign".
      
      Axiom Implements :
        M.IsTraitInstance
          "core::marker::Copy"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [].
    End Impl_core_marker_Copy_for_core_num_flt2dec_Sign.
    
    Module Impl_core_clone_Clone_for_core_num_flt2dec_Sign.
      Definition Self : Ty.t := Ty.path "core::num::flt2dec::Sign".
      
      (* Clone *)
      Definition clone (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (| M.read (| self |) |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::clone::Clone"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("clone", InstanceField.Method clone) ].
    End Impl_core_clone_Clone_for_core_num_flt2dec_Sign.
    
    Module Impl_core_marker_StructuralPartialEq_for_core_num_flt2dec_Sign.
      Definition Self : Ty.t := Ty.path "core::num::flt2dec::Sign".
      
      Axiom Implements :
        M.IsTraitInstance
          "core::marker::StructuralPartialEq"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [].
    End Impl_core_marker_StructuralPartialEq_for_core_num_flt2dec_Sign.
    
    Module Impl_core_cmp_PartialEq_for_core_num_flt2dec_Sign.
      Definition Self : Ty.t := Ty.path "core::num::flt2dec::Sign".
      
      (* PartialEq *)
      Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ __self_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.path "core::num::flt2dec::Sign" ]
                    |),
                    [ M.read (| self |) ]
                  |)
                |) in
              let~ __arg1_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.path "core::num::flt2dec::Sign" ]
                    |),
                    [ M.read (| other |) ]
                  |)
                |) in
              M.alloc (| BinOp.eq (| M.read (| __self_discr |), M.read (| __arg1_discr |) |) |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::cmp::PartialEq"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("eq", InstanceField.Method eq) ].
    End Impl_core_cmp_PartialEq_for_core_num_flt2dec_Sign.
    
    Module Impl_core_cmp_Eq_for_core_num_flt2dec_Sign.
      Definition Self : Ty.t := Ty.path "core::num::flt2dec::Sign".
      
      (* Eq *)
      Definition assert_receiver_is_total_eq
          (ε : list Value.t)
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            Value.Tuple []))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::cmp::Eq"
          Self
          (* Trait polymorphic types *) []
          (* Instance *)
          [ ("assert_receiver_is_total_eq", InstanceField.Method assert_receiver_is_total_eq) ].
    End Impl_core_cmp_Eq_for_core_num_flt2dec_Sign.
    
    Module Impl_core_fmt_Debug_for_core_num_flt2dec_Sign.
      Definition Self : Ty.t := Ty.path "core::num::flt2dec::Sign".
      
      (* Debug *)
      Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.call_closure (|
              M.get_associated_function (| Ty.path "core::fmt::Formatter", "write_str", [] |),
              [
                M.read (| f |);
                M.read (|
                  M.match_operator (|
                    self,
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ := M.is_struct_tuple (| γ, "core::num::flt2dec::Sign::Minus" |) in
                          M.alloc (| M.read (| Value.String "Minus" |) |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ :=
                            M.is_struct_tuple (| γ, "core::num::flt2dec::Sign::MinusPlus" |) in
                          M.alloc (| M.read (| Value.String "MinusPlus" |) |)))
                    ]
                  |)
                |)
              ]
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        M.IsTraitInstance
          "core::fmt::Debug"
          Self
          (* Trait polymorphic types *) []
          (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
    End Impl_core_fmt_Debug_for_core_num_flt2dec_Sign.
    
    (*
    fn determine_sign(sign: Sign, decoded: &FullDecoded, negative: bool) -> &'static str {
        match ( *decoded, sign) {
            (FullDecoded::Nan, _) => "",
            (_, Sign::Minus) => {
                if negative {
                    "-"
                } else {
                    ""
                }
            }
            (_, Sign::MinusPlus) => {
                if negative {
                    "-"
                } else {
                    "+"
                }
            }
        }
    }
    *)
    Definition determine_sign (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ sign; decoded; negative ] =>
        ltac:(M.monadic
          (let sign := M.alloc (| sign |) in
          let decoded := M.alloc (| decoded |) in
          let negative := M.alloc (| negative |) in
          M.read (|
            M.match_operator (|
              M.alloc (| Value.Tuple [ M.read (| M.read (| decoded |) |); M.read (| sign |) ] |),
              [
                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 _ :=
                      M.is_struct_tuple (|
                        γ0_0,
                        "core::num::flt2dec::decoder::FullDecoded::Nan"
                      |) in
                    Value.String ""));
                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 _ := M.is_struct_tuple (| γ0_1, "core::num::flt2dec::Sign::Minus" |) in
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ := M.use negative in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            Value.String "-"));
                        fun γ => ltac:(M.monadic (Value.String ""))
                      ]
                    |)));
                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 _ := M.is_struct_tuple (| γ0_1, "core::num::flt2dec::Sign::MinusPlus" |) in
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ := M.use negative in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            Value.String "-"));
                        fun γ => ltac:(M.monadic (Value.String "+"))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_determine_sign :
      M.IsFunction "core::num::flt2dec::determine_sign" determine_sign.
    
    (*
    pub fn to_shortest_str<'a, T, F>(
        mut format_shortest: F,
        v: T,
        sign: Sign,
        frac_digits: usize,
        buf: &'a mut [MaybeUninit<u8>],
        parts: &'a mut [MaybeUninit<Part<'a>>],
    ) -> Formatted<'a>
    where
        T: DecodableFloat,
        F: FnMut(&Decoded, &'a mut [MaybeUninit<u8>]) -> (&'a [u8], i16),
    {
        assert!(parts.len() >= 4);
        assert!(buf.len() >= MAX_SIG_DIGITS);
    
        let (negative, full_decoded) = decode(v);
        let sign = determine_sign(sign, &full_decoded, negative);
        match full_decoded {
            FullDecoded::Nan => {
                parts[0] = MaybeUninit::new(Part::Copy(b"NaN"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Infinite => {
                parts[0] = MaybeUninit::new(Part::Copy(b"inf"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Zero => {
                if frac_digits > 0 {
                    // [0.][0000]
                    parts[0] = MaybeUninit::new(Part::Copy(b"0."));
                    parts[1] = MaybeUninit::new(Part::Zero(frac_digits));
                    Formatted {
                        sign,
                        // SAFETY: we just initialized the elements `..2`.
                        parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..2]) },
                    }
                } else {
                    parts[0] = MaybeUninit::new(Part::Copy(b"0"));
                    Formatted {
                        sign,
                        // SAFETY: we just initialized the elements `..1`.
                        parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) },
                    }
                }
            }
            FullDecoded::Finite(ref decoded) => {
                let (buf, exp) = format_shortest(decoded, buf);
                Formatted { sign, parts: digits_to_dec_str(buf, exp, frac_digits, parts) }
            }
        }
    }
    *)
    Definition to_shortest_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ T; F ], [ format_shortest; v; sign; frac_digits; buf; parts ] =>
        ltac:(M.monadic
          (let format_shortest := M.alloc (| format_shortest |) in
          let v := M.alloc (| v |) in
          let sign := M.alloc (| sign |) in
          let frac_digits := M.alloc (| frac_digits |) in
          let buf := M.alloc (| buf |) in
          let parts := M.alloc (| parts |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| parts |) ]
                                |),
                                Value.Integer IntegerKind.Usize 4
                              |)
                            |)
                          |)) 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: parts.len() >= 4" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "u8" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| buf |) ]
                                |),
                                M.read (|
                                  M.get_constant (| "core::num::flt2dec::MAX_SIG_DIGITS" |)
                                |)
                              |)
                            |)
                          |)) 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: buf.len() >= MAX_SIG_DIGITS"
                              |)
                            ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::num::flt2dec::decoder::decode", [ T ] |),
                  [ M.read (| v |) ]
                |)
              |),
              [
                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 negative := M.copy (| γ0_0 |) in
                    let full_decoded := M.copy (| γ0_1 |) in
                    let~ sign :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (| "core::num::flt2dec::determine_sign", [] |),
                          [ M.read (| sign |); full_decoded; M.read (| negative |) ]
                        |)
                      |) in
                    M.match_operator (|
                      full_decoded,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Nan"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Infinite"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Zero"
                              |) in
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          BinOp.gt (|
                                            M.read (| frac_digits |),
                                            Value.Integer IntegerKind.Usize 0
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [ M.read (| UnsupportedLiteral |) ]
                                          ]
                                        |)
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 1 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Zero"
                                              [ M.read (| frac_digits |) ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "slice_assume_init_ref",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::index::Index",
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path
                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                          []
                                                          [ Ty.path "core::num::fmt::Part" ]
                                                      ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::ops::range::RangeTo")
                                                        []
                                                        [ Ty.path "usize" ]
                                                    ],
                                                    "index",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| parts |);
                                                    Value.StructRecord
                                                      "core::ops::range::RangeTo"
                                                      [ ("end_", Value.Integer IntegerKind.Usize 2)
                                                      ]
                                                  ]
                                                |)
                                              ]
                                            |))
                                        ]
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [ M.read (| UnsupportedLiteral |) ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "slice_assume_init_ref",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::index::Index",
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path
                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                          []
                                                          [ Ty.path "core::num::fmt::Part" ]
                                                      ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::ops::range::RangeTo")
                                                        []
                                                        [ Ty.path "usize" ]
                                                    ],
                                                    "index",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| parts |);
                                                    Value.StructRecord
                                                      "core::ops::range::RangeTo"
                                                      [ ("end_", Value.Integer IntegerKind.Usize 1)
                                                      ]
                                                  ]
                                                |)
                                              ]
                                            |))
                                        ]
                                    |)))
                              ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Finite",
                                0
                              |) in
                            let decoded := M.alloc (| γ0_0 |) in
                            M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::function::FnMut",
                                    F,
                                    [
                                      Ty.tuple
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [ Ty.path "core::num::flt2dec::decoder::Decoded" ];
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "u8" ]
                                                ]
                                            ]
                                        ]
                                    ],
                                    "call_mut",
                                    []
                                  |),
                                  [
                                    format_shortest;
                                    Value.Tuple [ M.read (| decoded |); M.read (| buf |) ]
                                  ]
                                |)
                              |),
                              [
                                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 buf := M.copy (| γ0_0 |) in
                                    let exp := M.copy (| γ0_1 |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_function (|
                                                "core::num::flt2dec::digits_to_dec_str",
                                                []
                                              |),
                                              [
                                                M.read (| buf |);
                                                M.read (| exp |);
                                                M.read (| frac_digits |);
                                                M.read (| parts |)
                                              ]
                                            |))
                                        ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_to_shortest_str :
      M.IsFunction "core::num::flt2dec::to_shortest_str" to_shortest_str.
    
    (*
    pub fn to_shortest_exp_str<'a, T, F>(
        mut format_shortest: F,
        v: T,
        sign: Sign,
        dec_bounds: (i16, i16),
        upper: bool,
        buf: &'a mut [MaybeUninit<u8>],
        parts: &'a mut [MaybeUninit<Part<'a>>],
    ) -> Formatted<'a>
    where
        T: DecodableFloat,
        F: FnMut(&Decoded, &'a mut [MaybeUninit<u8>]) -> (&'a [u8], i16),
    {
        assert!(parts.len() >= 6);
        assert!(buf.len() >= MAX_SIG_DIGITS);
        assert!(dec_bounds.0 <= dec_bounds.1);
    
        let (negative, full_decoded) = decode(v);
        let sign = determine_sign(sign, &full_decoded, negative);
        match full_decoded {
            FullDecoded::Nan => {
                parts[0] = MaybeUninit::new(Part::Copy(b"NaN"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Infinite => {
                parts[0] = MaybeUninit::new(Part::Copy(b"inf"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Zero => {
                parts[0] = if dec_bounds.0 <= 0 && 0 < dec_bounds.1 {
                    MaybeUninit::new(Part::Copy(b"0"))
                } else {
                    MaybeUninit::new(Part::Copy(if upper { b"0E0" } else { b"0e0" }))
                };
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Finite(ref decoded) => {
                let (buf, exp) = format_shortest(decoded, buf);
                let vis_exp = exp as i32 - 1;
                let parts = if dec_bounds.0 as i32 <= vis_exp && vis_exp < dec_bounds.1 as i32 {
                    digits_to_dec_str(buf, exp, 0, parts)
                } else {
                    digits_to_exp_str(buf, exp, 0, upper, parts)
                };
                Formatted { sign, parts }
            }
        }
    }
    *)
    Definition to_shortest_exp_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ T; F ], [ format_shortest; v; sign; dec_bounds; upper; buf; parts ] =>
        ltac:(M.monadic
          (let format_shortest := M.alloc (| format_shortest |) in
          let v := M.alloc (| v |) in
          let sign := M.alloc (| sign |) in
          let dec_bounds := M.alloc (| dec_bounds |) in
          let upper := M.alloc (| upper |) in
          let buf := M.alloc (| buf |) in
          let parts := M.alloc (| parts |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| parts |) ]
                                |),
                                Value.Integer IntegerKind.Usize 6
                              |)
                            |)
                          |)) 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: parts.len() >= 6" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "u8" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| buf |) ]
                                |),
                                M.read (|
                                  M.get_constant (| "core::num::flt2dec::MAX_SIG_DIGITS" |)
                                |)
                              |)
                            |)
                          |)) 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: buf.len() >= MAX_SIG_DIGITS"
                              |)
                            ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.le (|
                                M.read (| M.SubPointer.get_tuple_field (| dec_bounds, 0 |) |),
                                M.read (| M.SubPointer.get_tuple_field (| dec_bounds, 1 |) |)
                              |)
                            |)
                          |)) 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: dec_bounds.0 <= dec_bounds.1"
                              |)
                            ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::num::flt2dec::decoder::decode", [ T ] |),
                  [ M.read (| v |) ]
                |)
              |),
              [
                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 negative := M.copy (| γ0_0 |) in
                    let full_decoded := M.copy (| γ0_1 |) in
                    let~ sign :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (| "core::num::flt2dec::determine_sign", [] |),
                          [ M.read (| sign |); full_decoded; M.read (| negative |) ]
                        |)
                      |) in
                    M.match_operator (|
                      full_decoded,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Nan"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Infinite"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Zero"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (| Value.Tuple [] |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ :=
                                            M.use
                                              (M.alloc (|
                                                LogicalOp.and (|
                                                  BinOp.le (|
                                                    M.read (|
                                                      M.SubPointer.get_tuple_field (|
                                                        dec_bounds,
                                                        0
                                                      |)
                                                    |),
                                                    Value.Integer IntegerKind.I16 0
                                                  |),
                                                  ltac:(M.monadic
                                                    (BinOp.lt (|
                                                      Value.Integer IntegerKind.I16 0,
                                                      M.read (|
                                                        M.SubPointer.get_tuple_field (|
                                                          dec_bounds,
                                                          1
                                                        |)
                                                      |)
                                                    |)))
                                                |)
                                              |)) in
                                          let _ :=
                                            M.is_constant_or_break_match (|
                                              M.read (| γ |),
                                              Value.Bool true
                                            |) in
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "new",
                                                []
                                              |),
                                              [
                                                Value.StructTuple
                                                  "core::num::fmt::Part::Copy"
                                                  [ M.read (| UnsupportedLiteral |) ]
                                              ]
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "new",
                                                []
                                              |),
                                              [
                                                Value.StructTuple
                                                  "core::num::fmt::Part::Copy"
                                                  [
                                                    M.read (|
                                                      M.match_operator (|
                                                        M.alloc (| Value.Tuple [] |),
                                                        [
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ := M.use upper in
                                                              let _ :=
                                                                M.is_constant_or_break_match (|
                                                                  M.read (| γ |),
                                                                  Value.Bool true
                                                                |) in
                                                              M.alloc (|
                                                                M.read (| UnsupportedLiteral |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (M.alloc (|
                                                                M.read (| UnsupportedLiteral |)
                                                              |)))
                                                        ]
                                                      |)
                                                    |)
                                                  ]
                                              ]
                                            |)
                                          |)))
                                    ]
                                  |)
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Finite",
                                0
                              |) in
                            let decoded := M.alloc (| γ0_0 |) in
                            M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::function::FnMut",
                                    F,
                                    [
                                      Ty.tuple
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [ Ty.path "core::num::flt2dec::decoder::Decoded" ];
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "u8" ]
                                                ]
                                            ]
                                        ]
                                    ],
                                    "call_mut",
                                    []
                                  |),
                                  [
                                    format_shortest;
                                    Value.Tuple [ M.read (| decoded |); M.read (| buf |) ]
                                  ]
                                |)
                              |),
                              [
                                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 buf := M.copy (| γ0_0 |) in
                                    let exp := M.copy (| γ0_1 |) in
                                    let~ vis_exp :=
                                      M.alloc (|
                                        BinOp.Wrap.sub (|
                                          M.rust_cast (M.read (| exp |)),
                                          Value.Integer IntegerKind.I32 1
                                        |)
                                      |) in
                                    let~ parts :=
                                      M.copy (|
                                        M.match_operator (|
                                          M.alloc (| Value.Tuple [] |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ :=
                                                  M.use
                                                    (M.alloc (|
                                                      LogicalOp.and (|
                                                        BinOp.le (|
                                                          M.rust_cast
                                                            (M.read (|
                                                              M.SubPointer.get_tuple_field (|
                                                                dec_bounds,
                                                                0
                                                              |)
                                                            |)),
                                                          M.read (| vis_exp |)
                                                        |),
                                                        ltac:(M.monadic
                                                          (BinOp.lt (|
                                                            M.read (| vis_exp |),
                                                            M.rust_cast
                                                              (M.read (|
                                                                M.SubPointer.get_tuple_field (|
                                                                  dec_bounds,
                                                                  1
                                                                |)
                                                              |))
                                                          |)))
                                                      |)
                                                    |)) in
                                                let _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ |),
                                                    Value.Bool true
                                                  |) in
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "core::num::flt2dec::digits_to_dec_str",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| buf |);
                                                      M.read (| exp |);
                                                      Value.Integer IntegerKind.Usize 0;
                                                      M.read (| parts |)
                                                    ]
                                                  |)
                                                |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (M.alloc (|
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "core::num::flt2dec::digits_to_exp_str",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| buf |);
                                                      M.read (| exp |);
                                                      Value.Integer IntegerKind.Usize 0;
                                                      M.read (| upper |);
                                                      M.read (| parts |)
                                                    ]
                                                  |)
                                                |)))
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [ ("sign", M.read (| sign |)); ("parts", M.read (| parts |))
                                        ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_to_shortest_exp_str :
      M.IsFunction "core::num::flt2dec::to_shortest_exp_str" to_shortest_exp_str.
    
    (*
    fn estimate_max_buf_len(exp: i16) -> usize {
        21 + ((if exp < 0 { -12 } else { 5 } * exp as i32) as usize >> 4)
    }
    *)
    Definition estimate_max_buf_len (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ exp ] =>
        ltac:(M.monadic
          (let exp := M.alloc (| exp |) in
          BinOp.Wrap.add (|
            Value.Integer IntegerKind.Usize 21,
            BinOp.Wrap.shr (|
              M.rust_cast
                (BinOp.Wrap.mul (|
                  M.read (|
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  BinOp.lt (| M.read (| exp |), Value.Integer IntegerKind.I16 0 |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            M.alloc (| Value.Integer IntegerKind.I32 (-12) |)));
                        fun γ => ltac:(M.monadic (M.alloc (| Value.Integer IntegerKind.I32 5 |)))
                      ]
                    |)
                  |),
                  M.rust_cast (M.read (| exp |))
                |)),
              Value.Integer IntegerKind.I32 4
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_estimate_max_buf_len :
      M.IsFunction "core::num::flt2dec::estimate_max_buf_len" estimate_max_buf_len.
    
    (*
    pub fn to_exact_exp_str<'a, T, F>(
        mut format_exact: F,
        v: T,
        sign: Sign,
        ndigits: usize,
        upper: bool,
        buf: &'a mut [MaybeUninit<u8>],
        parts: &'a mut [MaybeUninit<Part<'a>>],
    ) -> Formatted<'a>
    where
        T: DecodableFloat,
        F: FnMut(&Decoded, &'a mut [MaybeUninit<u8>], i16) -> (&'a [u8], i16),
    {
        assert!(parts.len() >= 6);
        assert!(ndigits > 0);
    
        let (negative, full_decoded) = decode(v);
        let sign = determine_sign(sign, &full_decoded, negative);
        match full_decoded {
            FullDecoded::Nan => {
                parts[0] = MaybeUninit::new(Part::Copy(b"NaN"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Infinite => {
                parts[0] = MaybeUninit::new(Part::Copy(b"inf"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Zero => {
                if ndigits > 1 {
                    // [0.][0000][e0]
                    parts[0] = MaybeUninit::new(Part::Copy(b"0."));
                    parts[1] = MaybeUninit::new(Part::Zero(ndigits - 1));
                    parts[2] = MaybeUninit::new(Part::Copy(if upper { b"E0" } else { b"e0" }));
                    Formatted {
                        sign,
                        // SAFETY: we just initialized the elements `..3`.
                        parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..3]) },
                    }
                } else {
                    parts[0] = MaybeUninit::new(Part::Copy(if upper { b"0E0" } else { b"0e0" }));
                    Formatted {
                        sign,
                        // SAFETY: we just initialized the elements `..1`.
                        parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) },
                    }
                }
            }
            FullDecoded::Finite(ref decoded) => {
                let maxlen = estimate_max_buf_len(decoded.exp);
                assert!(buf.len() >= ndigits || buf.len() >= maxlen);
    
                let trunc = if ndigits < maxlen { ndigits } else { maxlen };
                let (buf, exp) = format_exact(decoded, &mut buf[..trunc], i16::MIN);
                Formatted { sign, parts: digits_to_exp_str(buf, exp, ndigits, upper, parts) }
            }
        }
    }
    *)
    Definition to_exact_exp_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ T; F ], [ format_exact; v; sign; ndigits; upper; buf; parts ] =>
        ltac:(M.monadic
          (let format_exact := M.alloc (| format_exact |) in
          let v := M.alloc (| v |) in
          let sign := M.alloc (| sign |) in
          let ndigits := M.alloc (| ndigits |) in
          let upper := M.alloc (| upper |) in
          let buf := M.alloc (| buf |) in
          let parts := M.alloc (| parts |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| parts |) ]
                                |),
                                Value.Integer IntegerKind.Usize 6
                              |)
                            |)
                          |)) 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: parts.len() >= 6" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.gt (| M.read (| ndigits |), 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: ndigits > 0" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::num::flt2dec::decoder::decode", [ T ] |),
                  [ M.read (| v |) ]
                |)
              |),
              [
                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 negative := M.copy (| γ0_0 |) in
                    let full_decoded := M.copy (| γ0_1 |) in
                    let~ sign :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (| "core::num::flt2dec::determine_sign", [] |),
                          [ M.read (| sign |); full_decoded; M.read (| negative |) ]
                        |)
                      |) in
                    M.match_operator (|
                      full_decoded,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Nan"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Infinite"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Zero"
                              |) in
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          BinOp.gt (|
                                            M.read (| ndigits |),
                                            Value.Integer IntegerKind.Usize 1
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [ M.read (| UnsupportedLiteral |) ]
                                          ]
                                        |)
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 1 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Zero"
                                              [
                                                BinOp.Wrap.sub (|
                                                  M.read (| ndigits |),
                                                  Value.Integer IntegerKind.Usize 1
                                                |)
                                              ]
                                          ]
                                        |)
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 2 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [
                                                M.read (|
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.use upper in
                                                          let _ :=
                                                            M.is_constant_or_break_match (|
                                                              M.read (| γ |),
                                                              Value.Bool true
                                                            |) in
                                                          M.alloc (|
                                                            M.read (| UnsupportedLiteral |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (|
                                                            M.read (| UnsupportedLiteral |)
                                                          |)))
                                                    ]
                                                  |)
                                                |)
                                              ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "slice_assume_init_ref",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::index::Index",
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path
                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                          []
                                                          [ Ty.path "core::num::fmt::Part" ]
                                                      ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::ops::range::RangeTo")
                                                        []
                                                        [ Ty.path "usize" ]
                                                    ],
                                                    "index",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| parts |);
                                                    Value.StructRecord
                                                      "core::ops::range::RangeTo"
                                                      [ ("end_", Value.Integer IntegerKind.Usize 3)
                                                      ]
                                                  ]
                                                |)
                                              ]
                                            |))
                                        ]
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [
                                                M.read (|
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ := M.use upper in
                                                          let _ :=
                                                            M.is_constant_or_break_match (|
                                                              M.read (| γ |),
                                                              Value.Bool true
                                                            |) in
                                                          M.alloc (|
                                                            M.read (| UnsupportedLiteral |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (|
                                                            M.read (| UnsupportedLiteral |)
                                                          |)))
                                                    ]
                                                  |)
                                                |)
                                              ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "slice_assume_init_ref",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::index::Index",
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path
                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                          []
                                                          [ Ty.path "core::num::fmt::Part" ]
                                                      ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::ops::range::RangeTo")
                                                        []
                                                        [ Ty.path "usize" ]
                                                    ],
                                                    "index",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| parts |);
                                                    Value.StructRecord
                                                      "core::ops::range::RangeTo"
                                                      [ ("end_", Value.Integer IntegerKind.Usize 1)
                                                      ]
                                                  ]
                                                |)
                                              ]
                                            |))
                                        ]
                                    |)))
                              ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Finite",
                                0
                              |) in
                            let decoded := M.alloc (| γ0_0 |) in
                            let~ maxlen :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_function (|
                                    "core::num::flt2dec::estimate_max_buf_len",
                                    []
                                  |),
                                  [
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| decoded |),
                                        "core::num::flt2dec::decoder::Decoded",
                                        "exp"
                                      |)
                                    |)
                                  ]
                                |)
                              |) in
                            let~ _ :=
                              M.match_operator (|
                                M.alloc (| Value.Tuple [] |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ :=
                                        M.use
                                          (M.alloc (|
                                            UnOp.not (|
                                              LogicalOp.or (|
                                                BinOp.ge (|
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "slice")
                                                        []
                                                        [
                                                          Ty.apply
                                                            (Ty.path
                                                              "core::mem::maybe_uninit::MaybeUninit")
                                                            []
                                                            [ Ty.path "u8" ]
                                                        ],
                                                      "len",
                                                      []
                                                    |),
                                                    [ M.read (| buf |) ]
                                                  |),
                                                  M.read (| ndigits |)
                                                |),
                                                ltac:(M.monadic
                                                  (BinOp.ge (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.apply
                                                          (Ty.path "slice")
                                                          []
                                                          [
                                                            Ty.apply
                                                              (Ty.path
                                                                "core::mem::maybe_uninit::MaybeUninit")
                                                              []
                                                              [ Ty.path "u8" ]
                                                          ],
                                                        "len",
                                                        []
                                                      |),
                                                      [ M.read (| buf |) ]
                                                    |),
                                                    M.read (| maxlen |)
                                                  |)))
                                              |)
                                            |)
                                          |)) 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: buf.len() >= ndigits || buf.len() >= maxlen"
                                              |)
                                            ]
                                          |)
                                        |)
                                      |)));
                                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                ]
                              |) in
                            let~ trunc :=
                              M.copy (|
                                M.match_operator (|
                                  M.alloc (| Value.Tuple [] |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ :=
                                          M.use
                                            (M.alloc (|
                                              BinOp.lt (|
                                                M.read (| ndigits |),
                                                M.read (| maxlen |)
                                              |)
                                            |)) in
                                        let _ :=
                                          M.is_constant_or_break_match (|
                                            M.read (| γ |),
                                            Value.Bool true
                                          |) in
                                        ndigits));
                                    fun γ => ltac:(M.monadic maxlen)
                                  ]
                                |)
                              |) in
                            M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::function::FnMut",
                                    F,
                                    [
                                      Ty.tuple
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [ Ty.path "core::num::flt2dec::decoder::Decoded" ];
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "u8" ]
                                                ]
                                            ];
                                          Ty.path "i16"
                                        ]
                                    ],
                                    "call_mut",
                                    []
                                  |),
                                  [
                                    format_exact;
                                    Value.Tuple
                                      [
                                        M.read (| decoded |);
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::IndexMut",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "u8" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index_mut",
                                            []
                                          |),
                                          [
                                            M.read (| buf |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", M.read (| trunc |)) ]
                                          ]
                                        |);
                                        M.read (| M.get_constant (| "core::num::MIN" |) |)
                                      ]
                                  ]
                                |)
                              |),
                              [
                                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 buf := M.copy (| γ0_0 |) in
                                    let exp := M.copy (| γ0_1 |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_function (|
                                                "core::num::flt2dec::digits_to_exp_str",
                                                []
                                              |),
                                              [
                                                M.read (| buf |);
                                                M.read (| exp |);
                                                M.read (| ndigits |);
                                                M.read (| upper |);
                                                M.read (| parts |)
                                              ]
                                            |))
                                        ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_to_exact_exp_str :
      M.IsFunction "core::num::flt2dec::to_exact_exp_str" to_exact_exp_str.
    
    (*
    pub fn to_exact_fixed_str<'a, T, F>(
        mut format_exact: F,
        v: T,
        sign: Sign,
        frac_digits: usize,
        buf: &'a mut [MaybeUninit<u8>],
        parts: &'a mut [MaybeUninit<Part<'a>>],
    ) -> Formatted<'a>
    where
        T: DecodableFloat,
        F: FnMut(&Decoded, &'a mut [MaybeUninit<u8>], i16) -> (&'a [u8], i16),
    {
        assert!(parts.len() >= 4);
    
        let (negative, full_decoded) = decode(v);
        let sign = determine_sign(sign, &full_decoded, negative);
        match full_decoded {
            FullDecoded::Nan => {
                parts[0] = MaybeUninit::new(Part::Copy(b"NaN"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Infinite => {
                parts[0] = MaybeUninit::new(Part::Copy(b"inf"));
                // SAFETY: we just initialized the elements `..1`.
                Formatted { sign, parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) } }
            }
            FullDecoded::Zero => {
                if frac_digits > 0 {
                    // [0.][0000]
                    parts[0] = MaybeUninit::new(Part::Copy(b"0."));
                    parts[1] = MaybeUninit::new(Part::Zero(frac_digits));
                    Formatted {
                        sign,
                        // SAFETY: we just initialized the elements `..2`.
                        parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..2]) },
                    }
                } else {
                    parts[0] = MaybeUninit::new(Part::Copy(b"0"));
                    Formatted {
                        sign,
                        // SAFETY: we just initialized the elements `..1`.
                        parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) },
                    }
                }
            }
            FullDecoded::Finite(ref decoded) => {
                let maxlen = estimate_max_buf_len(decoded.exp);
                assert!(buf.len() >= maxlen);
    
                // it *is* possible that `frac_digits` is ridiculously large.
                // `format_exact` will end rendering digits much earlier in this case,
                // because we are strictly limited by `maxlen`.
                let limit = if frac_digits < 0x8000 { -(frac_digits as i16) } else { i16::MIN };
                let (buf, exp) = format_exact(decoded, &mut buf[..maxlen], limit);
                if exp <= limit {
                    // the restriction couldn't been met, so this should render like zero no matter
                    // `exp` was. this does not include the case that the restriction has been met
                    // only after the final rounding-up; it's a regular case with `exp = limit + 1`.
                    debug_assert_eq!(buf.len(), 0);
                    if frac_digits > 0 {
                        // [0.][0000]
                        parts[0] = MaybeUninit::new(Part::Copy(b"0."));
                        parts[1] = MaybeUninit::new(Part::Zero(frac_digits));
                        Formatted {
                            sign,
                            // SAFETY: we just initialized the elements `..2`.
                            parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..2]) },
                        }
                    } else {
                        parts[0] = MaybeUninit::new(Part::Copy(b"0"));
                        Formatted {
                            sign,
                            // SAFETY: we just initialized the elements `..1`.
                            parts: unsafe { MaybeUninit::slice_assume_init_ref(&parts[..1]) },
                        }
                    }
                } else {
                    Formatted { sign, parts: digits_to_dec_str(buf, exp, frac_digits, parts) }
                }
            }
        }
    }
    *)
    Definition to_exact_fixed_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ T; F ], [ format_exact; v; sign; frac_digits; buf; parts ] =>
        ltac:(M.monadic
          (let format_exact := M.alloc (| format_exact |) in
          let v := M.alloc (| v |) in
          let sign := M.alloc (| sign |) in
          let frac_digits := M.alloc (| frac_digits |) in
          let buf := M.alloc (| buf |) in
          let parts := M.alloc (| parts |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              BinOp.ge (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ]
                                      ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| parts |) ]
                                |),
                                Value.Integer IntegerKind.Usize 4
                              |)
                            |)
                          |)) 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: parts.len() >= 4" |) ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::num::flt2dec::decoder::decode", [ T ] |),
                  [ M.read (| v |) ]
                |)
              |),
              [
                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 negative := M.copy (| γ0_0 |) in
                    let full_decoded := M.copy (| γ0_1 |) in
                    let~ sign :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (| "core::num::flt2dec::determine_sign", [] |),
                          [ M.read (| sign |); full_decoded; M.read (| negative |) ]
                        |)
                      |) in
                    M.match_operator (|
                      full_decoded,
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Nan"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Infinite"
                              |) in
                            let~ _ :=
                              M.write (|
                                M.SubPointer.get_array_field (|
                                  M.read (| parts |),
                                  M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                      []
                                      [ Ty.path "core::num::fmt::Part" ],
                                    "new",
                                    []
                                  |),
                                  [
                                    Value.StructTuple
                                      "core::num::fmt::Part::Copy"
                                      [ M.read (| UnsupportedLiteral |) ]
                                  ]
                                |)
                              |) in
                            M.alloc (|
                              Value.StructRecord
                                "core::num::fmt::Formatted"
                                [
                                  ("sign", M.read (| sign |));
                                  ("parts",
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                          []
                                          [ Ty.path "core::num::fmt::Part" ],
                                        "slice_assume_init_ref",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::Index",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index",
                                            []
                                          |),
                                          [
                                            M.read (| parts |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", Value.Integer IntegerKind.Usize 1) ]
                                          ]
                                        |)
                                      ]
                                    |))
                                ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let _ :=
                              M.is_struct_tuple (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Zero"
                              |) in
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          BinOp.gt (|
                                            M.read (| frac_digits |),
                                            Value.Integer IntegerKind.Usize 0
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [ M.read (| UnsupportedLiteral |) ]
                                          ]
                                        |)
                                      |) in
                                    let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 1 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Zero"
                                              [ M.read (| frac_digits |) ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "slice_assume_init_ref",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::index::Index",
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path
                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                          []
                                                          [ Ty.path "core::num::fmt::Part" ]
                                                      ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::ops::range::RangeTo")
                                                        []
                                                        [ Ty.path "usize" ]
                                                    ],
                                                    "index",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| parts |);
                                                    Value.StructRecord
                                                      "core::ops::range::RangeTo"
                                                      [ ("end_", Value.Integer IntegerKind.Usize 2)
                                                      ]
                                                  ]
                                                |)
                                              ]
                                            |))
                                        ]
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let~ _ :=
                                      M.write (|
                                        M.SubPointer.get_array_field (|
                                          M.read (| parts |),
                                          M.alloc (| Value.Integer IntegerKind.Usize 0 |)
                                        |),
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.apply
                                              (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                              []
                                              [ Ty.path "core::num::fmt::Part" ],
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "core::num::fmt::Part::Copy"
                                              [ M.read (| UnsupportedLiteral |) ]
                                          ]
                                        |)
                                      |) in
                                    M.alloc (|
                                      Value.StructRecord
                                        "core::num::fmt::Formatted"
                                        [
                                          ("sign", M.read (| sign |));
                                          ("parts",
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "core::num::fmt::Part" ],
                                                "slice_assume_init_ref",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::index::Index",
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path
                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                          []
                                                          [ Ty.path "core::num::fmt::Part" ]
                                                      ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::ops::range::RangeTo")
                                                        []
                                                        [ Ty.path "usize" ]
                                                    ],
                                                    "index",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| parts |);
                                                    Value.StructRecord
                                                      "core::ops::range::RangeTo"
                                                      [ ("end_", Value.Integer IntegerKind.Usize 1)
                                                      ]
                                                  ]
                                                |)
                                              ]
                                            |))
                                        ]
                                    |)))
                              ]
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::num::flt2dec::decoder::FullDecoded::Finite",
                                0
                              |) in
                            let decoded := M.alloc (| γ0_0 |) in
                            let~ maxlen :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_function (|
                                    "core::num::flt2dec::estimate_max_buf_len",
                                    []
                                  |),
                                  [
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| decoded |),
                                        "core::num::flt2dec::decoder::Decoded",
                                        "exp"
                                      |)
                                    |)
                                  ]
                                |)
                              |) in
                            let~ _ :=
                              M.match_operator (|
                                M.alloc (| Value.Tuple [] |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ :=
                                        M.use
                                          (M.alloc (|
                                            UnOp.not (|
                                              BinOp.ge (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path
                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                          []
                                                          [ Ty.path "u8" ]
                                                      ],
                                                    "len",
                                                    []
                                                  |),
                                                  [ M.read (| buf |) ]
                                                |),
                                                M.read (| maxlen |)
                                              |)
                                            |)
                                          |)) 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: buf.len() >= maxlen"
                                              |)
                                            ]
                                          |)
                                        |)
                                      |)));
                                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                ]
                              |) in
                            let~ limit :=
                              M.copy (|
                                M.match_operator (|
                                  M.alloc (| Value.Tuple [] |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ :=
                                          M.use
                                            (M.alloc (|
                                              BinOp.lt (|
                                                M.read (| frac_digits |),
                                                Value.Integer IntegerKind.Usize 32768
                                              |)
                                            |)) in
                                        let _ :=
                                          M.is_constant_or_break_match (|
                                            M.read (| γ |),
                                            Value.Bool true
                                          |) in
                                        M.alloc (|
                                          UnOp.neg (| M.rust_cast (M.read (| frac_digits |)) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic (M.get_constant (| "core::num::MIN" |)))
                                  ]
                                |)
                              |) in
                            M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::function::FnMut",
                                    F,
                                    [
                                      Ty.tuple
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [ Ty.path "core::num::flt2dec::decoder::Decoded" ];
                                          Ty.apply
                                            (Ty.path "&mut")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "slice")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                    []
                                                    [ Ty.path "u8" ]
                                                ]
                                            ];
                                          Ty.path "i16"
                                        ]
                                    ],
                                    "call_mut",
                                    []
                                  |),
                                  [
                                    format_exact;
                                    Value.Tuple
                                      [
                                        M.read (| decoded |);
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::index::IndexMut",
                                            Ty.apply
                                              (Ty.path "slice")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::mem::maybe_uninit::MaybeUninit")
                                                  []
                                                  [ Ty.path "u8" ]
                                              ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::ops::range::RangeTo")
                                                []
                                                [ Ty.path "usize" ]
                                            ],
                                            "index_mut",
                                            []
                                          |),
                                          [
                                            M.read (| buf |);
                                            Value.StructRecord
                                              "core::ops::range::RangeTo"
                                              [ ("end_", M.read (| maxlen |)) ]
                                          ]
                                        |);
                                        M.read (| limit |)
                                      ]
                                  ]
                                |)
                              |),
                              [
                                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 buf := M.copy (| γ0_0 |) in
                                    let exp := M.copy (| γ0_1 |) in
                                    M.match_operator (|
                                      M.alloc (| Value.Tuple [] |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ :=
                                              M.use
                                                (M.alloc (|
                                                  BinOp.le (|
                                                    M.read (| exp |),
                                                    M.read (| limit |)
                                                  |)
                                                |)) in
                                            let _ :=
                                              M.is_constant_or_break_match (|
                                                M.read (| γ |),
                                                Value.Bool true
                                              |) in
                                            let~ _ :=
                                              M.match_operator (|
                                                M.alloc (| Value.Tuple [] |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ :=
                                                        M.use (M.alloc (| Value.Bool true |)) in
                                                      let _ :=
                                                        M.is_constant_or_break_match (|
                                                          M.read (| γ |),
                                                          Value.Bool true
                                                        |) in
                                                      let~ _ :=
                                                        M.match_operator (|
                                                          M.alloc (|
                                                            Value.Tuple
                                                              [
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.apply
                                                                        (Ty.path "slice")
                                                                        []
                                                                        [ Ty.path "u8" ],
                                                                      "len",
                                                                      []
                                                                    |),
                                                                    [ M.read (| buf |) ]
                                                                  |)
                                                                |);
                                                                M.alloc (|
                                                                  Value.Integer IntegerKind.Usize 0
                                                                |)
                                                              ]
                                                          |),
                                                          [
                                                            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 left_val := M.copy (| γ0_0 |) in
                                                                let right_val :=
                                                                  M.copy (| γ0_1 |) in
                                                                M.match_operator (|
                                                                  M.alloc (| Value.Tuple [] |),
                                                                  [
                                                                    fun γ =>
                                                                      ltac:(M.monadic
                                                                        (let γ :=
                                                                          M.use
                                                                            (M.alloc (|
                                                                              UnOp.not (|
                                                                                BinOp.eq (|
                                                                                  M.read (|
                                                                                    M.read (|
                                                                                      left_val
                                                                                    |)
                                                                                  |),
                                                                                  M.read (|
                                                                                    M.read (|
                                                                                      right_val
                                                                                    |)
                                                                                  |)
                                                                                |)
                                                                              |)
                                                                            |)) in
                                                                        let _ :=
                                                                          M.is_constant_or_break_match (|
                                                                            M.read (| γ |),
                                                                            Value.Bool true
                                                                          |) in
                                                                        M.alloc (|
                                                                          M.never_to_any (|
                                                                            M.read (|
                                                                              let~ kind :=
                                                                                M.alloc (|
                                                                                  Value.StructTuple
                                                                                    "core::panicking::AssertKind::Eq"
                                                                                    []
                                                                                |) in
                                                                              M.alloc (|
                                                                                M.call_closure (|
                                                                                  M.get_function (|
                                                                                    "core::panicking::assert_failed",
                                                                                    [
                                                                                      Ty.path
                                                                                        "usize";
                                                                                      Ty.path
                                                                                        "usize"
                                                                                    ]
                                                                                  |),
                                                                                  [
                                                                                    M.read (|
                                                                                      kind
                                                                                    |);
                                                                                    M.read (|
                                                                                      left_val
                                                                                    |);
                                                                                    M.read (|
                                                                                      right_val
                                                                                    |);
                                                                                    Value.StructTuple
                                                                                      "core::option::Option::None"
                                                                                      []
                                                                                  ]
                                                                                |)
                                                                              |)
                                                                            |)
                                                                          |)
                                                                        |)));
                                                                    fun γ =>
                                                                      ltac:(M.monadic
                                                                        (M.alloc (|
                                                                          Value.Tuple []
                                                                        |)))
                                                                  ]
                                                                |)))
                                                          ]
                                                        |) in
                                                      M.alloc (| Value.Tuple [] |)));
                                                  fun γ =>
                                                    ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                                ]
                                              |) in
                                            M.match_operator (|
                                              M.alloc (| Value.Tuple [] |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ :=
                                                      M.use
                                                        (M.alloc (|
                                                          BinOp.gt (|
                                                            M.read (| frac_digits |),
                                                            Value.Integer IntegerKind.Usize 0
                                                          |)
                                                        |)) in
                                                    let _ :=
                                                      M.is_constant_or_break_match (|
                                                        M.read (| γ |),
                                                        Value.Bool true
                                                      |) in
                                                    let~ _ :=
                                                      M.write (|
                                                        M.SubPointer.get_array_field (|
                                                          M.read (| parts |),
                                                          M.alloc (|
                                                            Value.Integer IntegerKind.Usize 0
                                                          |)
                                                        |),
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.apply
                                                              (Ty.path
                                                                "core::mem::maybe_uninit::MaybeUninit")
                                                              []
                                                              [ Ty.path "core::num::fmt::Part" ],
                                                            "new",
                                                            []
                                                          |),
                                                          [
                                                            Value.StructTuple
                                                              "core::num::fmt::Part::Copy"
                                                              [ M.read (| UnsupportedLiteral |) ]
                                                          ]
                                                        |)
                                                      |) in
                                                    let~ _ :=
                                                      M.write (|
                                                        M.SubPointer.get_array_field (|
                                                          M.read (| parts |),
                                                          M.alloc (|
                                                            Value.Integer IntegerKind.Usize 1
                                                          |)
                                                        |),
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.apply
                                                              (Ty.path
                                                                "core::mem::maybe_uninit::MaybeUninit")
                                                              []
                                                              [ Ty.path "core::num::fmt::Part" ],
                                                            "new",
                                                            []
                                                          |),
                                                          [
                                                            Value.StructTuple
                                                              "core::num::fmt::Part::Zero"
                                                              [ M.read (| frac_digits |) ]
                                                          ]
                                                        |)
                                                      |) in
                                                    M.alloc (|
                                                      Value.StructRecord
                                                        "core::num::fmt::Formatted"
                                                        [
                                                          ("sign", M.read (| sign |));
                                                          ("parts",
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.apply
                                                                  (Ty.path
                                                                    "core::mem::maybe_uninit::MaybeUninit")
                                                                  []
                                                                  [ Ty.path "core::num::fmt::Part"
                                                                  ],
                                                                "slice_assume_init_ref",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "core::ops::index::Index",
                                                                    Ty.apply
                                                                      (Ty.path "slice")
                                                                      []
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                                          []
                                                                          [
                                                                            Ty.path
                                                                              "core::num::fmt::Part"
                                                                          ]
                                                                      ],
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::ops::range::RangeTo")
                                                                        []
                                                                        [ Ty.path "usize" ]
                                                                    ],
                                                                    "index",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (| parts |);
                                                                    Value.StructRecord
                                                                      "core::ops::range::RangeTo"
                                                                      [
                                                                        ("end_",
                                                                          Value.Integer
                                                                            IntegerKind.Usize
                                                                            2)
                                                                      ]
                                                                  ]
                                                                |)
                                                              ]
                                                            |))
                                                        ]
                                                    |)));
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let~ _ :=
                                                      M.write (|
                                                        M.SubPointer.get_array_field (|
                                                          M.read (| parts |),
                                                          M.alloc (|
                                                            Value.Integer IntegerKind.Usize 0
                                                          |)
                                                        |),
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.apply
                                                              (Ty.path
                                                                "core::mem::maybe_uninit::MaybeUninit")
                                                              []
                                                              [ Ty.path "core::num::fmt::Part" ],
                                                            "new",
                                                            []
                                                          |),
                                                          [
                                                            Value.StructTuple
                                                              "core::num::fmt::Part::Copy"
                                                              [ M.read (| UnsupportedLiteral |) ]
                                                          ]
                                                        |)
                                                      |) in
                                                    M.alloc (|
                                                      Value.StructRecord
                                                        "core::num::fmt::Formatted"
                                                        [
                                                          ("sign", M.read (| sign |));
                                                          ("parts",
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.apply
                                                                  (Ty.path
                                                                    "core::mem::maybe_uninit::MaybeUninit")
                                                                  []
                                                                  [ Ty.path "core::num::fmt::Part"
                                                                  ],
                                                                "slice_assume_init_ref",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "core::ops::index::Index",
                                                                    Ty.apply
                                                                      (Ty.path "slice")
                                                                      []
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::mem::maybe_uninit::MaybeUninit")
                                                                          []
                                                                          [
                                                                            Ty.path
                                                                              "core::num::fmt::Part"
                                                                          ]
                                                                      ],
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::ops::range::RangeTo")
                                                                        []
                                                                        [ Ty.path "usize" ]
                                                                    ],
                                                                    "index",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (| parts |);
                                                                    Value.StructRecord
                                                                      "core::ops::range::RangeTo"
                                                                      [
                                                                        ("end_",
                                                                          Value.Integer
                                                                            IntegerKind.Usize
                                                                            1)
                                                                      ]
                                                                  ]
                                                                |)
                                                              ]
                                                            |))
                                                        ]
                                                    |)))
                                              ]
                                            |)));
                                        fun γ =>
                                          ltac:(M.monadic
                                            (M.alloc (|
                                              Value.StructRecord
                                                "core::num::fmt::Formatted"
                                                [
                                                  ("sign", M.read (| sign |));
                                                  ("parts",
                                                    M.call_closure (|
                                                      M.get_function (|
                                                        "core::num::flt2dec::digits_to_dec_str",
                                                        []
                                                      |),
                                                      [
                                                        M.read (| buf |);
                                                        M.read (| exp |);
                                                        M.read (| frac_digits |);
                                                        M.read (| parts |)
                                                      ]
                                                    |))
                                                ]
                                            |)))
                                      ]
                                    |)))
                              ]
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Function_to_exact_fixed_str :
      M.IsFunction "core::num::flt2dec::to_exact_fixed_str" to_exact_fixed_str.
  End flt2dec.
End num.
