program main
  fn make_values(base: i32) -> (array i32 3)
    array i32
      var base
      binary +
        var base
        int 1
      binary +
        var base
        int 2
  fn first(values: (array i32 3)) -> i32
    index
      var values
      int 0
  fn at(values: (array i32 3), i: i32) -> i32
    index
      var values
      var i
  fn echo(values: (array i32 3)) -> (array i32 3)
    var values
  fn call_return_index(i: i32) -> i32
    index
      call make_values
        int 10
      var i
  fn local_array_flow(i: i32) -> i32
    local let values: (array i32 3)
      call make_values
        int 20
    call at
      var values
      var i
  fn parameter_local_copy(values: (array i32 3), i: i32) -> i32
    local let copy: (array i32 3)
      var values
    index
      var copy
      var i
  fn main() -> i32
    call call_return_index
      int 1
  test "array parameter value flow"
    binary =
      call first
        call make_values
          int 7
      int 7
  test "array dynamic index"
    binary =
      call at
        call make_values
          int 4
        int 2
      int 6
  test "array local call value flow"
    binary =
      call local_array_flow
        int 1
      int 21
  test "array parameter local copy"
    binary =
      call parameter_local_copy
        call make_values
          int 40
        int 2
      int 42
  test "array return call value flow"
    binary =
      index
        call echo
          call make_values
            int 30
        int 2
      int 32
