Program: 71495
Project: 71495
Buggy source:
/** 
 * Arguments may only be used as args to the apply. Everything else is disqualified
 * @return true if arguments escape
 */
private boolean argumentsEscape(){
  final Deque<Set<Expression>> stack=new ArrayDeque<>();
  try {
    functionNode=(FunctionNode)functionNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()){
      private boolean isCurrentArg(      final Expression expr){
        return !stack.isEmpty() && stack.peek().contains(expr);
      }
      private boolean isArguments(      final Expression expr){
        return expr instanceof IdentNode && ARGUMENTS.equals(((IdentNode)expr).getName());
      }
      @Override public Node leaveIdentNode(      final IdentNode identNode){
        if (ARGUMENTS.equals(identNode.getName()) && !isCurrentArg(identNode)) {
          throw new UnsupportedOperationException();
        }
        return identNode;
      }
      @Override public boolean enterCallNode(      final CallNode callNode){
        final Set<Expression> callArgs=new HashSet<>();
        if (isApply(callNode)) {
          final List<Expression> argList=callNode.getArgs();
          if (argList.size() != 2 || !isArguments(argList.get(argList.size() - 1))) {
            throw new UnsupportedOperationException();
          }
          callArgs.addAll(callNode.getArgs());
        }
        stack.push(callArgs);
        return true;
      }
      @Override public Node leaveCallNode(      final CallNode callNode){
        stack.pop();
        return callNode;
      }
    }
);
  }
 catch (  final UnsupportedOperationException e) {
    log.fine("String_Node_Str" + functionNode.getName() + "String_Node_Str");
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Arguments may only be used as args to the apply. Everything else is disqualified We cannot control arguments if they escape from the method and go into an unknown scope, thus we are conservative and treat any access to arguments outside the apply call as a case of "we cannot apply the optimization".
 * @return true if arguments escape
 */
private boolean argumentsEscape(){
  final Deque<Set<Expression>> stack=new ArrayDeque<>();
  try {
    functionNode=(FunctionNode)functionNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()){
      private boolean isCurrentArg(      final Expression expr){
        return !stack.isEmpty() && stack.peek().contains(expr);
      }
      private boolean isArguments(      final Expression expr){
        return expr instanceof IdentNode && ARGUMENTS.equals(((IdentNode)expr).getName());
      }
      private boolean isParam(      final String name){
        for (        final IdentNode param : functionNode.getParameters()) {
          if (param.getName().equals(name)) {
            return true;
          }
        }
        return false;
      }
      @Override public Node leaveIdentNode(      final IdentNode identNode){
        if (isParam(identNode.getName()) || ARGUMENTS.equals(identNode.getName()) && !isCurrentArg(identNode)) {
          throw new UnsupportedOperationException();
        }
        return identNode;
      }
      @Override public boolean enterCallNode(      final CallNode callNode){
        final Set<Expression> callArgs=new HashSet<>();
        if (isApply(callNode)) {
          final List<Expression> argList=callNode.getArgs();
          if (argList.size() != 2 || !isArguments(argList.get(argList.size() - 1))) {
            throw new UnsupportedOperationException();
          }
          callArgs.addAll(callNode.getArgs());
        }
        stack.push(callArgs);
        return true;
      }
      @Override public Node leaveCallNode(      final CallNode callNode){
        stack.pop();
        return callNode;
      }
    }
);
  }
 catch (  final UnsupportedOperationException e) {
    log.fine("String_Node_Str" + functionNode.getName() + "String_Node_Str");
    return true;
  }
  return false;
}