neo-decompiler 0.10.1

Neo N3 NEF decompiler: parse, disassemble, lift bytecode to high-level pseudocode and C# skeletons, with a CLI, JSON reports, and optional WebAssembly bindings.
Documentation
import { applyInstructionForArgInference } from "./entry-stack-effects.js";
import { createEntryStackState } from "./entry-stack-state.js";

export function inferRequiredEntryStackDepth(instructions) {
  const state = createEntryStackState();
  let sawSupportedOpcode = false;

  for (const instruction of instructions) {
    if (instruction.opcode.mnemonic === "RET") {
      break;
    }
    if (!applyInstructionForArgInference(instruction, state)) {
      return 0;
    }
    sawSupportedOpcode = true;
  }

  return sawSupportedOpcode ? state.required : 0;
}