function [D,x0,w0] = flushZeroDelay(D,x0,w0)
% Eliminates zero internal delays and augments IC accordingly.

%  Copyright 2020 The MathWorks, Inc.
id = D.Delay.Internal;
if ~all(id)
   nq0 = size(D.k,1);
   D = elimZeroDelay(D);
   if ~isempty(x0)
      % nq-nq0 nodes added: update [q0;q0'] accordingly
      nq = size(D.k,1);
      x0 = [x0(1:nq0,:);zeros(nq-nq0,1);x0(nq0+1:2*nq0,:);zeros(nq-nq0,1)];
   end
   if nargin>2
      w0 = w0(id>0,:);
   end
end