(module
 (type $vector (array (mut i32)))
 (type $struct (struct (field (ref null $vector))))
 (type $ref|func|_=>_none (func (param (ref func))))
 (type $i32_=>_none (func (param i32)))
 (type $none_=>_ref?|$struct| (func (result (ref null $struct))))
 (type $none_=>_f64 (func (result f64)))
 (type $none_=>_i32 (func (result i32)))
 (type $i32_=>_funcref (func (param i32) (result funcref)))
 (type $none_=>_none (func))
 (import "out" "log" (func $log (param i32)))
 (elem declare func $br_on-to-br $br_on-to-flow $i32_=>_none $none_=>_i32)
 (func $foo (result (ref null $struct))
  (if (result (ref null $struct))
   (i32.const 1)
   (struct.new_with_rtt $struct
    (array.new_default_with_rtt $vector
     (i32.const 1)
     (rtt.canon $vector)
    )
    (rtt.canon $struct)
   )
   (ref.null $struct)
  )
 )
 (func $test-prefinalize (result f64)
  (loop $loop (result f64)
   (if (result f64)
    (i32.const 1)
    (f64.const 0)
    (block $block (result f64)
     (nop)
     (br_if $loop
      (i32.eqz
       (i32.const 0)
      )
     )
     (unreachable)
    )
   )
  )
 )
 (func $none_=>_i32 (result i32)
  (unreachable)
 )
 (func $i32_=>_none (param $0 i32)
  (nop)
 )
 (func $selectify (param $x i32) (result funcref)
  (select (result funcref)
   (ref.func $none_=>_i32)
   (ref.func $i32_=>_none)
   (local.get $x)
  )
 )
 (func $br_on-to-br (param $func (ref func))
  (call $log
   (i32.const 0)
  )
  (block $null
   (drop
    (ref.func $br_on-to-br)
   )
   (call $log
    (i32.const 1)
   )
  )
  (call $log
   (i32.const 2)
  )
  (drop
   (block $func (result (ref $ref|func|_=>_none))
    (drop
     (br $func
      (ref.func $br_on-to-br)
     )
    )
    (call $log
     (i32.const 3)
    )
    (ref.func $br_on-to-br)
   )
  )
  (call $log
   (i32.const 4)
  )
  (drop
   (block $data (result (ref $vector))
    (drop
     (br $data
      (array.new_default_with_rtt $vector
       (i32.const 1)
       (rtt.canon $vector)
      )
     )
    )
    (call $log
     (i32.const 5)
    )
    (array.new_default_with_rtt $vector
     (i32.const 2)
     (rtt.canon $vector)
    )
   )
  )
  (call $log
   (i32.const 6)
  )
  (drop
   (block $i31 (result i31ref)
    (drop
     (br $i31
      (i31.new
       (i32.const 42)
      )
     )
    )
    (call $log
     (i32.const 7)
    )
    (i31.new
     (i32.const 1337)
    )
   )
  )
  (call $log
   (i32.const 8)
  )
  (drop
   (block $non-null (result (ref $ref|func|_=>_none))
    (br $non-null
     (ref.func $br_on-to-br)
    )
    (call $log
     (i32.const 9)
    )
    (ref.func $br_on-to-br)
   )
  )
 )
 (func $br_on-to-flow
  (drop
   (block $data (result (ref null data))
    (drop
     (ref.func $br_on-to-flow)
    )
    (ref.null data)
   )
  )
  (drop
   (block $datab (result (ref null data))
    (drop
     (i31.new
      (i32.const 1337)
     )
    )
    (ref.null data)
   )
  )
  (drop
   (block $func (result funcref)
    (drop
     (array.new_default_with_rtt $vector
      (i32.const 2)
      (rtt.canon $vector)
     )
    )
    (ref.null func)
   )
  )
  (drop
   (block $funcb (result funcref)
    (drop
     (i31.new
      (i32.const 1337)
     )
    )
    (ref.null func)
   )
  )
  (drop
   (block $i31 (result (ref null i31))
    (drop
     (array.new_default_with_rtt $vector
      (i32.const 2)
      (rtt.canon $vector)
     )
    )
    (ref.null i31)
   )
  )
  (drop
   (block $i31b (result (ref null i31))
    (drop
     (ref.func $br_on-to-flow)
    )
    (ref.null i31)
   )
  )
 )
)
