Program: 62089
Project: 62089
Buggy source:
private int renameAS2Identifiers(RenameType renameType,Map<String,String> selected){
  actionsMap=new HashMap<>();
  allFunctions=new ArrayList<>();
  allVariableNames=new ArrayList<>();
  allStrings=new HashMap<>();
  List<Object> objs=new ArrayList<>();
  int ret=0;
  objs.addAll(tags);
  getVariables(objs,"String_Node_Str");
  informListeners("String_Node_Str","String_Node_Str");
  int fc=0;
  for (  MyEntry<DirectValueActionItem,ConstantPool> it : allVariableNames) {
    String name=it.key.toStringNoH(it.value);
    allVariableNamesStr.add(name);
  }
  informListeners("String_Node_Str","String_Node_Str");
  int classCount=0;
  for (  Tag t : tags) {
    if (t instanceof DoInitActionTag) {
      classCount++;
    }
  }
  int cnt=0;
  for (  Tag t : tags) {
    if (t instanceof DoInitActionTag) {
      cnt++;
      informListeners("String_Node_Str","String_Node_Str" + cnt + "String_Node_Str"+ classCount);
      DoInitActionTag dia=(DoInitActionTag)t;
      String exportName=dia.getExportName();
      final String pkgPrefix="String_Node_Str";
      String classNameParts[]=null;
      if ((exportName != null) && exportName.startsWith(pkgPrefix)) {
        String className=exportName.substring(pkgPrefix.length());
        if (className.contains("String_Node_Str")) {
          classNameParts=className.split("String_Node_Str");
        }
 else {
          classNameParts=new String[]{className};
        }
      }
      int staticOperation=(Boolean)Configuration.getConfig("String_Node_Str",true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC;
      List<GraphTargetItem> dec=Action.actionsToTree(dia.getActions(version),version,staticOperation,"String_Node_Str");
      GraphTargetItem name=null;
      for (      GraphTargetItem it : dec) {
        if (it instanceof ClassActionItem) {
          ClassActionItem cti=(ClassActionItem)it;
          List<GraphTargetItem> methods=new ArrayList<>();
          methods.addAll(cti.functions);
          methods.addAll(cti.staticFunctions);
          for (          GraphTargetItem gti : methods) {
            if (gti instanceof FunctionActionItem) {
              FunctionActionItem fun=(FunctionActionItem)gti;
              if (fun.calculatedFunctionName instanceof DirectValueActionItem) {
                DirectValueActionItem dvf=(DirectValueActionItem)fun.calculatedFunctionName;
                String fname=dvf.toStringNoH(null);
                String changed=deobfuscateName(fname,false,"String_Node_Str",renameType,selected);
                if (changed != null) {
                  deobfuscated.put(fname,changed);
                }
              }
            }
          }
          List<GraphTargetItem> vars=new ArrayList<>();
          for (          MyEntry<GraphTargetItem,GraphTargetItem> item : cti.vars) {
            vars.add(item.key);
          }
          for (          MyEntry<GraphTargetItem,GraphTargetItem> item : cti.staticVars) {
            vars.add(item.key);
          }
          for (          GraphTargetItem gti : vars) {
            if (gti instanceof DirectValueActionItem) {
              DirectValueActionItem dvf=(DirectValueActionItem)gti;
              String vname=dvf.toStringNoH(null);
              String changed=deobfuscateName(vname,false,"String_Node_Str",renameType,selected);
              if (changed != null) {
                deobfuscated.put(vname,changed);
              }
            }
          }
          name=cti.className;
          break;
        }
        if (it instanceof InterfaceActionItem) {
          InterfaceActionItem ift=(InterfaceActionItem)it;
          name=ift.name;
        }
      }
      if (name != null) {
        int pos=0;
        while (name instanceof GetMemberActionItem) {
          GetMemberActionItem mem=(GetMemberActionItem)name;
          GraphTargetItem memberName=mem.memberName;
          if (memberName instanceof DirectValueActionItem) {
            DirectValueActionItem dvt=(DirectValueActionItem)memberName;
            String nameStr=dvt.toStringNoH(null);
            if (classNameParts != null) {
              if (classNameParts.length - 1 - pos < 0) {
                break;
              }
            }
            String changedNameStr=nameStr;
            if (classNameParts != null) {
              changedNameStr=classNameParts[classNameParts.length - 1 - pos];
            }
            String changedNameStr2=deobfuscateName(changedNameStr,pos == 0,pos == 0 ? "String_Node_Str" : "String_Node_Str",renameType,selected);
            if (changedNameStr2 != null) {
              changedNameStr=changedNameStr2;
            }
            ret++;
            deobfuscated.put(nameStr,changedNameStr);
            pos++;
          }
          name=mem.object;
        }
        if (name instanceof GetVariableActionItem) {
          GetVariableActionItem var=(GetVariableActionItem)name;
          if (var.name instanceof DirectValueActionItem) {
            DirectValueActionItem dvt=(DirectValueActionItem)var.name;
            String nameStr=dvt.toStringNoH(null);
            if (classNameParts != null) {
              if (classNameParts.length - 1 - pos < 0) {
                break;
              }
            }
            String changedNameStr=nameStr;
            if (classNameParts != null) {
              changedNameStr=classNameParts[classNameParts.length - 1 - pos];
            }
            String changedNameStr2=deobfuscateName(changedNameStr,pos == 0,pos == 0 ? "String_Node_Str" : "String_Node_Str",renameType,selected);
            if (changedNameStr2 != null) {
              changedNameStr=changedNameStr2;
            }
            ret++;
            deobfuscated.put(nameStr,changedNameStr);
            pos++;
          }
        }
      }
    }
  }
  for (  GraphSourceItem fun : allFunctions) {
    fc++;
    informListeners("String_Node_Str","String_Node_Str" + fc + "String_Node_Str"+ allFunctions.size());
    if (fun instanceof ActionDefineFunction) {
      ActionDefineFunction f=(ActionDefineFunction)fun;
      if (f.functionName.equals("String_Node_Str")) {
        continue;
      }
      String changed=deobfuscateName(f.functionName,false,"String_Node_Str",renameType,selected);
      if (changed != null) {
        f.replacedFunctionName=changed;
        ret++;
      }
    }
    if (fun instanceof ActionDefineFunction2) {
      ActionDefineFunction2 f=(ActionDefineFunction2)fun;
      if (f.functionName.equals("String_Node_Str")) {
        continue;
      }
      String changed=deobfuscateName(f.functionName,false,"String_Node_Str",renameType,selected);
      if (changed != null) {
        f.replacedFunctionName=changed;
        ret++;
      }
    }
  }
  HashSet<String> stringsNoVarH=new HashSet<>();
  List<DirectValueActionItem> allVariableNamesDv=new ArrayList<>();
  for (  MyEntry<DirectValueActionItem,ConstantPool> it : allVariableNames) {
    allVariableNamesDv.add(it.key);
  }
  for (  DirectValueActionItem ti : allStrings.keySet()) {
    if (!allVariableNamesDv.contains(ti)) {
      stringsNoVarH.add(System.identityHashCode(allStrings.get(ti)) + "String_Node_Str" + ti.toStringNoH(allStrings.get(ti)));
    }
  }
  int vc=0;
  for (  MyEntry<DirectValueActionItem,ConstantPool> it : allVariableNames) {
    vc++;
    String name=it.key.toStringNoH(it.value);
    String changed=deobfuscateName(name,false,usageTypes.get(it.key),renameType,selected);
    if (changed != null) {
      boolean addNew=false;
      String h=System.identityHashCode(it.key) + "String_Node_Str" + name;
      if (stringsNoVarH.contains(h)) {
        addNew=true;
      }
      ActionPush pu=(ActionPush)it.key.src;
      if (pu.replacement == null) {
        pu.replacement=new ArrayList<>();
        pu.replacement.addAll(pu.values);
      }
      if (pu.replacement.get(it.key.pos) instanceof ConstantIndex) {
        ConstantIndex ci=(ConstantIndex)pu.replacement.get(it.key.pos);
        ConstantPool pool=it.value;
        if (pool == null) {
          continue;
        }
        if (pool.constants == null) {
          continue;
        }
        if (addNew) {
          pool.constants.add(changed);
          ci.index=pool.constants.size() - 1;
        }
 else {
          pool.constants.set(ci.index,changed);
        }
      }
 else {
        pu.replacement.set(it.key.pos,changed);
      }
      ret++;
    }
  }
  for (  ASMSource src : actionsMap.keySet()) {
    actionsMap.put(src,Action.removeNops(0,actionsMap.get(src),version,0,"String_Node_Str"));
    src.setActions(actionsMap.get(src),version);
  }
  deobfuscateInstanceNames(renameType,tags,selected);
  return ret;
}

Fixed version (ground truth):
private int renameAS2Identifiers(RenameType renameType,Map<String,String> selected){
  actionsMap=new HashMap<>();
  allFunctions=new ArrayList<>();
  allVariableNames=new ArrayList<>();
  allStrings=new HashMap<>();
  List<Object> objs=new ArrayList<>();
  int ret=0;
  objs.addAll(tags);
  getVariables(objs,"String_Node_Str");
  informListeners("String_Node_Str","String_Node_Str");
  int fc=0;
  for (  MyEntry<DirectValueActionItem,ConstantPool> it : allVariableNames) {
    String name=it.key.toStringNoH(it.value);
    allVariableNamesStr.add(name);
  }
  informListeners("String_Node_Str","String_Node_Str");
  int classCount=0;
  for (  Tag t : tags) {
    if (t instanceof DoInitActionTag) {
      classCount++;
    }
  }
  int cnt=0;
  for (  Tag t : tags) {
    if (t instanceof DoInitActionTag) {
      cnt++;
      informListeners("String_Node_Str","String_Node_Str" + cnt + "String_Node_Str"+ classCount);
      DoInitActionTag dia=(DoInitActionTag)t;
      String exportName=dia.getExportName();
      final String pkgPrefix="String_Node_Str";
      String classNameParts[]=null;
      if ((exportName != null) && exportName.startsWith(pkgPrefix)) {
        String className=exportName.substring(pkgPrefix.length());
        if (className.contains("String_Node_Str")) {
          classNameParts=className.split("String_Node_Str");
        }
 else {
          classNameParts=new String[]{className};
        }
      }
      int staticOperation=Graph.SOP_USE_STATIC;
      List<GraphTargetItem> dec=Action.actionsToTree(dia.getActions(version),version,staticOperation,"String_Node_Str");
      GraphTargetItem name=null;
      for (      GraphTargetItem it : dec) {
        if (it instanceof ClassActionItem) {
          ClassActionItem cti=(ClassActionItem)it;
          List<GraphTargetItem> methods=new ArrayList<>();
          methods.addAll(cti.functions);
          methods.addAll(cti.staticFunctions);
          for (          GraphTargetItem gti : methods) {
            if (gti instanceof FunctionActionItem) {
              FunctionActionItem fun=(FunctionActionItem)gti;
              if (fun.calculatedFunctionName instanceof DirectValueActionItem) {
                DirectValueActionItem dvf=(DirectValueActionItem)fun.calculatedFunctionName;
                String fname=dvf.toStringNoH(null);
                String changed=deobfuscateName(fname,false,"String_Node_Str",renameType,selected);
                if (changed != null) {
                  deobfuscated.put(fname,changed);
                }
              }
            }
          }
          List<GraphTargetItem> vars=new ArrayList<>();
          for (          MyEntry<GraphTargetItem,GraphTargetItem> item : cti.vars) {
            vars.add(item.key);
          }
          for (          MyEntry<GraphTargetItem,GraphTargetItem> item : cti.staticVars) {
            vars.add(item.key);
          }
          for (          GraphTargetItem gti : vars) {
            if (gti instanceof DirectValueActionItem) {
              DirectValueActionItem dvf=(DirectValueActionItem)gti;
              String vname=dvf.toStringNoH(null);
              String changed=deobfuscateName(vname,false,"String_Node_Str",renameType,selected);
              if (changed != null) {
                deobfuscated.put(vname,changed);
              }
            }
          }
          name=cti.className;
          break;
        }
        if (it instanceof InterfaceActionItem) {
          InterfaceActionItem ift=(InterfaceActionItem)it;
          name=ift.name;
        }
      }
      if (name != null) {
        int pos=0;
        while (name instanceof GetMemberActionItem) {
          GetMemberActionItem mem=(GetMemberActionItem)name;
          GraphTargetItem memberName=mem.memberName;
          if (memberName instanceof DirectValueActionItem) {
            DirectValueActionItem dvt=(DirectValueActionItem)memberName;
            String nameStr=dvt.toStringNoH(null);
            if (classNameParts != null) {
              if (classNameParts.length - 1 - pos < 0) {
                break;
              }
            }
            String changedNameStr=nameStr;
            if (classNameParts != null) {
              changedNameStr=classNameParts[classNameParts.length - 1 - pos];
            }
            String changedNameStr2=deobfuscateName(changedNameStr,pos == 0,pos == 0 ? "String_Node_Str" : "String_Node_Str",renameType,selected);
            if (changedNameStr2 != null) {
              changedNameStr=changedNameStr2;
            }
            ret++;
            deobfuscated.put(nameStr,changedNameStr);
            pos++;
          }
          name=mem.object;
        }
        if (name instanceof GetVariableActionItem) {
          GetVariableActionItem var=(GetVariableActionItem)name;
          if (var.name instanceof DirectValueActionItem) {
            DirectValueActionItem dvt=(DirectValueActionItem)var.name;
            String nameStr=dvt.toStringNoH(null);
            if (classNameParts != null) {
              if (classNameParts.length - 1 - pos < 0) {
                break;
              }
            }
            String changedNameStr=nameStr;
            if (classNameParts != null) {
              changedNameStr=classNameParts[classNameParts.length - 1 - pos];
            }
            String changedNameStr2=deobfuscateName(changedNameStr,pos == 0,pos == 0 ? "String_Node_Str" : "String_Node_Str",renameType,selected);
            if (changedNameStr2 != null) {
              changedNameStr=changedNameStr2;
            }
            ret++;
            deobfuscated.put(nameStr,changedNameStr);
            pos++;
          }
        }
      }
    }
  }
  for (  GraphSourceItem fun : allFunctions) {
    fc++;
    informListeners("String_Node_Str","String_Node_Str" + fc + "String_Node_Str"+ allFunctions.size());
    if (fun instanceof ActionDefineFunction) {
      ActionDefineFunction f=(ActionDefineFunction)fun;
      if (f.functionName.equals("String_Node_Str")) {
        continue;
      }
      String changed=deobfuscateName(f.functionName,false,"String_Node_Str",renameType,selected);
      if (changed != null) {
        f.replacedFunctionName=changed;
        ret++;
      }
    }
    if (fun instanceof ActionDefineFunction2) {
      ActionDefineFunction2 f=(ActionDefineFunction2)fun;
      if (f.functionName.equals("String_Node_Str")) {
        continue;
      }
      String changed=deobfuscateName(f.functionName,false,"String_Node_Str",renameType,selected);
      if (changed != null) {
        f.replacedFunctionName=changed;
        ret++;
      }
    }
  }
  HashSet<String> stringsNoVarH=new HashSet<>();
  List<DirectValueActionItem> allVariableNamesDv=new ArrayList<>();
  for (  MyEntry<DirectValueActionItem,ConstantPool> it : allVariableNames) {
    allVariableNamesDv.add(it.key);
  }
  for (  DirectValueActionItem ti : allStrings.keySet()) {
    if (!allVariableNamesDv.contains(ti)) {
      stringsNoVarH.add(System.identityHashCode(allStrings.get(ti)) + "String_Node_Str" + ti.toStringNoH(allStrings.get(ti)));
    }
  }
  int vc=0;
  for (  MyEntry<DirectValueActionItem,ConstantPool> it : allVariableNames) {
    vc++;
    String name=it.key.toStringNoH(it.value);
    String changed=deobfuscateName(name,false,usageTypes.get(it.key),renameType,selected);
    if (changed != null) {
      boolean addNew=false;
      String h=System.identityHashCode(it.key) + "String_Node_Str" + name;
      if (stringsNoVarH.contains(h)) {
        addNew=true;
      }
      ActionPush pu=(ActionPush)it.key.src;
      if (pu.replacement == null) {
        pu.replacement=new ArrayList<>();
        pu.replacement.addAll(pu.values);
      }
      if (pu.replacement.get(it.key.pos) instanceof ConstantIndex) {
        ConstantIndex ci=(ConstantIndex)pu.replacement.get(it.key.pos);
        ConstantPool pool=it.value;
        if (pool == null) {
          continue;
        }
        if (pool.constants == null) {
          continue;
        }
        if (addNew) {
          pool.constants.add(changed);
          ci.index=pool.constants.size() - 1;
        }
 else {
          pool.constants.set(ci.index,changed);
        }
      }
 else {
        pu.replacement.set(it.key.pos,changed);
      }
      ret++;
    }
  }
  for (  ASMSource src : actionsMap.keySet()) {
    actionsMap.put(src,Action.removeNops(0,actionsMap.get(src),version,0,"String_Node_Str"));
    src.setActions(actionsMap.get(src),version);
  }
  deobfuscateInstanceNames(renameType,tags,selected);
  return ret;
}