Before:
(module
)
Keeping: <none>
After:
(module
)
Secondary:
(module
)


Before:
(module
 (type $0 (func (param i32)))
 (global $glob (mut i32) (i32.const 7))
 (memory $mem 3 42 shared)
 (table $tab 3 42 funcref)
 (tag $e (param i32))
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32)))
 (global $glob (mut i32) (i32.const 7))
 (memory $mem 3 42 shared)
 (table $tab 3 42 funcref)
 (tag $e (param i32))
 (export "%memory" (memory $mem))
 (export "%table" (table $tab))
 (export "%global" (global $glob))
 (export "%tag" (tag $e))
)
Secondary:
(module
 (type $0 (func (param i32)))
 (import "primary" "%memory" (memory $mem 3 42 shared))
 (import "primary" "%table" (table $tab 3 42 funcref))
 (import "primary" "%global" (global $glob (mut i32)))
 (import "primary" "%tag" (tag $e (param i32)))
)


Before:
(module
 (type $0 (func (param i32)))
 (import "env" "mem" (memory $mem 3 42 shared))
 (import "env" "tab" (table $tab 3 42 funcref))
 (import "env" "glob" (global $glob (mut i32)))
 (import "env" "e" (tag $e (param i32)))
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32)))
 (import "env" "mem" (memory $mem 3 42 shared))
 (import "env" "tab" (table $tab 3 42 funcref))
 (import "env" "glob" (global $glob (mut i32)))
 (import "env" "e" (tag $e (param i32)))
 (export "%memory" (memory $mem))
 (export "%table" (table $tab))
 (export "%global" (global $glob))
 (export "%tag" (tag $e))
)
Secondary:
(module
 (type $0 (func (param i32)))
 (import "primary" "%memory" (memory $mem 3 42 shared))
 (import "primary" "%table" (table $tab 3 42 funcref))
 (import "primary" "%global" (global $glob (mut i32)))
 (import "primary" "%tag" (tag $e (param i32)))
)


Before:
(module
 (type $0 (func (param i32)))
 (global $glob (mut i32) (i32.const 7))
 (memory $mem 3 42 shared)
 (table $tab 3 42 funcref)
 (tag $e (param i32))
 (export "mem" (memory $mem))
 (export "tab" (table $tab))
 (export "glob" (global $glob))
 (export "e" (tag $e))
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32)))
 (global $glob (mut i32) (i32.const 7))
 (memory $mem 3 42 shared)
 (table $tab 3 42 funcref)
 (tag $e (param i32))
 (export "mem" (memory $mem))
 (export "tab" (table $tab))
 (export "glob" (global $glob))
 (export "e" (tag $e))
)
Secondary:
(module
 (type $0 (func (param i32)))
 (import "primary" "mem" (memory $mem 3 42 shared))
 (import "primary" "tab" (table $tab 3 42 funcref))
 (import "primary" "glob" (global $glob (mut i32)))
 (import "primary" "e" (tag $e (param i32)))
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Secondary:
(module
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (export "foo" (func $foo))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (export "foo" (func $foo))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Secondary:
(module
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 1 funcref)
 (elem $0 (i32.const 0) $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 1 funcref)
 (elem $0 (i32.const 0) $foo)
 (export "%table" (table $table))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Secondary:
(module
 (import "primary" "%table" (table $table 1 funcref))
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 2 funcref)
 (elem $0 (i32.const 0) $foo $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 2 funcref)
 (elem $0 (i32.const 0) $foo $foo)
 (export "%table" (table $table))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Secondary:
(module
 (import "primary" "%table" (table $table 2 funcref))
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (table $table 1 funcref)
 (elem $0 (global.get $base) $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (table $table 1 funcref)
 (elem $0 (global.get $base) $foo)
 (export "%table" (table $table))
 (export "%global" (global $base))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Secondary:
(module
 (import "primary" "%table" (table $table 1 funcref))
 (import "primary" "%global" (global $base i32))
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (table $table 2 funcref)
 (elem $0 (global.get $base) $foo $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (table $table 2 funcref)
 (elem $0 (global.get $base) $foo $foo)
 (export "%table" (table $table))
 (export "%global" (global $base))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Secondary:
(module
 (import "primary" "%table" (table $table 2 funcref))
 (import "primary" "%global" (global $base i32))
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "foo" (func $foo (type $0) (param i32) (result i32)))
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "foo" (func $foo (type $0) (param i32) (result i32)))
)
Secondary:
(module
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "foo" (func $foo (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (elem $0 (i32.const 42) $foo)
 (export "foo" (func $foo))
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "foo" (func $foo (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (elem $0 (i32.const 42) $foo)
 (export "foo" (func $foo))
 (export "%table" (table $table))
)
Secondary:
(module
 (import "primary" "%table" (table $table 1000 funcref))
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (import "env" "foo" (func $foo (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (elem $0 (global.get $base) $foo)
 (export "foo" (func $foo))
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (import "env" "foo" (func $foo (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (elem $0 (global.get $base) $foo)
 (export "foo" (func $foo))
 (export "%table" (table $table))
 (export "%global" (global $base))
)
Secondary:
(module
 (import "primary" "%table" (table $table 1000 funcref))
 (import "primary" "%global" (global $base i32))
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: <none>
After:
(module
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (export "foo" (func $foo))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $0 1 funcref)
 (elem $0 (i32.const 0) $placeholder_0)
 (export "foo" (func $foo))
 (export "%table" (table $0))
 (func $foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table" (table $0 1 funcref))
 (elem $0 (i32.const 0) $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 1 funcref)
 (elem $0 (i32.const 0) $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $table 1 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (i32.const 0) func $trampoline_foo)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "%table" (table $table))
 (export "%table_1" (table $0))
 (func $trampoline_foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table_1" (table $0 1 funcref))
 (import "primary" "%table" (table $table 1 funcref))
 (elem $0 (table $0) (i32.const 0) func $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 2 funcref)
 (elem $0 (i32.const 0) $foo $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $table 2 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (i32.const 0) func $trampoline_foo $trampoline_foo)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "%table" (table $table))
 (export "%table_1" (table $0))
 (func $trampoline_foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table_1" (table $0 1 funcref))
 (import "primary" "%table" (table $table 2 funcref))
 (elem $0 (table $0) (i32.const 0) func $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 1000 funcref)
 (elem $0 (i32.const 42) $foo)
 (export "foo" (func $foo))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (i32.const 42) func $trampoline_foo)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "foo" (func $foo))
 (export "%table" (table $table))
 (export "%table_2" (table $0))
 (func $foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
 (func $trampoline_foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table_2" (table $0 1 funcref))
 (import "primary" "%table" (table $table 1000 funcref))
 (elem $0 (table $0) (i32.const 0) func $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (table $table 1000 funcref)
 (elem $0 (global.get $base) $foo)
 (export "foo" (func $foo))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (global.get $base) func $trampoline_foo)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "foo" (func $foo))
 (export "%table" (table $table))
 (export "%table_2" (table $0))
 (export "%global" (global $base))
 (func $foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
 (func $trampoline_foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table_2" (table $0 1 funcref))
 (import "primary" "%table" (table $table 1000 funcref))
 (import "primary" "%global" (global $base i32))
 (elem $0 (table $0) (i32.const 0) func $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (table $table 1000 funcref)
 (elem $0 (global.get $base) $foo $foo)
 (export "foo" (func $foo))
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: <none>
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (global.get $base) func $trampoline_foo $trampoline_foo)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "foo" (func $foo))
 (export "%table" (table $table))
 (export "%table_2" (table $0))
 (export "%global" (global $base))
 (func $foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
 (func $trampoline_foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table_2" (table $0 1 funcref))
 (import "primary" "%table" (table $table 1000 funcref))
 (import "primary" "%global" (global $base i32))
 (elem $0 (table $0) (i32.const 0) func $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func))
 (type $1 (func (param i32) (result i32)))
 (import "env" "base" (global $base i32))
 (table $table 1000 funcref)
 (elem $0 (global.get $base) $null $foo)
 (export "foo" (func $foo))
 (func $null (type $0)
  (nop)
 )
 (func $foo (type $1) (param $0 i32) (result i32)
  (local.get $0)
 )
)
Keeping: null
After:
(module
 (type $0 (func (param i32) (result i32)))
 (type $1 (func))
 (import "env" "base" (global $base i32))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $table 1000 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (global.get $base) func $null $trampoline_foo)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "foo" (func $foo))
 (export "%table" (table $table))
 (export "%table_2" (table $0))
 (export "%global" (global $base))
 (func $null (type $1)
  (nop)
 )
 (func $foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
 (func $trampoline_foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (local.get $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table_2" (table $0 1 funcref))
 (import "primary" "%table" (table $table 1000 funcref))
 (import "primary" "%global" (global $base i32))
 (elem $0 (table $0) (i32.const 0) func $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (local.get $0)
 )
)


Before:
(module
 (type $0 (func))
 (func $foo (type $0)
  (call $bar)
 )
 (func $bar (type $0)
  (nop)
 )
)
Keeping: bar, foo
After:
(module
 (type $0 (func))
 (func $foo (type $0)
  (call $bar)
 )
 (func $bar (type $0)
  (nop)
 )
)
Secondary:
(module
)


Before:
(module
 (type $0 (func))
 (func $foo (type $0)
  (call $bar)
 )
 (func $bar (type $0)
  (nop)
 )
)
Keeping: bar
After:
(module
 (type $0 (func))
 (export "%bar" (func $bar))
 (func $bar (type $0)
  (nop)
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%bar" (func $bar (type $0)))
 (func $foo (type $0)
  (call $bar)
 )
)


Before:
(module
 (type $0 (func))
 (func $foo (type $0)
  (call $bar)
 )
 (func $bar (type $0)
  (nop)
 )
)
Keeping: foo
After:
(module
 (type $0 (func))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (table $0 1 funcref)
 (elem $0 (i32.const 0) $placeholder_0)
 (export "%table" (table $0))
 (func $foo (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table" (table $0 1 funcref))
 (elem $0 (i32.const 0) $bar)
 (func $bar (type $0)
  (nop)
 )
)


Before:
(module
 (type $0 (func))
 (func $foo (type $0)
  (call $bar)
 )
 (func $bar (type $0)
  (nop)
 )
)
Keeping: <none>
After:
(module
)
Secondary:
(module
 (type $0 (func))
 (func $bar (type $0)
  (nop)
 )
 (func $foo (type $0)
  (call $bar)
 )
)


Before:
(module
 (type $0 (func))
 (export "%foo" (func $bar))
 (func $foo (type $0)
  (nop)
 )
 (func $bar (type $0)
  (call $foo)
 )
)
Keeping: foo
After:
(module
 (type $0 (func))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (table $0 1 funcref)
 (elem $0 (i32.const 0) $placeholder_0)
 (export "%foo" (func $bar))
 (export "%foo_1" (func $foo))
 (export "%table" (table $0))
 (func $foo (type $0)
  (nop)
 )
 (func $bar (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table" (table $0 1 funcref))
 (import "primary" "%foo_1" (func $foo (type $0)))
 (elem $0 (i32.const 0) $bar)
 (func $bar (type $0)
  (call $foo)
 )
)


Before:
(module
 (type $0 (func))
 (table $table 4 funcref)
 (elem $0 (i32.const 0) $foo $bar $baz $quux)
 (func $foo (type $0)
  (nop)
 )
 (func $bar (type $0)
  (nop)
 )
 (func $baz (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
)
Keeping: bar, quux
After:
(module
 (type $0 (func))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (import "placeholder" "1" (func $placeholder_1 (type $0)))
 (table $table 4 funcref)
 (table $0 2 funcref)
 (elem $0 (table $table) (i32.const 0) func $trampoline_foo $bar $trampoline_baz $quux)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0 $placeholder_1)
 (export "%table" (table $table))
 (export "%table_1" (table $0))
 (func $bar (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
 (func $trampoline_foo (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
 (func $trampoline_baz (type $0)
  (call_indirect $0 (type $0)
   (i32.const 1)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table_1" (table $0 2 funcref))
 (import "primary" "%table" (table $table 4 funcref))
 (elem $0 (table $0) (i32.const 0) func $foo $baz)
 (func $baz (type $0)
  (nop)
 )
 (func $foo (type $0)
  (nop)
 )
)


Before:
(module
 (type $0 (func))
 (import "env" "base" (global $base i32))
 (table $table 4 funcref)
 (elem $0 (global.get $base) $foo $bar $baz $quux)
 (func $foo (type $0)
  (nop)
 )
 (func $bar (type $0)
  (nop)
 )
 (func $baz (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
)
Keeping: bar, quux
After:
(module
 (type $0 (func))
 (import "env" "base" (global $base i32))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (import "placeholder" "1" (func $placeholder_1 (type $0)))
 (table $table 4 funcref)
 (table $0 2 funcref)
 (elem $0 (table $table) (global.get $base) func $trampoline_foo $bar $trampoline_baz $quux)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0 $placeholder_1)
 (export "%table" (table $table))
 (export "%table_1" (table $0))
 (export "%global" (global $base))
 (func $bar (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
 (func $trampoline_foo (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
 (func $trampoline_baz (type $0)
  (call_indirect $0 (type $0)
   (i32.const 1)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table_1" (table $0 2 funcref))
 (import "primary" "%table" (table $table 4 funcref))
 (import "primary" "%global" (global $base i32))
 (elem $0 (table $0) (i32.const 0) func $foo $baz)
 (func $baz (type $0)
  (nop)
 )
 (func $foo (type $0)
  (nop)
 )
)


Before:
(module
 (type $0 (func))
 (table $table 4 funcref)
 (elem $0 (i32.const 0) $foo $bar $baz $quux)
 (func $foo (type $0)
  (nop)
 )
 (func $bar (type $0)
  (nop)
 )
 (func $baz (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
)
Keeping: baz
After:
(module
 (type $0 (func))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (import "placeholder" "1" (func $placeholder_1 (type $0)))
 (import "placeholder" "2" (func $placeholder_2 (type $0)))
 (table $table 4 funcref)
 (table $0 3 funcref)
 (elem $0 (table $table) (i32.const 0) func $trampoline_foo $trampoline_bar $baz $trampoline_quux)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0 $placeholder_1 $placeholder_2)
 (export "%table" (table $table))
 (export "%table_1" (table $0))
 (func $baz (type $0)
  (nop)
 )
 (func $trampoline_foo (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
 (func $trampoline_bar (type $0)
  (call_indirect $0 (type $0)
   (i32.const 1)
  )
 )
 (func $trampoline_quux (type $0)
  (call_indirect $0 (type $0)
   (i32.const 2)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table_1" (table $0 3 funcref))
 (import "primary" "%table" (table $table 4 funcref))
 (elem $0 (table $0) (i32.const 0) func $foo $bar $quux)
 (func $bar (type $0)
  (nop)
 )
 (func $foo (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
)


Before:
(module
 (type $0 (func))
 (import "env" "base" (global $base i32))
 (table $table 4 funcref)
 (elem $0 (global.get $base) $foo $bar $baz $quux)
 (func $foo (type $0)
  (nop)
 )
 (func $bar (type $0)
  (nop)
 )
 (func $baz (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
)
Keeping: baz
After:
(module
 (type $0 (func))
 (import "env" "base" (global $base i32))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (import "placeholder" "1" (func $placeholder_1 (type $0)))
 (import "placeholder" "2" (func $placeholder_2 (type $0)))
 (table $table 4 funcref)
 (table $0 3 funcref)
 (elem $0 (table $table) (global.get $base) func $trampoline_foo $trampoline_bar $baz $trampoline_quux)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0 $placeholder_1 $placeholder_2)
 (export "%table" (table $table))
 (export "%table_1" (table $0))
 (export "%global" (global $base))
 (func $baz (type $0)
  (nop)
 )
 (func $trampoline_foo (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
 (func $trampoline_bar (type $0)
  (call_indirect $0 (type $0)
   (i32.const 1)
  )
 )
 (func $trampoline_quux (type $0)
  (call_indirect $0 (type $0)
   (i32.const 2)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table_1" (table $0 3 funcref))
 (import "primary" "%table" (table $table 4 funcref))
 (import "primary" "%global" (global $base i32))
 (elem $0 (table $0) (i32.const 0) func $foo $bar $quux)
 (func $bar (type $0)
  (nop)
 )
 (func $foo (type $0)
  (nop)
 )
 (func $quux (type $0)
  (nop)
 )
)


Before:
(module
 (type $0 (func))
 (import "env" "base" (global $base i32))
 (table $table 2 funcref)
 (elem $0 (global.get $base) $foo $bar)
 (func $foo (type $0)
  (nop)
 )
 (func $bar (type $0)
  (call $foo)
 )
)
Keeping: foo
After:
(module
 (type $0 (func))
 (import "env" "base" (global $base i32))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (table $table 2 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (global.get $base) func $foo $trampoline_bar)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "%foo" (func $foo))
 (export "%table" (table $table))
 (export "%table_2" (table $0))
 (export "%global" (global $base))
 (func $foo (type $0)
  (nop)
 )
 (func $trampoline_bar (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table_2" (table $0 1 funcref))
 (import "primary" "%table" (table $table 2 funcref))
 (import "primary" "%global" (global $base i32))
 (import "primary" "%foo" (func $foo (type $0)))
 (elem $0 (table $0) (i32.const 0) func $bar)
 (func $bar (type $0)
  (call $foo)
 )
)


Before:
(module
 (type $0 (func (param i32) (result i32)))
 (table $table 1 1 funcref)
 (elem $0 (i32.const 0) $foo)
 (func $foo (type $0) (param $0 i32) (result i32)
  (call $bar
   (i32.const 0)
  )
 )
 (func $bar (type $0) (param $0 i32) (result i32)
  (call $foo
   (i32.const 1)
  )
 )
)
Keeping: foo
After:
(module
 (type $0 (func (param i32) (result i32)))
 (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32)))
 (table $table 1 1 funcref)
 (table $0 1 funcref)
 (elem $0 (table $table) (i32.const 0) func $foo)
 (elem $0_1 (table $0) (i32.const 0) func $placeholder_0)
 (export "%foo" (func $foo))
 (export "%table" (table $table))
 (export "%table_2" (table $0))
 (func $foo (type $0) (param $0 i32) (result i32)
  (call_indirect $0 (type $0)
   (i32.const 0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func (param i32) (result i32)))
 (import "primary" "%table_2" (table $0 1 funcref))
 (import "primary" "%table" (table $table 1 1 funcref))
 (import "primary" "%foo" (func $foo (type $0) (param i32) (result i32)))
 (elem $0 (table $0) (i32.const 0) func $bar)
 (func $bar (type $0) (param $0 i32) (result i32)
  (call $foo
   (i32.const 1)
  )
 )
)


Before:
(module
 (type $0 (func))
 (export "foo1" (func $foo))
 (export "foo2" (func $foo))
 (func $foo (type $0)
  (nop)
 )
)
Keeping: <none>
After:
(module
 (type $0 (func))
 (import "placeholder" "0" (func $placeholder_0 (type $0)))
 (table $0 1 funcref)
 (elem $0 (i32.const 0) $placeholder_0)
 (export "foo1" (func $foo))
 (export "foo2" (func $foo))
 (export "%table" (table $0))
 (func $foo (type $0)
  (call_indirect $0 (type $0)
   (i32.const 0)
  )
 )
)
Secondary:
(module
 (type $0 (func))
 (import "primary" "%table" (table $0 1 funcref))
 (elem $0 (i32.const 0) $foo)
 (func $foo (type $0)
  (nop)
 )
)


Minimized names primary:
(module
 (type $0 (func))
 (export "already_exported" (func $3))
 (export "%b" (func $7))
 (export "%a" (func $0))
 (export "%c" (func $1))
 (export "%d" (func $2))
 (export "%e" (func $4))
 (export "%f" (func $5))
 (export "%g" (func $6))
 (export "%h" (func $8))
 (export "%i" (func $9))
 (func $0 (type $0)
  (nop)
 )
 (func $1 (type $0)
  (nop)
 )
 (func $2 (type $0)
  (nop)
 )
 (func $3 (type $0)
  (nop)
 )
 (func $4 (type $0)
  (nop)
 )
 (func $5 (type $0)
  (nop)
 )
 (func $6 (type $0)
  (nop)
 )
 (func $7 (type $0)
  (nop)
 )
 (func $8 (type $0)
  (nop)
 )
 (func $9 (type $0)
  (nop)
 )
)

Minimized names secondary:
(module
 (type $0 (func))
 (import "primary" "%a" (func $0 (type $0)))
 (import "primary" "%c" (func $1 (type $0)))
 (import "primary" "%d" (func $2 (type $0)))
 (import "primary" "already_exported" (func $3 (type $0)))
 (import "primary" "%e" (func $4 (type $0)))
 (import "primary" "%f" (func $5 (type $0)))
 (import "primary" "%g" (func $6 (type $0)))
 (import "primary" "%b" (func $7 (type $0)))
 (import "primary" "%h" (func $8 (type $0)))
 (import "primary" "%i" (func $9 (type $0)))
 (func $call (type $0)
  (call $0)
  (call $1)
  (call $2)
  (call $3)
  (call $4)
  (call $5)
  (call $6)
  (call $7)
  (call $8)
  (call $9)
 )
)

