private static List<VarVersionNode> getReversedPostOrder(Collection<VarVersionNode> roots) {
    List<VarVersionNode> lst = new ArrayList<>();
    Set<VarVersionNode> setVisited = new HashSet<>();
    Deque<VarVersionNode> stackNode = new ArrayDeque<>();
    Deque<Integer> stackIndex = new ArrayDeque<>();
    List<VarVersionNode> lstSuccs = new ArrayList<>();

    for (VarVersionNode root : roots) {
      List<VarVersionNode> lstTemp = new ArrayList<>();
      addToReversePostOrderListIterative(root, lstTemp, setVisited, stackNode, stackIndex, lstSuccs);
      lst.addAll(lstTemp);
    }

    return lst;
  }
Returns the set of nodes that are reachable by the given roots.
src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java