(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *)
(** [rename_attribute] *)
Require Import Primitives.
Import Primitives.
Require Import Coq.ZArith.ZArith.
Require Import List.
Import ListNotations.
Local Open Scope Primitives_scope.
Module RenameAttribute.

(** Trait declaration: [rename_attribute::BoolTrait]
    Source: 'tests/src/rename_attribute.rs', lines 10:0-20:1
    Visibility: public *)
Record BoolTest_t (Self : Type) := mkBoolTest_t {
  BoolTest_t_getTest : Self -> result bool;
  BoolTest_t_retTest : Self -> result bool;
}.

Arguments mkBoolTest_t { _ }.
Arguments BoolTest_t_getTest { _ } _.
Arguments BoolTest_t_retTest { _ } _.

(** [rename_attribute::BoolTrait::ret_true]:
    Source: 'tests/src/rename_attribute.rs', lines 17:4-19:5
    Visibility: public *)
Definition boolTrait_retTest_default
  {Self : Type} (self : Self) : result bool :=
  Ok true
.

(** [rename_attribute::{impl rename_attribute::BoolTrait for bool}::get_bool]:
    Source: 'tests/src/rename_attribute.rs', lines 24:4-26:5
    Visibility: public *)
Definition BoolImpl_getTest (self : bool) : result bool :=
  Ok self.

(** Trait implementation: [rename_attribute::{impl rename_attribute::BoolTrait for bool}]
    Source: 'tests/src/rename_attribute.rs', lines 23:0-27:1 *)
Definition BoolImpl : BoolTest_t bool := {|
  BoolTest_t_getTest := BoolImpl_getTest;
  BoolTest_t_retTest := boolTrait_retTest_default;
|}.

(** [rename_attribute::test_bool_trait]:
    Source: 'tests/src/rename_attribute.rs', lines 30:0-32:1
    Visibility: public *)
Definition boolFn (T : Type) (x : bool) : result bool :=
  b <- BoolImpl_getTest x; if b then boolTrait_retTest_default x else Ok false
.

(** [rename_attribute::SimpleEnum]
    Source: 'tests/src/rename_attribute.rs', lines 38:0-43:1 *)
Inductive VariantsTest_t :=
| VariantsTest_Variant1 : VariantsTest_t
| VariantsTest_SecondVariant : VariantsTest_t
| VariantsTest_ThirdVariant : VariantsTest_t
.

(** [rename_attribute::Foo]
    Source: 'tests/src/rename_attribute.rs', lines 46:0-49:1 *)
Record StructTest_t := mkStructTest_t { structTest_FieldTest : u32; }.

(** [rename_attribute::C]
    Source: 'tests/src/rename_attribute.rs', lines 52:0-52:28 *)
Definition const_Test : result u32 :=
  i <- u32_add 100%u32 10%u32; u32_add i 1%u32
.

(** [rename_attribute::CA]
    Source: 'tests/src/rename_attribute.rs', lines 55:0-55:23 *)
Definition const_Aeneas11 : result u32 := u32_add 10%u32 1%u32.

(** [rename_attribute::factorial]:
    Source: 'tests/src/rename_attribute.rs', lines 58:0-64:1 *)
Fixpoint factfn (n : nat) (n1 : u64) : result u64 :=
  match n with
  | O => Fail_ OutOfFuel
  | S n2 =>
    if n1 s<= 1%u64
    then Ok 1%u64
    else (i <- u64_sub n1 1%u64; i1 <- factfn n2 i; u64_mul n1 i1)
  end
.

(** [rename_attribute::sum]: loop 0:
    Source: 'tests/src/rename_attribute.rs', lines 70:4-73:5
    Visibility: public *)
Fixpoint no_borrows_sum_loop
  (n : nat) (max : u32) (i : u32) (s : u32) : result u32 :=
  match n with
  | O => Fail_ OutOfFuel
  | S n1 =>
    if i s< max
    then (
      s1 <- u32_add s i;
      i1 <- u32_add i 1%u32;
      no_borrows_sum_loop n1 max i1 s1)
    else Ok s
  end
.

(** [rename_attribute::sum]:
    Source: 'tests/src/rename_attribute.rs', lines 67:0-77:1
    Visibility: public *)
Definition no_borrows_sum (n : nat) (max : u32) : result u32 :=
  s <- no_borrows_sum_loop n max 0%u32 0%u32; u32_mul s 2%u32
.

End RenameAttribute.
