private static void addToReversePostOrderListIterative(
    VarVersionNode root,
    List<? super VarVersionNode> lst,
    Set<? super VarVersionNode> setVisited,
    Deque<VarVersionNode> stackNode,
    Deque<Integer> stackIndex,
    List<VarVersionNode> lstSuccs
  ) {
    stackNode.clear();
    stackIndex.clear();

    stackNode.add(root);
    stackIndex.add(0);

    while (!stackNode.isEmpty()) {
      VarVersionNode node = stackNode.peekLast();
      int index = stackIndex.removeLast();

      setVisited.add(node);

      lstSuccs.clear();
      lstSuccs.addAll(node.successors);
      for (; index < lstSuccs.size(); index++) {
        VarVersionNode succ = lstSuccs.get(index);

        if (!setVisited.contains(succ)) {
          stackIndex.add(index + 1);
          stackNode.add(succ);
          stackIndex.add(0);
          break;
        }
      }

      if (index == lstSuccs.size()) {
        lst.add(0, node);
        stackNode.removeLast();
      }
    }
  }
Returns the set of nodes that are reachable by the given roots.
src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java