int[] (ControlFlow controlFlow) { final int[] loop = new int[controlFlow.getInstructionCount()]; // loop[i] = loop number(strongly connected component number) of i-th instruction or 0 if outside loop MyGraph graph = new MyGraph(controlFlow); final DFSTBuilder<Instruction> builder = new DFSTBuilder<>(graph); IntList sccs = builder.getSCCs(); int tNumber = 0; int component = 0; for (IntListIterator iterator = sccs.iterator(); iterator.hasNext(); ) { int size = iterator.nextInt(); int value = size > 1 ? ++component : 0; for (int i = 0; i < size; i++) { Instruction instruction = builder.getNodeByTNumber(tNumber + i); loop[instruction.getIndex()] = value; } tNumber += size; } return loop; }