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: spm_shoot_update.m
    path of file: ./repos/bspm/thirdparty/spm12/toolbox/Shoot
    
    the code of the file until where you have to start completion: function [u0,ll1,ll2,grad_norm] = spm_shoot_update(g,f,u0,phi,dt,prm, bs_args,scale)
% Shooting Of Diffeomorphisms (Spawn Of Dartel).
% FORMAT u0 = spm_shoot_update(g,f,u0,phi,dt,prm, bs
    
function [ll,b,A] = mnom_derivs(g,f,phi,dt, bs_args)
% Compute log-likelihood, first and second derivatives for multi-nomial matching
% FORMAT [ll,b,A] = mnom_derivs(g,f,phi,dt,bs_args)
% g       - cell array of template B-spline coefficients
% f       - cell array of individual subject data
% phi     - deformation field
% dt      - Jacobian determinants
% bs_args - B-spline arguments for sampling g.  Defaults to [2 2 2  1 1 1] if
%           not supplied.
%
% ll      - log-likelihood
% b       - first derivatives
% A       - (approx) second derivatives (Fisher information)
%
%_______________________________________________________________________
% Copyright (C) 2009 Wellcome Trust Centre for Neuroimaging

if nargin<4,
    bs_args = [2 2 2  1 1 1];
end