IntFunction<BitSet> () { final ControlFlowGraph graph = new ControlFlowGraph(flow.getSize()) { @Override void addArc(int offset, int nextOffset) { nextOffset = promoteThroughGotoChain(flow, nextOffset); if (nextOffset >= flowStart && nextOffset < flowEnd) { super.addArc(offset, nextOffset); } } }; graph.buildFrom(flow); return startOffset -> { BitSet visitedOffsets = new BitSet(flowEnd); graph.depthFirstSearch(startOffset, visitedOffsets); return visitedOffsets; }; }