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: inverse_ir.m
    path of file: ./repos/HRTF-Individualization/model/matlabcode/functions/headphone_eq
    
    the code of the file until where you have to start completion: function iir = inverse_ir(ir,mode)
% function iir = inverse_ir(ir,mode)    
% iir: inverse impulse response
% ir : impulse response to invert
% mode: 1 -> minimum phase inversion
% mode: 2 -> reverse phase inversion

    i_l = length(ir);

    
function iir = inverse_ir(ir,mode)
% function iir = inverse_ir(ir,mode)    
% iir: inverse impulse response
% ir : impulse response to invert
% mode: 1 -> minimum phase inversion
% mode: 2 -> reverse phase inversion

    i_l = length(ir);
    mg = abs(fft(ir,i_l));
    mg = mg/max(mg);
    mg = mg + 0.12;
    s_f = length(mg);
    if mod(s_f,2) == 0
        s_fi = length(mg)/2;
    else
        s_fi = (length(mg)-1)/2;
    end