/* This file was automatically generated by pyNLControl.*/


#include "{{FileName}}.h"
#include "{{FileName}}_Call.h"

void {{FileName}}_Call_Func({%for xin in Func_In%}casadi_real *{{xin}}, {%endfor%}{%for xout in Func_Out%}casadi_real *{{xout}}{% if not loop.last %}, {% endif %} {%endfor%})
{
    int i;

    const casadi_real *arg[{{arg_size}}];
    casadi_real *res[{{res_size}}];
    casadi_int iw[{{iw_size}}];
    casadi_real w[{{w_size}}];

    {#Input address assign#}
    {%set NumIn = Func_In|length %}
    {%set StartIn = namespace(value=0)%}
    {%for k in range(NumIn)%}
    arg[{{k}}] = w + {{StartIn.value}};
    {%set StartIn.value = StartIn.value + SizeIn[loop.index0]%}
    {%endfor%}
    {#Output address assign#}
    {%set NumOut = Func_Out|length %}
    {%set StartOut = namespace(value=0)%}
    {%for k in range(NumOut)%}
    res[{{k}}] = w + {{StartIn.value + StartOut.value}};
    {%set StartOut.value = StartOut.value + SizeOut[loop.index0]%}
    {%endfor%}
    {#Assign input value#}
    {%set StartIn = namespace(value=0)%}
    {%for k in range(NumIn)%}
    for (i = {{StartIn.value}}; i < {{StartIn.value + SizeIn[loop.index0]}}; i++)
        w[i] = {{Func_In[loop.index0]}}[i-{{StartIn.value}}];
    {%set StartIn.value = StartIn.value + SizeIn[loop.index0]%}
    {%endfor%}
    {{Func_Name}} (arg, res, iw, w + {{StartIn.value+StartOut.value}}, 0);
    {#Assign output value#}
    {%set StartOut = namespace(value=0)%}
    {%for k in range(NumOut)%}
    for (i = {{StartIn.value+StartOut.value}}; i < {{StartIn.value+StartOut.value + SizeOut[loop.index0]}}; i++)
        {{Func_Out[loop.index0]}}[i-{{StartIn.value+StartOut.value}}] = w[i];
    {%set StartOut.value = StartOut.value + SizeOut[loop.index0]%}
    {%endfor%}
}