@Test
public void testRemoveDuplicateReturn2() throws Exception {

  final String program = "int foo() {\n"
      + " int x;\n"
      + " return 0;\n"
      + " x = 1;\n"
      + " return 1;\n"
      + " x = 2;\n"
      + " return 2;\n"
      + " return 3;\n"
      + "}\n";
  final String expected = "int foo() {\n"
      + " int x;\n"
      + " return 3;\n"
      + "}\n";
  final TranslationUnit tu = ParseHelper.parse(program);
  final List<StmtReductionOpportunity> ops = StmtReductionOpportunities.findOpportunities(
      MakeShaderJobFromFragmentShader.make(tu),
      new ReducerContext(true, ShadingLanguageVersion.ESSL_300, new RandomWrapper(0),
          new IdGenerator()));
  assertEquals(6, ops.size());
  ops.get(0).applyReduction();
  ops.get(1).applyReduction();
  ops.get(2).applyReduction();
  ops.get(3).applyReduction();
  ops.get(4).applyReduction();
  assertFalse(ops.get(5).preconditionHolds());
  CompareAsts.assertEqualAsts(expected, tu);
}