boolean (IfNode rtnode) { if (rtnode.edgetypes.get(0) == 0) { IfNode ifbranch = rtnode.succs.get(0); if (ifbranch.succs.size() == 2) { // if-else branch if (ifbranch.succs.get(0).value == rtnode.succs.get(1).value) { IfStatement ifparent = (IfStatement)rtnode.value; IfStatement ifchild = (IfStatement)ifbranch.value; if (ifchild.getFirst().getExprents().isEmpty()) { ifparent.getFirst().removeSuccessor(ifparent.getIfEdge()); ifchild.getFirst().removeSuccessor(ifchild.getIfEdge()); ifparent.getStats().removeWithKey(ifchild.id); if (ifbranch.edgetypes.get(1) == 1 && ifbranch.edgetypes.get(0) == 1) { // target null ifparent.setIfstat(null); StatEdge ifedge = ifchild.getAllSuccessorEdges().get(0); ifchild.removeSuccessor(ifedge); ifedge.setSource(ifparent.getFirst()); ifparent.getFirst().addSuccessor(ifedge); ifparent.setIfEdge(ifedge); } else { throw new RuntimeException("inconsistent if structure!"); } // merge if conditions IfExprent statexpr = ifparent.getHeadexprent(); List<Exprent> lstOperands = new ArrayList<>(); lstOperands.add(statexpr.getCondition()); lstOperands.add(new FunctionExprent(FunctionExprent.FUNCTION_BOOL_NOT, ifchild.getHeadexprent().getCondition(), null)); statexpr.setCondition(new FunctionExprent(FunctionExprent.FUNCTION_CADD, lstOperands, null)); statexpr.addBytecodeOffsets(ifchild.getHeadexprent().bytecode); return true; } } } } return false; }