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: prima.m
    path of file: ./repos/prima/benchmark/rescue_idz/matlab/interfaces
    
    the code of the file until where you have to start completion: function [x, fx, exitflag, output] = prima(varargin)
%PRIMA is a package for solving the following generic continuous
%   optimization problem without using derivatives:
%
%   minimiz
    
function evaluation
    % occurred. But then we will have to modify the validation of fx, funcCount,
    % and fhist in postprima. To avoid such a modification, we set fx, funcCount,
    % and fhist as below and then revise them in postprima.
    output.fx = fun(output.x);  % preprima has defined a fake objective function
    output.funcCount = 1;
    if options.output_xhist
        output.xhist = output.x;
    end