void (VarTypeProcessor typeProcessor, DirectGraph graph, VarVersionsProcessor previousVersionsProcessor) { final Map<VarVersionPair, VarType> mapExprentMaxTypes = typeProcessor.getMaxExprentTypes(); Map<VarVersionPair, VarType> mapExprentMinTypes = typeProcessor.getMinExprentTypes(); Map<VarVersionPair, Integer> mapFinalVars = typeProcessor.getFinalVariables(); CounterContainer counters = DecompilerContext.getCounterContainer(); final Map<VarVersionPair, Integer> mapVarPaar = new HashMap<>(); Map<Integer, Integer> mapOriginalVarIndices = new HashMap<>(); // map var-version pairs on new var indexes for (VarVersionPair pair : new ArrayList<>(mapExprentMinTypes.keySet())) { if (pair.version >= 0) { int newIndex = pair.version == 1 ? pair.var : counters.getCounterAndIncrement(CounterContainer.VAR_COUNTER); VarVersionPair newVar = new VarVersionPair(newIndex, 0); mapExprentMinTypes.put(newVar, mapExprentMinTypes.get(pair)); mapExprentMaxTypes.put(newVar, mapExprentMaxTypes.get(pair)); if (mapFinalVars.containsKey(pair)) { mapFinalVars.put(newVar, mapFinalVars.remove(pair)); } mapVarPaar.put(pair, newIndex); mapOriginalVarIndices.put(newIndex, pair.var); } } // set new vars graph.iterateExprents(exprent -> { List<Exprent> lst = exprent.getAllExprents(true); lst.add(exprent); for (Exprent expr : lst) { if (expr.type == Exprent.EXPRENT_VAR) { VarExprent newVar = (VarExprent)expr; Integer newVarIndex = mapVarPaar.get(new VarVersionPair(newVar)); if (newVarIndex != null) { newVar.setIndex(newVarIndex); newVar.setVersion(0); } } else if (expr.type == Exprent.EXPRENT_CONST) { VarType maxType = mapExprentMaxTypes.get(new VarVersionPair(expr.id, -1)); if (maxType != null && maxType.equals(VarType.VARTYPE_CHAR)) { ((ConstExprent)expr).setConstType(maxType); } } } return 0; }); if (previousVersionsProcessor != null) { Map<Integer, Integer> oldIndices = previousVersionsProcessor.getMapOriginalVarIndices(); this.mapOriginalVarIndices = new HashMap<>(mapOriginalVarIndices.size()); for (Entry<Integer, Integer> entry : mapOriginalVarIndices.entrySet()) { Integer value = entry.getValue(); Integer oldValue = oldIndices.get(value); value = oldValue != null ? oldValue : value; this.mapOriginalVarIndices.put(entry.getKey(), value); } } else { this.mapOriginalVarIndices = mapOriginalVarIndices; } }