program main
  fn make_i32_values(base: i32) -> (array i32 3)
    array i32
      var base
      binary +
        var base
        int 1
      binary +
        var base
        int 2
  fn make_i64_values(base: i64) -> (array i64 3)
    array i64
      var base
      binary +
        var base
        i64 1
      binary +
        var base
        i64 2
  fn make_f64_values(base: f64) -> (array f64 3)
    array f64
      var base
      binary +
        var base
        float 1
      binary +
        var base
        float 2
  fn make_flags(first: bool) -> (array bool 3)
    array bool
      var first
      bool false
      bool true
  fn i32_at(values: (array i32 3), i: i32) -> i32
    index
      var values
      var i
  fn i64_at(values: (array i64 3), i: i32) -> i64
    index
      var values
      var i
  fn f64_at(values: (array f64 3), i: i32) -> f64
    index
      var values
      var i
  fn bool_at(values: (array bool 3), i: i32) -> bool
    index
      var values
      var i
  fn i64_local_array_flow(i: i32) -> i64
    local let values: (array i64 3)
      call make_i64_values
        i64 40
    call i64_at
      var values
      var i
  fn f64_parameter_local_copy(values: (array f64 3), i: i32) -> f64
    local let copy: (array f64 3)
      var values
    index
      var copy
      var i
  fn echo_flags(values: (array bool 3)) -> (array bool 3)
    var values
  fn bool_call_return_index(i: i32) -> bool
    index
      call make_flags
        bool true
      var i
  fn main() -> i32
    if
      call bool_call_return_index
        int 0
      int 0
      int 1
  test "i32 array parameter value flow"
    binary =
      call i32_at
        call make_i32_values
          int 7
        int 0
      int 7
  test "i64 array local call value flow"
    binary =
      call i64_local_array_flow
        int 2
      i64 42
  test "f64 array parameter local copy"
    binary =
      call f64_parameter_local_copy
        call make_f64_values
          float 4
        int 1
      float 5
  test "bool array dynamic index"
    call bool_at
      call make_flags
        bool true
      int 2
  test "bool array return call value flow"
    index
      call echo_flags
        call make_flags
          bool false
      int 2
