boolean performAndOrShortcut(Node a, Node b) {
         if (b.getInEdges().size() != 1) return false;
         if (b.block.getChildCount() > 0) {
             // Node b is not a mere conditional.
             return false;
         }

         
         ConditionalEdge aToC;
         ConditionalEdge bToC;
         boolean isOR = true;
         
         while(true) {
             aToC = a.getConditionalEdge(isOR);
             bToC = b.getConditionalEdge(isOR);
             if (bToC.target == aToC.target) break;
             if (!isOR) return false;
             isOR = false;
         }
         
         if (aToC.target.getInEdges().size() != 2) return false;

         ConditionalEdge bToD = b.getConditionalEdge(!isOR);
         ConditionalEdge aToB = a.getConditionalEdge(!isOR);
         
         aToB.redirect(bToD.target);
         removeEdge(bToC);
         removeEdge(bToD);
         removeNode(b);
         
         InfixExpression infix = new InfixExpression(
                 isOR?InfixExpression.Operator.CONDITIONAL_OR:InfixExpression.Operator.CONDITIONAL_AND);
         // Note that the order aToC, then bToC is important.
         infix.setOperands(
                 aToC.getBooleanExpression().getExpression(), 
                 bToC.getBooleanExpression().getExpression());
         
         BooleanExpression be = new BooleanExpression(infix);
         aToC.setBooleanExpression(be);
         aToB.setBooleanExpression(be);
         
         logger.debug("Created shortcut and removed " + b);
         
         return true;
     }