Program: 27370
Project: 27370
Buggy source:
@Override protected List<PassFactory> getOptimizations(){
  List<PassFactory> passes=new ArrayList<>();
  if (options.skipNonTranspilationPasses) {
    return passes;
  }
  passes.add(gatherExternProperties);
  passes.add(garbageCollectChecks);
  if (options.instrumentForCoverage) {
    passes.add(instrumentForCodeCoverage);
  }
  if (options.runtimeTypeCheck) {
    passes.add(runtimeTypeCheck);
  }
  if (options.j2clPassMode.shouldAddJ2clPasses()) {
    passes.add(j2clPass);
    passes.add(j2clPropertyInlinerPass);
  }
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.replaceIdGenerators) {
    passes.add(replaceIdGenerators);
  }
  if (options.optimizeArgumentsArray) {
    passes.add(optimizeArgumentsArray);
  }
  if (options.closurePass && (options.removeAbstractMethods || options.removeClosureAsserts)) {
    passes.add(closureCodeRemoval);
  }
  if (options.disambiguatePrivateProperties) {
    passes.add(disambiguatePrivateProperties);
  }
  if (options.collapseProperties) {
    passes.add(collapseProperties);
  }
  if (options.inferConsts) {
    passes.add(inferConsts);
  }
  if (options.reportPath != null && options.smartNameRemoval) {
    passes.add(initNameAnalyzeReport);
  }
  if (options.extraSmartNameRemoval && options.smartNameRemoval) {
    if (options.foldConstants && (options.inlineVariables || options.inlineLocalVariables)) {
      passes.add(earlyInlineVariables);
      passes.add(earlyPeepholeOptimizations);
    }
    passes.add(extraSmartNamePass);
  }
  if (options.rewritePolyfills) {
    passes.add(removeUnusedPolyfills);
  }
  if (options.shouldDisambiguateProperties()) {
    passes.add(disambiguateProperties);
  }
  if (options.computeFunctionSideEffects) {
    passes.add(markPureFunctions);
  }
 else   if (options.markNoSideEffectCalls) {
    passes.add(markNoSideEffectCalls);
  }
  if (options.chainCalls) {
    passes.add(chainCalls);
  }
  passes.add(checkConstParams);
  assertAllOneTimePasses(passes);
  if (options.smartNameRemoval || options.reportPath != null) {
    passes.addAll(getCodeRemovingPasses());
    passes.add(smartNamePass);
  }
  if (options.closurePass) {
    passes.add(closureOptimizePrimitives);
  }
  if (!options.replaceStringsFunctionDescriptions.isEmpty()) {
    passes.add(replaceStrings);
  }
  if (options.crossModuleCodeMotion) {
    passes.add(crossModuleCodeMotion);
  }
  if (options.devirtualizePrototypeMethods) {
    passes.add(devirtualizePrototypeMethods);
  }
  if (options.customPasses != null) {
    passes.add(getCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATION_LOOP));
  }
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.inlineVariables || options.inlineLocalVariables) {
    passes.add(flowSensitiveInlineVariables);
  }
  passes.addAll(getMainOptimizationLoop());
  passes.add(createEmptyPass("String_Node_Str"));
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.crossModuleCodeMotion) {
    passes.add(crossModuleCodeMotion);
  }
  if (options.crossModuleMethodMotion) {
    passes.add(crossModuleMethodMotion);
  }
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.customPasses != null) {
    passes.add(getCustomPasses(CustomPassExecutionTime.AFTER_OPTIMIZATION_LOOP));
  }
  if (options.inlineVariables || options.inlineLocalVariables) {
    passes.add(flowSensitiveInlineVariables);
    if (options.removeUnusedVars || options.removeUnusedLocalVars) {
      passes.add(getRemoveUnusedVars("String_Node_Str",false));
    }
  }
  if (options.smartNameRemoval) {
    passes.add(smartNamePass2);
  }
  if (options.collapseAnonymousFunctions) {
    passes.add(collapseAnonymousFunctions);
  }
  if (options.moveFunctionDeclarations || options.renamePrefixNamespace != null) {
    passes.add(moveFunctionDeclarations);
  }
  if (options.anonymousFunctionNaming == AnonymousFunctionNamingPolicy.MAPPED) {
    passes.add(nameMappedAnonymousFunctions);
  }
  if (options.extractPrototypeMemberDeclarations != ExtractPrototypeMemberDeclarationsMode.OFF) {
    passes.add(extractPrototypeMemberDeclarations);
  }
  if (options.shouldAmbiguateProperties() && (options.propertyRenaming == PropertyRenamingPolicy.ALL_UNQUOTED)) {
    passes.add(ambiguateProperties);
  }
  if (options.propertyRenaming == PropertyRenamingPolicy.ALL_UNQUOTED) {
    passes.add(renameProperties);
  }
  if (options.reserveRawExports) {
    passes.add(gatherRawExports);
  }
  if (options.convertToDottedProperties) {
    passes.add(convertToDottedProperties);
  }
  if (options.rewriteFunctionExpressions) {
    passes.add(rewriteFunctionExpressions);
  }
  if (!options.aliasableStrings.isEmpty() || options.aliasAllStrings) {
    passes.add(aliasStrings);
  }
  passes.add(markUnnormalized);
  if (options.coalesceVariableNames) {
    passes.add(coalesceVariableNames);
    if (options.foldConstants) {
      passes.add(peepholeOptimizations);
    }
  }
  if (options.collapseVariableDeclarations) {
    passes.add(exploitAssign);
    passes.add(collapseVariableDeclarations);
  }
  passes.add(denormalize);
  if (options.instrumentationTemplate != null) {
    passes.add(instrumentFunctions);
  }
  if (options.variableRenaming != VariableRenamingPolicy.ALL) {
    passes.add(invertContextualRenaming);
  }
  if (options.variableRenaming != VariableRenamingPolicy.OFF) {
    passes.add(renameVars);
  }
  if (options.processObjectPropertyString) {
    passes.add(objectPropertyStringPostprocess);
  }
  if (options.labelRenaming) {
    passes.add(renameLabels);
  }
  if (options.foldConstants) {
    passes.add(latePeepholeOptimizations);
  }
  if (options.anonymousFunctionNaming == AnonymousFunctionNamingPolicy.UNMAPPED) {
    passes.add(nameUnmappedAnonymousFunctions);
  }
  if (protectHiddenSideEffects) {
    passes.add(stripSideEffectProtection);
  }
  if (options.renamePrefixNamespace != null) {
    if (!GLOBAL_SYMBOL_NAMESPACE_PATTERN.matcher(options.renamePrefixNamespace).matches()) {
      throw new IllegalArgumentException("String_Node_Str" + options.renamePrefixNamespace);
    }
    passes.add(rescopeGlobalSymbols);
  }
  passes.add(sanityCheckAst);
  passes.add(sanityCheckVars);
  if (options.getLanguageOut().isEs6OrHigher()) {
    passes.add(optimizeToEs6);
    passes.add(rewriteBindThis);
  }
  return passes;
}

Fixed version (ground truth):
@Override protected List<PassFactory> getOptimizations(){
  List<PassFactory> passes=new ArrayList<>();
  if (options.skipNonTranspilationPasses) {
    return passes;
  }
  passes.add(gatherExternProperties);
  passes.add(garbageCollectChecks);
  if (options.instrumentForCoverage) {
    passes.add(instrumentForCodeCoverage);
  }
  if (options.runtimeTypeCheck) {
    passes.add(runtimeTypeCheck);
  }
  if (options.j2clPassMode.shouldAddJ2clPasses()) {
    passes.add(j2clPass);
    passes.add(j2clPropertyInlinerPass);
  }
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.replaceIdGenerators) {
    passes.add(replaceIdGenerators);
  }
  if (options.optimizeArgumentsArray) {
    passes.add(optimizeArgumentsArray);
  }
  if (options.closurePass && (options.removeAbstractMethods || options.removeClosureAsserts)) {
    passes.add(closureCodeRemoval);
  }
  if (options.disambiguatePrivateProperties) {
    passes.add(disambiguatePrivateProperties);
  }
  if (options.collapseProperties) {
    passes.add(collapseProperties);
  }
  if (options.inferConsts) {
    passes.add(inferConsts);
  }
  if (options.reportPath != null && options.smartNameRemoval) {
    passes.add(initNameAnalyzeReport);
  }
  if (options.extraSmartNameRemoval && options.smartNameRemoval) {
    if (options.foldConstants && (options.inlineVariables || options.inlineLocalVariables)) {
      passes.add(earlyInlineVariables);
      passes.add(earlyPeepholeOptimizations);
    }
    passes.add(extraSmartNamePass);
  }
  if (options.shouldDisambiguateProperties()) {
    passes.add(disambiguateProperties);
  }
  if (options.computeFunctionSideEffects) {
    passes.add(markPureFunctions);
  }
 else   if (options.markNoSideEffectCalls) {
    passes.add(markNoSideEffectCalls);
  }
  if (options.chainCalls) {
    passes.add(chainCalls);
  }
  passes.add(checkConstParams);
  assertAllOneTimePasses(passes);
  if (options.smartNameRemoval || options.reportPath != null) {
    passes.addAll(getCodeRemovingPasses());
    passes.add(smartNamePass);
  }
  if (options.closurePass) {
    passes.add(closureOptimizePrimitives);
  }
  if (!options.replaceStringsFunctionDescriptions.isEmpty()) {
    passes.add(replaceStrings);
  }
  if (options.crossModuleCodeMotion) {
    passes.add(crossModuleCodeMotion);
  }
  if (options.devirtualizePrototypeMethods) {
    passes.add(devirtualizePrototypeMethods);
  }
  if (options.customPasses != null) {
    passes.add(getCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATION_LOOP));
  }
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.inlineVariables || options.inlineLocalVariables) {
    passes.add(flowSensitiveInlineVariables);
  }
  passes.addAll(getMainOptimizationLoop());
  passes.add(createEmptyPass("String_Node_Str"));
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.crossModuleCodeMotion) {
    passes.add(crossModuleCodeMotion);
  }
  if (options.crossModuleMethodMotion) {
    passes.add(crossModuleMethodMotion);
  }
  passes.add(createEmptyPass("String_Node_Str"));
  if (options.customPasses != null) {
    passes.add(getCustomPasses(CustomPassExecutionTime.AFTER_OPTIMIZATION_LOOP));
  }
  if (options.inlineVariables || options.inlineLocalVariables) {
    passes.add(flowSensitiveInlineVariables);
    if (options.removeUnusedVars || options.removeUnusedLocalVars) {
      passes.add(getRemoveUnusedVars("String_Node_Str",false));
    }
  }
  if (options.smartNameRemoval) {
    passes.add(smartNamePass2);
  }
  if (options.collapseAnonymousFunctions) {
    passes.add(collapseAnonymousFunctions);
  }
  if (options.moveFunctionDeclarations || options.renamePrefixNamespace != null) {
    passes.add(moveFunctionDeclarations);
  }
  if (options.anonymousFunctionNaming == AnonymousFunctionNamingPolicy.MAPPED) {
    passes.add(nameMappedAnonymousFunctions);
  }
  if (options.extractPrototypeMemberDeclarations != ExtractPrototypeMemberDeclarationsMode.OFF) {
    passes.add(extractPrototypeMemberDeclarations);
  }
  if (options.shouldAmbiguateProperties() && (options.propertyRenaming == PropertyRenamingPolicy.ALL_UNQUOTED)) {
    passes.add(ambiguateProperties);
  }
  if (options.propertyRenaming == PropertyRenamingPolicy.ALL_UNQUOTED) {
    passes.add(renameProperties);
  }
  if (options.reserveRawExports) {
    passes.add(gatherRawExports);
  }
  if (options.convertToDottedProperties) {
    passes.add(convertToDottedProperties);
  }
  if (options.rewriteFunctionExpressions) {
    passes.add(rewriteFunctionExpressions);
  }
  if (!options.aliasableStrings.isEmpty() || options.aliasAllStrings) {
    passes.add(aliasStrings);
  }
  passes.add(markUnnormalized);
  if (options.coalesceVariableNames) {
    passes.add(coalesceVariableNames);
    if (options.foldConstants) {
      passes.add(peepholeOptimizations);
    }
  }
  if (options.collapseVariableDeclarations) {
    passes.add(exploitAssign);
    passes.add(collapseVariableDeclarations);
  }
  passes.add(denormalize);
  if (options.instrumentationTemplate != null) {
    passes.add(instrumentFunctions);
  }
  if (options.variableRenaming != VariableRenamingPolicy.ALL) {
    passes.add(invertContextualRenaming);
  }
  if (options.variableRenaming != VariableRenamingPolicy.OFF) {
    passes.add(renameVars);
  }
  if (options.processObjectPropertyString) {
    passes.add(objectPropertyStringPostprocess);
  }
  if (options.labelRenaming) {
    passes.add(renameLabels);
  }
  if (options.foldConstants) {
    passes.add(latePeepholeOptimizations);
  }
  if (options.anonymousFunctionNaming == AnonymousFunctionNamingPolicy.UNMAPPED) {
    passes.add(nameUnmappedAnonymousFunctions);
  }
  if (protectHiddenSideEffects) {
    passes.add(stripSideEffectProtection);
  }
  if (options.renamePrefixNamespace != null) {
    if (!GLOBAL_SYMBOL_NAMESPACE_PATTERN.matcher(options.renamePrefixNamespace).matches()) {
      throw new IllegalArgumentException("String_Node_Str" + options.renamePrefixNamespace);
    }
    passes.add(rescopeGlobalSymbols);
  }
  passes.add(sanityCheckAst);
  passes.add(sanityCheckVars);
  if (options.getLanguageOut().isEs6OrHigher()) {
    passes.add(optimizeToEs6);
    passes.add(rewriteBindThis);
  }
  return passes;
}