public static @Nullable Statement isHead(Statement head) {
    if (head.getLastBasicType() == StatementType.GENERAL && !head.isMonitorEnter()) {
      // at most one outgoing edge
      StatEdge edge = null;
      List<StatEdge> successorEdges = head.getSuccessorEdges(EdgeType.DIRECT_ALL);
      if (!successorEdges.isEmpty()) {
        edge = successorEdges.get(0);
      }
      // regular loop
      if (edge != null && edge.getType() == EdgeType.REGULAR && edge.getDestination() == head) {
        return new DoStatement(head);
      }
      // continues
      if (head.type != StatementType.DO && (edge == null || edge.getType() != EdgeType.REGULAR) &&
          head.getContinueSet().contains(head.getBasichead())) {
        return new DoStatement(head);
      }
    }
    return null;
  }
public static @Nullable Statement isHead(Statement head)