You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: coarsepatch.m
    path of file: ./repos/GIBBON/lib
    
    the code of the file until where you have to start completion: function [varargout]=coarsepatch(F,V,f)

% function [F,V,Eb]=coarsepatch(F,V,f)
%-------------------------------------------------------------------------
% 
% 
% 
% Change log: 
% 2019/06/25 Added variable output handling as well as outputting of
% boundary edges

    
function [varargout]=coarsepatch(F,V,f)

% function [F,V,Eb]=coarsepatch(F,V,f)
%-------------------------------------------------------------------------
% 
% 
% 
% Change log: 
% 2019/06/25 Added variable output handling as well as outputting of
% boundary edges
%-------------------------------------------------------------------------
%%
% Run reducepatch
[F,V] = reducepatch(F,V,f,'fast');

%%
% Avoid/fix reducepatch bugs
[F,V]=mergeVertices(F,V); %Merge vertices
F=patchRemoveCollapsed(F); %remove collapsed (edges)
[F,V]=triSurfRemoveThreeConnect(F,V); 
[F,V]=patchCleanUnused(F,V); %Remove unused points
F=uniqueIntegerRow(F); %Removing double faces

%%

varargout{1}=F;
varargout{2}=V;

if nargout==3
    %Also compute boundary
    varargout{3}=patchBoundary(F,V);
end