/* Include files */

#include <stddef.h>
#include "blas.h"
#include "main_sfun.h"
#include "c2_main.h"
#include "mwmathutil.h"
#define CHARTINSTANCE_CHARTNUMBER      (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER   (chartInstance->instanceNumber)
#include "main_sfun_debug_macros.h"
#define _SF_MEX_LISTEN_FOR_CTRL_C(S)   sf_mex_listen_for_ctrl_c(sfGlobalDebugInstanceStruct,S);

/* Type Definitions */

/* Named Constants */
#define CALL_EVENT                     (-1)

/* Variable Declarations */

/* Variable Definitions */
static real_T _sfTime_;
static const char * c2_debug_family_names[59] = { "R", "wp", "lat_uav",
  "lon_uav", "lat_wp1", "lon_wp1", "dLat", "dLon", "a", "c", "lat_wp2",
  "lon_wp2", "dist2", "lat_pm", "lon_pm", "dist_pm", "DTRK_rad", "TRKC_rad",
  "K1", "K2", "lon_c", "lat_c", "dist_c", "rum_rad", "rum", "arc", "delta",
  "nargin", "nargout", "nt", "latt", "lont", "altt", "speed", "okt", "Rlat",
  "Rlon", "dc", "lon", "lat", "alt", "h", "hpath", "betta", "DTG", "on_track0",
  "times", "vel", "dist1", "dist_2", "roll", "TRK", "DTRK", "TRKERR", "XTRK",
  "OK", "on_track", "tim", "rollout" };

/* Function Declarations */
static void initialize_c2_main(SFc2_mainInstanceStruct *chartInstance);
static void initialize_params_c2_main(SFc2_mainInstanceStruct *chartInstance);
static void enable_c2_main(SFc2_mainInstanceStruct *chartInstance);
static void disable_c2_main(SFc2_mainInstanceStruct *chartInstance);
static void c2_update_debugger_state_c2_main(SFc2_mainInstanceStruct
  *chartInstance);
static const mxArray *get_sim_state_c2_main(SFc2_mainInstanceStruct
  *chartInstance);
static void set_sim_state_c2_main(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_st);
static void finalize_c2_main(SFc2_mainInstanceStruct *chartInstance);
static void sf_gateway_c2_main(SFc2_mainInstanceStruct *chartInstance);
static void c2_chartstep_c2_main(SFc2_mainInstanceStruct *chartInstance);
static void initSimStructsc2_main(SFc2_mainInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
  c2_chartNumber, uint32_T c2_instanceNumber);
static const mxArray *c2_sf_marshallOut(void *chartInstanceVoid, void *c2_inData);
static real_T c2_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_rollout, const char_T *c2_identifier);
static real_T c2_b_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_b_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static const mxArray *c2_c_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static void c2_c_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  c2_sKtWNgXb9c99UqYJaA6MzR *c2_y);
static void c2_d_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId, real_T c2_y[12]);
static void c2_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static void c2_info_helper(const mxArray **c2_info);
static const mxArray *c2_emlrt_marshallOut(const char * c2_u);
static const mxArray *c2_b_emlrt_marshallOut(const uint32_T c2_u);
static real_T c2_sqrt(SFc2_mainInstanceStruct *chartInstance, real_T c2_x);
static void c2_eml_error(SFc2_mainInstanceStruct *chartInstance);
static real_T c2_atan2(SFc2_mainInstanceStruct *chartInstance, real_T c2_y,
  real_T c2_x);
static void c2_eml_scalar_eg(SFc2_mainInstanceStruct *chartInstance);
static const mxArray *c2_d_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static int32_T c2_e_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static uint8_T c2_f_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_b_is_active_c2_main, const char_T *c2_identifier);
static uint8_T c2_g_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_b_sqrt(SFc2_mainInstanceStruct *chartInstance, real_T *c2_x);
static void init_dsm_address_info(SFc2_mainInstanceStruct *chartInstance);

/* Function Definitions */
static void initialize_c2_main(SFc2_mainInstanceStruct *chartInstance)
{
  chartInstance->c2_sfEvent = CALL_EVENT;
  _sfTime_ = sf_get_time(chartInstance->S);
  chartInstance->c2_is_active_c2_main = 0U;
}

static void initialize_params_c2_main(SFc2_mainInstanceStruct *chartInstance)
{
  (void)chartInstance;
}

static void enable_c2_main(SFc2_mainInstanceStruct *chartInstance)
{
  _sfTime_ = sf_get_time(chartInstance->S);
}

static void disable_c2_main(SFc2_mainInstanceStruct *chartInstance)
{
  _sfTime_ = sf_get_time(chartInstance->S);
}

static void c2_update_debugger_state_c2_main(SFc2_mainInstanceStruct
  *chartInstance)
{
  (void)chartInstance;
}

static const mxArray *get_sim_state_c2_main(SFc2_mainInstanceStruct
  *chartInstance)
{
  const mxArray *c2_st;
  const mxArray *c2_y = NULL;
  real_T c2_hoistedGlobal;
  real_T c2_u;
  const mxArray *c2_b_y = NULL;
  real_T c2_b_hoistedGlobal;
  real_T c2_b_u;
  const mxArray *c2_c_y = NULL;
  real_T c2_c_hoistedGlobal;
  real_T c2_c_u;
  const mxArray *c2_d_y = NULL;
  real_T c2_d_hoistedGlobal;
  real_T c2_d_u;
  const mxArray *c2_e_y = NULL;
  real_T c2_e_hoistedGlobal;
  real_T c2_e_u;
  const mxArray *c2_f_y = NULL;
  real_T c2_f_hoistedGlobal;
  real_T c2_f_u;
  const mxArray *c2_g_y = NULL;
  real_T c2_g_hoistedGlobal;
  real_T c2_g_u;
  const mxArray *c2_h_y = NULL;
  real_T c2_h_hoistedGlobal;
  real_T c2_h_u;
  const mxArray *c2_i_y = NULL;
  real_T c2_i_hoistedGlobal;
  real_T c2_i_u;
  const mxArray *c2_j_y = NULL;
  real_T c2_j_hoistedGlobal;
  real_T c2_j_u;
  const mxArray *c2_k_y = NULL;
  real_T c2_k_hoistedGlobal;
  real_T c2_k_u;
  const mxArray *c2_l_y = NULL;
  uint8_T c2_l_hoistedGlobal;
  uint8_T c2_l_u;
  const mxArray *c2_m_y = NULL;
  real_T *c2_DTRK;
  real_T *c2_OK;
  real_T *c2_TRK;
  real_T *c2_TRKERR;
  real_T *c2_XTRK;
  real_T *c2_dist1;
  real_T *c2_dist_2;
  real_T *c2_on_track;
  real_T *c2_roll;
  real_T *c2_rollout;
  real_T *c2_tim;
  c2_rollout = (real_T *)ssGetOutputPortSignal(chartInstance->S, 11);
  c2_tim = (real_T *)ssGetOutputPortSignal(chartInstance->S, 10);
  c2_on_track = (real_T *)ssGetOutputPortSignal(chartInstance->S, 9);
  c2_OK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 8);
  c2_XTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 7);
  c2_TRKERR = (real_T *)ssGetOutputPortSignal(chartInstance->S, 6);
  c2_DTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 5);
  c2_TRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 4);
  c2_roll = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_dist_2 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c2_dist1 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c2_st = NULL;
  c2_st = NULL;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_createcellmatrix(12, 1), false);
  c2_hoistedGlobal = *c2_DTRK;
  c2_u = c2_hoistedGlobal;
  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", &c2_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 0, c2_b_y);
  c2_b_hoistedGlobal = *c2_OK;
  c2_b_u = c2_b_hoistedGlobal;
  c2_c_y = NULL;
  sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_b_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 1, c2_c_y);
  c2_c_hoistedGlobal = *c2_TRK;
  c2_c_u = c2_c_hoistedGlobal;
  c2_d_y = NULL;
  sf_mex_assign(&c2_d_y, sf_mex_create("y", &c2_c_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 2, c2_d_y);
  c2_d_hoistedGlobal = *c2_TRKERR;
  c2_d_u = c2_d_hoistedGlobal;
  c2_e_y = NULL;
  sf_mex_assign(&c2_e_y, sf_mex_create("y", &c2_d_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 3, c2_e_y);
  c2_e_hoistedGlobal = *c2_XTRK;
  c2_e_u = c2_e_hoistedGlobal;
  c2_f_y = NULL;
  sf_mex_assign(&c2_f_y, sf_mex_create("y", &c2_e_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 4, c2_f_y);
  c2_f_hoistedGlobal = *c2_dist1;
  c2_f_u = c2_f_hoistedGlobal;
  c2_g_y = NULL;
  sf_mex_assign(&c2_g_y, sf_mex_create("y", &c2_f_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 5, c2_g_y);
  c2_g_hoistedGlobal = *c2_dist_2;
  c2_g_u = c2_g_hoistedGlobal;
  c2_h_y = NULL;
  sf_mex_assign(&c2_h_y, sf_mex_create("y", &c2_g_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 6, c2_h_y);
  c2_h_hoistedGlobal = *c2_on_track;
  c2_h_u = c2_h_hoistedGlobal;
  c2_i_y = NULL;
  sf_mex_assign(&c2_i_y, sf_mex_create("y", &c2_h_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 7, c2_i_y);
  c2_i_hoistedGlobal = *c2_roll;
  c2_i_u = c2_i_hoistedGlobal;
  c2_j_y = NULL;
  sf_mex_assign(&c2_j_y, sf_mex_create("y", &c2_i_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 8, c2_j_y);
  c2_j_hoistedGlobal = *c2_rollout;
  c2_j_u = c2_j_hoistedGlobal;
  c2_k_y = NULL;
  sf_mex_assign(&c2_k_y, sf_mex_create("y", &c2_j_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 9, c2_k_y);
  c2_k_hoistedGlobal = *c2_tim;
  c2_k_u = c2_k_hoistedGlobal;
  c2_l_y = NULL;
  sf_mex_assign(&c2_l_y, sf_mex_create("y", &c2_k_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 10, c2_l_y);
  c2_l_hoistedGlobal = chartInstance->c2_is_active_c2_main;
  c2_l_u = c2_l_hoistedGlobal;
  c2_m_y = NULL;
  sf_mex_assign(&c2_m_y, sf_mex_create("y", &c2_l_u, 3, 0U, 0U, 0U, 0), false);
  sf_mex_setcell(c2_y, 11, c2_m_y);
  sf_mex_assign(&c2_st, c2_y, false);
  return c2_st;
}

static void set_sim_state_c2_main(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_st)
{
  const mxArray *c2_u;
  real_T *c2_DTRK;
  real_T *c2_OK;
  real_T *c2_TRK;
  real_T *c2_TRKERR;
  real_T *c2_XTRK;
  real_T *c2_dist1;
  real_T *c2_dist_2;
  real_T *c2_on_track;
  real_T *c2_roll;
  real_T *c2_rollout;
  real_T *c2_tim;
  c2_rollout = (real_T *)ssGetOutputPortSignal(chartInstance->S, 11);
  c2_tim = (real_T *)ssGetOutputPortSignal(chartInstance->S, 10);
  c2_on_track = (real_T *)ssGetOutputPortSignal(chartInstance->S, 9);
  c2_OK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 8);
  c2_XTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 7);
  c2_TRKERR = (real_T *)ssGetOutputPortSignal(chartInstance->S, 6);
  c2_DTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 5);
  c2_TRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 4);
  c2_roll = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_dist_2 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c2_dist1 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c2_doneDoubleBufferReInit = true;
  c2_u = sf_mex_dup(c2_st);
  *c2_DTRK = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    0)), "DTRK");
  *c2_OK = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 1)),
    "OK");
  *c2_TRK = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 2)),
    "TRK");
  *c2_TRKERR = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    3)), "TRKERR");
  *c2_XTRK = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    4)), "XTRK");
  *c2_dist1 = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    5)), "dist1");
  *c2_dist_2 = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    6)), "dist_2");
  *c2_on_track = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell
    (c2_u, 7)), "on_track");
  *c2_roll = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    8)), "roll");
  *c2_rollout = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell
    (c2_u, 9)), "rollout");
  *c2_tim = c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    10)), "tim");
  chartInstance->c2_is_active_c2_main = c2_f_emlrt_marshallIn(chartInstance,
    sf_mex_dup(sf_mex_getcell(c2_u, 11)), "is_active_c2_main");
  sf_mex_destroy(&c2_u);
  c2_update_debugger_state_c2_main(chartInstance);
  sf_mex_destroy(&c2_st);
}

static void finalize_c2_main(SFc2_mainInstanceStruct *chartInstance)
{
  (void)chartInstance;
}

static void sf_gateway_c2_main(SFc2_mainInstanceStruct *chartInstance)
{
  int32_T c2_i0;
  int32_T c2_i1;
  int32_T c2_i2;
  int32_T c2_i3;
  int32_T c2_i4;
  int32_T c2_i5;
  int32_T c2_i6;
  int32_T c2_i7;
  int32_T c2_i8;
  real_T *c2_dist1;
  real_T *c2_dist_2;
  real_T *c2_lon;
  real_T *c2_lat;
  real_T *c2_alt;
  real_T *c2_h;
  real_T *c2_hpath;
  real_T *c2_betta;
  real_T *c2_roll;
  real_T *c2_TRK;
  real_T *c2_DTRK;
  real_T *c2_TRKERR;
  real_T *c2_XTRK;
  real_T *c2_DTG;
  real_T *c2_OK;
  real_T *c2_on_track0;
  real_T *c2_on_track;
  real_T *c2_times;
  real_T *c2_tim;
  real_T *c2_rollout;
  real_T *c2_vel;
  real_T (*c2_dc)[12];
  real_T (*c2_Rlon)[12];
  real_T (*c2_Rlat)[12];
  real_T (*c2_okt)[12];
  real_T (*c2_speed)[12];
  real_T (*c2_altt)[12];
  real_T (*c2_lont)[12];
  real_T (*c2_latt)[12];
  real_T (*c2_nt)[12];
  c2_vel = (real_T *)ssGetInputPortSignal(chartInstance->S, 18);
  c2_rollout = (real_T *)ssGetOutputPortSignal(chartInstance->S, 11);
  c2_tim = (real_T *)ssGetOutputPortSignal(chartInstance->S, 10);
  c2_times = (real_T *)ssGetInputPortSignal(chartInstance->S, 17);
  c2_on_track = (real_T *)ssGetOutputPortSignal(chartInstance->S, 9);
  c2_on_track0 = (real_T *)ssGetInputPortSignal(chartInstance->S, 16);
  c2_OK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 8);
  c2_DTG = (real_T *)ssGetInputPortSignal(chartInstance->S, 15);
  c2_XTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 7);
  c2_TRKERR = (real_T *)ssGetOutputPortSignal(chartInstance->S, 6);
  c2_DTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 5);
  c2_TRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 4);
  c2_roll = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_betta = (real_T *)ssGetInputPortSignal(chartInstance->S, 14);
  c2_hpath = (real_T *)ssGetInputPortSignal(chartInstance->S, 13);
  c2_h = (real_T *)ssGetInputPortSignal(chartInstance->S, 12);
  c2_alt = (real_T *)ssGetInputPortSignal(chartInstance->S, 11);
  c2_lat = (real_T *)ssGetInputPortSignal(chartInstance->S, 10);
  c2_lon = (real_T *)ssGetInputPortSignal(chartInstance->S, 9);
  c2_dc = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 8);
  c2_Rlon = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 7);
  c2_Rlat = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 6);
  c2_okt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 5);
  c2_speed = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 4);
  c2_altt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 3);
  c2_lont = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 2);
  c2_latt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 1);
  c2_nt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 0);
  c2_dist_2 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c2_dist1 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  chartInstance->c2_sfEvent = CALL_EVENT;
  c2_chartstep_c2_main(chartInstance);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_mainMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c2_dist1, 0U);
  _SFD_DATA_RANGE_CHECK(*c2_dist_2, 1U);
  for (c2_i0 = 0; c2_i0 < 12; c2_i0++) {
    _SFD_DATA_RANGE_CHECK((*c2_nt)[c2_i0], 2U);
  }

  for (c2_i1 = 0; c2_i1 < 12; c2_i1++) {
    _SFD_DATA_RANGE_CHECK((*c2_latt)[c2_i1], 3U);
  }

  for (c2_i2 = 0; c2_i2 < 12; c2_i2++) {
    _SFD_DATA_RANGE_CHECK((*c2_lont)[c2_i2], 4U);
  }

  for (c2_i3 = 0; c2_i3 < 12; c2_i3++) {
    _SFD_DATA_RANGE_CHECK((*c2_altt)[c2_i3], 5U);
  }

  for (c2_i4 = 0; c2_i4 < 12; c2_i4++) {
    _SFD_DATA_RANGE_CHECK((*c2_speed)[c2_i4], 6U);
  }

  for (c2_i5 = 0; c2_i5 < 12; c2_i5++) {
    _SFD_DATA_RANGE_CHECK((*c2_okt)[c2_i5], 7U);
  }

  for (c2_i6 = 0; c2_i6 < 12; c2_i6++) {
    _SFD_DATA_RANGE_CHECK((*c2_Rlat)[c2_i6], 8U);
  }

  for (c2_i7 = 0; c2_i7 < 12; c2_i7++) {
    _SFD_DATA_RANGE_CHECK((*c2_Rlon)[c2_i7], 9U);
  }

  for (c2_i8 = 0; c2_i8 < 12; c2_i8++) {
    _SFD_DATA_RANGE_CHECK((*c2_dc)[c2_i8], 10U);
  }

  _SFD_DATA_RANGE_CHECK(*c2_lon, 11U);
  _SFD_DATA_RANGE_CHECK(*c2_lat, 12U);
  _SFD_DATA_RANGE_CHECK(*c2_alt, 13U);
  _SFD_DATA_RANGE_CHECK(*c2_h, 14U);
  _SFD_DATA_RANGE_CHECK(*c2_hpath, 15U);
  _SFD_DATA_RANGE_CHECK(*c2_betta, 16U);
  _SFD_DATA_RANGE_CHECK(*c2_roll, 17U);
  _SFD_DATA_RANGE_CHECK(*c2_TRK, 18U);
  _SFD_DATA_RANGE_CHECK(*c2_DTRK, 19U);
  _SFD_DATA_RANGE_CHECK(*c2_TRKERR, 20U);
  _SFD_DATA_RANGE_CHECK(*c2_XTRK, 21U);
  _SFD_DATA_RANGE_CHECK(*c2_DTG, 22U);
  _SFD_DATA_RANGE_CHECK(*c2_OK, 23U);
  _SFD_DATA_RANGE_CHECK(*c2_on_track0, 24U);
  _SFD_DATA_RANGE_CHECK(*c2_on_track, 25U);
  _SFD_DATA_RANGE_CHECK(*c2_times, 26U);
  _SFD_DATA_RANGE_CHECK(*c2_tim, 27U);
  _SFD_DATA_RANGE_CHECK(*c2_rollout, 28U);
  _SFD_DATA_RANGE_CHECK(*c2_vel, 29U);
}

static void c2_chartstep_c2_main(SFc2_mainInstanceStruct *chartInstance)
{
  real_T c2_hoistedGlobal;
  real_T c2_b_hoistedGlobal;
  real_T c2_c_hoistedGlobal;
  real_T c2_d_hoistedGlobal;
  real_T c2_e_hoistedGlobal;
  real_T c2_f_hoistedGlobal;
  real_T c2_g_hoistedGlobal;
  real_T c2_h_hoistedGlobal;
  real_T c2_i_hoistedGlobal;
  real_T c2_j_hoistedGlobal;
  int32_T c2_i9;
  real_T c2_nt[12];
  int32_T c2_i10;
  real_T c2_latt[12];
  int32_T c2_i11;
  real_T c2_lont[12];
  int32_T c2_i12;
  real_T c2_altt[12];
  int32_T c2_i13;
  real_T c2_speed[12];
  int32_T c2_i14;
  real_T c2_okt[12];
  int32_T c2_i15;
  real_T c2_Rlat[12];
  int32_T c2_i16;
  real_T c2_Rlon[12];
  int32_T c2_i17;
  real_T c2_dc[12];
  real_T c2_lon;
  real_T c2_lat;
  real_T c2_alt;
  real_T c2_h;
  real_T c2_hpath;
  real_T c2_betta;
  real_T c2_DTG;
  real_T c2_on_track0;
  real_T c2_times;
  real_T c2_vel;
  uint32_T c2_debug_family_var_map[59];
  real_T c2_R;
  c2_sKtWNgXb9c99UqYJaA6MzR c2_wp;
  real_T c2_lat_uav;
  real_T c2_lon_uav;
  real_T c2_lat_wp1;
  real_T c2_lon_wp1;
  real_T c2_dLat;
  real_T c2_dLon;
  real_T c2_a;
  real_T c2_c;
  real_T c2_lat_wp2;
  real_T c2_lon_wp2;
  real_T c2_dist2;
  real_T c2_lat_pm;
  real_T c2_lon_pm;
  real_T c2_dist_pm;
  real_T c2_DTRK_rad;
  real_T c2_TRKC_rad;
  real_T c2_K1;
  real_T c2_K2;
  real_T c2_lon_c;
  real_T c2_lat_c;
  real_T c2_dist_c;
  real_T c2_rum_rad;
  real_T c2_rum;
  real_T c2_arc;
  real_T c2_delta;
  real_T c2_nargin = 19.0;
  real_T c2_nargout = 11.0;
  real_T c2_dist1;
  real_T c2_dist_2;
  real_T c2_roll;
  real_T c2_TRK;
  real_T c2_DTRK;
  real_T c2_TRKERR;
  real_T c2_XTRK;
  real_T c2_OK;
  real_T c2_on_track;
  real_T c2_tim;
  real_T c2_rollout;
  int32_T c2_i18;
  int32_T c2_i19;
  int32_T c2_i20;
  int32_T c2_i21;
  int32_T c2_i22;
  int32_T c2_i23;
  real_T c2_A;
  real_T c2_x;
  real_T c2_b_x;
  real_T c2_c_x;
  real_T c2_b_A;
  real_T c2_d_x;
  real_T c2_e_x;
  real_T c2_f_x;
  real_T c2_c_A;
  real_T c2_g_x;
  real_T c2_h_x;
  real_T c2_i_x;
  real_T c2_d_A;
  real_T c2_j_x;
  real_T c2_k_x;
  real_T c2_l_x;
  real_T c2_e_A;
  real_T c2_m_x;
  real_T c2_n_x;
  real_T c2_o_x;
  real_T c2_y;
  real_T c2_p_x;
  real_T c2_q_x;
  real_T c2_f_A;
  real_T c2_r_x;
  real_T c2_s_x;
  real_T c2_t_x;
  real_T c2_b_y;
  real_T c2_u_x;
  real_T c2_v_x;
  real_T c2_g_A;
  real_T c2_w_x;
  real_T c2_x_x;
  real_T c2_y_x;
  real_T c2_c_y;
  real_T c2_ab_x;
  real_T c2_bb_x;
  real_T c2_h_A;
  real_T c2_cb_x;
  real_T c2_db_x;
  real_T c2_eb_x;
  real_T c2_d_y;
  real_T c2_fb_x;
  real_T c2_gb_x;
  real_T c2_hb_x;
  real_T c2_ib_x;
  real_T c2_jb_x;
  real_T c2_kb_x;
  real_T c2_d0;
  real_T c2_d1;
  real_T c2_i_A;
  real_T c2_lb_x;
  real_T c2_mb_x;
  real_T c2_nb_x;
  real_T c2_j_A;
  real_T c2_ob_x;
  real_T c2_pb_x;
  real_T c2_qb_x;
  real_T c2_k_A;
  real_T c2_rb_x;
  real_T c2_sb_x;
  real_T c2_tb_x;
  real_T c2_e_y;
  real_T c2_ub_x;
  real_T c2_vb_x;
  real_T c2_l_A;
  real_T c2_wb_x;
  real_T c2_xb_x;
  real_T c2_yb_x;
  real_T c2_f_y;
  real_T c2_ac_x;
  real_T c2_bc_x;
  real_T c2_m_A;
  real_T c2_cc_x;
  real_T c2_dc_x;
  real_T c2_ec_x;
  real_T c2_g_y;
  real_T c2_fc_x;
  real_T c2_gc_x;
  real_T c2_n_A;
  real_T c2_hc_x;
  real_T c2_ic_x;
  real_T c2_jc_x;
  real_T c2_h_y;
  real_T c2_kc_x;
  real_T c2_lc_x;
  real_T c2_mc_x;
  real_T c2_nc_x;
  real_T c2_oc_x;
  real_T c2_pc_x;
  real_T c2_d2;
  real_T c2_d3;
  real_T c2_o_A;
  real_T c2_qc_x;
  real_T c2_rc_x;
  real_T c2_sc_x;
  real_T c2_p_A;
  real_T c2_tc_x;
  real_T c2_uc_x;
  real_T c2_vc_x;
  real_T c2_q_A;
  real_T c2_wc_x;
  real_T c2_xc_x;
  real_T c2_yc_x;
  real_T c2_i_y;
  real_T c2_ad_x;
  real_T c2_bd_x;
  real_T c2_r_A;
  real_T c2_cd_x;
  real_T c2_dd_x;
  real_T c2_ed_x;
  real_T c2_j_y;
  real_T c2_fd_x;
  real_T c2_gd_x;
  real_T c2_s_A;
  real_T c2_hd_x;
  real_T c2_id_x;
  real_T c2_jd_x;
  real_T c2_k_y;
  real_T c2_kd_x;
  real_T c2_ld_x;
  real_T c2_t_A;
  real_T c2_md_x;
  real_T c2_nd_x;
  real_T c2_od_x;
  real_T c2_l_y;
  real_T c2_pd_x;
  real_T c2_qd_x;
  real_T c2_rd_x;
  real_T c2_sd_x;
  real_T c2_td_x;
  real_T c2_ud_x;
  real_T c2_d4;
  real_T c2_d5;
  real_T c2_vd_x;
  real_T c2_wd_x;
  real_T c2_xd_x;
  real_T c2_yd_x;
  real_T c2_ae_x;
  real_T c2_be_x;
  real_T c2_ce_x;
  real_T c2_de_x;
  real_T c2_ee_x;
  real_T c2_fe_x;
  real_T c2_ge_x;
  real_T c2_he_x;
  real_T c2_ie_x;
  real_T c2_je_x;
  real_T c2_u_A;
  real_T c2_ke_x;
  real_T c2_le_x;
  real_T c2_me_x;
  real_T c2_ne_x;
  real_T c2_oe_x;
  real_T c2_pe_x;
  real_T c2_qe_x;
  real_T c2_re_x;
  real_T c2_se_x;
  real_T c2_te_x;
  real_T c2_ue_x;
  real_T c2_ve_x;
  real_T c2_we_x;
  real_T c2_xe_x;
  real_T c2_ye_x;
  real_T c2_af_x;
  real_T c2_bf_x;
  real_T c2_v_A;
  real_T c2_cf_x;
  real_T c2_df_x;
  real_T c2_ef_x;
  real_T c2_m_y;
  real_T c2_ff_x;
  real_T c2_gf_x;
  real_T c2_varargin_2;
  real_T c2_varargin_3;
  real_T c2_n_y;
  real_T c2_o_y;
  real_T c2_yk;
  real_T c2_p_y;
  real_T c2_b_varargin_2;
  real_T c2_b_varargin_3;
  real_T c2_q_y;
  real_T c2_r_y;
  real_T c2_b_yk;
  real_T c2_s_y;
  real_T c2_w_A;
  real_T c2_hf_x;
  real_T c2_if_x;
  real_T c2_jf_x;
  real_T c2_x_A;
  real_T c2_kf_x;
  real_T c2_lf_x;
  real_T c2_mf_x;
  real_T c2_y_A;
  real_T c2_nf_x;
  real_T c2_of_x;
  real_T c2_pf_x;
  real_T c2_t_y;
  real_T c2_qf_x;
  real_T c2_rf_x;
  real_T c2_ab_A;
  real_T c2_sf_x;
  real_T c2_tf_x;
  real_T c2_uf_x;
  real_T c2_u_y;
  real_T c2_vf_x;
  real_T c2_wf_x;
  real_T c2_bb_A;
  real_T c2_xf_x;
  real_T c2_yf_x;
  real_T c2_ag_x;
  real_T c2_v_y;
  real_T c2_bg_x;
  real_T c2_cg_x;
  real_T c2_cb_A;
  real_T c2_dg_x;
  real_T c2_eg_x;
  real_T c2_fg_x;
  real_T c2_w_y;
  real_T c2_gg_x;
  real_T c2_hg_x;
  real_T c2_ig_x;
  real_T c2_jg_x;
  real_T c2_kg_x;
  real_T c2_lg_x;
  real_T c2_d6;
  real_T c2_d7;
  real_T c2_mg_x;
  real_T c2_ng_x;
  real_T c2_og_x;
  real_T c2_pg_x;
  real_T c2_qg_x;
  real_T c2_rg_x;
  real_T c2_sg_x;
  real_T c2_tg_x;
  real_T c2_ug_x;
  real_T c2_vg_x;
  real_T c2_wg_x;
  real_T c2_xg_x;
  real_T c2_yg_x;
  real_T c2_ah_x;
  real_T c2_db_A;
  real_T c2_bh_x;
  real_T c2_ch_x;
  real_T c2_dh_x;
  real_T c2_c_varargin_2;
  real_T c2_c_varargin_3;
  real_T c2_x_y;
  real_T c2_y_y;
  real_T c2_c_yk;
  real_T c2_ab_y;
  real_T c2_d_varargin_2;
  real_T c2_d_varargin_3;
  real_T c2_bb_y;
  real_T c2_cb_y;
  real_T c2_d_yk;
  real_T c2_db_y;
  real_T *c2_b_rollout;
  real_T *c2_b_tim;
  real_T *c2_b_on_track;
  real_T *c2_b_OK;
  real_T *c2_b_XTRK;
  real_T *c2_b_TRKERR;
  real_T *c2_b_DTRK;
  real_T *c2_b_TRK;
  real_T *c2_b_roll;
  real_T *c2_b_dist_2;
  real_T *c2_b_dist1;
  real_T *c2_b_vel;
  real_T *c2_b_times;
  real_T *c2_b_on_track0;
  real_T *c2_b_DTG;
  real_T *c2_b_betta;
  real_T *c2_b_hpath;
  real_T *c2_b_h;
  real_T *c2_b_alt;
  real_T *c2_b_lat;
  real_T *c2_b_lon;
  real_T (*c2_b_dc)[12];
  real_T (*c2_b_Rlon)[12];
  real_T (*c2_b_Rlat)[12];
  real_T (*c2_b_okt)[12];
  real_T (*c2_b_speed)[12];
  real_T (*c2_b_altt)[12];
  real_T (*c2_b_lont)[12];
  real_T (*c2_b_latt)[12];
  real_T (*c2_b_nt)[12];
  boolean_T guard1 = false;
  boolean_T guard2 = false;
  boolean_T guard3 = false;
  boolean_T guard4 = false;
  boolean_T guard5 = false;
  boolean_T guard6 = false;
  boolean_T guard7 = false;
  c2_b_vel = (real_T *)ssGetInputPortSignal(chartInstance->S, 18);
  c2_b_rollout = (real_T *)ssGetOutputPortSignal(chartInstance->S, 11);
  c2_b_tim = (real_T *)ssGetOutputPortSignal(chartInstance->S, 10);
  c2_b_times = (real_T *)ssGetInputPortSignal(chartInstance->S, 17);
  c2_b_on_track = (real_T *)ssGetOutputPortSignal(chartInstance->S, 9);
  c2_b_on_track0 = (real_T *)ssGetInputPortSignal(chartInstance->S, 16);
  c2_b_OK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 8);
  c2_b_DTG = (real_T *)ssGetInputPortSignal(chartInstance->S, 15);
  c2_b_XTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 7);
  c2_b_TRKERR = (real_T *)ssGetOutputPortSignal(chartInstance->S, 6);
  c2_b_DTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 5);
  c2_b_TRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 4);
  c2_b_roll = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_b_betta = (real_T *)ssGetInputPortSignal(chartInstance->S, 14);
  c2_b_hpath = (real_T *)ssGetInputPortSignal(chartInstance->S, 13);
  c2_b_h = (real_T *)ssGetInputPortSignal(chartInstance->S, 12);
  c2_b_alt = (real_T *)ssGetInputPortSignal(chartInstance->S, 11);
  c2_b_lat = (real_T *)ssGetInputPortSignal(chartInstance->S, 10);
  c2_b_lon = (real_T *)ssGetInputPortSignal(chartInstance->S, 9);
  c2_b_dc = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 8);
  c2_b_Rlon = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 7);
  c2_b_Rlat = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 6);
  c2_b_okt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 5);
  c2_b_speed = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 4);
  c2_b_altt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 3);
  c2_b_lont = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 2);
  c2_b_latt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 1);
  c2_b_nt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 0);
  c2_b_dist_2 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c2_b_dist1 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  c2_hoistedGlobal = *c2_b_lon;
  c2_b_hoistedGlobal = *c2_b_lat;
  c2_c_hoistedGlobal = *c2_b_alt;
  c2_d_hoistedGlobal = *c2_b_h;
  c2_e_hoistedGlobal = *c2_b_hpath;
  c2_f_hoistedGlobal = *c2_b_betta;
  c2_g_hoistedGlobal = *c2_b_DTG;
  c2_h_hoistedGlobal = *c2_b_on_track0;
  c2_i_hoistedGlobal = *c2_b_times;
  c2_j_hoistedGlobal = *c2_b_vel;
  for (c2_i9 = 0; c2_i9 < 12; c2_i9++) {
    c2_nt[c2_i9] = (*c2_b_nt)[c2_i9];
  }

  for (c2_i10 = 0; c2_i10 < 12; c2_i10++) {
    c2_latt[c2_i10] = (*c2_b_latt)[c2_i10];
  }

  for (c2_i11 = 0; c2_i11 < 12; c2_i11++) {
    c2_lont[c2_i11] = (*c2_b_lont)[c2_i11];
  }

  for (c2_i12 = 0; c2_i12 < 12; c2_i12++) {
    c2_altt[c2_i12] = (*c2_b_altt)[c2_i12];
  }

  for (c2_i13 = 0; c2_i13 < 12; c2_i13++) {
    c2_speed[c2_i13] = (*c2_b_speed)[c2_i13];
  }

  for (c2_i14 = 0; c2_i14 < 12; c2_i14++) {
    c2_okt[c2_i14] = (*c2_b_okt)[c2_i14];
  }

  for (c2_i15 = 0; c2_i15 < 12; c2_i15++) {
    c2_Rlat[c2_i15] = (*c2_b_Rlat)[c2_i15];
  }

  for (c2_i16 = 0; c2_i16 < 12; c2_i16++) {
    c2_Rlon[c2_i16] = (*c2_b_Rlon)[c2_i16];
  }

  for (c2_i17 = 0; c2_i17 < 12; c2_i17++) {
    c2_dc[c2_i17] = (*c2_b_dc)[c2_i17];
  }

  c2_lon = c2_hoistedGlobal;
  c2_lat = c2_b_hoistedGlobal;
  c2_alt = c2_c_hoistedGlobal;
  c2_h = c2_d_hoistedGlobal;
  c2_hpath = c2_e_hoistedGlobal;
  c2_betta = c2_f_hoistedGlobal;
  c2_DTG = c2_g_hoistedGlobal;
  c2_on_track0 = c2_h_hoistedGlobal;
  c2_times = c2_i_hoistedGlobal;
  c2_vel = c2_j_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 59U, 59U, c2_debug_family_names,
    c2_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_R, 0U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_wp, 1U, c2_c_sf_marshallOut,
    c2_b_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lat_uav, 2U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lon_uav, 3U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lat_wp1, 4U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lon_wp1, 5U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_dLat, 6U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_dLon, 7U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_a, 8U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_c, 9U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lat_wp2, 10U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lon_wp2, 11U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_dist2, 12U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lat_pm, 13U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lon_pm, 14U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_dist_pm, 15U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_DTRK_rad, 16U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_TRKC_rad, 17U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_K1, 18U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_K2, 19U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lon_c, 20U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_lat_c, 21U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_dist_c, 22U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_rum_rad, 23U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_rum, 24U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_arc, 25U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_delta, 26U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargin, 27U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargout, 28U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_nt, 29U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_latt, 30U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_lont, 31U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_altt, 32U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_speed, 33U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_okt, 34U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_Rlat, 35U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_Rlon, 36U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(c2_dc, 37U, c2_b_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_lon, 38U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_lat, 39U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_alt, 40U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_h, 41U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_hpath, 42U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_betta, 43U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_DTG, 44U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_on_track0, 45U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_times, 46U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c2_vel, 47U, c2_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_dist1, 48U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_dist_2, 49U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_roll, 50U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_TRK, 51U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_DTRK, 52U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_TRKERR, 53U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_XTRK, 54U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_OK, 55U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_on_track, 56U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_tim, 57U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_rollout, 58U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 11);
  c2_R = 6367.445;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 13);
  for (c2_i18 = 0; c2_i18 < 12; c2_i18++) {
    c2_wp.n[c2_i18] = c2_nt[c2_i18];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 14);
  for (c2_i19 = 0; c2_i19 < 12; c2_i19++) {
    c2_wp.lat[c2_i19] = c2_latt[c2_i19];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 15);
  for (c2_i20 = 0; c2_i20 < 12; c2_i20++) {
    c2_wp.lon[c2_i20] = c2_lont[c2_i20];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 16);
  for (c2_i21 = 0; c2_i21 < 12; c2_i21++) {
    c2_wp.alt[c2_i21] = c2_altt[c2_i21];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 17);
  for (c2_i22 = 0; c2_i22 < 12; c2_i22++) {
    c2_wp.trajectory[c2_i22] = c2_speed[c2_i22];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 18);
  for (c2_i23 = 0; c2_i23 < 12; c2_i23++) {
    c2_wp.ok[c2_i23] = c2_okt[c2_i23];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 20);
  c2_A = c2_lat * 3.1415926535897931;
  c2_x = c2_A;
  c2_b_x = c2_x;
  c2_c_x = c2_b_x;
  c2_lat_uav = c2_c_x / 180.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 21);
  c2_b_A = c2_lon * 3.1415926535897931;
  c2_d_x = c2_b_A;
  c2_e_x = c2_d_x;
  c2_f_x = c2_e_x;
  c2_lon_uav = c2_f_x / 180.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 34);
  c2_c_A = c2_wp.lat[_SFD_EML_ARRAY_BOUNDS_CHECK("wp.lat", (int32_T)
    _SFD_INTEGER_CHECK("DTG", c2_DTG), 1, 12, 1, 0) - 1] * 3.1415926535897931;
  c2_g_x = c2_c_A;
  c2_h_x = c2_g_x;
  c2_i_x = c2_h_x;
  c2_lat_wp1 = c2_i_x / 180.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 35);
  c2_d_A = c2_wp.lon[_SFD_EML_ARRAY_BOUNDS_CHECK("wp.lon", (int32_T)
    _SFD_INTEGER_CHECK("DTG", c2_DTG), 1, 12, 1, 0) - 1] * 3.1415926535897931;
  c2_j_x = c2_d_A;
  c2_k_x = c2_j_x;
  c2_l_x = c2_k_x;
  c2_lon_wp1 = c2_l_x / 180.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 37);
  c2_dLat = c2_lat_uav - c2_lat_wp1;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 38);
  c2_dLon = c2_lon_uav - c2_lon_wp1;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 40);
  c2_e_A = c2_dLat;
  c2_m_x = c2_e_A;
  c2_n_x = c2_m_x;
  c2_o_x = c2_n_x;
  c2_y = c2_o_x / 2.0;
  c2_p_x = c2_y;
  c2_q_x = c2_p_x;
  c2_q_x = muDoubleScalarSin(c2_q_x);
  c2_f_A = c2_dLat;
  c2_r_x = c2_f_A;
  c2_s_x = c2_r_x;
  c2_t_x = c2_s_x;
  c2_b_y = c2_t_x / 2.0;
  c2_u_x = c2_b_y;
  c2_v_x = c2_u_x;
  c2_v_x = muDoubleScalarSin(c2_v_x);
  c2_g_A = c2_dLon;
  c2_w_x = c2_g_A;
  c2_x_x = c2_w_x;
  c2_y_x = c2_x_x;
  c2_c_y = c2_y_x / 2.0;
  c2_ab_x = c2_c_y;
  c2_bb_x = c2_ab_x;
  c2_bb_x = muDoubleScalarSin(c2_bb_x);
  c2_h_A = c2_dLon;
  c2_cb_x = c2_h_A;
  c2_db_x = c2_cb_x;
  c2_eb_x = c2_db_x;
  c2_d_y = c2_eb_x / 2.0;
  c2_fb_x = c2_d_y;
  c2_gb_x = c2_fb_x;
  c2_gb_x = muDoubleScalarSin(c2_gb_x);
  c2_hb_x = c2_lat_wp1;
  c2_ib_x = c2_hb_x;
  c2_ib_x = muDoubleScalarCos(c2_ib_x);
  c2_jb_x = c2_lat_uav;
  c2_kb_x = c2_jb_x;
  c2_kb_x = muDoubleScalarCos(c2_kb_x);
  c2_a = c2_q_x * c2_v_x + c2_bb_x * c2_gb_x * c2_ib_x * c2_kb_x;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 41);
  c2_d0 = c2_a;
  c2_b_sqrt(chartInstance, &c2_d0);
  c2_d1 = 1.0 - c2_a;
  c2_b_sqrt(chartInstance, &c2_d1);
  c2_c = 2.0 * c2_atan2(chartInstance, c2_d0, c2_d1);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 42);
  c2_dist1 = 6367.445 * c2_c;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 46);
  c2_i_A = c2_wp.lat[_SFD_EML_ARRAY_BOUNDS_CHECK("wp.lat", (int32_T)
    _SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1, 12, 1, 0) - 1] *
    3.1415926535897931;
  c2_lb_x = c2_i_A;
  c2_mb_x = c2_lb_x;
  c2_nb_x = c2_mb_x;
  c2_lat_wp2 = c2_nb_x / 180.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 47);
  c2_j_A = c2_wp.lon[_SFD_EML_ARRAY_BOUNDS_CHECK("wp.lon", (int32_T)
    _SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1, 12, 1, 0) - 1] *
    3.1415926535897931;
  c2_ob_x = c2_j_A;
  c2_pb_x = c2_ob_x;
  c2_qb_x = c2_pb_x;
  c2_lon_wp2 = c2_qb_x / 180.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 48);
  c2_betta = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 50);
  c2_dLat = c2_lat_uav - c2_lat_wp2;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 51);
  c2_dLon = c2_lon_uav - c2_lon_wp2;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 53);
  c2_k_A = c2_dLat;
  c2_rb_x = c2_k_A;
  c2_sb_x = c2_rb_x;
  c2_tb_x = c2_sb_x;
  c2_e_y = c2_tb_x / 2.0;
  c2_ub_x = c2_e_y;
  c2_vb_x = c2_ub_x;
  c2_vb_x = muDoubleScalarSin(c2_vb_x);
  c2_l_A = c2_dLat;
  c2_wb_x = c2_l_A;
  c2_xb_x = c2_wb_x;
  c2_yb_x = c2_xb_x;
  c2_f_y = c2_yb_x / 2.0;
  c2_ac_x = c2_f_y;
  c2_bc_x = c2_ac_x;
  c2_bc_x = muDoubleScalarSin(c2_bc_x);
  c2_m_A = c2_dLon;
  c2_cc_x = c2_m_A;
  c2_dc_x = c2_cc_x;
  c2_ec_x = c2_dc_x;
  c2_g_y = c2_ec_x / 2.0;
  c2_fc_x = c2_g_y;
  c2_gc_x = c2_fc_x;
  c2_gc_x = muDoubleScalarSin(c2_gc_x);
  c2_n_A = c2_dLon;
  c2_hc_x = c2_n_A;
  c2_ic_x = c2_hc_x;
  c2_jc_x = c2_ic_x;
  c2_h_y = c2_jc_x / 2.0;
  c2_kc_x = c2_h_y;
  c2_lc_x = c2_kc_x;
  c2_lc_x = muDoubleScalarSin(c2_lc_x);
  c2_mc_x = c2_lat_wp2;
  c2_nc_x = c2_mc_x;
  c2_nc_x = muDoubleScalarCos(c2_nc_x);
  c2_oc_x = c2_lat_uav;
  c2_pc_x = c2_oc_x;
  c2_pc_x = muDoubleScalarCos(c2_pc_x);
  c2_a = c2_vb_x * c2_bc_x + c2_gc_x * c2_lc_x * c2_nc_x * c2_pc_x;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 54);
  c2_d2 = c2_a;
  c2_b_sqrt(chartInstance, &c2_d2);
  c2_d3 = 1.0 - c2_a;
  c2_b_sqrt(chartInstance, &c2_d3);
  c2_c = 2.0 * c2_atan2(chartInstance, c2_d2, c2_d3);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 55);
  c2_dist2 = 6367.445 * c2_c;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 57);
  c2_dist_2 = c2_dist2;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 62);
  c2_o_A = c2_lat_wp2 + c2_lat_wp1;
  c2_qc_x = c2_o_A;
  c2_rc_x = c2_qc_x;
  c2_sc_x = c2_rc_x;
  c2_lat_pm = c2_sc_x / 2.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 63);
  c2_p_A = c2_lon_wp2 + c2_lon_wp1;
  c2_tc_x = c2_p_A;
  c2_uc_x = c2_tc_x;
  c2_vc_x = c2_uc_x;
  c2_lon_pm = c2_vc_x / 2.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 65);
  c2_dLat = c2_lat_uav - c2_lat_pm;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 66);
  c2_dLon = c2_lon_uav - c2_lon_pm;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 68);
  c2_q_A = c2_dLat;
  c2_wc_x = c2_q_A;
  c2_xc_x = c2_wc_x;
  c2_yc_x = c2_xc_x;
  c2_i_y = c2_yc_x / 2.0;
  c2_ad_x = c2_i_y;
  c2_bd_x = c2_ad_x;
  c2_bd_x = muDoubleScalarSin(c2_bd_x);
  c2_r_A = c2_dLat;
  c2_cd_x = c2_r_A;
  c2_dd_x = c2_cd_x;
  c2_ed_x = c2_dd_x;
  c2_j_y = c2_ed_x / 2.0;
  c2_fd_x = c2_j_y;
  c2_gd_x = c2_fd_x;
  c2_gd_x = muDoubleScalarSin(c2_gd_x);
  c2_s_A = c2_dLon;
  c2_hd_x = c2_s_A;
  c2_id_x = c2_hd_x;
  c2_jd_x = c2_id_x;
  c2_k_y = c2_jd_x / 2.0;
  c2_kd_x = c2_k_y;
  c2_ld_x = c2_kd_x;
  c2_ld_x = muDoubleScalarSin(c2_ld_x);
  c2_t_A = c2_dLon;
  c2_md_x = c2_t_A;
  c2_nd_x = c2_md_x;
  c2_od_x = c2_nd_x;
  c2_l_y = c2_od_x / 2.0;
  c2_pd_x = c2_l_y;
  c2_qd_x = c2_pd_x;
  c2_qd_x = muDoubleScalarSin(c2_qd_x);
  c2_rd_x = c2_lat_pm;
  c2_sd_x = c2_rd_x;
  c2_sd_x = muDoubleScalarCos(c2_sd_x);
  c2_td_x = c2_lat_uav;
  c2_ud_x = c2_td_x;
  c2_ud_x = muDoubleScalarCos(c2_ud_x);
  c2_a = c2_bd_x * c2_gd_x + c2_ld_x * c2_qd_x * c2_sd_x * c2_ud_x;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 69);
  c2_d4 = c2_a;
  c2_b_sqrt(chartInstance, &c2_d4);
  c2_d5 = 1.0 - c2_a;
  c2_b_sqrt(chartInstance, &c2_d5);
  c2_c = 2.0 * c2_atan2(chartInstance, c2_d4, c2_d5);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 70);
  c2_dist_pm = 6367.445 * c2_c;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 76);
  c2_TRK = c2_hpath + c2_betta;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 78);
  guard1 = false;
  if (CV_EML_COND(0, 1, 0, c2_Rlon[_SFD_EML_ARRAY_BOUNDS_CHECK("Rlon", (int32_T)
        _SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1, 12, 1, 0) - 1] == 0.0)) {
    if (CV_EML_COND(0, 1, 1, c2_Rlat[_SFD_EML_ARRAY_BOUNDS_CHECK("Rlat",
          (int32_T)_SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1, 12, 1, 0) - 1] ==
                    0.0)) {
      CV_EML_MCDC(0, 1, 0, true);
      CV_EML_IF(0, 1, 0, true);
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 83);
      if (CV_EML_IF(0, 1, 1, c2_dist2 < 0.3)) {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 84);
        c2_OK = 1.0;
      } else {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 86);
        c2_OK = 0.0;
      }

      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 92);
      c2_vd_x = c2_lon_wp2 - c2_lon_wp1;
      c2_wd_x = c2_vd_x;
      c2_wd_x = muDoubleScalarSin(c2_wd_x);
      c2_xd_x = c2_lat_wp2;
      c2_yd_x = c2_xd_x;
      c2_yd_x = muDoubleScalarCos(c2_yd_x);
      c2_ae_x = c2_lat_wp1;
      c2_be_x = c2_ae_x;
      c2_be_x = muDoubleScalarCos(c2_be_x);
      c2_ce_x = c2_lat_wp2;
      c2_de_x = c2_ce_x;
      c2_de_x = muDoubleScalarSin(c2_de_x);
      c2_ee_x = c2_lat_wp1;
      c2_fe_x = c2_ee_x;
      c2_fe_x = muDoubleScalarSin(c2_fe_x);
      c2_ge_x = c2_lat_wp2;
      c2_he_x = c2_ge_x;
      c2_he_x = muDoubleScalarCos(c2_he_x);
      c2_ie_x = c2_lon_wp2 - c2_lon_wp1;
      c2_je_x = c2_ie_x;
      c2_je_x = muDoubleScalarCos(c2_je_x);
      c2_DTRK_rad = c2_atan2(chartInstance, c2_wd_x * c2_yd_x, c2_be_x * c2_de_x
        - c2_fe_x * c2_he_x * c2_je_x);
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 94);
      c2_u_A = c2_DTRK_rad * 180.0;
      c2_ke_x = c2_u_A;
      c2_le_x = c2_ke_x;
      c2_me_x = c2_le_x;
      c2_DTRK = c2_me_x / 3.1415926535897931;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 98);
      c2_TRKERR = c2_DTRK - c2_TRK;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 102);
      if (CV_EML_IF(0, 1, 2, c2_TRKERR > 180.0)) {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 103);
        c2_TRKERR = 360.0 - c2_TRKERR;
      } else {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 104);
        if (CV_EML_IF(0, 1, 3, c2_TRKERR < -180.0)) {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 105);
          c2_TRKERR += 360.0;
        }
      }

      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 110);
      c2_ne_x = c2_lon_uav - c2_lon_wp1;
      c2_oe_x = c2_ne_x;
      c2_oe_x = muDoubleScalarSin(c2_oe_x);
      c2_pe_x = c2_lat_uav;
      c2_qe_x = c2_pe_x;
      c2_qe_x = muDoubleScalarCos(c2_qe_x);
      c2_re_x = c2_lat_wp1;
      c2_se_x = c2_re_x;
      c2_se_x = muDoubleScalarCos(c2_se_x);
      c2_te_x = c2_lat_uav;
      c2_ue_x = c2_te_x;
      c2_ue_x = muDoubleScalarSin(c2_ue_x);
      c2_ve_x = c2_lat_wp1;
      c2_we_x = c2_ve_x;
      c2_we_x = muDoubleScalarSin(c2_we_x);
      c2_xe_x = c2_lat_uav;
      c2_ye_x = c2_xe_x;
      c2_ye_x = muDoubleScalarCos(c2_ye_x);
      c2_af_x = c2_lon_uav - c2_lon_wp1;
      c2_bf_x = c2_af_x;
      c2_bf_x = muDoubleScalarCos(c2_bf_x);
      c2_TRKC_rad = c2_atan2(chartInstance, c2_oe_x * c2_qe_x, c2_se_x * c2_ue_x
        - c2_we_x * c2_ye_x * c2_bf_x);
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 111);
      c2_v_A = c2_DTRK * 3.1415926535897931;
      c2_cf_x = c2_v_A;
      c2_df_x = c2_cf_x;
      c2_ef_x = c2_df_x;
      c2_m_y = c2_ef_x / 180.0;
      c2_ff_x = c2_m_y - c2_TRKC_rad;
      c2_gf_x = c2_ff_x;
      c2_gf_x = muDoubleScalarSin(c2_gf_x);
      c2_XTRK = c2_dist1 * c2_gf_x;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 118);
      guard2 = false;
      guard3 = false;
      guard4 = false;
      if (CV_EML_COND(0, 1, 2, c2_dist_pm > 1.5)) {
        if (CV_EML_COND(0, 1, 3, c2_times == 0.0)) {
          if (CV_EML_COND(0, 1, 4, c2_wp.ok[_SFD_EML_ARRAY_BOUNDS_CHECK("wp.ok",
                (int32_T)_SFD_INTEGER_CHECK("DTG", c2_DTG), 1, 12, 1, 0) - 1] !=
                          1.0)) {
            if (CV_EML_COND(0, 1, 5, c2_wp.ok[_SFD_EML_ARRAY_BOUNDS_CHECK(
                  "wp.ok", (int32_T)_SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1,
                  12, 1, 0) - 1] != 1.0)) {
              CV_EML_MCDC(0, 1, 1, true);
              CV_EML_IF(0, 1, 4, true);
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 120);
              c2_on_track = 0.0;
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 121);
              c2_tim = 0.0;
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 122);
              c2_roll = 0.0;
            } else {
              guard4 = true;
            }
          } else {
            guard4 = true;
          }
        } else {
          guard3 = true;
        }
      } else {
        guard3 = true;
      }

      if (guard4 == true) {
        guard2 = true;
      }

      if (guard3 == true) {
        guard2 = true;
      }

      if (guard2 == true) {
        CV_EML_MCDC(0, 1, 1, false);
        CV_EML_IF(0, 1, 4, false);
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 125);
        c2_tim = 1.0;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 126);
        c2_on_track = 1.0;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 131U);
        c2_K1 = 7.6;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 132U);
        c2_K2 = 230.0;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 134U);
        c2_roll = 7.6 * c2_TRKERR + 230.0 * c2_XTRK;
      }

      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 142U);
      c2_varargin_2 = c2_roll;
      c2_varargin_3 = c2_varargin_2;
      c2_n_y = c2_varargin_3;
      c2_o_y = c2_n_y;
      c2_eml_scalar_eg(chartInstance);
      c2_yk = c2_o_y;
      c2_p_y = c2_yk;
      c2_eml_scalar_eg(chartInstance);
      c2_roll = muDoubleScalarMin(15.0, c2_p_y);
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 143U);
      c2_b_varargin_2 = c2_roll;
      c2_b_varargin_3 = c2_b_varargin_2;
      c2_q_y = c2_b_varargin_3;
      c2_r_y = c2_q_y;
      c2_eml_scalar_eg(chartInstance);
      c2_b_yk = c2_r_y;
      c2_s_y = c2_b_yk;
      c2_eml_scalar_eg(chartInstance);
      c2_roll = muDoubleScalarMax(-15.0, c2_s_y);
    } else {
      guard1 = true;
    }
  } else {
    guard1 = true;
  }

  if (guard1 == true) {
    CV_EML_MCDC(0, 1, 0, false);
    CV_EML_IF(0, 1, 0, false);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 149U);
    c2_w_A = c2_Rlon[_SFD_EML_ARRAY_BOUNDS_CHECK("Rlon", (int32_T)
      _SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1, 12, 1, 0) - 1] *
      3.1415926535897931;
    c2_hf_x = c2_w_A;
    c2_if_x = c2_hf_x;
    c2_jf_x = c2_if_x;
    c2_lon_c = c2_jf_x / 180.0;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 150U);
    c2_x_A = c2_Rlat[_SFD_EML_ARRAY_BOUNDS_CHECK("Rlat", (int32_T)
      _SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1, 12, 1, 0) - 1] *
      3.1415926535897931;
    c2_kf_x = c2_x_A;
    c2_lf_x = c2_kf_x;
    c2_mf_x = c2_lf_x;
    c2_lat_c = c2_mf_x / 180.0;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 153U);
    c2_dLat = c2_lat_uav - c2_lat_c;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 154U);
    c2_dLon = c2_lon_uav - c2_lon_c;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 156U);
    c2_y_A = c2_dLat;
    c2_nf_x = c2_y_A;
    c2_of_x = c2_nf_x;
    c2_pf_x = c2_of_x;
    c2_t_y = c2_pf_x / 2.0;
    c2_qf_x = c2_t_y;
    c2_rf_x = c2_qf_x;
    c2_rf_x = muDoubleScalarSin(c2_rf_x);
    c2_ab_A = c2_dLat;
    c2_sf_x = c2_ab_A;
    c2_tf_x = c2_sf_x;
    c2_uf_x = c2_tf_x;
    c2_u_y = c2_uf_x / 2.0;
    c2_vf_x = c2_u_y;
    c2_wf_x = c2_vf_x;
    c2_wf_x = muDoubleScalarSin(c2_wf_x);
    c2_bb_A = c2_dLon;
    c2_xf_x = c2_bb_A;
    c2_yf_x = c2_xf_x;
    c2_ag_x = c2_yf_x;
    c2_v_y = c2_ag_x / 2.0;
    c2_bg_x = c2_v_y;
    c2_cg_x = c2_bg_x;
    c2_cg_x = muDoubleScalarSin(c2_cg_x);
    c2_cb_A = c2_dLon;
    c2_dg_x = c2_cb_A;
    c2_eg_x = c2_dg_x;
    c2_fg_x = c2_eg_x;
    c2_w_y = c2_fg_x / 2.0;
    c2_gg_x = c2_w_y;
    c2_hg_x = c2_gg_x;
    c2_hg_x = muDoubleScalarSin(c2_hg_x);
    c2_ig_x = c2_lat_c;
    c2_jg_x = c2_ig_x;
    c2_jg_x = muDoubleScalarCos(c2_jg_x);
    c2_kg_x = c2_lat_uav;
    c2_lg_x = c2_kg_x;
    c2_lg_x = muDoubleScalarCos(c2_lg_x);
    c2_a = c2_rf_x * c2_wf_x + c2_cg_x * c2_hg_x * c2_jg_x * c2_lg_x;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 157U);
    c2_d6 = c2_a;
    c2_b_sqrt(chartInstance, &c2_d6);
    c2_d7 = 1.0 - c2_a;
    c2_b_sqrt(chartInstance, &c2_d7);
    c2_c = 2.0 * c2_atan2(chartInstance, c2_d6, c2_d7);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 158U);
    c2_dist_c = 6367.445 * c2_c;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 161U);
    c2_mg_x = c2_lon_uav - c2_lon_c;
    c2_ng_x = c2_mg_x;
    c2_ng_x = muDoubleScalarSin(c2_ng_x);
    c2_og_x = c2_lat_uav;
    c2_pg_x = c2_og_x;
    c2_pg_x = muDoubleScalarCos(c2_pg_x);
    c2_qg_x = c2_lat_c;
    c2_rg_x = c2_qg_x;
    c2_rg_x = muDoubleScalarCos(c2_rg_x);
    c2_sg_x = c2_lat_uav;
    c2_tg_x = c2_sg_x;
    c2_tg_x = muDoubleScalarSin(c2_tg_x);
    c2_ug_x = c2_lat_c;
    c2_vg_x = c2_ug_x;
    c2_vg_x = muDoubleScalarSin(c2_vg_x);
    c2_wg_x = c2_lat_uav;
    c2_xg_x = c2_wg_x;
    c2_xg_x = muDoubleScalarCos(c2_xg_x);
    c2_yg_x = c2_lon_uav - c2_lon_c;
    c2_ah_x = c2_yg_x;
    c2_ah_x = muDoubleScalarCos(c2_ah_x);
    c2_rum_rad = c2_atan2(chartInstance, c2_ng_x * c2_pg_x, c2_rg_x * c2_tg_x -
                          c2_vg_x * c2_xg_x * c2_ah_x);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 163U);
    c2_db_A = c2_rum_rad * 180.0;
    c2_bh_x = c2_db_A;
    c2_ch_x = c2_bh_x;
    c2_dh_x = c2_ch_x;
    c2_rum = c2_dh_x / 3.1415926535897931;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 165U);
    if (CV_EML_IF(0, 1, 5, c2_rum < 0.0)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 166U);
      c2_rum += 360.0;
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 170U);
    c2_arc = c2_dc[_SFD_EML_ARRAY_BOUNDS_CHECK("dc", (int32_T)_SFD_INTEGER_CHECK
      ("DTG+2", c2_DTG + 2.0), 1, 12, 1, 0) - 1] - c2_rum;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 173U);
    if (CV_EML_IF(0, 1, 6, c2_arc >= 360.0)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 174U);
      c2_arc -= 360.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 175U);
      if (CV_EML_IF(0, 1, 7, c2_arc < -360.0)) {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 176U);
        c2_arc += 360.0;
      }
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 179U);
    if (CV_EML_IF(0, 1, 8, c2_arc >= 180.0)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 180U);
      c2_DTRK = c2_rum - 90.0;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 181U);
      c2_delta = -1.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 182U);
      if (CV_EML_IF(0, 1, 9, c2_arc <= -180.0)) {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 183U);
        c2_DTRK = c2_rum + 90.0;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 184U);
        c2_delta = 1.0;
      } else {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 185U);
        if (CV_EML_IF(0, 1, 10, c2_arc >= 0.0)) {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 186U);
          c2_DTRK = c2_rum + 90.0;
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 187U);
          c2_delta = 1.0;
        } else {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 189U);
          c2_DTRK = c2_rum - 90.0;
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 190U);
          c2_delta = -1.0;
        }
      }
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 194U);
    if (CV_EML_IF(0, 1, 11, c2_DTRK > 360.0)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 195U);
      c2_DTRK -= 360.0;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 196U);
      if (CV_EML_IF(0, 1, 12, c2_DTRK < -360.0)) {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 197U);
        c2_DTRK += 360.0;
      }
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 201U);
    c2_XTRK = c2_delta * (c2_dist_c - c2_dc[_SFD_EML_ARRAY_BOUNDS_CHECK("dc",
      (int32_T)_SFD_INTEGER_CHECK("DTG+1", c2_DTG + 1.0), 1, 12, 1, 0) - 1] *
                          1.852);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 203U);
    c2_TRKERR = c2_DTRK - c2_TRK;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 208U);
    if (CV_EML_IF(0, 1, 13, c2_TRKERR > 180.0)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 209U);
      c2_TRKERR = 360.0 - c2_TRKERR;
    } else {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 210U);
      if (CV_EML_IF(0, 1, 14, c2_TRKERR < -180.0)) {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 211U);
        c2_TRKERR += 360.0;
      }
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 215U);
    c2_K1 = 8.558;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 216U);
    c2_K2 = 230.0;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 219U);
    c2_roll = 8.558 * c2_TRKERR + 230.0 * c2_XTRK;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 222U);
    c2_c_varargin_2 = c2_roll;
    c2_c_varargin_3 = c2_c_varargin_2;
    c2_x_y = c2_c_varargin_3;
    c2_y_y = c2_x_y;
    c2_eml_scalar_eg(chartInstance);
    c2_c_yk = c2_y_y;
    c2_ab_y = c2_c_yk;
    c2_eml_scalar_eg(chartInstance);
    c2_roll = muDoubleScalarMin(15.0, c2_ab_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 223U);
    c2_d_varargin_2 = c2_roll;
    c2_d_varargin_3 = c2_d_varargin_2;
    c2_bb_y = c2_d_varargin_3;
    c2_cb_y = c2_bb_y;
    c2_eml_scalar_eg(chartInstance);
    c2_d_yk = c2_cb_y;
    c2_db_y = c2_d_yk;
    c2_eml_scalar_eg(chartInstance);
    c2_roll = muDoubleScalarMax(-15.0, c2_db_y);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 226U);
    guard7 = false;
    if (CV_EML_COND(0, 1, 6, c2_times == 0.0)) {
      if (CV_EML_COND(0, 1, 7, c2_dist1 > 0.2)) {
        CV_EML_MCDC(0, 1, 2, true);
        CV_EML_IF(0, 1, 15, true);
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 227U);
        c2_on_track = 0.0;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 228U);
        c2_tim = 0.0;
      } else {
        guard7 = true;
      }
    } else {
      guard7 = true;
    }

    if (guard7 == true) {
      CV_EML_MCDC(0, 1, 2, false);
      CV_EML_IF(0, 1, 15, false);
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 231U);
      c2_on_track = 1.0;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 232U);
      c2_tim = 1.0;
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 237U);
    guard5 = false;
    guard6 = false;
    if (CV_EML_COND(0, 1, 8, c2_arc + 0.043 > 0.0)) {
      if (CV_EML_COND(0, 1, 9, c2_arc - 0.043 < 0.0)) {
        if (CV_EML_COND(0, 1, 10, c2_on_track == 1.0)) {
          CV_EML_MCDC(0, 1, 3, true);
          CV_EML_IF(0, 1, 16, true);
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 238U);
          c2_OK = 1.0;
        } else {
          guard5 = true;
        }
      } else {
        guard6 = true;
      }
    } else {
      guard6 = true;
    }

    if (guard6 == true) {
      guard5 = true;
    }

    if (guard5 == true) {
      CV_EML_MCDC(0, 1, 3, false);
      CV_EML_IF(0, 1, 16, false);
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 240U);
      c2_OK = 0.0;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 251U);
  if (CV_EML_IF(0, 1, 17, c2_vel < 65.0)) {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 253U);
    c2_rollout = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, MAX_uint8_T);
    c2_rollout = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -255);
  _SFD_SYMBOL_SCOPE_POP();
  *c2_b_dist1 = c2_dist1;
  *c2_b_dist_2 = c2_dist_2;
  *c2_b_roll = c2_roll;
  *c2_b_TRK = c2_TRK;
  *c2_b_DTRK = c2_DTRK;
  *c2_b_TRKERR = c2_TRKERR;
  *c2_b_XTRK = c2_XTRK;
  *c2_b_OK = c2_OK;
  *c2_b_on_track = c2_on_track;
  *c2_b_tim = c2_tim;
  *c2_b_rollout = c2_rollout;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
}

static void initSimStructsc2_main(SFc2_mainInstanceStruct *chartInstance)
{
  (void)chartInstance;
}

static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
  c2_chartNumber, uint32_T c2_instanceNumber)
{
  (void)c2_machineNumber;
  (void)c2_chartNumber;
  (void)c2_instanceNumber;
}

static const mxArray *c2_sf_marshallOut(void *chartInstanceVoid, void *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  real_T c2_u;
  const mxArray *c2_y = NULL;
  SFc2_mainInstanceStruct *chartInstance;
  chartInstance = (SFc2_mainInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  c2_u = *(real_T *)c2_inData;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", &c2_u, 0, 0U, 0U, 0U, 0), false);
  sf_mex_assign(&c2_mxArrayOutData, c2_y, false);
  return c2_mxArrayOutData;
}

static real_T c2_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_rollout, const char_T *c2_identifier)
{
  real_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_rollout), &c2_thisId);
  sf_mex_destroy(&c2_rollout);
  return c2_y;
}

static real_T c2_b_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  real_T c2_y;
  real_T c2_d8;
  (void)chartInstance;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_d8, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d8;
  sf_mex_destroy(&c2_u);
  return c2_y;
}

static void c2_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_rollout;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  real_T c2_y;
  SFc2_mainInstanceStruct *chartInstance;
  chartInstance = (SFc2_mainInstanceStruct *)chartInstanceVoid;
  c2_rollout = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_rollout), &c2_thisId);
  sf_mex_destroy(&c2_rollout);
  *(real_T *)c2_outData = c2_y;
  sf_mex_destroy(&c2_mxArrayInData);
}

static const mxArray *c2_b_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i24;
  real_T c2_b_inData[12];
  int32_T c2_i25;
  real_T c2_u[12];
  const mxArray *c2_y = NULL;
  SFc2_mainInstanceStruct *chartInstance;
  chartInstance = (SFc2_mainInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  for (c2_i24 = 0; c2_i24 < 12; c2_i24++) {
    c2_b_inData[c2_i24] = (*(real_T (*)[12])c2_inData)[c2_i24];
  }

  for (c2_i25 = 0; c2_i25 < 12; c2_i25++) {
    c2_u[c2_i25] = c2_b_inData[c2_i25];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 0, 0U, 1U, 0U, 2, 1, 12), false);
  sf_mex_assign(&c2_mxArrayOutData, c2_y, false);
  return c2_mxArrayOutData;
}

static const mxArray *c2_c_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  c2_sKtWNgXb9c99UqYJaA6MzR c2_u;
  const mxArray *c2_y = NULL;
  int32_T c2_i26;
  real_T c2_b_u[12];
  const mxArray *c2_b_y = NULL;
  int32_T c2_i27;
  real_T c2_c_u[12];
  const mxArray *c2_c_y = NULL;
  int32_T c2_i28;
  real_T c2_d_u[12];
  const mxArray *c2_d_y = NULL;
  int32_T c2_i29;
  real_T c2_e_u[12];
  const mxArray *c2_e_y = NULL;
  int32_T c2_i30;
  real_T c2_f_u[12];
  const mxArray *c2_f_y = NULL;
  int32_T c2_i31;
  real_T c2_g_u[12];
  const mxArray *c2_g_y = NULL;
  SFc2_mainInstanceStruct *chartInstance;
  chartInstance = (SFc2_mainInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  c2_u = *(c2_sKtWNgXb9c99UqYJaA6MzR *)c2_inData;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_createstruct("structure", 2, 1, 1), false);
  for (c2_i26 = 0; c2_i26 < 12; c2_i26++) {
    c2_b_u[c2_i26] = c2_u.n[c2_i26];
  }

  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_b_u, 0, 0U, 1U, 0U, 2, 1, 12),
                false);
  sf_mex_addfield(c2_y, c2_b_y, "n", "n", 0);
  for (c2_i27 = 0; c2_i27 < 12; c2_i27++) {
    c2_c_u[c2_i27] = c2_u.lat[c2_i27];
  }

  c2_c_y = NULL;
  sf_mex_assign(&c2_c_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 2, 1, 12),
                false);
  sf_mex_addfield(c2_y, c2_c_y, "lat", "lat", 0);
  for (c2_i28 = 0; c2_i28 < 12; c2_i28++) {
    c2_d_u[c2_i28] = c2_u.lon[c2_i28];
  }

  c2_d_y = NULL;
  sf_mex_assign(&c2_d_y, sf_mex_create("y", c2_d_u, 0, 0U, 1U, 0U, 2, 1, 12),
                false);
  sf_mex_addfield(c2_y, c2_d_y, "lon", "lon", 0);
  for (c2_i29 = 0; c2_i29 < 12; c2_i29++) {
    c2_e_u[c2_i29] = c2_u.alt[c2_i29];
  }

  c2_e_y = NULL;
  sf_mex_assign(&c2_e_y, sf_mex_create("y", c2_e_u, 0, 0U, 1U, 0U, 2, 1, 12),
                false);
  sf_mex_addfield(c2_y, c2_e_y, "alt", "alt", 0);
  for (c2_i30 = 0; c2_i30 < 12; c2_i30++) {
    c2_f_u[c2_i30] = c2_u.trajectory[c2_i30];
  }

  c2_f_y = NULL;
  sf_mex_assign(&c2_f_y, sf_mex_create("y", c2_f_u, 0, 0U, 1U, 0U, 2, 1, 12),
                false);
  sf_mex_addfield(c2_y, c2_f_y, "trajectory", "trajectory", 0);
  for (c2_i31 = 0; c2_i31 < 12; c2_i31++) {
    c2_g_u[c2_i31] = c2_u.ok[c2_i31];
  }

  c2_g_y = NULL;
  sf_mex_assign(&c2_g_y, sf_mex_create("y", c2_g_u, 0, 0U, 1U, 0U, 2, 1, 12),
                false);
  sf_mex_addfield(c2_y, c2_g_y, "ok", "ok", 0);
  sf_mex_assign(&c2_mxArrayOutData, c2_y, false);
  return c2_mxArrayOutData;
}

static void c2_c_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  c2_sKtWNgXb9c99UqYJaA6MzR *c2_y)
{
  emlrtMsgIdentifier c2_thisId;
  static const char * c2_fieldNames[6] = { "n", "lat", "lon", "alt",
    "trajectory", "ok" };

  c2_thisId.fParent = c2_parentId;
  sf_mex_check_struct(c2_parentId, c2_u, 6, c2_fieldNames, 0U, NULL);
  c2_thisId.fIdentifier = "n";
  c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getfield(c2_u, "n", "n",
    0)), &c2_thisId, c2_y->n);
  c2_thisId.fIdentifier = "lat";
  c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getfield(c2_u, "lat",
    "lat", 0)), &c2_thisId, c2_y->lat);
  c2_thisId.fIdentifier = "lon";
  c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getfield(c2_u, "lon",
    "lon", 0)), &c2_thisId, c2_y->lon);
  c2_thisId.fIdentifier = "alt";
  c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getfield(c2_u, "alt",
    "alt", 0)), &c2_thisId, c2_y->alt);
  c2_thisId.fIdentifier = "trajectory";
  c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getfield(c2_u,
    "trajectory", "trajectory", 0)), &c2_thisId, c2_y->trajectory);
  c2_thisId.fIdentifier = "ok";
  c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getfield(c2_u, "ok",
    "ok", 0)), &c2_thisId, c2_y->ok);
  sf_mex_destroy(&c2_u);
}

static void c2_d_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance, const
  mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId, real_T c2_y[12])
{
  real_T c2_dv0[12];
  int32_T c2_i32;
  (void)chartInstance;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_dv0, 1, 0, 0U, 1, 0U, 2, 1, 12);
  for (c2_i32 = 0; c2_i32 < 12; c2_i32++) {
    c2_y[c2_i32] = c2_dv0[c2_i32];
  }

  sf_mex_destroy(&c2_u);
}

static void c2_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_wp;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  c2_sKtWNgXb9c99UqYJaA6MzR c2_y;
  SFc2_mainInstanceStruct *chartInstance;
  chartInstance = (SFc2_mainInstanceStruct *)chartInstanceVoid;
  c2_wp = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_c_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_wp), &c2_thisId, &c2_y);
  sf_mex_destroy(&c2_wp);
  *(c2_sKtWNgXb9c99UqYJaA6MzR *)c2_outData = c2_y;
  sf_mex_destroy(&c2_mxArrayInData);
}

const mxArray *sf_c2_main_get_eml_resolved_functions_info(void)
{
  const mxArray *c2_nameCaptureInfo = NULL;
  c2_nameCaptureInfo = NULL;
  sf_mex_assign(&c2_nameCaptureInfo, sf_mex_createstruct("structure", 2, 29, 1),
                false);
  c2_info_helper(&c2_nameCaptureInfo);
  sf_mex_emlrtNameCapturePostProcessR2012a(&c2_nameCaptureInfo);
  return c2_nameCaptureInfo;
}

static void c2_info_helper(const mxArray **c2_info)
{
  const mxArray *c2_rhs0 = NULL;
  const mxArray *c2_lhs0 = NULL;
  const mxArray *c2_rhs1 = NULL;
  const mxArray *c2_lhs1 = NULL;
  const mxArray *c2_rhs2 = NULL;
  const mxArray *c2_lhs2 = NULL;
  const mxArray *c2_rhs3 = NULL;
  const mxArray *c2_lhs3 = NULL;
  const mxArray *c2_rhs4 = NULL;
  const mxArray *c2_lhs4 = NULL;
  const mxArray *c2_rhs5 = NULL;
  const mxArray *c2_lhs5 = NULL;
  const mxArray *c2_rhs6 = NULL;
  const mxArray *c2_lhs6 = NULL;
  const mxArray *c2_rhs7 = NULL;
  const mxArray *c2_lhs7 = NULL;
  const mxArray *c2_rhs8 = NULL;
  const mxArray *c2_lhs8 = NULL;
  const mxArray *c2_rhs9 = NULL;
  const mxArray *c2_lhs9 = NULL;
  const mxArray *c2_rhs10 = NULL;
  const mxArray *c2_lhs10 = NULL;
  const mxArray *c2_rhs11 = NULL;
  const mxArray *c2_lhs11 = NULL;
  const mxArray *c2_rhs12 = NULL;
  const mxArray *c2_lhs12 = NULL;
  const mxArray *c2_rhs13 = NULL;
  const mxArray *c2_lhs13 = NULL;
  const mxArray *c2_rhs14 = NULL;
  const mxArray *c2_lhs14 = NULL;
  const mxArray *c2_rhs15 = NULL;
  const mxArray *c2_lhs15 = NULL;
  const mxArray *c2_rhs16 = NULL;
  const mxArray *c2_lhs16 = NULL;
  const mxArray *c2_rhs17 = NULL;
  const mxArray *c2_lhs17 = NULL;
  const mxArray *c2_rhs18 = NULL;
  const mxArray *c2_lhs18 = NULL;
  const mxArray *c2_rhs19 = NULL;
  const mxArray *c2_lhs19 = NULL;
  const mxArray *c2_rhs20 = NULL;
  const mxArray *c2_lhs20 = NULL;
  const mxArray *c2_rhs21 = NULL;
  const mxArray *c2_lhs21 = NULL;
  const mxArray *c2_rhs22 = NULL;
  const mxArray *c2_lhs22 = NULL;
  const mxArray *c2_rhs23 = NULL;
  const mxArray *c2_lhs23 = NULL;
  const mxArray *c2_rhs24 = NULL;
  const mxArray *c2_lhs24 = NULL;
  const mxArray *c2_rhs25 = NULL;
  const mxArray *c2_lhs25 = NULL;
  const mxArray *c2_rhs26 = NULL;
  const mxArray *c2_lhs26 = NULL;
  const mxArray *c2_rhs27 = NULL;
  const mxArray *c2_lhs27 = NULL;
  const mxArray *c2_rhs28 = NULL;
  const mxArray *c2_lhs28 = NULL;
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 0);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("mrdivide"), "name", "name", 0);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 0);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p"), "resolved",
                  "resolved", 0);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1388460096U), "fileTimeLo",
                  "fileTimeLo", 0);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 0);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1370009886U), "mFileTimeLo",
                  "mFileTimeLo", 0);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 0);
  sf_mex_assign(&c2_rhs0, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs0, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs0), "rhs", "rhs", 0);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs0), "lhs", "lhs", 0);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p"), "context",
                  "context", 1);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.assert"),
                  "name", "name", 1);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
                  "dominantType", 1);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[IXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/assert.m"),
                  "resolved", "resolved", 1);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1363714556U), "fileTimeLo",
                  "fileTimeLo", 1);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 1);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 1);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 1);
  sf_mex_assign(&c2_rhs1, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs1, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs1), "rhs", "rhs", 1);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs1), "lhs", "lhs", 1);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p"), "context",
                  "context", 2);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("rdivide"), "name", "name", 2);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 2);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m"), "resolved",
                  "resolved", 2);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1363713880U), "fileTimeLo",
                  "fileTimeLo", 2);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 2);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 2);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 2);
  sf_mex_assign(&c2_rhs2, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs2, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs2), "rhs", "rhs", 2);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs2), "lhs", "lhs", 2);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m"), "context",
                  "context", 3);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "coder.internal.isBuiltInNumeric"), "name", "name", 3);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 3);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[IXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/isBuiltInNumeric.m"),
                  "resolved", "resolved", 3);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1363714556U), "fileTimeLo",
                  "fileTimeLo", 3);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 3);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 3);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 3);
  sf_mex_assign(&c2_rhs3, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs3, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs3), "rhs", "rhs", 3);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs3), "lhs", "lhs", 3);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m"), "context",
                  "context", 4);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalexp_compatible"),
                  "name", "name", 4);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 4);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_compatible.m"),
                  "resolved", "resolved", 4);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1286818796U), "fileTimeLo",
                  "fileTimeLo", 4);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 4);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 4);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 4);
  sf_mex_assign(&c2_rhs4, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs4, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs4), "rhs", "rhs", 4);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs4), "lhs", "lhs", 4);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m"), "context",
                  "context", 5);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_div"), "name", "name", 5);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 5);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m"), "resolved",
                  "resolved", 5);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1375980688U), "fileTimeLo",
                  "fileTimeLo", 5);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 5);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 5);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 5);
  sf_mex_assign(&c2_rhs5, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs5, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs5), "rhs", "rhs", 5);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs5), "lhs", "lhs", 5);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m"), "context",
                  "context", 6);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.div"), "name",
                  "name", 6);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 6);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[IXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/div.p"), "resolved",
                  "resolved", 6);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1389307920U), "fileTimeLo",
                  "fileTimeLo", 6);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 6);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 6);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 6);
  sf_mex_assign(&c2_rhs6, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs6, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs6), "rhs", "rhs", 6);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs6), "lhs", "lhs", 6);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 7);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("sin"), "name", "name", 7);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 7);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sin.m"), "resolved",
                  "resolved", 7);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1343830386U), "fileTimeLo",
                  "fileTimeLo", 7);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 7);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 7);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 7);
  sf_mex_assign(&c2_rhs7, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs7, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs7), "rhs", "rhs", 7);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs7), "lhs", "lhs", 7);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sin.m"), "context",
                  "context", 8);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_sin"), "name",
                  "name", 8);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 8);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_sin.m"),
                  "resolved", "resolved", 8);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1286818736U), "fileTimeLo",
                  "fileTimeLo", 8);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 8);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 8);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 8);
  sf_mex_assign(&c2_rhs8, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs8, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs8), "rhs", "rhs", 8);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs8), "lhs", "lhs", 8);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 9);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("cos"), "name", "name", 9);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 9);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/cos.m"), "resolved",
                  "resolved", 9);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1343830372U), "fileTimeLo",
                  "fileTimeLo", 9);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 9);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 9);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 9);
  sf_mex_assign(&c2_rhs9, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs9, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs9), "rhs", "rhs", 9);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs9), "lhs", "lhs", 9);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/cos.m"), "context",
                  "context", 10);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_cos"), "name",
                  "name", 10);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 10);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_cos.m"),
                  "resolved", "resolved", 10);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1286818722U), "fileTimeLo",
                  "fileTimeLo", 10);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 10);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 10);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 10);
  sf_mex_assign(&c2_rhs10, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs10, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs10), "rhs", "rhs",
                  10);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs10), "lhs", "lhs",
                  10);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 11);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("sqrt"), "name", "name", 11);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 11);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m"), "resolved",
                  "resolved", 11);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1343830386U), "fileTimeLo",
                  "fileTimeLo", 11);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 11);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 11);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 11);
  sf_mex_assign(&c2_rhs11, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs11, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs11), "rhs", "rhs",
                  11);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs11), "lhs", "lhs",
                  11);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m"), "context",
                  "context", 12);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_error"), "name", "name",
                  12);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
                  "dominantType", 12);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_error.m"), "resolved",
                  "resolved", 12);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1343830358U), "fileTimeLo",
                  "fileTimeLo", 12);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 12);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 12);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 12);
  sf_mex_assign(&c2_rhs12, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs12, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs12), "rhs", "rhs",
                  12);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs12), "lhs", "lhs",
                  12);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m"), "context",
                  "context", 13);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_sqrt"), "name",
                  "name", 13);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 13);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_sqrt.m"),
                  "resolved", "resolved", 13);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1286818738U), "fileTimeLo",
                  "fileTimeLo", 13);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 13);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 13);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 13);
  sf_mex_assign(&c2_rhs13, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs13, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs13), "rhs", "rhs",
                  13);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs13), "lhs", "lhs",
                  13);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 14);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("atan2"), "name", "name", 14);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 14);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/atan2.m"), "resolved",
                  "resolved", 14);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1343830372U), "fileTimeLo",
                  "fileTimeLo", 14);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 14);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 14);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 14);
  sf_mex_assign(&c2_rhs14, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs14, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs14), "rhs", "rhs",
                  14);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs14), "lhs", "lhs",
                  14);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/atan2.m"), "context",
                  "context", 15);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_eg"), "name",
                  "name", 15);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 15);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m"), "resolved",
                  "resolved", 15);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1375980688U), "fileTimeLo",
                  "fileTimeLo", 15);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 15);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 15);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 15);
  sf_mex_assign(&c2_rhs15, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs15, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs15), "rhs", "rhs",
                  15);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs15), "lhs", "lhs",
                  15);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m"), "context",
                  "context", 16);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.scalarEg"),
                  "name", "name", 16);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 16);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[IXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/scalarEg.p"),
                  "resolved", "resolved", 16);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1389307920U), "fileTimeLo",
                  "fileTimeLo", 16);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 16);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 16);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 16);
  sf_mex_assign(&c2_rhs16, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs16, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs16), "rhs", "rhs",
                  16);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs16), "lhs", "lhs",
                  16);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/atan2.m"), "context",
                  "context", 17);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalexp_alloc"), "name",
                  "name", 17);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 17);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m"),
                  "resolved", "resolved", 17);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1375980688U), "fileTimeLo",
                  "fileTimeLo", 17);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 17);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 17);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 17);
  sf_mex_assign(&c2_rhs17, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs17, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs17), "rhs", "rhs",
                  17);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs17), "lhs", "lhs",
                  17);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m"),
                  "context", "context", 18);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.scalexpAlloc"),
                  "name", "name", 18);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 18);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[IXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/scalexpAlloc.p"),
                  "resolved", "resolved", 18);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1389307920U), "fileTimeLo",
                  "fileTimeLo", 18);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 18);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 18);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 18);
  sf_mex_assign(&c2_rhs18, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs18, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs18), "rhs", "rhs",
                  18);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs18), "lhs", "lhs",
                  18);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/atan2.m"), "context",
                  "context", 19);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_atan2"), "name",
                  "name", 19);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 19);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_atan2.m"),
                  "resolved", "resolved", 19);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1286818720U), "fileTimeLo",
                  "fileTimeLo", 19);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 19);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 19);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 19);
  sf_mex_assign(&c2_rhs19, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs19, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs19), "rhs", "rhs",
                  19);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs19), "lhs", "lhs",
                  19);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 20);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("min"), "name", "name", 20);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 20);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/min.m"), "resolved",
                  "resolved", 20);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1311255318U), "fileTimeLo",
                  "fileTimeLo", 20);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 20);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 20);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 20);
  sf_mex_assign(&c2_rhs20, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs20, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs20), "rhs", "rhs",
                  20);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs20), "lhs", "lhs",
                  20);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/min.m"), "context",
                  "context", 21);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_min_or_max"), "name",
                  "name", 21);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
                  "dominantType", 21);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m"),
                  "resolved", "resolved", 21);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1378295984U), "fileTimeLo",
                  "fileTimeLo", 21);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 21);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 21);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 21);
  sf_mex_assign(&c2_rhs21, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs21, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs21), "rhs", "rhs",
                  21);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs21), "lhs", "lhs",
                  21);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_bin_extremum"),
                  "context", "context", 22);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_eg"), "name",
                  "name", 22);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 22);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m"), "resolved",
                  "resolved", 22);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1375980688U), "fileTimeLo",
                  "fileTimeLo", 22);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 22);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 22);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 22);
  sf_mex_assign(&c2_rhs22, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs22, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs22), "rhs", "rhs",
                  22);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs22), "lhs", "lhs",
                  22);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_bin_extremum"),
                  "context", "context", 23);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalexp_alloc"), "name",
                  "name", 23);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 23);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m"),
                  "resolved", "resolved", 23);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1375980688U), "fileTimeLo",
                  "fileTimeLo", 23);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 23);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 23);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 23);
  sf_mex_assign(&c2_rhs23, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs23, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs23), "rhs", "rhs",
                  23);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs23), "lhs", "lhs",
                  23);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_bin_extremum"),
                  "context", "context", 24);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_index_class"), "name",
                  "name", 24);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
                  "dominantType", 24);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m"),
                  "resolved", "resolved", 24);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1323170578U), "fileTimeLo",
                  "fileTimeLo", 24);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 24);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 24);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 24);
  sf_mex_assign(&c2_rhs24, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs24, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs24), "rhs", "rhs",
                  24);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs24), "lhs", "lhs",
                  24);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_scalar_bin_extremum"),
                  "context", "context", 25);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_eg"), "name",
                  "name", 25);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 25);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m"), "resolved",
                  "resolved", 25);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1375980688U), "fileTimeLo",
                  "fileTimeLo", 25);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 25);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 25);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 25);
  sf_mex_assign(&c2_rhs25, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs25, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs25), "rhs", "rhs",
                  25);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs25), "lhs", "lhs",
                  25);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_scalar_bin_extremum"),
                  "context", "context", 26);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "coder.internal.isBuiltInNumeric"), "name", "name", 26);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 26);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[IXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/isBuiltInNumeric.m"),
                  "resolved", "resolved", 26);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1363714556U), "fileTimeLo",
                  "fileTimeLo", 26);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 26);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 26);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 26);
  sf_mex_assign(&c2_rhs26, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs26, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs26), "rhs", "rhs",
                  26);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs26), "lhs", "lhs",
                  26);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 27);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("max"), "name", "name", 27);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
                  "dominantType", 27);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m"), "resolved",
                  "resolved", 27);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1311255316U), "fileTimeLo",
                  "fileTimeLo", 27);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 27);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 27);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 27);
  sf_mex_assign(&c2_rhs27, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs27, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs27), "rhs", "rhs",
                  27);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs27), "lhs", "lhs",
                  27);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m"), "context",
                  "context", 28);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_min_or_max"), "name",
                  "name", 28);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
                  "dominantType", 28);
  sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m"),
                  "resolved", "resolved", 28);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1378295984U), "fileTimeLo",
                  "fileTimeLo", 28);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
                  "fileTimeHi", 28);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
                  "mFileTimeLo", 28);
  sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
                  "mFileTimeHi", 28);
  sf_mex_assign(&c2_rhs28, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_assign(&c2_lhs28, sf_mex_createcellmatrix(0, 1), false);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs28), "rhs", "rhs",
                  28);
  sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs28), "lhs", "lhs",
                  28);
  sf_mex_destroy(&c2_rhs0);
  sf_mex_destroy(&c2_lhs0);
  sf_mex_destroy(&c2_rhs1);
  sf_mex_destroy(&c2_lhs1);
  sf_mex_destroy(&c2_rhs2);
  sf_mex_destroy(&c2_lhs2);
  sf_mex_destroy(&c2_rhs3);
  sf_mex_destroy(&c2_lhs3);
  sf_mex_destroy(&c2_rhs4);
  sf_mex_destroy(&c2_lhs4);
  sf_mex_destroy(&c2_rhs5);
  sf_mex_destroy(&c2_lhs5);
  sf_mex_destroy(&c2_rhs6);
  sf_mex_destroy(&c2_lhs6);
  sf_mex_destroy(&c2_rhs7);
  sf_mex_destroy(&c2_lhs7);
  sf_mex_destroy(&c2_rhs8);
  sf_mex_destroy(&c2_lhs8);
  sf_mex_destroy(&c2_rhs9);
  sf_mex_destroy(&c2_lhs9);
  sf_mex_destroy(&c2_rhs10);
  sf_mex_destroy(&c2_lhs10);
  sf_mex_destroy(&c2_rhs11);
  sf_mex_destroy(&c2_lhs11);
  sf_mex_destroy(&c2_rhs12);
  sf_mex_destroy(&c2_lhs12);
  sf_mex_destroy(&c2_rhs13);
  sf_mex_destroy(&c2_lhs13);
  sf_mex_destroy(&c2_rhs14);
  sf_mex_destroy(&c2_lhs14);
  sf_mex_destroy(&c2_rhs15);
  sf_mex_destroy(&c2_lhs15);
  sf_mex_destroy(&c2_rhs16);
  sf_mex_destroy(&c2_lhs16);
  sf_mex_destroy(&c2_rhs17);
  sf_mex_destroy(&c2_lhs17);
  sf_mex_destroy(&c2_rhs18);
  sf_mex_destroy(&c2_lhs18);
  sf_mex_destroy(&c2_rhs19);
  sf_mex_destroy(&c2_lhs19);
  sf_mex_destroy(&c2_rhs20);
  sf_mex_destroy(&c2_lhs20);
  sf_mex_destroy(&c2_rhs21);
  sf_mex_destroy(&c2_lhs21);
  sf_mex_destroy(&c2_rhs22);
  sf_mex_destroy(&c2_lhs22);
  sf_mex_destroy(&c2_rhs23);
  sf_mex_destroy(&c2_lhs23);
  sf_mex_destroy(&c2_rhs24);
  sf_mex_destroy(&c2_lhs24);
  sf_mex_destroy(&c2_rhs25);
  sf_mex_destroy(&c2_lhs25);
  sf_mex_destroy(&c2_rhs26);
  sf_mex_destroy(&c2_lhs26);
  sf_mex_destroy(&c2_rhs27);
  sf_mex_destroy(&c2_lhs27);
  sf_mex_destroy(&c2_rhs28);
  sf_mex_destroy(&c2_lhs28);
}

static const mxArray *c2_emlrt_marshallOut(const char * c2_u)
{
  const mxArray *c2_y = NULL;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 15, 0U, 0U, 0U, 2, 1, strlen
    (c2_u)), false);
  return c2_y;
}

static const mxArray *c2_b_emlrt_marshallOut(const uint32_T c2_u)
{
  const mxArray *c2_y = NULL;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", &c2_u, 7, 0U, 0U, 0U, 0), false);
  return c2_y;
}

static real_T c2_sqrt(SFc2_mainInstanceStruct *chartInstance, real_T c2_x)
{
  real_T c2_b_x;
  c2_b_x = c2_x;
  c2_b_sqrt(chartInstance, &c2_b_x);
  return c2_b_x;
}

static void c2_eml_error(SFc2_mainInstanceStruct *chartInstance)
{
  int32_T c2_i33;
  static char_T c2_cv0[30] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l',
    'b', 'o', 'x', ':', 'E', 'l', 'F', 'u', 'n', 'D', 'o', 'm', 'a', 'i', 'n',
    'E', 'r', 'r', 'o', 'r' };

  char_T c2_u[30];
  const mxArray *c2_y = NULL;
  int32_T c2_i34;
  static char_T c2_cv1[4] = { 's', 'q', 'r', 't' };

  char_T c2_b_u[4];
  const mxArray *c2_b_y = NULL;
  (void)chartInstance;
  for (c2_i33 = 0; c2_i33 < 30; c2_i33++) {
    c2_u[c2_i33] = c2_cv0[c2_i33];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 10, 0U, 1U, 0U, 2, 1, 30), false);
  for (c2_i34 = 0; c2_i34 < 4; c2_i34++) {
    c2_b_u[c2_i34] = c2_cv1[c2_i34];
  }

  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_b_u, 10, 0U, 1U, 0U, 2, 1, 4),
                false);
  sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                    sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message", 1U,
    2U, 14, c2_y, 14, c2_b_y));
}

static real_T c2_atan2(SFc2_mainInstanceStruct *chartInstance, real_T c2_y,
  real_T c2_x)
{
  real_T c2_b_y;
  real_T c2_b_x;
  c2_eml_scalar_eg(chartInstance);
  c2_b_y = c2_y;
  c2_b_x = c2_x;
  return muDoubleScalarAtan2(c2_b_y, c2_b_x);
}

static void c2_eml_scalar_eg(SFc2_mainInstanceStruct *chartInstance)
{
  (void)chartInstance;
}

static const mxArray *c2_d_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_u;
  const mxArray *c2_y = NULL;
  SFc2_mainInstanceStruct *chartInstance;
  chartInstance = (SFc2_mainInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  c2_u = *(int32_T *)c2_inData;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", &c2_u, 6, 0U, 0U, 0U, 0), false);
  sf_mex_assign(&c2_mxArrayOutData, c2_y, false);
  return c2_mxArrayOutData;
}

static int32_T c2_e_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  int32_T c2_y;
  int32_T c2_i35;
  (void)chartInstance;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_i35, 1, 6, 0U, 0, 0U, 0);
  c2_y = c2_i35;
  sf_mex_destroy(&c2_u);
  return c2_y;
}

static void c2_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_b_sfEvent;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  int32_T c2_y;
  SFc2_mainInstanceStruct *chartInstance;
  chartInstance = (SFc2_mainInstanceStruct *)chartInstanceVoid;
  c2_b_sfEvent = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_e_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_sfEvent),
    &c2_thisId);
  sf_mex_destroy(&c2_b_sfEvent);
  *(int32_T *)c2_outData = c2_y;
  sf_mex_destroy(&c2_mxArrayInData);
}

static uint8_T c2_f_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_b_is_active_c2_main, const char_T *c2_identifier)
{
  uint8_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_g_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_is_active_c2_main),
    &c2_thisId);
  sf_mex_destroy(&c2_b_is_active_c2_main);
  return c2_y;
}

static uint8_T c2_g_emlrt_marshallIn(SFc2_mainInstanceStruct *chartInstance,
  const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  uint8_T c2_y;
  uint8_T c2_u0;
  (void)chartInstance;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_u0, 1, 3, 0U, 0, 0U, 0);
  c2_y = c2_u0;
  sf_mex_destroy(&c2_u);
  return c2_y;
}

static void c2_b_sqrt(SFc2_mainInstanceStruct *chartInstance, real_T *c2_x)
{
  if (*c2_x < 0.0) {
    c2_eml_error(chartInstance);
  }

  *c2_x = muDoubleScalarSqrt(*c2_x);
}

static void init_dsm_address_info(SFc2_mainInstanceStruct *chartInstance)
{
  (void)chartInstance;
}

/* SFunction Glue Code */
#ifdef utFree
#undef utFree
#endif

#ifdef utMalloc
#undef utMalloc
#endif

#ifdef __cplusplus

extern "C" void *utMalloc(size_t size);
extern "C" void utFree(void*);

#else

extern void *utMalloc(size_t size);
extern void utFree(void*);

#endif

void sf_c2_main_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(506009469U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2449325414U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2192635211U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1435683512U);
}

mxArray *sf_c2_main_get_autoinheritance_info(void)
{
  const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
    "outputs", "locals" };

  mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1,1,5,
    autoinheritanceFields);

  {
    mxArray *mxChecksum = mxCreateString("coUnUtNstoLxMRmOYx5SNF");
    mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
  }

  {
    const char *dataFields[] = { "size", "type", "complexity" };

    mxArray *mxData = mxCreateStructMatrix(1,19,3,dataFields);

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,0,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,0,"type",mxType);
    }

    mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,1,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,1,"type",mxType);
    }

    mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,2,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,2,"type",mxType);
    }

    mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,3,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,3,"type",mxType);
    }

    mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,4,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,4,"type",mxType);
    }

    mxSetField(mxData,4,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,5,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,5,"type",mxType);
    }

    mxSetField(mxData,5,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,6,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,6,"type",mxType);
    }

    mxSetField(mxData,6,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,7,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,7,"type",mxType);
    }

    mxSetField(mxData,7,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(12);
      mxSetField(mxData,8,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,8,"type",mxType);
    }

    mxSetField(mxData,8,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,9,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,9,"type",mxType);
    }

    mxSetField(mxData,9,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,10,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,10,"type",mxType);
    }

    mxSetField(mxData,10,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,11,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,11,"type",mxType);
    }

    mxSetField(mxData,11,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,12,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,12,"type",mxType);
    }

    mxSetField(mxData,12,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,13,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,13,"type",mxType);
    }

    mxSetField(mxData,13,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,14,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,14,"type",mxType);
    }

    mxSetField(mxData,14,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,15,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,15,"type",mxType);
    }

    mxSetField(mxData,15,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,16,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,16,"type",mxType);
    }

    mxSetField(mxData,16,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,17,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,17,"type",mxType);
    }

    mxSetField(mxData,17,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,18,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,18,"type",mxType);
    }

    mxSetField(mxData,18,"complexity",mxCreateDoubleScalar(0));
    mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
  }

  {
    mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
                mxREAL));
  }

  {
    const char *dataFields[] = { "size", "type", "complexity" };

    mxArray *mxData = mxCreateStructMatrix(1,11,3,dataFields);

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,0,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,0,"type",mxType);
    }

    mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,1,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,1,"type",mxType);
    }

    mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,2,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,2,"type",mxType);
    }

    mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,3,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,3,"type",mxType);
    }

    mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,4,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,4,"type",mxType);
    }

    mxSetField(mxData,4,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,5,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,5,"type",mxType);
    }

    mxSetField(mxData,5,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,6,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,6,"type",mxType);
    }

    mxSetField(mxData,6,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,7,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,7,"type",mxType);
    }

    mxSetField(mxData,7,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,8,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,8,"type",mxType);
    }

    mxSetField(mxData,8,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,9,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,9,"type",mxType);
    }

    mxSetField(mxData,9,"complexity",mxCreateDoubleScalar(0));

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(1);
      pr[1] = (double)(1);
      mxSetField(mxData,10,"size",mxSize);
    }

    {
      const char *typeFields[] = { "base", "fixpt" };

      mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
      mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
      mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
      mxSetField(mxData,10,"type",mxType);
    }

    mxSetField(mxData,10,"complexity",mxCreateDoubleScalar(0));
    mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
  }

  {
    mxSetField(mxAutoinheritanceInfo,0,"locals",mxCreateDoubleMatrix(0,0,mxREAL));
  }

  return(mxAutoinheritanceInfo);
}

mxArray *sf_c2_main_third_party_uses_info(void)
{
  mxArray * mxcell3p = mxCreateCellMatrix(1,0);
  return(mxcell3p);
}

mxArray *sf_c2_main_updateBuildInfo_args_info(void)
{
  mxArray *mxBIArgs = mxCreateCellMatrix(1,0);
  return mxBIArgs;
}

static const mxArray *sf_get_sim_state_info_c2_main(void)
{
  const char *infoFields[] = { "chartChecksum", "varInfo" };

  mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
  const char *infoEncStr[] = {
    "100 S1x10'type','srcId','name','auxInfo'{{M[1],M[22],T\"DTRK\",},{M[1],M[27],T\"OK\",},{M[1],M[21],T\"TRK\",},{M[1],M[43],T\"TRKERR\",},{M[1],M[23],T\"XTRK\",},{M[1],M[42],T\"dist1\",},{M[1],M[44],T\"dist_2\",},{M[1],M[39],T\"on_track\",},{M[1],M[14],T\"roll\",},{M[1],M[45],T\"rollout\",}}",
    "100 S1x2'type','srcId','name','auxInfo'{{M[1],M[41],T\"tim\",},{M[8],M[0],T\"is_active_c2_main\",}}"
  };

  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 12, 10);
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
  sf_c2_main_get_check_sum(&mxChecksum);
  mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
  mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
  return mxInfo;
}

static void chart_debug_initialization(SimStruct *S, unsigned int
  fullDebuggerInitialization)
{
  if (!sim_mode_is_rtw_gen(S)) {
    SFc2_mainInstanceStruct *chartInstance;
    ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
    ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
    chartInstance = (SFc2_mainInstanceStruct *) chartInfo->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (sfGlobalDebugInstanceStruct,
           _mainMachineNumber_,
           2,
           1,
           1,
           0,
           30,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           (void *)S);

        /* Each instance must initialize ist own list of scripts */
        init_script_number_translation(_mainMachineNumber_,
          chartInstance->chartNumber,chartInstance->instanceNumber);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          sf_debug_set_chart_disable_implicit_casting
            (sfGlobalDebugInstanceStruct,_mainMachineNumber_,
             chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
            _mainMachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,2,0,1,"dist1");
          _SFD_SET_DATA_PROPS(1,2,0,1,"dist_2");
          _SFD_SET_DATA_PROPS(2,1,1,0,"nt");
          _SFD_SET_DATA_PROPS(3,1,1,0,"latt");
          _SFD_SET_DATA_PROPS(4,1,1,0,"lont");
          _SFD_SET_DATA_PROPS(5,1,1,0,"altt");
          _SFD_SET_DATA_PROPS(6,1,1,0,"speed");
          _SFD_SET_DATA_PROPS(7,1,1,0,"okt");
          _SFD_SET_DATA_PROPS(8,1,1,0,"Rlat");
          _SFD_SET_DATA_PROPS(9,1,1,0,"Rlon");
          _SFD_SET_DATA_PROPS(10,1,1,0,"dc");
          _SFD_SET_DATA_PROPS(11,1,1,0,"lon");
          _SFD_SET_DATA_PROPS(12,1,1,0,"lat");
          _SFD_SET_DATA_PROPS(13,1,1,0,"alt");
          _SFD_SET_DATA_PROPS(14,1,1,0,"h");
          _SFD_SET_DATA_PROPS(15,1,1,0,"hpath");
          _SFD_SET_DATA_PROPS(16,1,1,0,"betta");
          _SFD_SET_DATA_PROPS(17,2,0,1,"roll");
          _SFD_SET_DATA_PROPS(18,2,0,1,"TRK");
          _SFD_SET_DATA_PROPS(19,2,0,1,"DTRK");
          _SFD_SET_DATA_PROPS(20,2,0,1,"TRKERR");
          _SFD_SET_DATA_PROPS(21,2,0,1,"XTRK");
          _SFD_SET_DATA_PROPS(22,1,1,0,"DTG");
          _SFD_SET_DATA_PROPS(23,2,0,1,"OK");
          _SFD_SET_DATA_PROPS(24,1,1,0,"on_track0");
          _SFD_SET_DATA_PROPS(25,2,0,1,"on_track");
          _SFD_SET_DATA_PROPS(26,1,1,0,"times");
          _SFD_SET_DATA_PROPS(27,2,0,1,"tim");
          _SFD_SET_DATA_PROPS(28,2,0,1,"rollout");
          _SFD_SET_DATA_PROPS(29,1,1,0,"vel");
          _SFD_STATE_INFO(0,0,2);
          _SFD_CH_SUBSTATE_COUNT(0);
          _SFD_CH_SUBSTATE_DECOMP(0);
        }

        _SFD_CV_INIT_CHART(0,0,0,0);

        {
          _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
        }

        _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);

        /* Initialization of MATLAB Function Model Coverage */
        _SFD_CV_INIT_EML(0,1,1,18,0,0,0,0,0,11,4);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,5176);
        _SFD_CV_INIT_EML_IF(0,1,0,1850,1885,3336,5055);
        _SFD_CV_INIT_EML_IF(0,1,1,1981,1995,2014,2040);
        _SFD_CV_INIT_EML_IF(0,1,2,2358,2371,2403,2421);
        _SFD_CV_INIT_EML_IF(0,1,3,2403,2421,-1,2421);
        _SFD_CV_INIT_EML_IF(0,1,4,2775,2838,2968,3230);
        _SFD_CV_INIT_EML_IF(0,1,5,3886,3894,-1,3925);
        _SFD_CV_INIT_EML_IF(0,1,6,4010,4021,4047,4062);
        _SFD_CV_INIT_EML_IF(0,1,7,4047,4062,-1,4062);
        _SFD_CV_INIT_EML_IF(0,1,8,4101,4112,4156,4322);
        _SFD_CV_INIT_EML_IF(0,1,9,4156,4172,4215,4322);
        _SFD_CV_INIT_EML_IF(0,1,10,4215,4228,4271,4322);
        _SFD_CV_INIT_EML_IF(0,1,11,4338,4349,4378,4394);
        _SFD_CV_INIT_EML_IF(0,1,12,4378,4394,-1,4394);
        _SFD_CV_INIT_EML_IF(0,1,13,4533,4546,4578,4596);
        _SFD_CV_INIT_EML_IF(0,1,14,4578,4596,-1,4596);
        _SFD_CV_INIT_EML_IF(0,1,15,4784,4808,4857,4904);
        _SFD_CV_INIT_EML_IF(0,1,16,4948,4993,5012,5038);
        _SFD_CV_INIT_EML_IF(0,1,17,5092,5101,5145,5173);

        {
          static int condStart[] = { 1853, 1871 };

          static int condEnd[] = { 1867, 1885 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,1,0,1853,1885,2,0,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 2778, 2793, 2805, 2822 };

          static int condEnd[] = { 2789, 2801, 2818, 2837 };

          static int pfixExpr[] = { 0, 1, -3, 2, 3, -3, -3 };

          _SFD_CV_INIT_EML_MCDC(0,1,1,2778,2838,4,2,&(condStart[0]),&(condEnd[0]),
                                7,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 4787, 4799 };

          static int condEnd[] = { 4795, 4808 };

          static int pfixExpr[] = { 0, 1, -3 };

          _SFD_CV_INIT_EML_MCDC(0,1,2,4787,4808,2,6,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 4952, 4967, 4982 };

          static int condEnd[] = { 4963, 4978, 4993 };

          static int pfixExpr[] = { 0, 1, -3, 2, -3 };

          _SFD_CV_INIT_EML_MCDC(0,1,3,4952,4993,3,8,&(condStart[0]),&(condEnd[0]),
                                5,&(pfixExpr[0]));
        }

        _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(5,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(6,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(7,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(8,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(9,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 12;
          _SFD_SET_DATA_COMPILED_PROPS(10,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
        }

        _SFD_SET_DATA_COMPILED_PROPS(11,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(12,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(13,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(14,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(15,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(16,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(17,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(18,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(19,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(20,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(21,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(22,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(23,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(24,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(25,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(26,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);
        _SFD_SET_DATA_COMPILED_PROPS(27,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(28,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)c2_sf_marshallIn);
        _SFD_SET_DATA_COMPILED_PROPS(29,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)NULL);

        {
          real_T *c2_dist1;
          real_T *c2_dist_2;
          real_T *c2_lon;
          real_T *c2_lat;
          real_T *c2_alt;
          real_T *c2_h;
          real_T *c2_hpath;
          real_T *c2_betta;
          real_T *c2_roll;
          real_T *c2_TRK;
          real_T *c2_DTRK;
          real_T *c2_TRKERR;
          real_T *c2_XTRK;
          real_T *c2_DTG;
          real_T *c2_OK;
          real_T *c2_on_track0;
          real_T *c2_on_track;
          real_T *c2_times;
          real_T *c2_tim;
          real_T *c2_rollout;
          real_T *c2_vel;
          real_T (*c2_nt)[12];
          real_T (*c2_latt)[12];
          real_T (*c2_lont)[12];
          real_T (*c2_altt)[12];
          real_T (*c2_speed)[12];
          real_T (*c2_okt)[12];
          real_T (*c2_Rlat)[12];
          real_T (*c2_Rlon)[12];
          real_T (*c2_dc)[12];
          c2_vel = (real_T *)ssGetInputPortSignal(chartInstance->S, 18);
          c2_rollout = (real_T *)ssGetOutputPortSignal(chartInstance->S, 11);
          c2_tim = (real_T *)ssGetOutputPortSignal(chartInstance->S, 10);
          c2_times = (real_T *)ssGetInputPortSignal(chartInstance->S, 17);
          c2_on_track = (real_T *)ssGetOutputPortSignal(chartInstance->S, 9);
          c2_on_track0 = (real_T *)ssGetInputPortSignal(chartInstance->S, 16);
          c2_OK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 8);
          c2_DTG = (real_T *)ssGetInputPortSignal(chartInstance->S, 15);
          c2_XTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 7);
          c2_TRKERR = (real_T *)ssGetOutputPortSignal(chartInstance->S, 6);
          c2_DTRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 5);
          c2_TRK = (real_T *)ssGetOutputPortSignal(chartInstance->S, 4);
          c2_roll = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
          c2_betta = (real_T *)ssGetInputPortSignal(chartInstance->S, 14);
          c2_hpath = (real_T *)ssGetInputPortSignal(chartInstance->S, 13);
          c2_h = (real_T *)ssGetInputPortSignal(chartInstance->S, 12);
          c2_alt = (real_T *)ssGetInputPortSignal(chartInstance->S, 11);
          c2_lat = (real_T *)ssGetInputPortSignal(chartInstance->S, 10);
          c2_lon = (real_T *)ssGetInputPortSignal(chartInstance->S, 9);
          c2_dc = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 8);
          c2_Rlon = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 7);
          c2_Rlat = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 6);
          c2_okt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 5);
          c2_speed = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 4);
          c2_altt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 3);
          c2_lont = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 2);
          c2_latt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 1);
          c2_nt = (real_T (*)[12])ssGetInputPortSignal(chartInstance->S, 0);
          c2_dist_2 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
          c2_dist1 = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
          _SFD_SET_DATA_VALUE_PTR(0U, c2_dist1);
          _SFD_SET_DATA_VALUE_PTR(1U, c2_dist_2);
          _SFD_SET_DATA_VALUE_PTR(2U, *c2_nt);
          _SFD_SET_DATA_VALUE_PTR(3U, *c2_latt);
          _SFD_SET_DATA_VALUE_PTR(4U, *c2_lont);
          _SFD_SET_DATA_VALUE_PTR(5U, *c2_altt);
          _SFD_SET_DATA_VALUE_PTR(6U, *c2_speed);
          _SFD_SET_DATA_VALUE_PTR(7U, *c2_okt);
          _SFD_SET_DATA_VALUE_PTR(8U, *c2_Rlat);
          _SFD_SET_DATA_VALUE_PTR(9U, *c2_Rlon);
          _SFD_SET_DATA_VALUE_PTR(10U, *c2_dc);
          _SFD_SET_DATA_VALUE_PTR(11U, c2_lon);
          _SFD_SET_DATA_VALUE_PTR(12U, c2_lat);
          _SFD_SET_DATA_VALUE_PTR(13U, c2_alt);
          _SFD_SET_DATA_VALUE_PTR(14U, c2_h);
          _SFD_SET_DATA_VALUE_PTR(15U, c2_hpath);
          _SFD_SET_DATA_VALUE_PTR(16U, c2_betta);
          _SFD_SET_DATA_VALUE_PTR(17U, c2_roll);
          _SFD_SET_DATA_VALUE_PTR(18U, c2_TRK);
          _SFD_SET_DATA_VALUE_PTR(19U, c2_DTRK);
          _SFD_SET_DATA_VALUE_PTR(20U, c2_TRKERR);
          _SFD_SET_DATA_VALUE_PTR(21U, c2_XTRK);
          _SFD_SET_DATA_VALUE_PTR(22U, c2_DTG);
          _SFD_SET_DATA_VALUE_PTR(23U, c2_OK);
          _SFD_SET_DATA_VALUE_PTR(24U, c2_on_track0);
          _SFD_SET_DATA_VALUE_PTR(25U, c2_on_track);
          _SFD_SET_DATA_VALUE_PTR(26U, c2_times);
          _SFD_SET_DATA_VALUE_PTR(27U, c2_tim);
          _SFD_SET_DATA_VALUE_PTR(28U, c2_rollout);
          _SFD_SET_DATA_VALUE_PTR(29U, c2_vel);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
        _mainMachineNumber_,chartInstance->chartNumber,
        chartInstance->instanceNumber);
    }
  }
}

static const char* sf_get_instance_specialization(void)
{
  return "yCbKaeEYF2tKy5nCSLGkPC";
}

static void sf_opaque_initialize_c2_main(void *chartInstanceVar)
{
  chart_debug_initialization(((SFc2_mainInstanceStruct*) chartInstanceVar)->S,0);
  initialize_params_c2_main((SFc2_mainInstanceStruct*) chartInstanceVar);
  initialize_c2_main((SFc2_mainInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_enable_c2_main(void *chartInstanceVar)
{
  enable_c2_main((SFc2_mainInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_disable_c2_main(void *chartInstanceVar)
{
  disable_c2_main((SFc2_mainInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_gateway_c2_main(void *chartInstanceVar)
{
  sf_gateway_c2_main((SFc2_mainInstanceStruct*) chartInstanceVar);
}

extern const mxArray* sf_internal_get_sim_state_c2_main(SimStruct* S)
{
  ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
  ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
  mxArray *plhs[1] = { NULL };

  mxArray *prhs[4];
  int mxError = 0;
  prhs[0] = mxCreateString("chart_simctx_raw2high");
  prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
  prhs[2] = (mxArray*) get_sim_state_c2_main((SFc2_mainInstanceStruct*)
    chartInfo->chartInstance);         /* raw sim ctx */
  prhs[3] = (mxArray*) sf_get_sim_state_info_c2_main();/* state var info */
  mxError = sf_mex_call_matlab(1, plhs, 4, prhs, "sfprivate");
  mxDestroyArray(prhs[0]);
  mxDestroyArray(prhs[1]);
  mxDestroyArray(prhs[2]);
  mxDestroyArray(prhs[3]);
  if (mxError || plhs[0] == NULL) {
    sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_raw2high'.\n");
  }

  return plhs[0];
}

extern void sf_internal_set_sim_state_c2_main(SimStruct* S, const mxArray *st)
{
  ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
  ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
  mxArray *plhs[1] = { NULL };

  mxArray *prhs[3];
  int mxError = 0;
  prhs[0] = mxCreateString("chart_simctx_high2raw");
  prhs[1] = mxDuplicateArray(st);      /* high level simctx */
  prhs[2] = (mxArray*) sf_get_sim_state_info_c2_main();/* state var info */
  mxError = sf_mex_call_matlab(1, plhs, 3, prhs, "sfprivate");
  mxDestroyArray(prhs[0]);
  mxDestroyArray(prhs[1]);
  mxDestroyArray(prhs[2]);
  if (mxError || plhs[0] == NULL) {
    sf_mex_error_message("Stateflow Internal Error: \nError calling 'chart_simctx_high2raw'.\n");
  }

  set_sim_state_c2_main((SFc2_mainInstanceStruct*)chartInfo->chartInstance,
                        mxDuplicateArray(plhs[0]));
  mxDestroyArray(plhs[0]);
}

static const mxArray* sf_opaque_get_sim_state_c2_main(SimStruct* S)
{
  return sf_internal_get_sim_state_c2_main(S);
}

static void sf_opaque_set_sim_state_c2_main(SimStruct* S, const mxArray *st)
{
  sf_internal_set_sim_state_c2_main(S, st);
}

static void sf_opaque_terminate_c2_main(void *chartInstanceVar)
{
  if (chartInstanceVar!=NULL) {
    SimStruct *S = ((SFc2_mainInstanceStruct*) chartInstanceVar)->S;
    ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
    if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
      sf_clear_rtw_identifier(S);
      unload_main_optimization_info();
    }

    finalize_c2_main((SFc2_mainInstanceStruct*) chartInstanceVar);
    utFree((void *)chartInstanceVar);
    if (crtInfo != NULL) {
      utFree((void *)crtInfo);
    }

    ssSetUserData(S,NULL);
  }
}

static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
  initSimStructsc2_main((SFc2_mainInstanceStruct*) chartInstanceVar);
}

extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c2_main(SimStruct *S)
{
  int i;
  for (i=0;i<ssGetNumRunTimeParams(S);i++) {
    if (ssGetSFcnParamTunable(S,i)) {
      ssUpdateDlgParamAsRunTimeParam(S,i);
    }
  }

  if (sf_machine_global_initializer_called()) {
    ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
    ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
    initialize_params_c2_main((SFc2_mainInstanceStruct*)
      (chartInfo->chartInstance));
  }
}

static void mdlSetWorkWidths_c2_main(SimStruct *S)
{
  if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
    mxArray *infoStruct = load_main_optimization_info();
    int_T chartIsInlinable =
      (int_T)sf_is_chart_inlinable(sf_get_instance_specialization(),infoStruct,2);
    ssSetStateflowIsInlinable(S,chartIsInlinable);
    ssSetRTWCG(S,sf_rtw_info_uint_prop(sf_get_instance_specialization(),
                infoStruct,2,"RTWCG"));
    ssSetEnableFcnIsTrivial(S,1);
    ssSetDisableFcnIsTrivial(S,1);
    ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop
      (sf_get_instance_specialization(),infoStruct,2,
       "gatewayCannotBeInlinedMultipleTimes"));
    sf_update_buildInfo(sf_get_instance_specialization(),infoStruct,2);
    if (chartIsInlinable) {
      ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 3, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 4, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 5, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 6, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 7, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 8, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 9, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 10, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 11, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 12, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 13, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 14, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 15, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 16, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 17, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 18, SS_REUSABLE_AND_LOCAL);
      sf_mark_chart_expressionable_inputs(S,sf_get_instance_specialization(),
        infoStruct,2,19);
      sf_mark_chart_reusable_outputs(S,sf_get_instance_specialization(),
        infoStruct,2,11);
    }

    {
      unsigned int outPortIdx;
      for (outPortIdx=1; outPortIdx<=11; ++outPortIdx) {
        ssSetOutputPortOptimizeInIR(S, outPortIdx, 1U);
      }
    }

    {
      unsigned int inPortIdx;
      for (inPortIdx=0; inPortIdx < 19; ++inPortIdx) {
        ssSetInputPortOptimizeInIR(S, inPortIdx, 1U);
      }
    }

    sf_set_rtw_dwork_info(S,sf_get_instance_specialization(),infoStruct,2);
    ssSetHasSubFunctions(S,!(chartIsInlinable));
  } else {
  }

  ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
  ssSetChecksum0(S,(2519522374U));
  ssSetChecksum1(S,(2732536240U));
  ssSetChecksum2(S,(2564154377U));
  ssSetChecksum3(S,(1521773693U));
  ssSetmdlDerivatives(S, NULL);
  ssSetExplicitFCSSCtrl(S,1);
  ssSupportsMultipleExecInstances(S,1);
}

static void mdlRTW_c2_main(SimStruct *S)
{
  if (sim_mode_is_rtw_gen(S)) {
    ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
  }
}

static void mdlStart_c2_main(SimStruct *S)
{
  SFc2_mainInstanceStruct *chartInstance;
  ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)utMalloc(sizeof
    (ChartRunTimeInfo));
  chartInstance = (SFc2_mainInstanceStruct *)utMalloc(sizeof
    (SFc2_mainInstanceStruct));
  memset(chartInstance, 0, sizeof(SFc2_mainInstanceStruct));
  if (chartInstance==NULL) {
    sf_mex_error_message("Could not allocate memory for chart instance.");
  }

  chartInstance->chartInfo.chartInstance = chartInstance;
  chartInstance->chartInfo.isEMLChart = 1;
  chartInstance->chartInfo.chartInitialized = 0;
  chartInstance->chartInfo.sFunctionGateway = sf_opaque_gateway_c2_main;
  chartInstance->chartInfo.initializeChart = sf_opaque_initialize_c2_main;
  chartInstance->chartInfo.terminateChart = sf_opaque_terminate_c2_main;
  chartInstance->chartInfo.enableChart = sf_opaque_enable_c2_main;
  chartInstance->chartInfo.disableChart = sf_opaque_disable_c2_main;
  chartInstance->chartInfo.getSimState = sf_opaque_get_sim_state_c2_main;
  chartInstance->chartInfo.setSimState = sf_opaque_set_sim_state_c2_main;
  chartInstance->chartInfo.getSimStateInfo = sf_get_sim_state_info_c2_main;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c2_main;
  chartInstance->chartInfo.mdlStart = mdlStart_c2_main;
  chartInstance->chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c2_main;
  chartInstance->chartInfo.extModeExec = NULL;
  chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.storeCurrentConfiguration = NULL;
  chartInstance->chartInfo.debugInstance = sfGlobalDebugInstanceStruct;
  chartInstance->S = S;
  crtInfo->instanceInfo = (&(chartInstance->chartInfo));
  crtInfo->isJITEnabled = false;
  ssSetUserData(S,(void *)(crtInfo));  /* register the chart instance with simstruct */
  init_dsm_address_info(chartInstance);
  if (!sim_mode_is_rtw_gen(S)) {
  }

  sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
  chart_debug_initialization(S,1);
}

void c2_main_method_dispatcher(SimStruct *S, int_T method, void *data)
{
  switch (method) {
   case SS_CALL_MDL_START:
    mdlStart_c2_main(S);
    break;

   case SS_CALL_MDL_SET_WORK_WIDTHS:
    mdlSetWorkWidths_c2_main(S);
    break;

   case SS_CALL_MDL_PROCESS_PARAMETERS:
    mdlProcessParameters_c2_main(S);
    break;

   default:
    /* Unhandled method */
    sf_mex_error_message("Stateflow Internal Error:\n"
                         "Error calling c2_main_method_dispatcher.\n"
                         "Can't handle method %d.\n", method);
    break;
  }
}
