program main
  fn make_words(head: string) -> (array string 3)
    array string
      var head
      string "middle"
      string "tail"
  fn at(values: (array string 3), i: i32) -> string
    index
      var values
      var i
  fn echo(values: (array string 3)) -> (array string 3)
    var values
  fn call_return_index(i: i32) -> string
    index
      call make_words
        string "call"
      var i
  fn local_array_flow(i: i32) -> string
    local let words: (array string 3)
      call make_words
        string "local"
    call at
      var words
      var i
  fn parameter_local_copy(values: (array string 3), i: i32) -> string
    local let copy: (array string 3)
      var values
    index
      var copy
      var i
  fn main() -> i32
    if
      binary =
        call call_return_index
          int 1
        string "middle"
      int 0
      int 1
  test "string array parameter value flow"
    binary =
      call at
        call make_words
          string "alpha"
        int 0
      string "alpha"
  test "string array dynamic index"
    binary =
      call at
        call make_words
          string "alpha"
        int 2
      string "tail"
  test "string array local call value flow"
    binary =
      call local_array_flow
        int 1
      string "middle"
  test "string array parameter local copy"
    binary =
      call parameter_local_copy
        call make_words
          string "omega"
        int 0
      string "omega"
  test "string array return call value flow"
    binary =
      index
        call echo
          call make_words
            string "zeta"
        int 2
      string "tail"
