class LoopBodyFinder {

  private final FastStack<Object> stack = new FastStack<Object>();
  private final Set<Set<Object>> loops = new HashSet<Set<Object>>();

  LoopBodyFinder(Map<Object, Object> backEdges, DirectedGraph g) {
    findLoopBody(backEdges, g);
  }

  private void findLoopBody(Map<Object, Object> backEdges, DirectedGraph g) {<FILL_FUNCTION_BODY>}

  private Set<Object> finder(Object tail, Object head, DirectedGraph g) {
    Set<Object> loop = new HashSet<Object>();
    loop.add(head);
    insert(tail, loop);
    while (!stack.empty()) {
      Object p = stack.pop();
      Iterator predsListIt = g.getPredsOf(p).iterator();
      while (predsListIt.hasNext()) {
        Object pred = predsListIt.next();
        insert(pred, loop);
      }
    }
    return loop;
  }

  private void insert(Object m, Set<Object> loop) {
    if (!loop.contains(m)) {
      loop.add(m);
      stack.push(m);
    }
  }

  public Set<Set<Object>> getLoopBody() {
    return loops;
  }
}

    Set maps = backEdges.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext();) {
      Map.Entry entry = (Map.Entry) iter.next();
      Object tail = entry.getKey();
      // Tag tag = (Tag)key.getTags().get(0);
      // System.out.println("---key= "+tag+" "+key);
      Object head = entry.getValue();
      Set<Object> loopBody = finder(tail, head, g);
      loops.add(loopBody);
    }

  
<no_super_class>