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: a_repmat.m
    path of file: ./repos/d2d/arFramework3/ThirdParty/StrucID/adimat/runtime
    
    the code of the file until where you have to start completion: % function adj = a_repmat(adj, varargin)
%   compute adjoint of repmat(val, varargin{:})
%
% see also a_zeros, a_mean
%
% This file is part of the ADiMat runtime environmen
    
function adj = a_repmat(adj, varargin)
%   compute adjoint of repmat(val, varargin{:})
%
% see also a_zeros, a_mean
%
% This file is part of the ADiMat runtime environment
%
% Copyright (c) 2018 Johannes Willkomm
% Copyright (c) 2015 Johannes Willkomm
function r = a_repmat(adj, val, varargin)
  if nargin < 4
    dims = varargin{1};
  else
    dims = [ varargin{:} ];
  end