neo-decompiler 0.11.0

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
export const MAX_SIMULATED_POPS = 1024;

export function createEntryStackState() {
  return {
    required: 0,
    stack: [],
  };
}

export function topLiteral(state) {
  return state.stack.at(-1);
}

export function popCount(state, count) {
  ensureAvailable(state, count);
  for (let index = 0; index < count; index += 1) {
    state.stack.pop();
  }
}

export function ensureAvailable(state, count) {
  const boundedCount = Math.min(count, MAX_SIMULATED_POPS);
  while (state.stack.length < boundedCount) {
    state.stack.unshift(null);
    state.required += 1;
  }
}