;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.

;; RUN: wasm-opt %s -all -o %t.text.wast -g -S
;; RUN: wasm-as %s -all -g -o %t.wasm
;; RUN: wasm-dis %t.wasm -all -o %t.bin.wast
;; RUN: wasm-as %s -all -o %t.nodebug.wasm
;; RUN: wasm-dis %t.nodebug.wasm -all -o %t.bin.nodebug.wast
;; RUN: cat %t.text.wast | filecheck %s --check-prefix=CHECK-TEXT
;; RUN: cat %t.bin.wast | filecheck %s --check-prefix=CHECK-BIN
;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG

(module
  ;; CHECK-TEXT:      (type $f (func (param i32) (result i64)))
  ;; CHECK-BIN:      (type $f (func (param i32) (result i64)))
  (type $f (func (param i32) (result i64)))
  ;; CHECK-TEXT:      (import "" "" (func $1 (exact (type $f) (param i32) (result i64))))
  ;; CHECK-BIN:      (import "" "" (func $1 (exact (type $f) (param i32) (result i64))))
  (import "" "" (func $1 (exact (type $f))))
  ;; CHECK-TEXT:      (import "" "" (func $2 (exact (type $f) (param i32) (result i64))))
  ;; CHECK-BIN:      (import "" "" (func $2 (exact (type $f) (param i32) (result i64))))
  (import "" "" (func $2 (exact (type $f) (param i32) (result i64))))
  ;; CHECK-TEXT:      (import "" "" (func $3 (exact (type $f) (param i32) (result i64))))
  ;; CHECK-BIN:      (import "" "" (func $3 (exact (type $f) (param i32) (result i64))))
  (import "" "" (func $3 (exact (param i32) (result i64))))

  (func $4 (import "" "") (exact (type $f)))
  (func $5 (import "" "") (exact (type $f) (param i32) (result i64)))
  (func $6 (import "" "") (exact (param i32) (result i64)))

  (global (ref (exact $f)) (ref.func $1))
  (global (ref (exact $f)) (ref.func $2))
  (global (ref (exact $f)) (ref.func $3))
  (global (ref (exact $f)) (ref.func $4))
  (global (ref (exact $f)) (ref.func $5))
  (global (ref (exact $f)) (ref.func $6))
)
;; CHECK-TEXT:      (import "" "" (func $4 (exact (type $f) (param i32) (result i64))))

;; CHECK-TEXT:      (import "" "" (func $5 (exact (type $f) (param i32) (result i64))))

;; CHECK-TEXT:      (import "" "" (func $6 (exact (type $f) (param i32) (result i64))))

;; CHECK-TEXT:      (global $global$0 (ref (exact $f)) (ref.func $1))

;; CHECK-TEXT:      (global $global$1 (ref (exact $f)) (ref.func $2))

;; CHECK-TEXT:      (global $global$2 (ref (exact $f)) (ref.func $3))

;; CHECK-TEXT:      (global $global$3 (ref (exact $f)) (ref.func $4))

;; CHECK-TEXT:      (global $global$4 (ref (exact $f)) (ref.func $5))

;; CHECK-TEXT:      (global $global$5 (ref (exact $f)) (ref.func $6))

;; CHECK-BIN:      (import "" "" (func $4 (exact (type $f) (param i32) (result i64))))

;; CHECK-BIN:      (import "" "" (func $5 (exact (type $f) (param i32) (result i64))))

;; CHECK-BIN:      (import "" "" (func $6 (exact (type $f) (param i32) (result i64))))

;; CHECK-BIN:      (global $global$0 (ref (exact $f)) (ref.func $1))

;; CHECK-BIN:      (global $global$1 (ref (exact $f)) (ref.func $2))

;; CHECK-BIN:      (global $global$2 (ref (exact $f)) (ref.func $3))

;; CHECK-BIN:      (global $global$3 (ref (exact $f)) (ref.func $4))

;; CHECK-BIN:      (global $global$4 (ref (exact $f)) (ref.func $5))

;; CHECK-BIN:      (global $global$5 (ref (exact $f)) (ref.func $6))

;; CHECK-BIN-NODEBUG:      (type $0 (func (param i32) (result i64)))

;; CHECK-BIN-NODEBUG:      (import "" "" (func $fimport$0 (exact (type $0) (param i32) (result i64))))

;; CHECK-BIN-NODEBUG:      (import "" "" (func $fimport$1 (exact (type $0) (param i32) (result i64))))

;; CHECK-BIN-NODEBUG:      (import "" "" (func $fimport$2 (exact (type $0) (param i32) (result i64))))

;; CHECK-BIN-NODEBUG:      (import "" "" (func $fimport$3 (exact (type $0) (param i32) (result i64))))

;; CHECK-BIN-NODEBUG:      (import "" "" (func $fimport$4 (exact (type $0) (param i32) (result i64))))

;; CHECK-BIN-NODEBUG:      (import "" "" (func $fimport$5 (exact (type $0) (param i32) (result i64))))

;; CHECK-BIN-NODEBUG:      (global $global$0 (ref (exact $0)) (ref.func $fimport$0))

;; CHECK-BIN-NODEBUG:      (global $global$1 (ref (exact $0)) (ref.func $fimport$1))

;; CHECK-BIN-NODEBUG:      (global $global$2 (ref (exact $0)) (ref.func $fimport$2))

;; CHECK-BIN-NODEBUG:      (global $global$3 (ref (exact $0)) (ref.func $fimport$3))

;; CHECK-BIN-NODEBUG:      (global $global$4 (ref (exact $0)) (ref.func $fimport$4))

;; CHECK-BIN-NODEBUG:      (global $global$5 (ref (exact $0)) (ref.func $fimport$5))
