program main
  fn empty_values() -> (vec i32)
    call std.vec.i32.empty
  fn pair(base: i32) -> (vec i32)
    local let values: (vec i32)
      call std.vec.i32.empty
    local let first: (vec i32)
      call std.vec.i32.append
        var values
        var base
    call std.vec.i32.append
      var first
      binary +
        var base
        int 1
  fn echo(values: (vec i32)) -> (vec i32)
    var values
  fn length(values: (vec i32)) -> i32
    call std.vec.i32.len
      var values
  fn at(values: (vec i32), i: i32) -> i32
    call std.vec.i32.index
      var values
      var i
  fn call_return_len() -> i32
    call std.vec.i32.len
      call echo
        call pair
          int 20
  fn original_len_after_append() -> i32
    local let values: (vec i32)
      call std.vec.i32.empty
    local let appended: (vec i32)
      call std.vec.i32.append
        var values
        int 1
    call std.vec.i32.len
      var values
  fn main() -> i32
    call std.io.print_i32
      call call_return_len
    call at
      call pair
        int 40
      int 1
  test "vec i32 empty length"
    binary =
      call std.vec.i32.len
        call empty_values
      int 0
  test "vec i32 append length"
    binary =
      call length
        call pair
          int 40
      int 2
  test "vec i32 index"
    binary =
      call at
        call pair
          int 40
        int 1
      int 41
  test "vec i32 append is immutable"
    binary =
      call original_len_after_append
      int 0
  test "vec i32 equality"
    binary =
      call pair
        int 5
      call std.vec.i32.append
        call std.vec.i32.append
          call std.vec.i32.empty
          int 5
        int 6
