private static NegationAnalysis tryNegation(final Member method,
                                                final Type[] argumentTypes,
                                                final ControlFlowGraph graph,
                                                final boolean isBooleanResult,
                                                final DFSTree dfs,
                                                final boolean jsr) throws AnalyzerException {

      class Util {
        boolean isMethodCall(int opCode) {
          return opCode == Opcodes.INVOKESTATIC ||
                 opCode == Opcodes.INVOKESPECIAL ||
                 opCode == Opcodes.INVOKEVIRTUAL ||
                 opCode == Opcodes.INVOKEINTERFACE;
        }

        boolean singleIfBranch() {
          int branch = 0;

          for (int i = 0; i < graph.transitions.length; i++) {
            int[] transition = graph.transitions[i];
            if (transition.length == 2) {
              branch++;
              int opCode = graph.methodNode.instructions.get(i).getOpcode();
              boolean isIfInsn = opCode == Opcodes.IFEQ || opCode == Opcodes.IFNE;
              if (!isIfInsn) {
                return false;
              }
            }
            if (branch > 1)
              return false;
          }
          return branch == 1;
        }

        boolean singleMethodCall() {
          int callCount = 0;
          for (int i = 0; i < graph.transitions.length; i++) {
            if (isMethodCall(graph.methodNode.instructions.get(i).getOpcode())) {
              callCount++;
              if (callCount > 1) {
                return false;
              }
            }
          }
          return callCount == 1;
        }

        public boolean booleanConstResult() {
          try {
            final boolean[] origins =
              OriginsAnalysis.resultOrigins(
                leakingParametersAndFrames(method, graph.methodNode, argumentTypes, jsr).frames,
                graph.methodNode.instructions,
                graph);

            for (int i = 0; i < origins.length; i++) {
              if (origins[i]) {
                int opCode = graph.methodNode.instructions.get(i).getOpcode();
                boolean isBooleanConst = opCode == Opcodes.ICONST_0 || opCode == Opcodes.ICONST_1;
                if (!isBooleanConst) {
                  return false;
                }
              }
            }

            return true;
          }
          catch (AnalyzerException ignore) {
          }
          return false;
        }
      }

      if (graph.methodNode.instructions.size() < 20 && isBooleanResult && dfs.isBackEmpty() && !jsr) {
        Util util = new Util();
        if (util.singleIfBranch() && util.singleMethodCall() && util.booleanConstResult()) {
          NegationAnalysis analyzer = new NegationAnalysis(method, graph);
          try {
            analyzer.analyze();
            return analyzer;
          }
          catch (NegationAnalysisFailedException ignore) {
            return null;
          }
        }
      }

      return null;
    }
private static NegationAnalysis tryNegation(final Member method,
                                                final Type[] argumentTypes,
                                                final ControlFlowGraph graph,
                                                final boolean isBooleanResult,
                                                final DFSTree dfs,
                                                final boolean jsr)