program main
  struct NumericRecord
    field wide: i64
    field ratio: f64
  fn make_record(wide: i64, ratio: f64) -> NumericRecord
    construct NumericRecord : NumericRecord
      field wide
        var wide : i64
      field ratio
        var ratio : f64
  fn literal_record() -> NumericRecord
    construct NumericRecord : NumericRecord
      field wide
        i64 2147483648 : i64
      field ratio
        float 3.5 : f64
  fn echo_record(record: NumericRecord) -> NumericRecord
    var record : NumericRecord
  fn local_record(wide: i64, ratio: f64) -> NumericRecord
    local let record : unit
      call make_record : NumericRecord
        var wide : i64
        var ratio : f64
    call echo_record : NumericRecord
      var record : NumericRecord
  fn record_wide(record: NumericRecord) -> i64
    field-access wide : i64
      var record : NumericRecord
  fn record_ratio(record: NumericRecord) -> f64
    field-access ratio : f64
      var record : NumericRecord
  fn wide_total(record: NumericRecord) -> i64
    binary + : i64
      field-access wide : i64
        var record : NumericRecord
      i64 10 : i64
  fn ratio_total(record: NumericRecord) -> f64
    binary + : f64
      field-access ratio : f64
        var record : NumericRecord
      float 1.5 : f64
  fn wide_in_range(record: NumericRecord) -> bool
    if : bool
      binary > : bool
        field-access wide : i64
          var record : NumericRecord
        i64 2147483640 : i64
      binary < : bool
        field-access wide : i64
          var record : NumericRecord
        i64 2147483660 : i64
      bool false : bool
  fn ratio_in_range(record: NumericRecord) -> bool
    if : bool
      binary > : bool
        field-access ratio : f64
          var record : NumericRecord
        float 3 : f64
      binary < : bool
        field-access ratio : f64
          var record : NumericRecord
        float 4 : f64
      bool false : bool
  fn wide_text(record: NumericRecord) -> string
    call std.num.i64_to_string : string
      field-access wide : i64
        var record : NumericRecord
  fn ratio_text(record: NumericRecord) -> string
    call std.num.f64_to_string : string
      field-access ratio : f64
        var record : NumericRecord
  fn main() -> i32
    call std.io.print_i64 : unit
      call record_wide : i64
        call literal_record : NumericRecord
    call std.io.print_f64 : unit
      call record_ratio : f64
        call literal_record : NumericRecord
    if : i32
      call wide_in_range : bool
        call local_record : NumericRecord
          i64 2147483648 : i64
          float 3.5 : f64
      if : i32
        call ratio_in_range : bool
          call local_record : NumericRecord
            i64 2147483648 : i64
            float 3.5 : f64
        int 0 : i32
        int 1 : i32
      int 1 : i32
  test "numeric struct i64 field access"
    binary = : bool
      call record_wide : i64
        call literal_record : NumericRecord
      i64 2147483648 : i64
  test "numeric struct f64 field access"
    binary = : bool
      call record_ratio : f64
        call literal_record : NumericRecord
      float 3.5 : f64
  test "numeric struct i64 arithmetic after access"
    binary = : bool
      call wide_total : i64
        call literal_record : NumericRecord
      i64 2147483658 : i64
  test "numeric struct f64 arithmetic after access"
    binary = : bool
      call ratio_total : f64
        call literal_record : NumericRecord
      float 5 : f64
  test "numeric struct i64 comparison after access"
    call wide_in_range : bool
      call literal_record : NumericRecord
  test "numeric struct f64 comparison after access"
    call ratio_in_range : bool
      call literal_record : NumericRecord
  test "numeric struct local param return call flow"
    binary = : bool
      call wide_total : i64
        call local_record : NumericRecord
          i64 2147483648 : i64
          float 3.5 : f64
      i64 2147483658 : i64
  test "numeric struct i64 format after access"
    binary = : bool
      call wide_text : string
        call literal_record : NumericRecord
      string "2147483648" : string
  test "numeric struct f64 format after access"
    binary = : bool
      call ratio_text : string
        call literal_record : NumericRecord
      string "3.5" : string
