Program: 40161
Project: 40161
Buggy source:
@Override public IR makeIR(final IMethod method,Context context,SSAOptions options){
  if (method instanceof Retranslatable) {
    @SuppressWarnings("String_Node_Str") final Value<Integer> v=(Value<Integer>)context.get(ArgumentCountContext.ARGUMENT_COUNT);
    final Retranslatable m=(Retranslatable)method;
    if (v != null) {
      final JavaScriptLoader myloader=(JavaScriptLoader)method.getDeclaringClass().getClassLoader();
class FixedArgumentsRewriter extends CAstBasicRewriter {
        private final CAstEntity e;
        Map<String,CAstNode> argRefs=HashMapFactory.make();
        public FixedArgumentsRewriter(        CAst Ast){
          super(Ast,false);
          this.e=m.getEntity();
          for (          Segments s : CAstPattern.findAll(destructuredAccessPattern,m.getEntity())) {
            argRefs.put(s.getSingle("String_Node_Str").getValue().toString(),s.getSingle("String_Node_Str"));
          }
        }
        private CAstNode handleArgumentRef(        CAstNode n){
          Object x=n.getValue();
          if (x != null) {
            if (x instanceof Number && ((Number)x).intValue() < v.getValue() - 2) {
              int arg=((Number)x).intValue() + 2;
              if (arg < e.getArgumentCount()) {
                return Ast.makeNode(CAstNode.VAR,Ast.makeConstant(e.getArgumentNames()[arg]));
              }
 else {
                return Ast.makeNode(CAstNode.VAR,Ast.makeConstant("String_Node_Str" + arg));
              }
            }
 else             if (x instanceof String && "String_Node_Str".equals(x)) {
              return Ast.makeConstant(v.getValue());
            }
          }
          return null;
        }
        @Override protected CAstNode copyNodes(        CAstNode root,        CAstControlFlowMap cfg,        NonCopyingContext context,        Map<Pair<CAstNode,NoKey>,CAstNode> nodeMap){
          CAstNode result=null;
          Segments s;
          if ((s=CAstPattern.match(directAccessPattern,root)) != null) {
            result=handleArgumentRef(s.getSingle("String_Node_Str"));
          }
 else           if ((s=CAstPattern.match(destructuredCallPattern,root)) != null) {
            if (argRefs.containsKey(s.getSingle("String_Node_Str").getValue().toString())) {
              List<CAstNode> x=new ArrayList<CAstNode>();
              CAstNode ref=handleArgumentRef(argRefs.get(s.getSingle("String_Node_Str").getValue().toString()));
              if (ref != null) {
                x.add(ref);
                x.add(Ast.makeConstant("String_Node_Str"));
                x.add(Ast.makeNode(CAstNode.VAR,Ast.makeConstant("String_Node_Str")));
                for (                CAstNode c : s.getMultiple("String_Node_Str")) {
                  x.add(copyNodes(c,cfg,context,nodeMap));
                }
                result=Ast.makeNode(CAstNode.CALL,x.toArray(new CAstNode[x.size()]));
              }
            }
          }
 else           if (root.getKind() == CAstNode.CONSTANT) {
            result=Ast.makeConstant(root.getValue());
          }
 else           if (root.getKind() == CAstNode.OPERATOR) {
            result=root;
          }
          if (result == null) {
            CAstNode children[]=new CAstNode[root.getChildCount()];
            for (int i=0; i < children.length; i++) {
              children[i]=copyNodes(root.getChild(i),cfg,context,nodeMap);
            }
            for (            Object label : cfg.getTargetLabels(root)) {
              if (label instanceof CAstNode) {
                copyNodes((CAstNode)label,cfg,context,nodeMap);
              }
            }
            CAstNode copy=Ast.makeNode(root.getKind(),children);
            result=copy;
          }
          nodeMap.put(Pair.make(root,context.key()),result);
          return result;
        }
      }
      final FixedArgumentsRewriter args=new FixedArgumentsRewriter(new CAstImpl());
      final JSConstantFoldingRewriter fold=new JSConstantFoldingRewriter(new CAstImpl());
class ArgumentativeTranslator extends JSAstTranslator {
        public ArgumentativeTranslator(        JavaScriptLoader loader){
          super(loader);
        }
        private CAstEntity codeBodyEntity;
        private IMethod specializedCode;
        @Override protected int getArgumentCount(        CAstEntity f){
          return Math.max(super.getArgumentCount(f),v.getValue());
        }
        @Override protected String[] getArgumentNames(        CAstEntity f){
          if (super.getArgumentCount(f) >= v.getValue()) {
            return super.getArgumentNames(f);
          }
 else {
            String[] argNames=new String[v.getValue()];
            System.arraycopy(super.getArgumentNames(f),0,argNames,0,super.getArgumentCount(f));
            for (int i=super.getArgumentCount(f); i < argNames.length; i++) {
              argNames[i]="String_Node_Str" + i;
            }
            return argNames;
          }
        }
        @Override protected String composeEntityName(        WalkContext parent,        CAstEntity f){
          if (f == codeBodyEntity) {
            return super.composeEntityName(parent,f) + "String_Node_Str" + v.getValue().intValue();
          }
 else {
            return super.composeEntityName(parent,f);
          }
        }
        @Override protected void defineFunction(        CAstEntity N,        WalkContext definingContext,        AbstractCFG cfg,        SymbolTable symtab,        boolean hasCatchBlock,        TypeReference[][] caughtTypes,        boolean hasMonitorOp,        AstLexicalInformation LI,        DebuggingInformation debugInfo){
          if (N == codeBodyEntity) {
            specializedCode=myloader.makeCodeBodyCode(cfg,symtab,hasCatchBlock,caughtTypes,hasMonitorOp,LI,debugInfo,method.getDeclaringClass());
          }
 else {
            super.defineFunction(N,definingContext,cfg,symtab,hasCatchBlock,caughtTypes,hasMonitorOp,LI,debugInfo);
          }
        }
        @Override public void translate(        CAstEntity N,        WalkContext context){
          if (N == m.getEntity()) {
            codeBodyEntity=fold.rewrite(args.rewrite(N));
            super.translate(codeBodyEntity,context);
          }
 else {
            super.translate(N,context);
          }
        }
      }
      ArgumentativeTranslator a=new ArgumentativeTranslator(myloader);
      m.retranslate(a);
      return super.makeIR(a.specializedCode,context,options);
    }
  }
  return super.makeIR(method,context,options);
}

Fixed version (ground truth):
@Override public IR makeIR(final IMethod method,Context context,SSAOptions options){
  if (method instanceof Retranslatable) {
    @SuppressWarnings("String_Node_Str") final Value<Integer> v=(Value<Integer>)context.get(ArgumentCountContext.ARGUMENT_COUNT);
    final Retranslatable m=(Retranslatable)method;
    if (v != null) {
      final JavaScriptLoader myloader=(JavaScriptLoader)method.getDeclaringClass().getClassLoader();
class FixedArgumentsRewriter extends CAstBasicRewriter {
        private final CAstEntity e;
        Map<String,CAstNode> argRefs=HashMapFactory.make();
        public FixedArgumentsRewriter(        CAst Ast){
          super(Ast,false);
          this.e=m.getEntity();
          for (          Segments s : CAstPattern.findAll(destructuredAccessPattern,m.getEntity())) {
            argRefs.put(s.getSingle("String_Node_Str").getValue().toString(),s.getSingle("String_Node_Str"));
          }
        }
        private CAstNode handleArgumentRef(        CAstNode n){
          Object x=n.getValue();
          if (x != null) {
            if (x instanceof Number && ((Number)x).intValue() < v.getValue() - 2) {
              int arg=((Number)x).intValue() + 2;
              if (arg < e.getArgumentCount()) {
                return Ast.makeNode(CAstNode.VAR,Ast.makeConstant(e.getArgumentNames()[arg]));
              }
 else {
                return Ast.makeNode(CAstNode.VAR,Ast.makeConstant("String_Node_Str" + arg));
              }
            }
 else             if (x instanceof String && "String_Node_Str".equals(x)) {
              return Ast.makeConstant(v.getValue());
            }
          }
          return null;
        }
        @Override protected CAstNode copyNodes(        CAstNode root,        CAstControlFlowMap cfg,        NonCopyingContext context,        Map<Pair<CAstNode,NoKey>,CAstNode> nodeMap){
          CAstNode result=null;
          Segments s;
          if ((s=CAstPattern.match(directAccessPattern,root)) != null) {
            result=handleArgumentRef(s.getSingle("String_Node_Str"));
          }
 else           if ((s=CAstPattern.match(destructuredCallPattern,root)) != null) {
            if (argRefs.containsKey(s.getSingle("String_Node_Str").getValue().toString())) {
              List<CAstNode> x=new ArrayList<CAstNode>();
              CAstNode ref=handleArgumentRef(argRefs.get(s.getSingle("String_Node_Str").getValue().toString()));
              if (ref != null) {
                x.add(ref);
                x.add(Ast.makeConstant("String_Node_Str"));
                x.add(Ast.makeNode(CAstNode.VAR,Ast.makeConstant("String_Node_Str")));
                for (                CAstNode c : s.getMultiple("String_Node_Str")) {
                  x.add(copyNodes(c,cfg,context,nodeMap));
                }
                result=Ast.makeNode(CAstNode.CALL,x.toArray(new CAstNode[x.size()]));
              }
            }
          }
 else           if (root.getKind() == CAstNode.CONSTANT) {
            result=Ast.makeConstant(root.getValue());
          }
 else           if (root.getKind() == CAstNode.OPERATOR) {
            result=root;
          }
          if (result == null) {
            CAstNode children[]=new CAstNode[root.getChildCount()];
            for (int i=0; i < children.length; i++) {
              children[i]=copyNodes(root.getChild(i),cfg,context,nodeMap);
            }
            for (            Object label : cfg.getTargetLabels(root)) {
              if (label instanceof CAstNode) {
                copyNodes((CAstNode)label,cfg,context,nodeMap);
              }
            }
            CAstNode copy=Ast.makeNode(root.getKind(),children);
            result=copy;
          }
          nodeMap.put(Pair.make(root,context.key()),result);
          return result;
        }
      }
      final FixedArgumentsRewriter args=new FixedArgumentsRewriter(new CAstImpl());
      final JSConstantFoldingRewriter fold=new JSConstantFoldingRewriter(new CAstImpl());
class ArgumentativeTranslator extends JSAstTranslator {
        public ArgumentativeTranslator(        JavaScriptLoader loader){
          super(loader);
        }
        private CAstEntity codeBodyEntity;
        private IMethod specializedCode;
        @Override protected int getArgumentCount(        CAstEntity f){
          return Math.max(super.getArgumentCount(f),v.getValue());
        }
        @Override protected String[] getArgumentNames(        CAstEntity f){
          if (super.getArgumentCount(f) >= v.getValue()) {
            return super.getArgumentNames(f);
          }
 else {
            String[] argNames=new String[v.getValue()];
            System.arraycopy(super.getArgumentNames(f),0,argNames,0,super.getArgumentCount(f));
            for (int i=super.getArgumentCount(f); i < argNames.length; i++) {
              argNames[i]="String_Node_Str" + i;
            }
            return argNames;
          }
        }
        @Override protected String composeEntityName(        WalkContext parent,        CAstEntity f){
          if (f == codeBodyEntity) {
            return super.composeEntityName(parent,f) + "String_Node_Str" + v.getValue().intValue();
          }
 else {
            return super.composeEntityName(parent,f);
          }
        }
        @Override protected void defineFunction(        CAstEntity N,        WalkContext definingContext,        AbstractCFG cfg,        SymbolTable symtab,        boolean hasCatchBlock,        Map<IBasicBlock,TypeReference[]> caughtTypes,        boolean hasMonitorOp,        AstLexicalInformation LI,        DebuggingInformation debugInfo){
          if (N == codeBodyEntity) {
            specializedCode=myloader.makeCodeBodyCode(cfg,symtab,hasCatchBlock,caughtTypes,hasMonitorOp,LI,debugInfo,method.getDeclaringClass());
          }
 else {
            super.defineFunction(N,definingContext,cfg,symtab,hasCatchBlock,caughtTypes,hasMonitorOp,LI,debugInfo);
          }
        }
        @Override public void translate(        CAstEntity N,        WalkContext context){
          if (N == m.getEntity()) {
            codeBodyEntity=fold.rewrite(args.rewrite(N));
            super.translate(codeBodyEntity,context);
          }
 else {
            super.translate(N,context);
          }
        }
      }
      ArgumentativeTranslator a=new ArgumentativeTranslator(myloader);
      m.retranslate(a);
      return super.makeIR(a.specializedCode,context,options);
    }
  }
  return super.makeIR(method,context,options);
}