### Question:
ExecutionGraphManipulator extends ExecutionGraph { public int[] getAvailableRegisters(int address) { int[] registers = new int[getRegisterCount(address)]; for (int i = 0; i < registers.length; i++) { registers[i] = i; } Deque<ExecutionNode> stack = new ArrayDeque<>(getChildren(address)); ExecutionNode node = stack.peek(); if (null == node) { assert getTemplateNode(address).getOp() instanceof ReturnOp || getTemplateNode(address).getOp() instanceof ReturnVoidOp; return registers; } Set<Integer> registersRead = new HashSet<>(); Set<Integer> registersAssigned = new HashSet<>(); while ((node = stack.poll()) != null) { MethodState mState = node.getContext().getMethodState(); for (Integer register : registers) { if (registersRead.contains(register) || registersAssigned.contains(register)) { continue; } if (node.getOp().getName().startsWith("move-result")) { continue; } if (mState.wasRegisterRead(register)) { registersRead.add(register); } else if (mState.wasRegisterAssigned(register)) { registersAssigned.add(register); } } stack.addAll(node.getChildren()); } return Arrays.stream(registers).filter(r -> !registersRead.contains(r)).toArray(); } ExecutionGraphManipulator(ExecutionGraph graph, VirtualMethod method, VirtualMachine vm, DexBuilder dexBuilder); void addInstruction(MethodLocation location, BuilderInstruction instruction); void addInstruction(int address, BuilderInstruction newInstruction); int[] getAvailableRegisters(int address); List<ExecutionNode> getChildren(int address); DexBuilder getDexBuilder(); @Nullable BuilderInstruction getInstruction(int address); int[] getParentAddresses(int address); List<BuilderTryBlock> getTryBlocks(); @Override VirtualMachine getVM(); void removeInstruction(MethodLocation location); void removeInstruction(int address); void removeInstructions(List<Integer> addresses); void replaceInstruction(int insertAddress, BuilderInstruction instruction); void replaceInstruction(int insertAddress, List<BuilderInstruction> instructions); MethodLocation getLocation(int address);  }### Answer:
@Test public void hasEveryRegisterAvailableAtEveryAddress() { manipulator = OptimizerTester.getGraphManipulator(CLASS_NAME, "verySimple()V"); int[] addresses = manipulator.getAddresses(); for (int address : addresses) { int[] actualAvailable = manipulator.getAvailableRegisters(address); assertArrayEquals(new int[] { 0, 1, 2, 3, 4 }, actualAvailable); } }