function [maxval,indx] = max(varargin)
%MATLAB Code Generation Library Function

%   Copyright 2003-2019 The MathWorks, Inc.
%#codegen

coder.internal.allowHalfInputs;
coder.internal.implicitExpansionBuiltin;
coder.inline('always'); % for shrinktypes on indx output
narginchk(1,5);
if nargin == 2
    eml_property('associative','commutative');
end
if nargout <= 1
    maxval = coder.internal.minOrMax('max',varargin{:});
else
    [maxval,iindx] = coder.internal.minOrMax('max',varargin{:});
    indx = double(iindx);
end
