program main
  fn maybe_value(value: i32) -> (option i32)
    some : (option i32)
      var value : i32
  fn maybe_empty() -> (option i32)
    none : (option i32)
  fn maybe_wide_value(value: i64) -> (option i64)
    some : (option i64)
      var value : i64
  fn maybe_wide_empty() -> (option i64)
    none : (option i64)
  fn maybe_float_value(value: f64) -> (option f64)
    some : (option f64)
      var value : f64
  fn maybe_float_empty() -> (option f64)
    none : (option f64)
  fn maybe_flag_value(value: bool) -> (option bool)
    some : (option bool)
      var value : bool
  fn maybe_flag_empty() -> (option bool)
    none : (option bool)
  fn maybe_string_value(value: string) -> (option string)
    some : (option string)
      var value : string
  fn maybe_string_empty() -> (option string)
    none : (option string)
  fn result_ok_value(value: i32) -> (result i32 i32)
    ok : (result i32 i32)
      var value : i32
  fn result_err_value(code: i32) -> (result i32 i32)
    err : (result i32 i32)
      var code : i32
  fn option_value_or(value: (option i32), fallback: i32) -> i32
    match : i32
      subject
        var value : (option i32)
      arm some payload
        var payload : i32
      arm none
        var fallback : i32
  fn option_bump_or_zero(value: (option i32)) -> i32
    match : i32
      subject
        var value : (option i32)
      arm some payload
        local let bumped : unit
          binary + : i32
            var payload : i32
            int 1 : i32
        var bumped : i32
      arm none
        int 0 : i32
  fn option_wide_value_or(value: (option i64), fallback: i64) -> i64
    match : i64
      subject
        var value : (option i64)
      arm some payload
        var payload : i64
      arm none
        var fallback : i64
  fn option_wide_bump_or_zero(value: (option i64)) -> i64
    match : i64
      subject
        var value : (option i64)
      arm some payload
        local let bumped : unit
          binary + : i64
            var payload : i64
            i64 1 : i64
        var bumped : i64
      arm none
        i64 0 : i64
  fn option_float_value_or(value: (option f64), fallback: f64) -> f64
    match : f64
      subject
        var value : (option f64)
      arm some payload
        var payload : f64
      arm none
        var fallback : f64
  fn option_float_bump_or_zero(value: (option f64)) -> f64
    match : f64
      subject
        var value : (option f64)
      arm some payload
        local let bumped : unit
          binary + : f64
            var payload : f64
            float 1 : f64
        var bumped : f64
      arm none
        float 0 : f64
  fn option_flag_value_or(value: (option bool), fallback: bool) -> bool
    match : bool
      subject
        var value : (option bool)
      arm some payload
        var payload : bool
      arm none
        var fallback : bool
  fn option_flag_selected_or(value: (option bool), fallback: bool) -> bool
    match : bool
      subject
        var value : (option bool)
      arm some payload
        if : bool
          var payload : bool
          bool true : bool
          bool false : bool
        var payload : bool
      arm none
        var fallback : bool
  fn option_string_value_or(value: (option string), fallback: string) -> string
    match : string
      subject
        var value : (option string)
      arm some payload
        var payload : string
      arm none
        var fallback : string
  fn option_string_selected_or(value: (option string), fallback: string) -> string
    match : string
      subject
        var value : (option string)
      arm some payload
        local let chosen : unit
          var payload : string
        var chosen : string
      arm none
        var fallback : string
  fn result_value_or_code(value: (result i32 i32)) -> i32
    match : i32
      subject
        var value : (result i32 i32)
      arm ok payload
        var payload : i32
      arm err code
        var code : i32
  fn result_score(value: (result i32 i32)) -> i32
    match : i32
      subject
        var value : (result i32 i32)
      arm ok payload
        binary + : i32
          var payload : i32
          int 10 : i32
      arm err code
        var code : i32
  fn main() -> i32
    int 0 : i32
  test "option match some payload"
    binary = : bool
      call option_value_or : i32
        call maybe_value : (option i32)
          int 42 : i32
        int 0 : i32
      int 42 : i32
  test "option match none fallback"
    binary = : bool
      call option_value_or : i32
        call maybe_empty : (option i32)
        int 7 : i32
      int 7 : i32
  test "option match multi expression arm"
    binary = : bool
      call option_bump_or_zero : i32
        call maybe_value : (option i32)
          int 8 : i32
      int 9 : i32
  test "option i64 match some payload"
    binary = : bool
      call option_wide_value_or : i64
        call maybe_wide_value : (option i64)
          i64 2147483648 : i64
        i64 0 : i64
      i64 2147483648 : i64
  test "option i64 match none fallback"
    binary = : bool
      call option_wide_value_or : i64
        call maybe_wide_empty : (option i64)
        i64 7 : i64
      i64 7 : i64
  test "option i64 match multi expression arm"
    binary = : bool
      call option_wide_bump_or_zero : i64
        call maybe_wide_value : (option i64)
          i64 8 : i64
      i64 9 : i64
  test "option f64 match some payload"
    binary = : bool
      call option_float_value_or : f64
        call maybe_float_value : (option f64)
          float 42.5 : f64
        float 0 : f64
      float 42.5 : f64
  test "option f64 match none fallback"
    binary = : bool
      call option_float_value_or : f64
        call maybe_float_empty : (option f64)
        float 7 : f64
      float 7 : f64
  test "option f64 match multi expression arm"
    binary = : bool
      call option_float_bump_or_zero : f64
        call maybe_float_value : (option f64)
          float 8.5 : f64
      float 9.5 : f64
  test "option bool match some payload"
    call option_flag_value_or : bool
      call maybe_flag_value : (option bool)
        bool true : bool
      bool false : bool
  test "option bool match none fallback"
    call option_flag_value_or : bool
      call maybe_flag_empty : (option bool)
      bool true : bool
  test "option bool match multi expression arm"
    call option_flag_selected_or : bool
      call maybe_flag_value : (option bool)
        bool true : bool
      bool false : bool
  test "option string match some payload"
    binary = : bool
      call option_string_value_or : string
        call maybe_string_value : (option string)
          string "slovo" : string
        string "fallback" : string
      string "slovo" : string
  test "option string match none fallback"
    binary = : bool
      call option_string_value_or : string
        call maybe_string_empty : (option string)
        string "fallback" : string
      string "fallback" : string
  test "option string match multi expression arm"
    binary = : bool
      call option_string_selected_or : string
        call maybe_string_value : (option string)
          string "oak" : string
        string "fallback" : string
      string "oak" : string
  test "result match ok payload"
    binary = : bool
      call result_value_or_code : i32
        call result_ok_value : (result i32 i32)
          int 30 : i32
      int 30 : i32
  test "result match err payload"
    binary = : bool
      call result_value_or_code : i32
        call result_err_value : (result i32 i32)
          int 5 : i32
      int 5 : i32
  test "result match computed arm"
    binary = : bool
      call result_score : i32
        call result_ok_value : (result i32 i32)
          int 2 : i32
      int 12 : i32
