The decompiled output from wasm-decompile can be challenging to interpret since the function table is omitted from the resulting files. Annotating the function index within the output aids in comprehending which function is being invoked by the call_indirect instruction.
Consider the following WebAssembly text file, a.wat:

```wat
(module
  (type $FUNCSIG$i (func (param i32) (result i32)))
  (table 0 1 funcref)
  (elem (i32.const 0) funcref (ref.func $test))
  (memory $0 1)

  (func $test (type $FUNCSIG$i) (param $p i32) (result i32)
    local.get $p
    i32.const 42
    i32.add
  )

  (func $main (result i32)
    i32.const 42
    i32.const 0
    call_indirect (type $FUNCSIG$i)
  )
)
```

After running the following commands:

```sh
wat2wasm a.wat -o a.wasm
wasm-decompile a.wasm -o a.dcmp
```

I obtained the decompiled output as such:

```c
memory M_a(initial: 1, max: 0);

table T_a:funcref(min: 0, max: 1);

function f_a(a:int):int {
  return a + 42
}

function f_b():int {
  return call_indirect(42, 0)
}
```

This decompiled file lacks information about the function table. Moreover, the arguments of the call_indirect function are not immediately clear.
For clearer understanding, consider the decompiled output if it were presented in the following manner:

```c
memory M_a(initial: 1, max: 0);

table T_a:funcref[f_a];

// funcref[0]
function f_a(a:int):int {
  return a + 42
}

function f_b():int {
  return call_indirect(funcref[0])(42)
}
```

With such modifications, it would be more apparent which function the call_indirect is calling.
Output results of the wasm-decompile to be easier to understand which function is called by call_indirect
This is a GitHub Issue
repo:wabt
owner:WebAssembly
Title : Output results of the wasm-decompile to be easier to understand which function is called by call_indirect
Issue date:

--- start body ---
The decompiled output from wasm-decompile can be challenging to interpret since the function table is omitted from the resulting files. Annotating the function index within the output aids in comprehending which function is being invoked by the call_indirect instruction.
Consider the following WebAssembly text file, a.wat:

```wat
(module
  (type $FUNCSIG$i (func (param i32) (result i32)))
  (table 0 1 funcref)
  (elem (i32.const 0) funcref (ref.func $test))
  (memory $0 1)

  (func $test (type $FUNCSIG$i) (param $p i32) (result i32)
    local.get $p
    i32.const 42
    i32.add
  )

  (func $main (result i32)
    i32.const 42
    i32.const 0
    call_indirect (type $FUNCSIG$i)
  )
)
```

After running the following commands:

```sh
wat2wasm a.wat -o a.wasm
wasm-decompile a.wasm -o a.dcmp
```

I obtained the decompiled output as such:

```c
memory M_a(initial: 1, max: 0);

table T_a:funcref(min: 0, max: 1);

function f_a(a:int):int {
  return a + 42
}

function f_b():int {
  return call_indirect(42, 0)
}
```

This decompiled file lacks information about the function table. Moreover, the arguments of the call_indirect function are not immediately clear.
For clearer understanding, consider the decompiled output if it were presented in the following manner:

```c
memory M_a(initial: 1, max: 0);

table T_a:funcref[f_a];

// funcref[0]
function f_a(a:int):int {
  return a + 42
}

function f_b():int {
  return call_indirect(funcref[0])(42)
}
```

With such modifications, it would be more apparent which function the call_indirect is calling.
--- end body ---
