private static boolean areInstructionsReachable(final @NotNull ControlFlow flow,
                                                  final int @NotNull [] instructionOffsets,
                                                  final int startOffset) {
    class MyVisitor extends InstructionClientVisitor<Boolean> {
      private boolean reachable;

      @Override
      public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
        reachable |= ArrayUtil.indexOf(instructionOffsets, nextOffset) >= 0;
      }

      @Override
      public @NotNull Boolean getResult() {
        return reachable;
      }
    }

    if (startOffset != 0 && hasCalls(flow)) {
      // Additional computations are required to take into account CALL and RETURN instructions in the case where
      // the start offset isn't the beginning of the control flow, because we couldn't know the correct state
      // of the call stack if we started traversal of the control flow from an offset in the middle.
      return areInstructionsReachableWithCalls(flow, instructionOffsets, startOffset);
    }
    MyVisitor visitor = new MyVisitor();
    depthFirstSearch(flow, visitor, startOffset, flow.getSize());

    return visitor.getResult().booleanValue();
  }
private static boolean areInstructionsReachable(final @NotNull ControlFlow flow,
                                                  final int @NotNull [] instructionOffsets,
                                                  final int startOffset)