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: brentmin.m
    path of file: ./repos/bads/gpml-matlab-v3.6-2015-07-07/util
    
    the code of the file until where you have to start completion: %% BRENTMIN: Brent's minimization method in one dimension
function [xmin,fmin,funccount,varargout] = ...
                                  brentmin(xlow,xupp,Nitmax,tol,f,nout,varargin)
% code taken from
%    ยง 10.2 Parabolic Interpolation and Brent's Method in One Dimension
%    Press, Teukolsky, Vetterling & Flannery
%    Numerical Recipes in C, Cambridge University Press, 2002
%
% [xmin,fmin,funccout,varargout] = BRENTMIN(xlow,xupp,Nit,tol,f,nout,varargin)
%    Given a function f, and given a search interval this routine isolates 
%    the minimum of fractional precision of about tol using Brent's method.
% 
% INPUT
% -----
    
function [xmin,fmin,funccount,varargout] = ...
                                  brentmin(xlow,xupp,Nitmax,tol,f,nout,varargin)
% code taken from
%    ยง 10.2 Parabolic Interpolation and Brent's Method in One Dimension
%    Press, Teukolsky, Vetterling & Flannery
%    Numerical Recipes in C, Cambridge University Press, 2002
%
% [xmin,fmin,funccout,varargout] = BRENTMIN(xlow,xupp,Nit,tol,f,nout,varargin)
%    Given a function f, and given a search interval this routine isolates 
%    the minimum of fractional precision of about tol using Brent's method.
% 
% INPUT
% -----
% xlow,xupp:  search interval such that xlow<=xmin<=xupp
% Nitmax:     maximum number of function evaluations made by the routine
% tol:        fractional precision 
% f:          [y,varargout{:}] = f(x,varargin{:}) is the function
% nout:       no. of outputs of f (in varargout) in addition to the y value
%
% OUTPUT
% ------
% fmin:      minimal function value
% xmin:      corresponding abscissa-value
% funccount: number of function evaluations made
% varargout: additional outputs of f at optimum
%
% Copyright (c) by Hannes Nickisch 2010-01-10.

if nargin<6, nout = 0; end