program main
  struct ArrayRecord
    field ints: (array i32 3)
    field wides: (array i64 2)
    field ratios: (array f64 3)
    field flags: (array bool 3)
    field words: (array string 3)
  fn make_record(base: i32, head: string) -> ArrayRecord
    construct ArrayRecord : ArrayRecord
      field ints
        array : (array i32 3)
          var base : i32
          binary + : i32
            var base : i32
            int 1 : i32
          binary + : i32
            var base : i32
            int 2 : i32
      field wides
        array : (array i64 2)
          i64 40 : i64
          i64 41 : i64
      field ratios
        array : (array f64 3)
          float 1.5 : f64
          float 2.5 : f64
          float 3.5 : f64
      field flags
        array : (array bool 3)
          bool false : bool
          bool true : bool
          bool true : bool
      field words
        array : (array string 3)
          var head : string
          string "moon" : string
          string "star" : string
  fn echo_record(record: ArrayRecord) -> ArrayRecord
    var record : ArrayRecord
  fn local_record(head: string) -> ArrayRecord
    local let record : unit
      call make_record : ArrayRecord
        int 7 : i32
        var head : string
    call echo_record : ArrayRecord
      var record : ArrayRecord
  fn int_at(record: ArrayRecord, i: i32) -> i32
    index : i32
      field-access ints : (array i32 3)
        var record : ArrayRecord
      var i : i32
  fn wide_at(record: ArrayRecord, i: i32) -> i64
    index : i64
      field-access wides : (array i64 2)
        var record : ArrayRecord
      var i : i32
  fn ratio_at(record: ArrayRecord, i: i32) -> f64
    index : f64
      field-access ratios : (array f64 3)
        var record : ArrayRecord
      var i : i32
  fn flag_at(record: ArrayRecord, i: i32) -> bool
    index : bool
      field-access flags : (array bool 3)
        var record : ArrayRecord
      var i : i32
  fn word_at(record: ArrayRecord, i: i32) -> string
    index : string
      field-access words : (array string 3)
        var record : ArrayRecord
      var i : i32
  fn main() -> i32
    if : i32
      call flag_at : bool
        call local_record : ArrayRecord
          string "sun" : string
        int 2 : i32
      int 0 : i32
      int 1 : i32
  test "struct array i32 field access"
    binary = : bool
      call int_at : i32
        call make_record : ArrayRecord
          int 7 : i32
          string "sun" : string
        int 2 : i32
      int 9 : i32
  test "struct array i64 field access"
    binary = : bool
      call wide_at : i64
        call make_record : ArrayRecord
          int 7 : i32
          string "sun" : string
        int 1 : i32
      i64 41 : i64
  test "struct array f64 field access"
    binary = : bool
      call ratio_at : f64
        call make_record : ArrayRecord
          int 7 : i32
          string "sun" : string
        int 2 : i32
      float 3.5 : f64
  test "struct array bool field access"
    call flag_at : bool
      call make_record : ArrayRecord
        int 7 : i32
        string "sun" : string
      int 1 : i32
  test "struct array string field access"
    binary = : bool
      call word_at : string
        call make_record : ArrayRecord
          int 7 : i32
          string "sun" : string
        int 1 : i32
      string "moon" : string
  test "struct array local param return call flow"
    binary = : bool
      call word_at : string
        call local_record : ArrayRecord
          string "sun" : string
        int 0 : i32
      string "sun" : string
