/* Include files */

#include "blascompat32.h"
#include "Hunt_crossley_Ident_sfun.h"
#include "c2_Hunt_crossley_Ident.h"
#include "mwmathutil.h"
#define CHARTINSTANCE_CHARTNUMBER      (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER   (chartInstance->instanceNumber)
#include "Hunt_crossley_Ident_sfun_debug_macros.h"

/* Type Definitions */

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

/* Variable Declarations */

/* Variable Definitions */
static const char * c2_debug_family_names[35] = { "kde_y", "kde_x", "n",
  "lambda", "SampNum", "nac", "count", "ParNum", "sigma2_RW", "sigma2", "epsi",
  "ye1", "inint_ths", "init_low", "init_high", "SampMin", "AccMin", "npdf",
  "ye1_candid", "dummy", "dumm", "prob_teta", "prob_epsi", "alpha", "z",
  "nargin", "nargout", "y", "u", "uc", "TETA_old", "Teta", "teta", "flag", "kde"
};

/* Function Declarations */
static void initialize_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void initialize_params_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void enable_c2_Hunt_crossley_Ident(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void disable_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void c2_update_debugger_state_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static const mxArray *get_sim_state_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void set_sim_state_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance, const mxArray *c2_st);
static void finalize_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void sf_c2_Hunt_crossley_Ident(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void c2_chartstep_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void initSimStructsc2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
  c2_chartNumber);
static const mxArray *c2_sf_marshallOut(void *chartInstanceVoid, void *c2_inData);
static void c2_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_kde, const char_T *c2_identifier, real_T
  c2_y[200]);
static void c2_b_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[200]);
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 real_T c2_c_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_flag, const char_T *c2_identifier);
static real_T c2_d_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_c_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static void c2_e_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_teta, const char_T *c2_identifier, real_T
  c2_y[4000]);
static void c2_f_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[4000]);
static void c2_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_d_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static void c2_g_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_Teta, const char_T *c2_identifier, real_T
  c2_y[3002]);
static void c2_h_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[3002]);
static void c2_d_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_e_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static const mxArray *c2_f_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static const mxArray *c2_g_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static void c2_i_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[2]);
static void c2_e_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_h_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static void c2_f_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[108]);
static void c2_b_info_helper(c2_ResolvedFunctionInfo c2_info[108]);
static real_T c2_mpower(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_a);
static void c2_eml_scalar_eg(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static real_T c2_sqrt(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                      real_T c2_x);
static void c2_eml_error(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static real_T c2_abs(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                     real_T c2_x);
static void c2_mean(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                    real_T c2_x[2002], real_T c2_y[2]);
static void c2_check_forloop_overflow_error
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static real_T c2_log10(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_x);
static void c2_b_eml_error(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static real_T c2_b_mpower(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_a, real_T c2_b);
static void c2_c_eml_error(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static real_T c2_rand(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void c2_genrandu(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  uint32_T c2_s, uint32_T *c2_e_state, real_T *c2_r);
static void c2_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2], uint32_T c2_f_state[2], real_T *c2_r);
static real_T c2_eml_rand_mt19937ar_stateful
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void c2_eml_rand_mt19937ar(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[625]);
static void c2_twister_state_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], real_T c2_seed, uint32_T c2_b_mt[625]);
static void c2_b_genrandu(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  uint32_T c2_mt[625], uint32_T c2_b_mt[625], real_T *c2_r);
static void c2_assert_valid_state(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void c2_genrand_uint32_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], uint32_T c2_b_mt[625], uint32_T c2_u[2]);
static void c2_d_eml_error(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void c2_randn(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                     real_T c2_r[2]);
static void c2_eml_rand_mcg16807(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state, uint32_T *c2_f_state, real_T *c2_r);
static void c2_b_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2], uint32_T c2_f_state[2], real_T *c2_r);
static void c2_b_eml_rand_mt19937ar(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[625], uint32_T c2_f_state[625], real_T
  *c2_r);
static real_T c2_b_rand(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static real_T c2_b_eml_rand_mt19937ar_stateful
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance);
static real_T c2_b_mean(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_x[100]);
static real_T c2_j_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_unifrnd, const char_T *c2_identifier);
static real_T c2_k_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_l_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_kde_x, const char_T *c2_identifier, real_T
  c2_y[100]);
static void c2_m_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[100]);
static const mxArray *c2_i_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData);
static int32_T c2_n_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_g_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static uint32_T c2_o_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_c_method, const char_T *c2_identifier);
static uint32_T c2_p_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static uint32_T c2_q_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_c_method, const char_T *c2_identifier);
static uint32_T c2_r_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static uint32_T c2_s_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier);
static uint32_T c2_t_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_u_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier,
  uint32_T c2_y[625]);
static void c2_v_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  uint32_T c2_y[625]);
static void c2_w_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier,
  uint32_T c2_y[2]);
static void c2_x_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  uint32_T c2_y[2]);
static void c2_y_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier,
  uint32_T c2_y[2]);
static void c2_ab_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  uint32_T c2_y[2]);
static uint8_T c2_bb_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_b_is_active_c2_Hunt_crossley_Ident, const
  char_T *c2_identifier);
static uint8_T c2_cb_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_b_sqrt(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                      real_T *c2_x);
static void c2_b_log10(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T *c2_x);
static real_T c2_c_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2]);
static void c2_b_twister_state_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], real_T c2_seed);
static real_T c2_c_genrandu(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625]);
static void c2_b_genrand_uint32_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], uint32_T c2_u[2]);
static real_T c2_b_eml_rand_mcg16807(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T *c2_e_state);
static real_T c2_d_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2]);
static real_T c2_c_eml_rand_mt19937ar(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[625]);
static void init_dsm_address_info(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance);

/* Function Definitions */
static void initialize_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  chartInstance->c2_sfEvent = CALL_EVENT;
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  chartInstance->c2_method_not_empty = FALSE;
  chartInstance->c2_state_not_empty = FALSE;
  chartInstance->c2_b_state_not_empty = FALSE;
  chartInstance->c2_c_state_not_empty = FALSE;
  chartInstance->c2_b_method_not_empty = FALSE;
  chartInstance->c2_d_state_not_empty = FALSE;
  chartInstance->c2_is_active_c2_Hunt_crossley_Ident = 0U;
}

static void initialize_params_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static void enable_c2_Hunt_crossley_Ident(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
}

static void disable_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
}

static void c2_update_debugger_state_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static const mxArray *get_sim_state_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  const mxArray *c2_st;
  const mxArray *c2_y = NULL;
  int32_T c2_i0;
  real_T c2_u[3002];
  const mxArray *c2_b_y = NULL;
  real_T c2_hoistedGlobal;
  real_T c2_b_u;
  const mxArray *c2_c_y = NULL;
  int32_T c2_i1;
  real_T c2_c_u[200];
  const mxArray *c2_d_y = NULL;
  int32_T c2_i2;
  real_T c2_d_u[4000];
  const mxArray *c2_e_y = NULL;
  uint32_T c2_b_hoistedGlobal;
  uint32_T c2_e_u;
  const mxArray *c2_f_y = NULL;
  uint32_T c2_c_hoistedGlobal;
  uint32_T c2_f_u;
  const mxArray *c2_g_y = NULL;
  uint32_T c2_d_hoistedGlobal;
  uint32_T c2_g_u;
  const mxArray *c2_h_y = NULL;
  int32_T c2_i3;
  uint32_T c2_h_u[625];
  const mxArray *c2_i_y = NULL;
  int32_T c2_i4;
  uint32_T c2_i_u[2];
  const mxArray *c2_j_y = NULL;
  int32_T c2_i5;
  uint32_T c2_j_u[2];
  const mxArray *c2_k_y = NULL;
  uint8_T c2_e_hoistedGlobal;
  uint8_T c2_k_u;
  const mxArray *c2_l_y = NULL;
  real_T *c2_flag;
  real_T (*c2_teta)[4000];
  real_T (*c2_kde)[200];
  real_T (*c2_Teta)[3002];
  c2_kde = (real_T (*)[200])ssGetOutputPortSignal(chartInstance->S, 4);
  c2_flag = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_teta = (real_T (*)[4000])ssGetOutputPortSignal(chartInstance->S, 2);
  c2_Teta = (real_T (*)[3002])ssGetOutputPortSignal(chartInstance->S, 1);
  c2_st = NULL;
  c2_st = NULL;
  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_createcellarray(11), FALSE);
  for (c2_i0 = 0; c2_i0 < 3002; c2_i0++) {
    c2_u[c2_i0] = (*c2_Teta)[c2_i0];
  }

  c2_b_y = NULL;
  sf_mex_assign(&c2_b_y, sf_mex_create("y", c2_u, 0, 0U, 1U, 0U, 2, 2, 1501),
                FALSE);
  sf_mex_setcell(c2_y, 0, c2_b_y);
  c2_hoistedGlobal = *c2_flag;
  c2_b_u = c2_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);
  for (c2_i1 = 0; c2_i1 < 200; c2_i1++) {
    c2_c_u[c2_i1] = (*c2_kde)[c2_i1];
  }

  c2_d_y = NULL;
  sf_mex_assign(&c2_d_y, sf_mex_create("y", c2_c_u, 0, 0U, 1U, 0U, 2, 2, 100),
                FALSE);
  sf_mex_setcell(c2_y, 2, c2_d_y);
  for (c2_i2 = 0; c2_i2 < 4000; c2_i2++) {
    c2_d_u[c2_i2] = (*c2_teta)[c2_i2];
  }

  c2_e_y = NULL;
  sf_mex_assign(&c2_e_y, sf_mex_create("y", c2_d_u, 0, 0U, 1U, 0U, 2, 2, 2000),
                FALSE);
  sf_mex_setcell(c2_y, 3, c2_e_y);
  c2_b_hoistedGlobal = chartInstance->c2_method;
  c2_e_u = c2_b_hoistedGlobal;
  c2_f_y = NULL;
  if (!chartInstance->c2_method_not_empty) {
    sf_mex_assign(&c2_f_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0),
                  FALSE);
  } else {
    sf_mex_assign(&c2_f_y, sf_mex_create("y", &c2_e_u, 7, 0U, 0U, 0U, 0), FALSE);
  }

  sf_mex_setcell(c2_y, 4, c2_f_y);
  c2_c_hoistedGlobal = chartInstance->c2_b_method;
  c2_f_u = c2_c_hoistedGlobal;
  c2_g_y = NULL;
  if (!chartInstance->c2_b_method_not_empty) {
    sf_mex_assign(&c2_g_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0),
                  FALSE);
  } else {
    sf_mex_assign(&c2_g_y, sf_mex_create("y", &c2_f_u, 7, 0U, 0U, 0U, 0), FALSE);
  }

  sf_mex_setcell(c2_y, 5, c2_g_y);
  c2_d_hoistedGlobal = chartInstance->c2_state;
  c2_g_u = c2_d_hoistedGlobal;
  c2_h_y = NULL;
  if (!chartInstance->c2_state_not_empty) {
    sf_mex_assign(&c2_h_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0),
                  FALSE);
  } else {
    sf_mex_assign(&c2_h_y, sf_mex_create("y", &c2_g_u, 7, 0U, 0U, 0U, 0), FALSE);
  }

  sf_mex_setcell(c2_y, 6, c2_h_y);
  for (c2_i3 = 0; c2_i3 < 625; c2_i3++) {
    c2_h_u[c2_i3] = chartInstance->c2_c_state[c2_i3];
  }

  c2_i_y = NULL;
  if (!chartInstance->c2_c_state_not_empty) {
    sf_mex_assign(&c2_i_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0),
                  FALSE);
  } else {
    sf_mex_assign(&c2_i_y, sf_mex_create("y", c2_h_u, 7, 0U, 1U, 0U, 1, 625),
                  FALSE);
  }

  sf_mex_setcell(c2_y, 7, c2_i_y);
  for (c2_i4 = 0; c2_i4 < 2; c2_i4++) {
    c2_i_u[c2_i4] = chartInstance->c2_b_state[c2_i4];
  }

  c2_j_y = NULL;
  if (!chartInstance->c2_b_state_not_empty) {
    sf_mex_assign(&c2_j_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0),
                  FALSE);
  } else {
    sf_mex_assign(&c2_j_y, sf_mex_create("y", c2_i_u, 7, 0U, 1U, 0U, 1, 2),
                  FALSE);
  }

  sf_mex_setcell(c2_y, 8, c2_j_y);
  for (c2_i5 = 0; c2_i5 < 2; c2_i5++) {
    c2_j_u[c2_i5] = chartInstance->c2_d_state[c2_i5];
  }

  c2_k_y = NULL;
  if (!chartInstance->c2_d_state_not_empty) {
    sf_mex_assign(&c2_k_y, sf_mex_create("y", NULL, 0, 0U, 1U, 0U, 2, 0, 0),
                  FALSE);
  } else {
    sf_mex_assign(&c2_k_y, sf_mex_create("y", c2_j_u, 7, 0U, 1U, 0U, 1, 2),
                  FALSE);
  }

  sf_mex_setcell(c2_y, 9, c2_k_y);
  c2_e_hoistedGlobal = chartInstance->c2_is_active_c2_Hunt_crossley_Ident;
  c2_k_u = c2_e_hoistedGlobal;
  c2_l_y = NULL;
  sf_mex_assign(&c2_l_y, sf_mex_create("y", &c2_k_u, 3, 0U, 0U, 0U, 0), FALSE);
  sf_mex_setcell(c2_y, 10, c2_l_y);
  sf_mex_assign(&c2_st, c2_y, FALSE);
  return c2_st;
}

static void set_sim_state_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance, const mxArray *c2_st)
{
  const mxArray *c2_u;
  real_T c2_dv0[3002];
  int32_T c2_i6;
  real_T c2_dv1[200];
  int32_T c2_i7;
  real_T c2_dv2[4000];
  int32_T c2_i8;
  uint32_T c2_uv0[625];
  int32_T c2_i9;
  uint32_T c2_uv1[2];
  int32_T c2_i10;
  uint32_T c2_uv2[2];
  int32_T c2_i11;
  real_T *c2_flag;
  real_T (*c2_Teta)[3002];
  real_T (*c2_kde)[200];
  real_T (*c2_teta)[4000];
  c2_kde = (real_T (*)[200])ssGetOutputPortSignal(chartInstance->S, 4);
  c2_flag = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_teta = (real_T (*)[4000])ssGetOutputPortSignal(chartInstance->S, 2);
  c2_Teta = (real_T (*)[3002])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c2_doneDoubleBufferReInit = TRUE;
  c2_u = sf_mex_dup(c2_st);
  c2_g_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 0)),
                        "Teta", c2_dv0);
  for (c2_i6 = 0; c2_i6 < 3002; c2_i6++) {
    (*c2_Teta)[c2_i6] = c2_dv0[c2_i6];
  }

  *c2_flag = c2_c_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u,
    1)), "flag");
  c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 2)), "kde",
                      c2_dv1);
  for (c2_i7 = 0; c2_i7 < 200; c2_i7++) {
    (*c2_kde)[c2_i7] = c2_dv1[c2_i7];
  }

  c2_e_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 3)),
                        "teta", c2_dv2);
  for (c2_i8 = 0; c2_i8 < 4000; c2_i8++) {
    (*c2_teta)[c2_i8] = c2_dv2[c2_i8];
  }

  chartInstance->c2_method = c2_o_emlrt_marshallIn(chartInstance, sf_mex_dup
    (sf_mex_getcell(c2_u, 4)), "method");
  chartInstance->c2_b_method = c2_q_emlrt_marshallIn(chartInstance, sf_mex_dup
    (sf_mex_getcell(c2_u, 5)), "method");
  chartInstance->c2_state = c2_s_emlrt_marshallIn(chartInstance, sf_mex_dup
    (sf_mex_getcell(c2_u, 6)), "state");
  c2_u_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 7)),
                        "state", c2_uv0);
  for (c2_i9 = 0; c2_i9 < 625; c2_i9++) {
    chartInstance->c2_c_state[c2_i9] = c2_uv0[c2_i9];
  }

  c2_w_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 8)),
                        "state", c2_uv1);
  for (c2_i10 = 0; c2_i10 < 2; c2_i10++) {
    chartInstance->c2_b_state[c2_i10] = c2_uv1[c2_i10];
  }

  c2_y_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 9)),
                        "state", c2_uv2);
  for (c2_i11 = 0; c2_i11 < 2; c2_i11++) {
    chartInstance->c2_d_state[c2_i11] = c2_uv2[c2_i11];
  }

  chartInstance->c2_is_active_c2_Hunt_crossley_Ident = c2_bb_emlrt_marshallIn
    (chartInstance, sf_mex_dup(sf_mex_getcell(c2_u, 10)),
     "is_active_c2_Hunt_crossley_Ident");
  sf_mex_destroy(&c2_u);
  c2_update_debugger_state_c2_Hunt_crossley_Ident(chartInstance);
  sf_mex_destroy(&c2_st);
}

static void finalize_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static void sf_c2_Hunt_crossley_Ident(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
  int32_T c2_i12;
  int32_T c2_i13;
  int32_T c2_i14;
  int32_T c2_i15;
  int32_T c2_i16;
  int32_T c2_i17;
  int32_T c2_i18;
  real_T *c2_flag;
  real_T (*c2_kde)[200];
  real_T (*c2_teta)[4000];
  real_T (*c2_TETA_old)[4000];
  real_T (*c2_uc)[100];
  real_T (*c2_u)[200];
  real_T (*c2_y)[100];
  real_T (*c2_Teta)[3002];
  c2_kde = (real_T (*)[200])ssGetOutputPortSignal(chartInstance->S, 4);
  c2_flag = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_teta = (real_T (*)[4000])ssGetOutputPortSignal(chartInstance->S, 2);
  c2_TETA_old = (real_T (*)[4000])ssGetInputPortSignal(chartInstance->S, 3);
  c2_uc = (real_T (*)[100])ssGetInputPortSignal(chartInstance->S, 2);
  c2_u = (real_T (*)[200])ssGetInputPortSignal(chartInstance->S, 1);
  c2_y = (real_T (*)[100])ssGetInputPortSignal(chartInstance->S, 0);
  c2_Teta = (real_T (*)[3002])ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  for (c2_i12 = 0; c2_i12 < 3002; c2_i12++) {
    _SFD_DATA_RANGE_CHECK((*c2_Teta)[c2_i12], 0U);
  }

  for (c2_i13 = 0; c2_i13 < 100; c2_i13++) {
    _SFD_DATA_RANGE_CHECK((*c2_y)[c2_i13], 1U);
  }

  for (c2_i14 = 0; c2_i14 < 200; c2_i14++) {
    _SFD_DATA_RANGE_CHECK((*c2_u)[c2_i14], 2U);
  }

  for (c2_i15 = 0; c2_i15 < 100; c2_i15++) {
    _SFD_DATA_RANGE_CHECK((*c2_uc)[c2_i15], 3U);
  }

  for (c2_i16 = 0; c2_i16 < 4000; c2_i16++) {
    _SFD_DATA_RANGE_CHECK((*c2_TETA_old)[c2_i16], 4U);
  }

  for (c2_i17 = 0; c2_i17 < 4000; c2_i17++) {
    _SFD_DATA_RANGE_CHECK((*c2_teta)[c2_i17], 5U);
  }

  _SFD_DATA_RANGE_CHECK(*c2_flag, 6U);
  for (c2_i18 = 0; c2_i18 < 200; c2_i18++) {
    _SFD_DATA_RANGE_CHECK((*c2_kde)[c2_i18], 7U);
  }

  chartInstance->c2_sfEvent = CALL_EVENT;
  c2_chartstep_c2_Hunt_crossley_Ident(chartInstance);
  sf_debug_check_for_state_inconsistency(_Hunt_crossley_IdentMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}

static void c2_chartstep_c2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  int32_T c2_i19;
  real_T c2_y[100];
  int32_T c2_i20;
  real_T c2_u[200];
  int32_T c2_i21;
  real_T c2_uc[100];
  int32_T c2_i22;
  static real_T c2_TETA_old[4000];
  uint32_T c2_debug_family_var_map[35];
  real_T c2_kde_y[100];
  real_T c2_kde_x[100];
  real_T c2_n;
  real_T c2_lambda;
  real_T c2_SampNum;
  real_T c2_nac;
  real_T c2_count;
  real_T c2_ParNum;
  real_T c2_sigma2_RW;
  real_T c2_sigma2;
  real_T c2_epsi[2];
  real_T c2_ye1;
  real_T c2_inint_ths;
  real_T c2_init_low;
  real_T c2_init_high;
  real_T c2_SampMin;
  real_T c2_AccMin;
  real_T c2_npdf;
  real_T c2_ye1_candid;
  real_T c2_dummy;
  real_T c2_dumm;
  real_T c2_prob_teta;
  real_T c2_prob_epsi;
  real_T c2_alpha;
  real_T c2_z;
  real_T c2_nargin = 4.0;
  real_T c2_nargout = 4.0;
  real_T c2_Teta[3002];
  real_T c2_teta[4000];
  real_T c2_flag;
  real_T c2_kde[200];
  int32_T c2_i23;
  int32_T c2_i24;
  int32_T c2_i25;
  int32_T c2_i26;
  int32_T c2_i2;
  real_T c2_b_i2;
  int32_T c2_i27;
  int32_T c2_i28;
  int32_T c2_i29;
  int32_T c2_i30;
  int32_T c2_i31;
  real_T c2_b_TETA_old[2002];
  real_T c2_dv3[2];
  int32_T c2_i32;
  real_T c2_b[2];
  int32_T c2_i33;
  int32_T c2_i34;
  int32_T c2_i35;
  int32_T c2_i36;
  int32_T c2_c_i2;
  real_T c2_a;
  real_T c2_b_b;
  real_T c2_b_y;
  real_T c2_b_a;
  real_T c2_c_b;
  real_T c2_c_a;
  real_T c2_d_b;
  real_T c2_c_y;
  real_T c2_d0;
  real_T c2_d1;
  real_T c2_e_b;
  real_T c2_d_y;
  real_T c2_x;
  real_T c2_b_x;
  real_T c2_d_a;
  real_T c2_f_b;
  real_T c2_e_y;
  real_T c2_A;
  real_T c2_c_x;
  real_T c2_d_x;
  real_T c2_f_y;
  real_T c2_e_x;
  real_T c2_f_x;
  real_T c2_g_b;
  real_T c2_g_y;
  real_T c2_d2;
  int32_T c2_k;
  real_T c2_b_k;
  real_T c2_e_a;
  real_T c2_h_y;
  real_T c2_g_x;
  real_T c2_h_x;
  real_T c2_f_a;
  int32_T c2_i37;
  int32_T c2_i_x;
  int32_T c2_i38;
  int32_T c2_d_i2;
  real_T c2_g_a;
  real_T c2_h_b;
  real_T c2_i_y;
  real_T c2_h_a;
  real_T c2_i_b;
  real_T c2_i_a;
  real_T c2_j_b;
  real_T c2_j_y;
  real_T c2_d3;
  real_T c2_d4;
  real_T c2_k_b;
  real_T c2_k_y;
  real_T c2_j_x;
  real_T c2_k_x;
  real_T c2_j_a;
  real_T c2_l_b;
  real_T c2_l_y;
  real_T c2_b_A;
  real_T c2_l_x;
  real_T c2_m_x;
  real_T c2_m_y;
  real_T c2_n_x;
  real_T c2_o_x;
  real_T c2_m_b;
  real_T c2_n_y;
  real_T c2_d5;
  real_T c2_varargin_2;
  real_T c2_varargin_3;
  real_T c2_o_y;
  real_T c2_p_y;
  real_T c2_yk;
  real_T c2_q_y;
  int32_T c2_i39;
  int32_T c2_i40;
  int32_T c2_i41;
  real_T c2_b_teta[4000];
  int32_T c2_i42;
  int32_T c2_i43;
  int32_T c2_i44;
  int32_T c2_i45;
  int32_T c2_i46;
  int32_T c2_i47;
  int32_T c2_i48;
  real_T c2_c_teta[4000];
  int32_T c2_i49;
  int32_T c2_i50;
  int32_T c2_i51;
  int32_T c2_i52;
  real_T c2_k_a;
  real_T c2_r_y;
  real_T c2_n_b;
  real_T c2_s_y;
  real_T c2_l_a;
  real_T c2_t_y;
  real_T c2_o_b;
  real_T c2_p_b;
  real_T c2_u_y;
  real_T c2_m_a;
  real_T c2_v_y;
  real_T c2_q_b;
  int32_T c2_i53;
  real_T c2_b_uc[100];
  real_T c2_b_u;
  const mxArray *c2_w_y = NULL;
  real_T c2_c_u;
  const mxArray *c2_x_y = NULL;
  real_T c2_d_u;
  const mxArray *c2_y_y = NULL;
  real_T c2_e_u;
  const mxArray *c2_ab_y = NULL;
  real_T c2_f_u;
  const mxArray *c2_bb_y = NULL;
  real_T c2_g_u;
  const mxArray *c2_cb_y = NULL;
  real_T c2_h_u;
  const mxArray *c2_db_y = NULL;
  real_T c2_i_u;
  const mxArray *c2_eb_y = NULL;
  real_T c2_j_u;
  const mxArray *c2_fb_y = NULL;
  real_T c2_k_u;
  const mxArray *c2_gb_y = NULL;
  real_T c2_l_u;
  const mxArray *c2_hb_y = NULL;
  real_T c2_m_u;
  const mxArray *c2_ib_y = NULL;
  int32_T c2_e_i2;
  real_T c2_n_a;
  real_T c2_r_b;
  real_T c2_jb_y;
  real_T c2_o_a;
  real_T c2_s_b;
  real_T c2_p_a;
  real_T c2_t_b;
  real_T c2_kb_y;
  real_T c2_d6;
  real_T c2_d7;
  real_T c2_u_b;
  real_T c2_lb_y;
  real_T c2_p_x;
  real_T c2_q_x;
  real_T c2_q_a;
  real_T c2_v_b;
  real_T c2_mb_y;
  real_T c2_c_A;
  real_T c2_r_x;
  real_T c2_s_x;
  real_T c2_nb_y;
  real_T c2_t_x;
  real_T c2_u_x;
  real_T c2_w_b;
  real_T c2_ob_y;
  real_T c2_d8;
  real_T c2_v_x;
  boolean_T c2_x_b;
  int32_T c2_c_k;
  real_T c2_r_a;
  int32_T c2_i54;
  int32_T c2_d_k;
  int32_T c2_i55;
  int32_T c2_f_i2;
  real_T c2_s_a;
  real_T c2_y_b;
  real_T c2_pb_y;
  real_T c2_t_a;
  real_T c2_ab_b;
  real_T c2_u_a;
  real_T c2_bb_b;
  real_T c2_qb_y;
  real_T c2_d9;
  real_T c2_d10;
  real_T c2_cb_b;
  real_T c2_rb_y;
  real_T c2_w_x;
  real_T c2_x_x;
  real_T c2_v_a;
  real_T c2_db_b;
  real_T c2_sb_y;
  real_T c2_d_A;
  real_T c2_y_x;
  real_T c2_ab_x;
  real_T c2_tb_y;
  real_T c2_bb_x;
  real_T c2_cb_x;
  real_T c2_eb_b;
  real_T c2_ub_y;
  real_T c2_d11;
  real_T c2_b_varargin_2;
  real_T c2_b_varargin_3;
  real_T c2_vb_y;
  real_T c2_wb_y;
  real_T c2_b_yk;
  real_T c2_xb_y;
  int32_T c2_e_k;
  int32_T c2_i56;
  int32_T c2_f_k;
  int32_T c2_g_k;
  int32_T c2_i57;
  real_T c2_d_teta[2];
  int32_T c2_i58;
  real_T c2_fb_b;
  real_T c2_yb_y;
  real_T c2_w_a;
  real_T c2_ac_y;
  real_T c2_gb_b;
  real_T c2_hb_b;
  real_T c2_bc_y;
  real_T c2_x_a;
  real_T c2_cc_y;
  real_T c2_ib_b;
  int32_T c2_i59;
  int32_T c2_i60;
  real_T c2_n_u[1501];
  const mxArray *c2_dc_y = NULL;
  const mxArray *c2_b_kde_y = NULL;
  const mxArray *c2_b_kde_x = NULL;
  real_T c2_dv4[100];
  int32_T c2_i61;
  real_T c2_dv5[100];
  int32_T c2_i62;
  int32_T c2_i63;
  int32_T c2_i64;
  int32_T c2_i65;
  int32_T c2_i66;
  int32_T c2_i67;
  int32_T c2_i68;
  real_T c2_o_u[1501];
  const mxArray *c2_ec_y = NULL;
  const mxArray *c2_c_kde_y = NULL;
  const mxArray *c2_c_kde_x = NULL;
  real_T c2_dv6[100];
  int32_T c2_i69;
  real_T c2_dv7[100];
  int32_T c2_i70;
  int32_T c2_i71;
  int32_T c2_i72;
  int32_T c2_i73;
  int32_T c2_i74;
  int32_T c2_i75;
  int32_T c2_i76;
  real_T *c2_b_flag;
  real_T (*c2_b_Teta)[3002];
  real_T (*c2_e_teta)[4000];
  real_T (*c2_b_kde)[200];
  real_T (*c2_c_TETA_old)[4000];
  real_T (*c2_c_uc)[100];
  real_T (*c2_p_u)[200];
  real_T (*c2_fc_y)[100];
  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;
  boolean_T guard8 = FALSE;
  boolean_T guard9 = FALSE;
  boolean_T guard10 = FALSE;
  int32_T exitg1;
  int32_T exitg2;
  int32_T exitg3;
  int32_T exitg4;
  int32_T exitg5;
  boolean_T guard11 = FALSE;
  c2_b_kde = (real_T (*)[200])ssGetOutputPortSignal(chartInstance->S, 4);
  c2_b_flag = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c2_e_teta = (real_T (*)[4000])ssGetOutputPortSignal(chartInstance->S, 2);
  c2_c_TETA_old = (real_T (*)[4000])ssGetInputPortSignal(chartInstance->S, 3);
  c2_c_uc = (real_T (*)[100])ssGetInputPortSignal(chartInstance->S, 2);
  c2_p_u = (real_T (*)[200])ssGetInputPortSignal(chartInstance->S, 1);
  c2_fc_y = (real_T (*)[100])ssGetInputPortSignal(chartInstance->S, 0);
  c2_b_Teta = (real_T (*)[3002])ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  for (c2_i19 = 0; c2_i19 < 100; c2_i19++) {
    c2_y[c2_i19] = (*c2_fc_y)[c2_i19];
  }

  for (c2_i20 = 0; c2_i20 < 200; c2_i20++) {
    c2_u[c2_i20] = (*c2_p_u)[c2_i20];
  }

  for (c2_i21 = 0; c2_i21 < 100; c2_i21++) {
    c2_uc[c2_i21] = (*c2_c_uc)[c2_i21];
  }

  for (c2_i22 = 0; c2_i22 < 4000; c2_i22++) {
    c2_TETA_old[c2_i22] = (*c2_c_TETA_old)[c2_i22];
  }

  sf_debug_symbol_scope_push_eml(0U, 35U, 35U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c2_kde_y, 0U, c2_h_sf_marshallOut,
    c2_f_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c2_kde_x, 1U, c2_h_sf_marshallOut,
    c2_f_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c2_n, 2U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c2_lambda, 3U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c2_SampNum, 4U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c2_nac, 5U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_count, 6U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c2_ParNum, 7U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c2_sigma2_RW, 8U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c2_sigma2, 9U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c2_epsi, 10U, c2_g_sf_marshallOut,
    c2_e_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_ye1, 11U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_inint_ths, 12U,
    c2_b_sf_marshallOut, c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_init_low, 13U,
    c2_b_sf_marshallOut, c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_init_high, 14U,
    c2_b_sf_marshallOut, c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c2_SampMin, 15U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c2_AccMin, 16U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c2_npdf, 17U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c2_ye1_candid, 18U,
    c2_b_sf_marshallOut, c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_dummy, 19U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_dumm, 20U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_prob_teta, 21U,
    c2_b_sf_marshallOut, c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_prob_epsi, 22U,
    c2_b_sf_marshallOut, c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_alpha, 23U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_z, 24U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargin, 25U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargout, 26U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c2_y, 27U, c2_e_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c2_u, 28U, c2_f_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c2_uc, 29U, c2_e_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c2_TETA_old, 30U, c2_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c2_Teta, 31U, c2_d_sf_marshallOut,
    c2_d_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c2_teta, 32U, c2_c_sf_marshallOut,
    c2_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_flag, 33U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c2_kde, 34U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 2);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 3);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
  for (c2_i23 = 0; c2_i23 < 100; c2_i23++) {
    c2_kde_y[c2_i23] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5);
  for (c2_i24 = 0; c2_i24 < 100; c2_i24++) {
    c2_kde_x[c2_i24] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 6);
  for (c2_i25 = 0; c2_i25 < 200; c2_i25++) {
    c2_kde[c2_i25] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 7);
  c2_n = 100.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 8);
  c2_lambda = 0.95;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 9);
  c2_SampNum = 2000.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 10);
  c2_nac = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 11);
  c2_count = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 12);
  c2_ParNum = 2.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 13);
  c2_sigma2_RW = 1.0E-7;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 14);
  c2_sigma2 = 0.003;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 16);
  for (c2_i26 = 0; c2_i26 < 2; c2_i26++) {
    c2_epsi[c2_i26] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 17);
  c2_ye1 = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 18);
  c2_flag = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 19);
  c2_inint_ths = 0.01;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 20);
  c2_init_low = -0.01;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 21);
  c2_init_high = 0.01;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 22);
  c2_SampMin = 1000.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 23);
  c2_AccMin = 0.9;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 24);
  c2_npdf = 132.98076013381089;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 26);
  c2_ye1_candid = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 30);
  c2_i2 = 0;
  while (c2_i2 < 100) {
    c2_b_i2 = 1.0 + (real_T)c2_i2;
    CV_EML_FOR(0, 1, 0, 1);
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 31);
    if (CV_EML_IF(0, 1, 0, c2_abs(chartInstance,
          c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)_SFD_INTEGER_CHECK("i2",
            c2_b_i2), 1, 100, 1, 0) + 99]) < 1.0E-5)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 32);
      c2_count++;
    }

    c2_i2++;
    sf_mex_listen_for_ctrl_c(chartInstance->S);
  }

  CV_EML_FOR(0, 1, 0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 36);
  if (CV_EML_IF(0, 1, 1, c2_count > 10.0)) {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 37);
    for (c2_i27 = 0; c2_i27 < 4000; c2_i27++) {
      c2_teta[c2_i27] = c2_TETA_old[c2_i27];
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 38);
    c2_flag = 2.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 43);
    c2_dummy = 0.0;
    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 44);
    c2_i28 = 0;
    for (c2_i29 = 0; c2_i29 < 2; c2_i29++) {
      c2_i30 = 0;
      for (c2_i31 = 0; c2_i31 < 1001; c2_i31++) {
        c2_b_TETA_old[c2_i31 + c2_i28] = c2_TETA_old[(c2_i30 + c2_i29) + 1998];
        c2_i30 += 2;
      }

      c2_i28 += 1001;
    }

    c2_mean(chartInstance, c2_b_TETA_old, c2_dv3);
    for (c2_i32 = 0; c2_i32 < 2; c2_i32++) {
      c2_b[c2_i32] = c2_dv3[c2_i32];
    }

    c2_i33 = 0;
    for (c2_i34 = 0; c2_i34 < 1999; c2_i34++) {
      for (c2_i35 = 0; c2_i35 < 2; c2_i35++) {
        c2_teta[c2_i35 + c2_i33] = c2_TETA_old[(c2_i35 + c2_i33) + 2];
      }

      c2_i33 += 2;
    }

    for (c2_i36 = 0; c2_i36 < 2; c2_i36++) {
      c2_teta[c2_i36 + 3998] = c2_b[c2_i36];
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 45);
    c2_c_i2 = 0;
    do {
      exitg5 = 0;
      if (c2_c_i2 < 100) {
        c2_b_i2 = 1.0 + (real_T)c2_c_i2;
        CV_EML_FOR(0, 1, 1, 1);
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 47);
        c2_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)_SFD_INTEGER_CHECK
          ("i2", c2_b_i2), 1, 100, 1, 0) - 1];
        c2_b_b = c2_teta[3999];
        c2_b_y = c2_a * c2_b_b;
        c2_b_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
          _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) + 99];
        c2_c_b = c2_teta[3998] + c2_b_y;
        c2_dumm = c2_b_a * c2_c_b;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 48);
        if (CV_EML_IF(0, 1, 2, c2_dumm < 0.0)) {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 49);
          c2_dummy = rtMinusInf;
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 50);
          exitg5 = 1;
        } else {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 52);
          c2_c_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
            _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1];
          c2_d_b = c2_teta[3999];
          c2_c_y = c2_c_a * c2_d_b;
          c2_d0 = c2_abs(chartInstance, c2_teta[3998] + c2_c_y);
          c2_b_log10(chartInstance, &c2_d0);
          c2_d1 = c2_abs(chartInstance, c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u",
            (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) + 99]);
          c2_b_log10(chartInstance, &c2_d1);
          c2_ye1 = c2_d1 + c2_d0;
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 53);
          c2_e_b = c2_n - c2_b_i2;
          c2_d_y = -0.95 * c2_e_b;
          c2_x = c2_d_y;
          c2_b_x = c2_x;
          c2_b_x = muDoubleScalarExp(c2_b_x);
          c2_d_a = -c2_b_x;
          c2_f_b = c2_mpower(chartInstance, c2_y[_SFD_EML_ARRAY_BOUNDS_CHECK("y",
                              (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100,
            1, 0) - 1] - c2_b_mpower(chartInstance, 10.0, c2_ye1));
          c2_e_y = c2_d_a * c2_f_b;
          c2_A = c2_e_y;
          c2_c_x = c2_A;
          c2_d_x = c2_c_x;
          c2_f_y = c2_d_x / 9.0E-6;
          c2_e_x = c2_f_y;
          c2_f_x = c2_e_x;
          c2_f_x = muDoubleScalarExp(c2_f_x);
          c2_g_b = c2_f_x;
          c2_g_y = 132.98076013381089 * c2_g_b;
          c2_d2 = c2_g_y;
          c2_b_log10(chartInstance, &c2_d2);
          c2_dummy += c2_d2;
          c2_c_i2++;
          sf_mex_listen_for_ctrl_c(chartInstance->S);
        }
      } else {
        CV_EML_FOR(0, 1, 1, 0);
        exitg5 = 1;
      }
    } while (exitg5 == 0);

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 60);
    if (CV_EML_IF(0, 1, 3, c2_b_mpower(chartInstance, 10.0, c2_dummy) >
                  c2_inint_ths)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 61);
      c2_prob_teta = c2_dummy;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 63);
      c2_sigma2_RW = 1.0E-9;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 64);
      c2_k = 0;
      do {
        exitg3 = 0;
        if (c2_k < 2000) {
          c2_b_k = 1.0 + (real_T)c2_k;
          CV_EML_FOR(0, 1, 2, 1);
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 68);
          c2_e_a = c2_rand(chartInstance);
          c2_h_y = c2_e_a * 2.0;
          c2_g_x = c2_h_y;
          c2_h_x = c2_g_x;
          c2_h_x = muDoubleScalarCeil(c2_h_x);
          c2_f_a = c2_sigma2_RW;
          c2_b_sqrt(chartInstance, &c2_f_a);
          c2_randn(chartInstance, c2_b);
          for (c2_i37 = 0; c2_i37 < 2; c2_i37++) {
            c2_b[c2_i37] *= c2_f_a;
          }

          c2_i_x = _SFD_EML_ARRAY_BOUNDS_CHECK("teta", (int32_T)
            _SFD_INTEGER_CHECK("ceil(rand*ParNum)", c2_h_x), 1, 2000, 2, 0) - 1;
          for (c2_i38 = 0; c2_i38 < 2; c2_i38++) {
            c2_epsi[c2_i38] = c2_teta[c2_i38 + (c2_i_x << 1)] + c2_b[c2_i38];
          }

          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 74);
          guard8 = FALSE;
          guard9 = FALSE;
          guard10 = FALSE;
          if (CV_EML_COND(0, 1, 0, c2_epsi[0] > 0.0)) {
            guard10 = TRUE;
          } else if (CV_EML_COND(0, 1, 1, c2_epsi[0] < -0.001)) {
            guard10 = TRUE;
          } else if (CV_EML_COND(0, 1, 2, c2_epsi[1] > 1.0E-7)) {
            guard9 = TRUE;
          } else if (CV_EML_COND(0, 1, 3, c2_epsi[1] < -1.0E-7)) {
            guard8 = TRUE;
          } else {
            CV_EML_MCDC(0, 1, 0, FALSE);
            CV_EML_IF(0, 1, 4, FALSE);
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 78);
            c2_ye1_candid = 0.0;
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 79);
            c2_dummy = 0.0;
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 80);
            c2_d_i2 = 0;
            do {
              exitg4 = 0;
              if (c2_d_i2 < 100) {
                c2_b_i2 = 1.0 + (real_T)c2_d_i2;
                CV_EML_FOR(0, 1, 3, 1);
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 84);
                c2_g_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
                  _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1];
                c2_h_b = c2_epsi[1];
                c2_i_y = c2_g_a * c2_h_b;
                c2_h_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
                  _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) + 99];
                c2_i_b = c2_epsi[0] + c2_i_y;
                c2_dumm = c2_h_a * c2_i_b;
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 86);
                if (CV_EML_IF(0, 1, 5, c2_dumm < 0.0)) {
                  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 87);
                  c2_dummy = rtMinusInf;
                  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 88);
                  exitg4 = 1;
                } else {
                  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 90);
                  c2_i_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
                    _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1];
                  c2_j_b = c2_epsi[1];
                  c2_j_y = c2_i_a * c2_j_b;
                  c2_d3 = c2_abs(chartInstance, c2_epsi[0] + c2_j_y);
                  c2_b_log10(chartInstance, &c2_d3);
                  c2_d4 = c2_abs(chartInstance, c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK
                                 ("u", (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2),
                                  1, 100, 1, 0) + 99]);
                  c2_b_log10(chartInstance, &c2_d4);
                  c2_ye1_candid = c2_d4 + c2_d3;
                  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 95);
                  c2_k_b = c2_n - c2_b_i2;
                  c2_k_y = -0.95 * c2_k_b;
                  c2_j_x = c2_k_y;
                  c2_k_x = c2_j_x;
                  c2_k_x = muDoubleScalarExp(c2_k_x);
                  c2_j_a = -c2_k_x;
                  c2_l_b = c2_mpower(chartInstance,
                                     c2_y[_SFD_EML_ARRAY_BOUNDS_CHECK("y",
                    (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) -
                                     1] - c2_b_mpower(chartInstance, 10.0,
                    c2_ye1_candid));
                  c2_l_y = c2_j_a * c2_l_b;
                  c2_b_A = c2_l_y;
                  c2_l_x = c2_b_A;
                  c2_m_x = c2_l_x;
                  c2_m_y = c2_m_x / 9.0E-6;
                  c2_n_x = c2_m_y;
                  c2_o_x = c2_n_x;
                  c2_o_x = muDoubleScalarExp(c2_o_x);
                  c2_m_b = c2_o_x;
                  c2_n_y = 132.98076013381089 * c2_m_b;
                  c2_d5 = c2_n_y;
                  c2_b_log10(chartInstance, &c2_d5);
                  c2_dummy += c2_d5;
                  c2_d_i2++;
                  sf_mex_listen_for_ctrl_c(chartInstance->S);
                }
              } else {
                CV_EML_FOR(0, 1, 3, 0);
                exitg4 = 1;
              }
            } while (exitg4 == 0);

            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 99);
            c2_prob_epsi = c2_dummy;
          }

          if (guard10 == TRUE) {
            guard9 = TRUE;
          }

          if (guard9 == TRUE) {
            guard8 = TRUE;
          }

          if (guard8 == TRUE) {
            CV_EML_MCDC(0, 1, 0, TRUE);
            CV_EML_IF(0, 1, 4, TRUE);
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 75);
            c2_prob_epsi = rtMinusInf;
          }

          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 102);
          c2_varargin_2 = c2_b_mpower(chartInstance, 10.0, c2_prob_epsi -
            c2_prob_teta);
          c2_varargin_3 = c2_varargin_2;
          c2_o_y = c2_varargin_3;
          c2_p_y = c2_o_y;
          c2_eml_scalar_eg(chartInstance);
          c2_yk = c2_p_y;
          c2_q_y = c2_yk;
          c2_eml_scalar_eg(chartInstance);
          c2_alpha = muDoubleScalarMin(1.0, c2_q_y);
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 103);
          c2_z = c2_b_rand(chartInstance);
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 105);
          if (CV_EML_IF(0, 1, 6, c2_z < c2_alpha)) {
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 106);
            c2_i39 = 0;
            for (c2_i40 = 0; c2_i40 < 1999; c2_i40++) {
              for (c2_i41 = 0; c2_i41 < 2; c2_i41++) {
                c2_b_teta[c2_i41 + c2_i39] = c2_teta[(c2_i41 + c2_i39) + 2];
              }

              c2_i39 += 2;
            }

            for (c2_i42 = 0; c2_i42 < 2; c2_i42++) {
              c2_b_teta[c2_i42 + 3998] = c2_epsi[c2_i42];
            }

            c2_i43 = 0;
            for (c2_i44 = 0; c2_i44 < 2000; c2_i44++) {
              for (c2_i45 = 0; c2_i45 < 2; c2_i45++) {
                c2_teta[c2_i45 + c2_i43] = c2_b_teta[c2_i45 + c2_i43];
              }

              c2_i43 += 2;
            }

            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 107);
            c2_prob_teta = c2_prob_epsi;
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 108);
            c2_nac++;
          } else {
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 110);
            c2_i46 = 0;
            for (c2_i47 = 0; c2_i47 < 1999; c2_i47++) {
              for (c2_i48 = 0; c2_i48 < 2; c2_i48++) {
                c2_c_teta[c2_i48 + c2_i46] = c2_teta[(c2_i48 + c2_i46) + 2];
              }

              c2_i46 += 2;
            }

            for (c2_i49 = 0; c2_i49 < 2; c2_i49++) {
              c2_c_teta[c2_i49 + 3998] = c2_teta[c2_i49 + 3998];
            }

            c2_i50 = 0;
            for (c2_i51 = 0; c2_i51 < 2000; c2_i51++) {
              for (c2_i52 = 0; c2_i52 < 2; c2_i52++) {
                c2_teta[c2_i52 + c2_i50] = c2_c_teta[c2_i52 + c2_i50];
              }

              c2_i50 += 2;
            }
          }

          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 113);
          guard11 = FALSE;
          if (CV_EML_COND(0, 1, 4, c2_b_k > c2_SampMin)) {
            c2_k_a = c2_b_k;
            c2_r_y = c2_k_a * 0.9;
            if (CV_EML_COND(0, 1, 5, c2_nac < c2_r_y)) {
              CV_EML_MCDC(0, 1, 1, TRUE);
              CV_EML_IF(0, 1, 7, TRUE);
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 114);
              exitg3 = 1;
            } else {
              guard11 = TRUE;
            }
          } else {
            guard11 = TRUE;
          }

          if (guard11 == TRUE) {
            CV_EML_MCDC(0, 1, 1, FALSE);
            CV_EML_IF(0, 1, 7, FALSE);
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 116);
            guard7 = FALSE;
            if (CV_EML_COND(0, 1, 6, c2_b_k == 750.0)) {
              c2_n_b = c2_b_k;
              c2_s_y = 0.5 * c2_n_b;
              c2_l_a = c2_s_y;
              c2_t_y = c2_l_a * 0.9;
              if (CV_EML_COND(0, 1, 7, c2_nac < c2_t_y)) {
                CV_EML_MCDC(0, 1, 2, TRUE);
                CV_EML_IF(0, 1, 8, TRUE);
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 117);
                c2_o_b = c2_sigma2_RW;
                c2_sigma2_RW = 0.1 * c2_o_b;
              } else {
                guard7 = TRUE;
              }
            } else {
              guard7 = TRUE;
            }

            if (guard7 == TRUE) {
              CV_EML_MCDC(0, 1, 2, FALSE);
              CV_EML_IF(0, 1, 8, FALSE);
            }

            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 119);
            guard6 = FALSE;
            if (CV_EML_COND(0, 1, 8, c2_b_k == 500.0)) {
              c2_p_b = c2_b_k;
              c2_u_y = 0.5 * c2_p_b;
              c2_m_a = c2_u_y;
              c2_v_y = c2_m_a * 0.9;
              if (CV_EML_COND(0, 1, 9, c2_nac < c2_v_y)) {
                CV_EML_MCDC(0, 1, 3, TRUE);
                CV_EML_IF(0, 1, 9, TRUE);
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 120);
                c2_q_b = c2_sigma2_RW;
                c2_sigma2_RW = 0.1 * c2_q_b;
              } else {
                guard6 = TRUE;
              }
            } else {
              guard6 = TRUE;
            }

            if (guard6 == TRUE) {
              CV_EML_MCDC(0, 1, 3, FALSE);
              CV_EML_IF(0, 1, 9, FALSE);
            }

            c2_k++;
            sf_mex_listen_for_ctrl_c(chartInstance->S);
          }
        } else {
          CV_EML_FOR(0, 1, 2, 0);
          exitg3 = 1;
        }
      } while (exitg3 == 0);

      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 125);
      c2_flag = 1.0;
    }

    _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 130U);
    if (CV_EML_IF(0, 1, 10, c2_flag == 0.0)) {
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 131U);
      c2_dummy = rtMinusInf;
      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 133U);
      while (CV_EML_WHILE(0, 1, 0, c2_b_mpower(chartInstance, 10.0, c2_dummy) <
                          c2_b_mpower(chartInstance, 10.0, 22.0))) {
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 134U);
        for (c2_i53 = 0; c2_i53 < 100; c2_i53++) {
          c2_b_uc[c2_i53] = c2_uc[c2_i53];
        }

        if (CV_EML_IF(0, 1, 11, c2_b_mean(chartInstance, c2_b_uc) > 0.0)) {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 135U);
          c2_b_u = -0.001;
          c2_w_y = NULL;
          sf_mex_assign(&c2_w_y, sf_mex_create("y", &c2_b_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_c_u = -0.0001;
          c2_x_y = NULL;
          sf_mex_assign(&c2_x_y, sf_mex_create("y", &c2_c_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_d_u = 1.0;
          c2_y_y = NULL;
          sf_mex_assign(&c2_y_y, sf_mex_create("y", &c2_d_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_teta[0] = c2_j_emlrt_marshallIn(chartInstance, sf_mex_call_debug(
            "unifrnd", 1U, 3U, 14, c2_w_y, 14, c2_x_y, 14, c2_y_y), "unifrnd");
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 136U);
          c2_e_u = 0.0;
          c2_ab_y = NULL;
          sf_mex_assign(&c2_ab_y, sf_mex_create("y", &c2_e_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_f_u = 1.0E-7;
          c2_bb_y = NULL;
          sf_mex_assign(&c2_bb_y, sf_mex_create("y", &c2_f_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_g_u = 1.0;
          c2_cb_y = NULL;
          sf_mex_assign(&c2_cb_y, sf_mex_create("y", &c2_g_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_teta[1] = c2_j_emlrt_marshallIn(chartInstance, sf_mex_call_debug(
            "unifrnd", 1U, 3U, 14, c2_ab_y, 14, c2_bb_y, 14, c2_cb_y), "unifrnd");
        } else {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 138U);
          c2_h_u = -0.0001;
          c2_db_y = NULL;
          sf_mex_assign(&c2_db_y, sf_mex_create("y", &c2_h_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_i_u = -1.0E-5;
          c2_eb_y = NULL;
          sf_mex_assign(&c2_eb_y, sf_mex_create("y", &c2_i_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_j_u = 1.0;
          c2_fb_y = NULL;
          sf_mex_assign(&c2_fb_y, sf_mex_create("y", &c2_j_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_teta[0] = c2_j_emlrt_marshallIn(chartInstance, sf_mex_call_debug(
            "unifrnd", 1U, 3U, 14, c2_db_y, 14, c2_eb_y, 14, c2_fb_y), "unifrnd");
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 139U);
          c2_k_u = -1.0E-7;
          c2_gb_y = NULL;
          sf_mex_assign(&c2_gb_y, sf_mex_create("y", &c2_k_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_l_u = 0.0;
          c2_hb_y = NULL;
          sf_mex_assign(&c2_hb_y, sf_mex_create("y", &c2_l_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_m_u = 1.0;
          c2_ib_y = NULL;
          sf_mex_assign(&c2_ib_y, sf_mex_create("y", &c2_m_u, 0, 0U, 0U, 0U, 0),
                        FALSE);
          c2_teta[1] = c2_j_emlrt_marshallIn(chartInstance, sf_mex_call_debug(
            "unifrnd", 1U, 3U, 14, c2_gb_y, 14, c2_hb_y, 14, c2_ib_y), "unifrnd");
        }

        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 141U);
        c2_count = 0.0;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 142U);
        c2_dummy = 0.0;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 146U);
        c2_e_i2 = 0;
        do {
          exitg2 = 0;
          if (c2_e_i2 < 100) {
            c2_b_i2 = 1.0 + (real_T)c2_e_i2;
            CV_EML_FOR(0, 1, 4, 1);
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 149U);
            c2_n_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
              _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1];
            c2_r_b = c2_teta[1];
            c2_jb_y = c2_n_a * c2_r_b;
            c2_o_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
              _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) + 99];
            c2_s_b = c2_teta[0] + c2_jb_y;
            c2_dumm = c2_o_a * c2_s_b;
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 150U);
            if (CV_EML_IF(0, 1, 12, c2_dumm < 0.0)) {
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 151U);
              c2_count++;
            }

            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 153U);
            if (CV_EML_IF(0, 1, 13, c2_count > 3.0)) {
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 154U);
              c2_dummy = rtMinusInf;
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 155U);
              exitg2 = 1;
            } else {
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 157U);
              c2_p_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
                _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1];
              c2_t_b = c2_teta[1];
              c2_kb_y = c2_p_a * c2_t_b;
              c2_d6 = c2_abs(chartInstance, c2_teta[0] + c2_kb_y);
              c2_b_log10(chartInstance, &c2_d6);
              c2_d7 = c2_abs(chartInstance, c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u",
                              (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100,
                1, 0) + 99]);
              c2_b_log10(chartInstance, &c2_d7);
              c2_ye1 = c2_d7 + c2_d6;
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 160U);
              c2_u_b = c2_n - c2_b_i2;
              c2_lb_y = -0.95 * c2_u_b;
              c2_p_x = c2_lb_y;
              c2_q_x = c2_p_x;
              c2_q_x = muDoubleScalarExp(c2_q_x);
              c2_q_a = -c2_q_x;
              c2_v_b = c2_mpower(chartInstance, c2_y[_SFD_EML_ARRAY_BOUNDS_CHECK
                                 ("y", (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2),
                                  1, 100, 1, 0) - 1] - c2_b_mpower(chartInstance,
                10.0, c2_ye1));
              c2_mb_y = c2_q_a * c2_v_b;
              c2_c_A = c2_mb_y;
              c2_r_x = c2_c_A;
              c2_s_x = c2_r_x;
              c2_nb_y = c2_s_x / 9.0E-6;
              c2_t_x = c2_nb_y;
              c2_u_x = c2_t_x;
              c2_u_x = muDoubleScalarExp(c2_u_x);
              c2_w_b = c2_u_x;
              c2_ob_y = 132.98076013381089 * c2_w_b;
              c2_d8 = c2_ob_y;
              c2_b_log10(chartInstance, &c2_d8);
              c2_dummy += c2_d8;
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 162U);
              c2_v_x = c2_dummy;
              c2_x_b = muDoubleScalarIsInf(c2_v_x);
              if (CV_EML_IF(0, 1, 14, c2_x_b)) {
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 163U);
                exitg2 = 1;
              } else {
                c2_e_i2++;
                sf_mex_listen_for_ctrl_c(chartInstance->S);
              }
            }
          } else {
            CV_EML_FOR(0, 1, 4, 0);
            exitg2 = 1;
          }
        } while (exitg2 == 0);

        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 168U);
        c2_prob_teta = c2_dummy;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 133U);
        sf_mex_listen_for_ctrl_c(chartInstance->S);
      }

      _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 172U);
      c2_c_k = 0;
      while (c2_c_k < 1999) {
        c2_b_k = 1.0 + (real_T)c2_c_k;
        CV_EML_FOR(0, 1, 5, 1);
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 174U);
        c2_prob_teta = c2_dummy;
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 178U);
        c2_r_a = c2_sigma2_RW;
        c2_b_sqrt(chartInstance, &c2_r_a);
        c2_randn(chartInstance, c2_b);
        for (c2_i54 = 0; c2_i54 < 2; c2_i54++) {
          c2_b[c2_i54] *= c2_r_a;
        }

        c2_d_k = _SFD_EML_ARRAY_BOUNDS_CHECK("teta", (int32_T)_SFD_INTEGER_CHECK
          ("k", c2_b_k), 1, 2000, 2, 0) - 1;
        for (c2_i55 = 0; c2_i55 < 2; c2_i55++) {
          c2_epsi[c2_i55] = c2_teta[c2_i55 + (c2_d_k << 1)] + c2_b[c2_i55];
        }

        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 182U);
        guard3 = FALSE;
        guard4 = FALSE;
        guard5 = FALSE;
        if (CV_EML_COND(0, 1, 10, c2_epsi[0] > 0.0)) {
          guard5 = TRUE;
        } else if (CV_EML_COND(0, 1, 11, c2_epsi[0] < -0.001)) {
          guard5 = TRUE;
        } else if (CV_EML_COND(0, 1, 12, c2_epsi[1] > 1.0E-7)) {
          guard4 = TRUE;
        } else if (CV_EML_COND(0, 1, 13, c2_epsi[1] < -1.0E-7)) {
          guard3 = TRUE;
        } else {
          CV_EML_MCDC(0, 1, 4, FALSE);
          CV_EML_IF(0, 1, 15, FALSE);
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 186U);
          c2_ye1_candid = 0.0;
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 187U);
          c2_dummy = 0.0;
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 188U);
          c2_f_i2 = 0;
          do {
            exitg1 = 0;
            if (c2_f_i2 < 100) {
              c2_b_i2 = 1.0 + (real_T)c2_f_i2;
              CV_EML_FOR(0, 1, 6, 1);
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 193U);
              c2_s_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
                _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1];
              c2_y_b = c2_epsi[1];
              c2_pb_y = c2_s_a * c2_y_b;
              c2_t_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
                _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) + 99];
              c2_ab_b = c2_epsi[0] + c2_pb_y;
              c2_dumm = c2_t_a * c2_ab_b;
              _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 195U);
              if (CV_EML_IF(0, 1, 16, c2_dumm < 0.0)) {
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 196U);
                c2_dummy = rtMinusInf;
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 197U);
                exitg1 = 1;
              } else {
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 199U);
                c2_u_a = c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
                  _SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1];
                c2_bb_b = c2_epsi[1];
                c2_qb_y = c2_u_a * c2_bb_b;
                c2_d9 = c2_abs(chartInstance, c2_epsi[0] + c2_qb_y);
                c2_b_log10(chartInstance, &c2_d9);
                c2_d10 = c2_abs(chartInstance, c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK(
                  "u", (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0)
                                + 99]);
                c2_b_log10(chartInstance, &c2_d10);
                c2_ye1_candid = c2_d10 + c2_d9;
                _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 202U);
                c2_cb_b = c2_n - c2_b_i2;
                c2_rb_y = -0.95 * c2_cb_b;
                c2_w_x = c2_rb_y;
                c2_x_x = c2_w_x;
                c2_x_x = muDoubleScalarExp(c2_x_x);
                c2_v_a = -c2_x_x;
                c2_db_b = c2_mpower(chartInstance,
                                    c2_y[_SFD_EML_ARRAY_BOUNDS_CHECK("y",
                  (int32_T)_SFD_INTEGER_CHECK("i2", c2_b_i2), 1, 100, 1, 0) - 1]
                                    - c2_b_mpower(chartInstance, 10.0,
                  c2_ye1_candid));
                c2_sb_y = c2_v_a * c2_db_b;
                c2_d_A = c2_sb_y;
                c2_y_x = c2_d_A;
                c2_ab_x = c2_y_x;
                c2_tb_y = c2_ab_x / 9.0E-6;
                c2_bb_x = c2_tb_y;
                c2_cb_x = c2_bb_x;
                c2_cb_x = muDoubleScalarExp(c2_cb_x);
                c2_eb_b = c2_cb_x;
                c2_ub_y = 132.98076013381089 * c2_eb_b;
                c2_d11 = c2_ub_y;
                c2_b_log10(chartInstance, &c2_d11);
                c2_dummy += c2_d11;
                c2_f_i2++;
                sf_mex_listen_for_ctrl_c(chartInstance->S);
              }
            } else {
              CV_EML_FOR(0, 1, 6, 0);
              exitg1 = 1;
            }
          } while (exitg1 == 0);

          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 206U);
          c2_prob_epsi = c2_dummy;
        }

        if (guard5 == TRUE) {
          guard4 = TRUE;
        }

        if (guard4 == TRUE) {
          guard3 = TRUE;
        }

        if (guard3 == TRUE) {
          CV_EML_MCDC(0, 1, 4, TRUE);
          CV_EML_IF(0, 1, 15, TRUE);
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 183U);
          c2_prob_epsi = rtMinusInf;
        }

        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 210U);
        c2_b_varargin_2 = c2_b_mpower(chartInstance, 10.0, c2_prob_epsi -
          c2_prob_teta);
        c2_b_varargin_3 = c2_b_varargin_2;
        c2_vb_y = c2_b_varargin_3;
        c2_wb_y = c2_vb_y;
        c2_eml_scalar_eg(chartInstance);
        c2_b_yk = c2_wb_y;
        c2_xb_y = c2_b_yk;
        c2_eml_scalar_eg(chartInstance);
        c2_alpha = muDoubleScalarMin(1.0, c2_xb_y);
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 211U);
        c2_z = c2_b_rand(chartInstance);
        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 213U);
        if (CV_EML_IF(0, 1, 17, c2_z < c2_alpha)) {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 214U);
          c2_e_k = _SFD_EML_ARRAY_BOUNDS_CHECK("teta", (int32_T)
            _SFD_INTEGER_CHECK("k+1", c2_b_k + 1.0), 1, 2000, 2, 0) - 1;
          for (c2_i56 = 0; c2_i56 < 2; c2_i56++) {
            c2_teta[c2_i56 + (c2_e_k << 1)] = c2_epsi[c2_i56];
          }

          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 215U);
          c2_prob_teta = c2_prob_epsi;
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 216U);
          c2_nac++;
        } else {
          _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 218U);
          c2_f_k = _SFD_EML_ARRAY_BOUNDS_CHECK("teta", (int32_T)
            _SFD_INTEGER_CHECK("k+1", c2_b_k + 1.0), 1, 2000, 2, 0) - 1;
          c2_g_k = _SFD_EML_ARRAY_BOUNDS_CHECK("teta", (int32_T)
            _SFD_INTEGER_CHECK("k", c2_b_k), 1, 2000, 2, 0) - 1;
          for (c2_i57 = 0; c2_i57 < 2; c2_i57++) {
            c2_d_teta[c2_i57] = c2_teta[c2_i57 + (c2_g_k << 1)];
          }

          for (c2_i58 = 0; c2_i58 < 2; c2_i58++) {
            c2_teta[c2_i58 + (c2_f_k << 1)] = c2_d_teta[c2_i58];
          }
        }

        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 224U);
        guard2 = FALSE;
        if (CV_EML_COND(0, 1, 14, c2_b_k == 1500.0)) {
          c2_fb_b = c2_b_k;
          c2_yb_y = 0.5 * c2_fb_b;
          c2_w_a = c2_yb_y;
          c2_ac_y = c2_w_a * 0.9;
          if (CV_EML_COND(0, 1, 15, c2_nac < c2_ac_y)) {
            CV_EML_MCDC(0, 1, 5, TRUE);
            CV_EML_IF(0, 1, 18, TRUE);
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 225U);
            c2_gb_b = c2_sigma2_RW;
            c2_sigma2_RW = 0.5 * c2_gb_b;
          } else {
            guard2 = TRUE;
          }
        } else {
          guard2 = TRUE;
        }

        if (guard2 == TRUE) {
          CV_EML_MCDC(0, 1, 5, FALSE);
          CV_EML_IF(0, 1, 18, FALSE);
        }

        _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 227U);
        guard1 = FALSE;
        if (CV_EML_COND(0, 1, 16, c2_b_k == 2000.0)) {
          c2_hb_b = c2_b_k;
          c2_bc_y = 0.8 * c2_hb_b;
          c2_x_a = c2_bc_y;
          c2_cc_y = c2_x_a * 0.9;
          if (CV_EML_COND(0, 1, 17, c2_nac < c2_cc_y)) {
            CV_EML_MCDC(0, 1, 6, TRUE);
            CV_EML_IF(0, 1, 19, TRUE);
            _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 228U);
            c2_ib_b = c2_sigma2_RW;
            c2_sigma2_RW = 0.5 * c2_ib_b;
          } else {
            guard1 = TRUE;
          }
        } else {
          guard1 = TRUE;
        }

        if (guard1 == TRUE) {
          CV_EML_MCDC(0, 1, 6, FALSE);
          CV_EML_IF(0, 1, 19, FALSE);
        }

        c2_c_k++;
        sf_mex_listen_for_ctrl_c(chartInstance->S);
      }

      CV_EML_FOR(0, 1, 5, 0);
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 237U);
  c2_i59 = 0;
  for (c2_i60 = 0; c2_i60 < 1501; c2_i60++) {
    c2_n_u[c2_i60] = c2_teta[c2_i59 + 998];
    c2_i59 += 2;
  }

  c2_dc_y = NULL;
  sf_mex_assign(&c2_dc_y, sf_mex_create("y", c2_n_u, 0, 0U, 1U, 0U, 2, 1, 1501),
                FALSE);
  sf_mex_call_debug("ksdensity", 2U, 1U, 14, c2_dc_y, &c2_b_kde_x, &c2_b_kde_y);
  c2_l_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_kde_x), "kde_x", c2_dv4);
  for (c2_i61 = 0; c2_i61 < 100; c2_i61++) {
    c2_kde_x[c2_i61] = c2_dv4[c2_i61];
  }

  c2_l_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_kde_y), "kde_y", c2_dv5);
  for (c2_i62 = 0; c2_i62 < 100; c2_i62++) {
    c2_kde_y[c2_i62] = c2_dv5[c2_i62];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 238U);
  c2_i63 = 0;
  for (c2_i64 = 0; c2_i64 < 100; c2_i64++) {
    c2_kde[c2_i63] = c2_kde_x[c2_i64];
    c2_i63 += 2;
  }

  c2_i65 = 0;
  for (c2_i66 = 0; c2_i66 < 100; c2_i66++) {
    c2_kde[c2_i65 + 1] = c2_kde_y[c2_i66];
    c2_i65 += 2;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 240U);
  c2_i67 = 0;
  for (c2_i68 = 0; c2_i68 < 1501; c2_i68++) {
    c2_o_u[c2_i68] = c2_teta[c2_i67 + 999];
    c2_i67 += 2;
  }

  c2_ec_y = NULL;
  sf_mex_assign(&c2_ec_y, sf_mex_create("y", c2_o_u, 0, 0U, 1U, 0U, 2, 1, 1501),
                FALSE);
  sf_mex_call_debug("ksdensity", 2U, 1U, 14, c2_ec_y, &c2_c_kde_x, &c2_c_kde_y);
  c2_l_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_c_kde_x), "kde_x", c2_dv6);
  for (c2_i69 = 0; c2_i69 < 100; c2_i69++) {
    c2_kde_x[c2_i69] = c2_dv6[c2_i69];
  }

  c2_l_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_c_kde_y), "kde_y", c2_dv7);
  for (c2_i70 = 0; c2_i70 < 100; c2_i70++) {
    c2_kde_y[c2_i70] = c2_dv7[c2_i70];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 246U);
  c2_i71 = 0;
  for (c2_i72 = 0; c2_i72 < 1501; c2_i72++) {
    for (c2_i73 = 0; c2_i73 < 2; c2_i73++) {
      c2_Teta[c2_i73 + c2_i71] = c2_teta[(c2_i73 + c2_i71) + 998];
    }

    c2_i71 += 2;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -246);
  sf_debug_symbol_scope_pop();
  sf_mex_destroy(&c2_b_kde_x);
  sf_mex_destroy(&c2_b_kde_y);
  sf_mex_destroy(&c2_c_kde_x);
  sf_mex_destroy(&c2_c_kde_y);
  for (c2_i74 = 0; c2_i74 < 3002; c2_i74++) {
    (*c2_b_Teta)[c2_i74] = c2_Teta[c2_i74];
  }

  for (c2_i75 = 0; c2_i75 < 4000; c2_i75++) {
    (*c2_e_teta)[c2_i75] = c2_teta[c2_i75];
  }

  *c2_b_flag = c2_flag;
  for (c2_i76 = 0; c2_i76 < 200; c2_i76++) {
    (*c2_b_kde)[c2_i76] = c2_kde[c2_i76];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
}

static void initSimStructsc2_Hunt_crossley_Ident
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

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

static const mxArray *c2_sf_marshallOut(void *chartInstanceVoid, void *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i77;
  int32_T c2_i78;
  int32_T c2_i79;
  real_T c2_b_inData[200];
  int32_T c2_i80;
  int32_T c2_i81;
  int32_T c2_i82;
  real_T c2_u[200];
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  c2_i77 = 0;
  for (c2_i78 = 0; c2_i78 < 100; c2_i78++) {
    for (c2_i79 = 0; c2_i79 < 2; c2_i79++) {
      c2_b_inData[c2_i79 + c2_i77] = (*(real_T (*)[200])c2_inData)[c2_i79 +
        c2_i77];
    }

    c2_i77 += 2;
  }

  c2_i80 = 0;
  for (c2_i81 = 0; c2_i81 < 100; c2_i81++) {
    for (c2_i82 = 0; c2_i82 < 2; c2_i82++) {
      c2_u[c2_i82 + c2_i80] = c2_b_inData[c2_i82 + c2_i80];
    }

    c2_i80 += 2;
  }

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

static void c2_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_kde, const char_T *c2_identifier, real_T
  c2_y[200])
{
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_kde), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_kde);
}

static void c2_b_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[200])
{
  real_T c2_dv8[200];
  int32_T c2_i83;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_dv8, 1, 0, 0U, 1, 0U, 2, 2,
                100);
  for (c2_i83 = 0; c2_i83 < 200; c2_i83++) {
    c2_y[c2_i83] = c2_dv8[c2_i83];
  }

  sf_mex_destroy(&c2_u);
}

static void c2_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_kde;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  real_T c2_y[200];
  int32_T c2_i84;
  int32_T c2_i85;
  int32_T c2_i86;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_kde = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_kde), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_kde);
  c2_i84 = 0;
  for (c2_i85 = 0; c2_i85 < 100; c2_i85++) {
    for (c2_i86 = 0; c2_i86 < 2; c2_i86++) {
      (*(real_T (*)[200])c2_outData)[c2_i86 + c2_i84] = c2_y[c2_i86 + c2_i84];
    }

    c2_i84 += 2;
  }

  sf_mex_destroy(&c2_mxArrayInData);
}

static const mxArray *c2_b_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  real_T c2_u;
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)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_c_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_flag, const char_T *c2_identifier)
{
  real_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_flag), &c2_thisId);
  sf_mex_destroy(&c2_flag);
  return c2_y;
}

static real_T c2_d_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  real_T c2_y;
  real_T c2_d12;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_d12, 1, 0, 0U, 0, 0U, 0);
  c2_y = c2_d12;
  sf_mex_destroy(&c2_u);
  return c2_y;
}

static void c2_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_flag;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  real_T c2_y;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_flag = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_flag), &c2_thisId);
  sf_mex_destroy(&c2_flag);
  *(real_T *)c2_outData = c2_y;
  sf_mex_destroy(&c2_mxArrayInData);
}

static const mxArray *c2_c_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i87;
  int32_T c2_i88;
  int32_T c2_i89;
  real_T c2_b_inData[4000];
  int32_T c2_i90;
  int32_T c2_i91;
  int32_T c2_i92;
  real_T c2_u[4000];
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  c2_i87 = 0;
  for (c2_i88 = 0; c2_i88 < 2000; c2_i88++) {
    for (c2_i89 = 0; c2_i89 < 2; c2_i89++) {
      c2_b_inData[c2_i89 + c2_i87] = (*(real_T (*)[4000])c2_inData)[c2_i89 +
        c2_i87];
    }

    c2_i87 += 2;
  }

  c2_i90 = 0;
  for (c2_i91 = 0; c2_i91 < 2000; c2_i91++) {
    for (c2_i92 = 0; c2_i92 < 2; c2_i92++) {
      c2_u[c2_i92 + c2_i90] = c2_b_inData[c2_i92 + c2_i90];
    }

    c2_i90 += 2;
  }

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

static void c2_e_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_teta, const char_T *c2_identifier, real_T
  c2_y[4000])
{
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_f_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_teta), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_teta);
}

static void c2_f_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[4000])
{
  real_T c2_dv9[4000];
  int32_T c2_i93;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_dv9, 1, 0, 0U, 1, 0U, 2, 2,
                2000);
  for (c2_i93 = 0; c2_i93 < 4000; c2_i93++) {
    c2_y[c2_i93] = c2_dv9[c2_i93];
  }

  sf_mex_destroy(&c2_u);
}

static void c2_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_teta;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  real_T c2_y[4000];
  int32_T c2_i94;
  int32_T c2_i95;
  int32_T c2_i96;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_teta = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_f_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_teta), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_teta);
  c2_i94 = 0;
  for (c2_i95 = 0; c2_i95 < 2000; c2_i95++) {
    for (c2_i96 = 0; c2_i96 < 2; c2_i96++) {
      (*(real_T (*)[4000])c2_outData)[c2_i96 + c2_i94] = c2_y[c2_i96 + c2_i94];
    }

    c2_i94 += 2;
  }

  sf_mex_destroy(&c2_mxArrayInData);
}

static const mxArray *c2_d_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i97;
  int32_T c2_i98;
  int32_T c2_i99;
  real_T c2_b_inData[3002];
  int32_T c2_i100;
  int32_T c2_i101;
  int32_T c2_i102;
  real_T c2_u[3002];
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  c2_i97 = 0;
  for (c2_i98 = 0; c2_i98 < 1501; c2_i98++) {
    for (c2_i99 = 0; c2_i99 < 2; c2_i99++) {
      c2_b_inData[c2_i99 + c2_i97] = (*(real_T (*)[3002])c2_inData)[c2_i99 +
        c2_i97];
    }

    c2_i97 += 2;
  }

  c2_i100 = 0;
  for (c2_i101 = 0; c2_i101 < 1501; c2_i101++) {
    for (c2_i102 = 0; c2_i102 < 2; c2_i102++) {
      c2_u[c2_i102 + c2_i100] = c2_b_inData[c2_i102 + c2_i100];
    }

    c2_i100 += 2;
  }

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

static void c2_g_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_Teta, const char_T *c2_identifier, real_T
  c2_y[3002])
{
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_h_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_Teta), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_Teta);
}

static void c2_h_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[3002])
{
  real_T c2_dv10[3002];
  int32_T c2_i103;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_dv10, 1, 0, 0U, 1, 0U, 2, 2,
                1501);
  for (c2_i103 = 0; c2_i103 < 3002; c2_i103++) {
    c2_y[c2_i103] = c2_dv10[c2_i103];
  }

  sf_mex_destroy(&c2_u);
}

static void c2_d_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_Teta;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  real_T c2_y[3002];
  int32_T c2_i104;
  int32_T c2_i105;
  int32_T c2_i106;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_Teta = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_h_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_Teta), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_Teta);
  c2_i104 = 0;
  for (c2_i105 = 0; c2_i105 < 1501; c2_i105++) {
    for (c2_i106 = 0; c2_i106 < 2; c2_i106++) {
      (*(real_T (*)[3002])c2_outData)[c2_i106 + c2_i104] = c2_y[c2_i106 +
        c2_i104];
    }

    c2_i104 += 2;
  }

  sf_mex_destroy(&c2_mxArrayInData);
}

static const mxArray *c2_e_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i107;
  real_T c2_b_inData[100];
  int32_T c2_i108;
  real_T c2_u[100];
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  for (c2_i107 = 0; c2_i107 < 100; c2_i107++) {
    c2_b_inData[c2_i107] = (*(real_T (*)[100])c2_inData)[c2_i107];
  }

  for (c2_i108 = 0; c2_i108 < 100; c2_i108++) {
    c2_u[c2_i108] = c2_b_inData[c2_i108];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 0, 0U, 1U, 0U, 1, 100), FALSE);
  sf_mex_assign(&c2_mxArrayOutData, c2_y, FALSE);
  return c2_mxArrayOutData;
}

static const mxArray *c2_f_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i109;
  int32_T c2_i110;
  int32_T c2_i111;
  real_T c2_b_inData[200];
  int32_T c2_i112;
  int32_T c2_i113;
  int32_T c2_i114;
  real_T c2_u[200];
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  c2_i109 = 0;
  for (c2_i110 = 0; c2_i110 < 2; c2_i110++) {
    for (c2_i111 = 0; c2_i111 < 100; c2_i111++) {
      c2_b_inData[c2_i111 + c2_i109] = (*(real_T (*)[200])c2_inData)[c2_i111 +
        c2_i109];
    }

    c2_i109 += 100;
  }

  c2_i112 = 0;
  for (c2_i113 = 0; c2_i113 < 2; c2_i113++) {
    for (c2_i114 = 0; c2_i114 < 100; c2_i114++) {
      c2_u[c2_i114 + c2_i112] = c2_b_inData[c2_i114 + c2_i112];
    }

    c2_i112 += 100;
  }

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

static const mxArray *c2_g_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i115;
  real_T c2_b_inData[2];
  int32_T c2_i116;
  real_T c2_u[2];
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  for (c2_i115 = 0; c2_i115 < 2; c2_i115++) {
    c2_b_inData[c2_i115] = (*(real_T (*)[2])c2_inData)[c2_i115];
  }

  for (c2_i116 = 0; c2_i116 < 2; c2_i116++) {
    c2_u[c2_i116] = c2_b_inData[c2_i116];
  }

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

static void c2_i_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[2])
{
  real_T c2_dv11[2];
  int32_T c2_i117;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_dv11, 1, 0, 0U, 1, 0U, 1, 2);
  for (c2_i117 = 0; c2_i117 < 2; c2_i117++) {
    c2_y[c2_i117] = c2_dv11[c2_i117];
  }

  sf_mex_destroy(&c2_u);
}

static void c2_e_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_epsi;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  real_T c2_y[2];
  int32_T c2_i118;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_epsi = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_i_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_epsi), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_epsi);
  for (c2_i118 = 0; c2_i118 < 2; c2_i118++) {
    (*(real_T (*)[2])c2_outData)[c2_i118] = c2_y[c2_i118];
  }

  sf_mex_destroy(&c2_mxArrayInData);
}

static const mxArray *c2_h_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_i119;
  real_T c2_b_inData[100];
  int32_T c2_i120;
  real_T c2_u[100];
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_mxArrayOutData = NULL;
  for (c2_i119 = 0; c2_i119 < 100; c2_i119++) {
    c2_b_inData[c2_i119] = (*(real_T (*)[100])c2_inData)[c2_i119];
  }

  for (c2_i120 = 0; c2_i120 < 100; c2_i120++) {
    c2_u[c2_i120] = c2_b_inData[c2_i120];
  }

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

static void c2_f_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
  const mxArray *c2_kde_x;
  const char_T *c2_identifier;
  emlrtMsgIdentifier c2_thisId;
  real_T c2_y[100];
  int32_T c2_i121;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c2_kde_x = sf_mex_dup(c2_mxArrayInData);
  c2_identifier = c2_varName;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_m_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_kde_x), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_kde_x);
  for (c2_i121 = 0; c2_i121 < 100; c2_i121++) {
    (*(real_T (*)[100])c2_outData)[c2_i121] = c2_y[c2_i121];
  }

  sf_mex_destroy(&c2_mxArrayInData);
}

const mxArray *sf_c2_Hunt_crossley_Ident_get_eml_resolved_functions_info(void)
{
  const mxArray *c2_nameCaptureInfo;
  c2_ResolvedFunctionInfo c2_info[108];
  const mxArray *c2_m0 = NULL;
  int32_T c2_i122;
  c2_ResolvedFunctionInfo *c2_r0;
  c2_nameCaptureInfo = NULL;
  c2_nameCaptureInfo = NULL;
  c2_info_helper(c2_info);
  c2_b_info_helper(c2_info);
  sf_mex_assign(&c2_m0, sf_mex_createstruct("nameCaptureInfo", 1, 108), FALSE);
  for (c2_i122 = 0; c2_i122 < 108; c2_i122++) {
    c2_r0 = &c2_info[c2_i122];
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->context, 15,
      0U, 0U, 0U, 2, 1, strlen(c2_r0->context)), "context", "nameCaptureInfo",
                    c2_i122);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->name, 15, 0U,
      0U, 0U, 2, 1, strlen(c2_r0->name)), "name", "nameCaptureInfo", c2_i122);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->dominantType,
      15, 0U, 0U, 0U, 2, 1, strlen(c2_r0->dominantType)), "dominantType",
                    "nameCaptureInfo", c2_i122);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", c2_r0->resolved, 15,
      0U, 0U, 0U, 2, 1, strlen(c2_r0->resolved)), "resolved", "nameCaptureInfo",
                    c2_i122);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTimeLo,
      7, 0U, 0U, 0U, 0), "fileTimeLo", "nameCaptureInfo", c2_i122);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->fileTimeHi,
      7, 0U, 0U, 0U, 0), "fileTimeHi", "nameCaptureInfo", c2_i122);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->mFileTimeLo,
      7, 0U, 0U, 0U, 0), "mFileTimeLo", "nameCaptureInfo", c2_i122);
    sf_mex_addfield(c2_m0, sf_mex_create("nameCaptureInfo", &c2_r0->mFileTimeHi,
      7, 0U, 0U, 0U, 0), "mFileTimeHi", "nameCaptureInfo", c2_i122);
  }

  sf_mex_assign(&c2_nameCaptureInfo, c2_m0, FALSE);
  sf_mex_emlrtNameCapturePostProcessR2012a(&c2_nameCaptureInfo);
  return c2_nameCaptureInfo;
}

static void c2_info_helper(c2_ResolvedFunctionInfo c2_info[108])
{
  c2_info[0].context = "";
  c2_info[0].name = "mtimes";
  c2_info[0].dominantType = "double";
  c2_info[0].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[0].fileTimeLo = 1289510692U;
  c2_info[0].fileTimeHi = 0U;
  c2_info[0].mFileTimeLo = 0U;
  c2_info[0].mFileTimeHi = 0U;
  c2_info[1].context = "";
  c2_info[1].name = "mpower";
  c2_info[1].dominantType = "double";
  c2_info[1].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mpower.m";
  c2_info[1].fileTimeLo = 1286813442U;
  c2_info[1].fileTimeHi = 0U;
  c2_info[1].mFileTimeLo = 0U;
  c2_info[1].mFileTimeHi = 0U;
  c2_info[2].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mpower.m";
  c2_info[2].name = "power";
  c2_info[2].dominantType = "double";
  c2_info[2].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m";
  c2_info[2].fileTimeLo = 1336513096U;
  c2_info[2].fileTimeHi = 0U;
  c2_info[2].mFileTimeLo = 0U;
  c2_info[2].mFileTimeHi = 0U;
  c2_info[3].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m!fltpower";
  c2_info[3].name = "eml_scalar_eg";
  c2_info[3].dominantType = "double";
  c2_info[3].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c2_info[3].fileTimeLo = 1286813396U;
  c2_info[3].fileTimeHi = 0U;
  c2_info[3].mFileTimeLo = 0U;
  c2_info[3].mFileTimeHi = 0U;
  c2_info[4].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m!fltpower";
  c2_info[4].name = "eml_scalexp_alloc";
  c2_info[4].dominantType = "double";
  c2_info[4].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m";
  c2_info[4].fileTimeLo = 1330599434U;
  c2_info[4].fileTimeHi = 0U;
  c2_info[4].mFileTimeLo = 0U;
  c2_info[4].mFileTimeHi = 0U;
  c2_info[5].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m!fltpower";
  c2_info[5].name = "floor";
  c2_info[5].dominantType = "double";
  c2_info[5].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/floor.m";
  c2_info[5].fileTimeLo = 1286813342U;
  c2_info[5].fileTimeHi = 0U;
  c2_info[5].mFileTimeLo = 0U;
  c2_info[5].mFileTimeHi = 0U;
  c2_info[6].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/floor.m";
  c2_info[6].name = "eml_scalar_floor";
  c2_info[6].dominantType = "double";
  c2_info[6].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_floor.m";
  c2_info[6].fileTimeLo = 1286813326U;
  c2_info[6].fileTimeHi = 0U;
  c2_info[6].mFileTimeLo = 0U;
  c2_info[6].mFileTimeHi = 0U;
  c2_info[7].context = "";
  c2_info[7].name = "sqrt";
  c2_info[7].dominantType = "double";
  c2_info[7].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m";
  c2_info[7].fileTimeLo = 1286813352U;
  c2_info[7].fileTimeHi = 0U;
  c2_info[7].mFileTimeLo = 0U;
  c2_info[7].mFileTimeHi = 0U;
  c2_info[8].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m";
  c2_info[8].name = "eml_error";
  c2_info[8].dominantType = "char";
  c2_info[8].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_error.m";
  c2_info[8].fileTimeLo = 1305309000U;
  c2_info[8].fileTimeHi = 0U;
  c2_info[8].mFileTimeLo = 0U;
  c2_info[8].mFileTimeHi = 0U;
  c2_info[9].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/sqrt.m";
  c2_info[9].name = "eml_scalar_sqrt";
  c2_info[9].dominantType = "double";
  c2_info[9].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_sqrt.m";
  c2_info[9].fileTimeLo = 1286813338U;
  c2_info[9].fileTimeHi = 0U;
  c2_info[9].mFileTimeLo = 0U;
  c2_info[9].mFileTimeHi = 0U;
  c2_info[10].context = "";
  c2_info[10].name = "mrdivide";
  c2_info[10].dominantType = "double";
  c2_info[10].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c2_info[10].fileTimeLo = 1342801944U;
  c2_info[10].fileTimeHi = 0U;
  c2_info[10].mFileTimeLo = 1319724566U;
  c2_info[10].mFileTimeHi = 0U;
  c2_info[11].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c2_info[11].name = "rdivide";
  c2_info[11].dominantType = "double";
  c2_info[11].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c2_info[11].fileTimeLo = 1286813444U;
  c2_info[11].fileTimeHi = 0U;
  c2_info[11].mFileTimeLo = 0U;
  c2_info[11].mFileTimeHi = 0U;
  c2_info[12].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c2_info[12].name = "eml_div";
  c2_info[12].dominantType = "double";
  c2_info[12].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
  c2_info[12].fileTimeLo = 1313338810U;
  c2_info[12].fileTimeHi = 0U;
  c2_info[12].mFileTimeLo = 0U;
  c2_info[12].mFileTimeHi = 0U;
  c2_info[13].context = "";
  c2_info[13].name = "abs";
  c2_info[13].dominantType = "double";
  c2_info[13].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[13].fileTimeLo = 1286813294U;
  c2_info[13].fileTimeHi = 0U;
  c2_info[13].mFileTimeLo = 0U;
  c2_info[13].mFileTimeHi = 0U;
  c2_info[14].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[14].name = "eml_scalar_abs";
  c2_info[14].dominantType = "double";
  c2_info[14].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_abs.m";
  c2_info[14].fileTimeLo = 1286813312U;
  c2_info[14].fileTimeHi = 0U;
  c2_info[14].mFileTimeLo = 0U;
  c2_info[14].mFileTimeHi = 0U;
  c2_info[15].context = "";
  c2_info[15].name = "floor";
  c2_info[15].dominantType = "double";
  c2_info[15].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/floor.m";
  c2_info[15].fileTimeLo = 1286813342U;
  c2_info[15].fileTimeHi = 0U;
  c2_info[15].mFileTimeLo = 0U;
  c2_info[15].mFileTimeHi = 0U;
  c2_info[16].context = "";
  c2_info[16].name = "mean";
  c2_info[16].dominantType = "double";
  c2_info[16].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/mean.m";
  c2_info[16].fileTimeLo = 1286813294U;
  c2_info[16].fileTimeHi = 0U;
  c2_info[16].mFileTimeLo = 0U;
  c2_info[16].mFileTimeHi = 0U;
  c2_info[17].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/mean.m";
  c2_info[17].name = "isequal";
  c2_info[17].dominantType = "double";
  c2_info[17].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/isequal.m";
  c2_info[17].fileTimeLo = 1286813358U;
  c2_info[17].fileTimeHi = 0U;
  c2_info[17].mFileTimeLo = 0U;
  c2_info[17].mFileTimeHi = 0U;
  c2_info[18].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/isequal.m";
  c2_info[18].name = "eml_isequal_core";
  c2_info[18].dominantType = "double";
  c2_info[18].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_isequal_core.m";
  c2_info[18].fileTimeLo = 1286813386U;
  c2_info[18].fileTimeHi = 0U;
  c2_info[18].mFileTimeLo = 0U;
  c2_info[18].mFileTimeHi = 0U;
  c2_info[19].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/mean.m";
  c2_info[19].name = "eml_const_nonsingleton_dim";
  c2_info[19].dominantType = "double";
  c2_info[19].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_const_nonsingleton_dim.m";
  c2_info[19].fileTimeLo = 1286813296U;
  c2_info[19].fileTimeHi = 0U;
  c2_info[19].mFileTimeLo = 0U;
  c2_info[19].mFileTimeHi = 0U;
  c2_info[20].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/mean.m";
  c2_info[20].name = "sum";
  c2_info[20].dominantType = "double";
  c2_info[20].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[20].fileTimeLo = 1314727612U;
  c2_info[20].fileTimeHi = 0U;
  c2_info[20].mFileTimeLo = 0U;
  c2_info[20].mFileTimeHi = 0U;
  c2_info[21].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[21].name = "eml_assert_valid_dim";
  c2_info[21].dominantType = "double";
  c2_info[21].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_assert_valid_dim.m";
  c2_info[21].fileTimeLo = 1286813294U;
  c2_info[21].fileTimeHi = 0U;
  c2_info[21].mFileTimeLo = 0U;
  c2_info[21].mFileTimeHi = 0U;
  c2_info[22].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_assert_valid_dim.m";
  c2_info[22].name = "eml_scalar_floor";
  c2_info[22].dominantType = "double";
  c2_info[22].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_floor.m";
  c2_info[22].fileTimeLo = 1286813326U;
  c2_info[22].fileTimeHi = 0U;
  c2_info[22].mFileTimeLo = 0U;
  c2_info[22].mFileTimeHi = 0U;
  c2_info[23].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_assert_valid_dim.m";
  c2_info[23].name = "eml_index_class";
  c2_info[23].dominantType = "";
  c2_info[23].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[23].fileTimeLo = 1323161578U;
  c2_info[23].fileTimeHi = 0U;
  c2_info[23].mFileTimeLo = 0U;
  c2_info[23].mFileTimeHi = 0U;
  c2_info[24].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_assert_valid_dim.m";
  c2_info[24].name = "intmax";
  c2_info[24].dominantType = "char";
  c2_info[24].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/intmax.m";
  c2_info[24].fileTimeLo = 1311246316U;
  c2_info[24].fileTimeHi = 0U;
  c2_info[24].mFileTimeLo = 0U;
  c2_info[24].mFileTimeHi = 0U;
  c2_info[25].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[25].name = "eml_index_class";
  c2_info[25].dominantType = "";
  c2_info[25].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[25].fileTimeLo = 1323161578U;
  c2_info[25].fileTimeHi = 0U;
  c2_info[25].mFileTimeLo = 0U;
  c2_info[25].mFileTimeHi = 0U;
  c2_info[26].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[26].name = "eml_scalar_eg";
  c2_info[26].dominantType = "double";
  c2_info[26].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c2_info[26].fileTimeLo = 1286813396U;
  c2_info[26].fileTimeHi = 0U;
  c2_info[26].mFileTimeLo = 0U;
  c2_info[26].mFileTimeHi = 0U;
  c2_info[27].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[27].name = "eml_matrix_vstride";
  c2_info[27].dominantType = "double";
  c2_info[27].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_vstride.m";
  c2_info[27].fileTimeLo = 1286813388U;
  c2_info[27].fileTimeHi = 0U;
  c2_info[27].mFileTimeLo = 0U;
  c2_info[27].mFileTimeHi = 0U;
  c2_info[28].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_vstride.m";
  c2_info[28].name = "eml_index_minus";
  c2_info[28].dominantType = "double";
  c2_info[28].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_minus.m";
  c2_info[28].fileTimeLo = 1286813378U;
  c2_info[28].fileTimeHi = 0U;
  c2_info[28].mFileTimeLo = 0U;
  c2_info[28].mFileTimeHi = 0U;
  c2_info[29].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_minus.m";
  c2_info[29].name = "eml_index_class";
  c2_info[29].dominantType = "";
  c2_info[29].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[29].fileTimeLo = 1323161578U;
  c2_info[29].fileTimeHi = 0U;
  c2_info[29].mFileTimeLo = 0U;
  c2_info[29].mFileTimeHi = 0U;
  c2_info[30].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_vstride.m";
  c2_info[30].name = "eml_index_class";
  c2_info[30].dominantType = "";
  c2_info[30].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[30].fileTimeLo = 1323161578U;
  c2_info[30].fileTimeHi = 0U;
  c2_info[30].mFileTimeLo = 0U;
  c2_info[30].mFileTimeHi = 0U;
  c2_info[31].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_vstride.m";
  c2_info[31].name = "eml_size_prod";
  c2_info[31].dominantType = "double";
  c2_info[31].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_size_prod.m";
  c2_info[31].fileTimeLo = 1286813398U;
  c2_info[31].fileTimeHi = 0U;
  c2_info[31].mFileTimeLo = 0U;
  c2_info[31].mFileTimeHi = 0U;
  c2_info[32].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_size_prod.m";
  c2_info[32].name = "eml_index_class";
  c2_info[32].dominantType = "";
  c2_info[32].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[32].fileTimeLo = 1323161578U;
  c2_info[32].fileTimeHi = 0U;
  c2_info[32].mFileTimeLo = 0U;
  c2_info[32].mFileTimeHi = 0U;
  c2_info[33].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[33].name = "eml_matrix_npages";
  c2_info[33].dominantType = "double";
  c2_info[33].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_npages.m";
  c2_info[33].fileTimeLo = 1286813386U;
  c2_info[33].fileTimeHi = 0U;
  c2_info[33].mFileTimeLo = 0U;
  c2_info[33].mFileTimeHi = 0U;
  c2_info[34].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_npages.m";
  c2_info[34].name = "eml_index_plus";
  c2_info[34].dominantType = "double";
  c2_info[34].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c2_info[34].fileTimeLo = 1286813378U;
  c2_info[34].fileTimeHi = 0U;
  c2_info[34].mFileTimeLo = 0U;
  c2_info[34].mFileTimeHi = 0U;
  c2_info[35].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c2_info[35].name = "eml_index_class";
  c2_info[35].dominantType = "";
  c2_info[35].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[35].fileTimeLo = 1323161578U;
  c2_info[35].fileTimeHi = 0U;
  c2_info[35].mFileTimeLo = 0U;
  c2_info[35].mFileTimeHi = 0U;
  c2_info[36].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_npages.m";
  c2_info[36].name = "eml_index_class";
  c2_info[36].dominantType = "";
  c2_info[36].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[36].fileTimeLo = 1323161578U;
  c2_info[36].fileTimeHi = 0U;
  c2_info[36].mFileTimeLo = 0U;
  c2_info[36].mFileTimeHi = 0U;
  c2_info[37].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_matrix_npages.m";
  c2_info[37].name = "eml_size_prod";
  c2_info[37].dominantType = "double";
  c2_info[37].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_size_prod.m";
  c2_info[37].fileTimeLo = 1286813398U;
  c2_info[37].fileTimeHi = 0U;
  c2_info[37].mFileTimeLo = 0U;
  c2_info[37].mFileTimeHi = 0U;
  c2_info[38].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_size_prod.m";
  c2_info[38].name = "eml_index_times";
  c2_info[38].dominantType = "double";
  c2_info[38].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_times.m";
  c2_info[38].fileTimeLo = 1286813380U;
  c2_info[38].fileTimeHi = 0U;
  c2_info[38].mFileTimeLo = 0U;
  c2_info[38].mFileTimeHi = 0U;
  c2_info[39].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_times.m";
  c2_info[39].name = "eml_index_class";
  c2_info[39].dominantType = "";
  c2_info[39].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[39].fileTimeLo = 1323161578U;
  c2_info[39].fileTimeHi = 0U;
  c2_info[39].mFileTimeLo = 0U;
  c2_info[39].mFileTimeHi = 0U;
  c2_info[40].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[40].name = "eml_int_forloop_overflow_check";
  c2_info[40].dominantType = "";
  c2_info[40].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m";
  c2_info[40].fileTimeLo = 1332159672U;
  c2_info[40].fileTimeHi = 0U;
  c2_info[40].mFileTimeLo = 0U;
  c2_info[40].mFileTimeHi = 0U;
  c2_info[41].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m!eml_int_forloop_overflow_check_helper";
  c2_info[41].name = "intmax";
  c2_info[41].dominantType = "char";
  c2_info[41].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/intmax.m";
  c2_info[41].fileTimeLo = 1311246316U;
  c2_info[41].fileTimeHi = 0U;
  c2_info[41].mFileTimeLo = 0U;
  c2_info[41].mFileTimeHi = 0U;
  c2_info[42].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[42].name = "eml_index_plus";
  c2_info[42].dominantType = "double";
  c2_info[42].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c2_info[42].fileTimeLo = 1286813378U;
  c2_info[42].fileTimeHi = 0U;
  c2_info[42].mFileTimeLo = 0U;
  c2_info[42].mFileTimeHi = 0U;
  c2_info[43].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/sum.m";
  c2_info[43].name = "eml_index_plus";
  c2_info[43].dominantType = "coder.internal.indexInt";
  c2_info[43].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c2_info[43].fileTimeLo = 1286813378U;
  c2_info[43].fileTimeHi = 0U;
  c2_info[43].mFileTimeLo = 0U;
  c2_info[43].mFileTimeHi = 0U;
  c2_info[44].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/mean.m";
  c2_info[44].name = "rdivide";
  c2_info[44].dominantType = "double";
  c2_info[44].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c2_info[44].fileTimeLo = 1286813444U;
  c2_info[44].fileTimeHi = 0U;
  c2_info[44].mFileTimeLo = 0U;
  c2_info[44].mFileTimeHi = 0U;
  c2_info[45].context = "";
  c2_info[45].name = "log10";
  c2_info[45].dominantType = "double";
  c2_info[45].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/log10.m";
  c2_info[45].fileTimeLo = 1286813344U;
  c2_info[45].fileTimeHi = 0U;
  c2_info[45].mFileTimeLo = 0U;
  c2_info[45].mFileTimeHi = 0U;
  c2_info[46].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/log10.m";
  c2_info[46].name = "eml_error";
  c2_info[46].dominantType = "char";
  c2_info[46].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_error.m";
  c2_info[46].fileTimeLo = 1305309000U;
  c2_info[46].fileTimeHi = 0U;
  c2_info[46].mFileTimeLo = 0U;
  c2_info[46].mFileTimeHi = 0U;
  c2_info[47].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/log10.m";
  c2_info[47].name = "eml_scalar_log10";
  c2_info[47].dominantType = "double";
  c2_info[47].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_log10.m";
  c2_info[47].fileTimeLo = 1286813328U;
  c2_info[47].fileTimeHi = 0U;
  c2_info[47].mFileTimeLo = 0U;
  c2_info[47].mFileTimeHi = 0U;
  c2_info[48].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_log10.m";
  c2_info[48].name = "realmax";
  c2_info[48].dominantType = "char";
  c2_info[48].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/realmax.m";
  c2_info[48].fileTimeLo = 1307642242U;
  c2_info[48].fileTimeHi = 0U;
  c2_info[48].mFileTimeLo = 0U;
  c2_info[48].mFileTimeHi = 0U;
  c2_info[49].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/realmax.m";
  c2_info[49].name = "eml_realmax";
  c2_info[49].dominantType = "char";
  c2_info[49].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_realmax.m";
  c2_info[49].fileTimeLo = 1326718996U;
  c2_info[49].fileTimeHi = 0U;
  c2_info[49].mFileTimeLo = 0U;
  c2_info[49].mFileTimeHi = 0U;
  c2_info[50].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_realmax.m";
  c2_info[50].name = "eml_float_model";
  c2_info[50].dominantType = "char";
  c2_info[50].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_float_model.m";
  c2_info[50].fileTimeLo = 1326718996U;
  c2_info[50].fileTimeHi = 0U;
  c2_info[50].mFileTimeLo = 0U;
  c2_info[50].mFileTimeHi = 0U;
  c2_info[51].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_realmax.m";
  c2_info[51].name = "mtimes";
  c2_info[51].dominantType = "double";
  c2_info[51].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[51].fileTimeLo = 1289510692U;
  c2_info[51].fileTimeHi = 0U;
  c2_info[51].mFileTimeLo = 0U;
  c2_info[51].mFileTimeHi = 0U;
  c2_info[52].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_log10.m";
  c2_info[52].name = "mrdivide";
  c2_info[52].dominantType = "double";
  c2_info[52].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c2_info[52].fileTimeLo = 1342801944U;
  c2_info[52].fileTimeHi = 0U;
  c2_info[52].mFileTimeLo = 1319724566U;
  c2_info[52].mFileTimeHi = 0U;
  c2_info[53].context = "";
  c2_info[53].name = "exp";
  c2_info[53].dominantType = "double";
  c2_info[53].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/exp.m";
  c2_info[53].fileTimeLo = 1286813340U;
  c2_info[53].fileTimeHi = 0U;
  c2_info[53].mFileTimeLo = 0U;
  c2_info[53].mFileTimeHi = 0U;
  c2_info[54].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/exp.m";
  c2_info[54].name = "eml_scalar_exp";
  c2_info[54].dominantType = "double";
  c2_info[54].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_exp.m";
  c2_info[54].fileTimeLo = 1301319464U;
  c2_info[54].fileTimeHi = 0U;
  c2_info[54].mFileTimeLo = 0U;
  c2_info[54].mFileTimeHi = 0U;
  c2_info[55].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m!fltpower";
  c2_info[55].name = "eml_error";
  c2_info[55].dominantType = "char";
  c2_info[55].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_error.m";
  c2_info[55].fileTimeLo = 1305309000U;
  c2_info[55].fileTimeHi = 0U;
  c2_info[55].mFileTimeLo = 0U;
  c2_info[55].mFileTimeHi = 0U;
  c2_info[56].context = "";
  c2_info[56].name = "rand";
  c2_info[56].dominantType = "";
  c2_info[56].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/rand.m";
  c2_info[56].fileTimeLo = 1313338822U;
  c2_info[56].fileTimeHi = 0U;
  c2_info[56].mFileTimeLo = 0U;
  c2_info[56].mFileTimeHi = 0U;
  c2_info[57].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/rand.m";
  c2_info[57].name = "eml_is_rand_extrinsic";
  c2_info[57].dominantType = "";
  c2_info[57].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_is_rand_extrinsic.m";
  c2_info[57].fileTimeLo = 1334062490U;
  c2_info[57].fileTimeHi = 0U;
  c2_info[57].mFileTimeLo = 0U;
  c2_info[57].mFileTimeHi = 0U;
  c2_info[58].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/rand.m";
  c2_info[58].name = "eml_rand";
  c2_info[58].dominantType = "char";
  c2_info[58].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand.m";
  c2_info[58].fileTimeLo = 1313338820U;
  c2_info[58].fileTimeHi = 0U;
  c2_info[58].mFileTimeLo = 0U;
  c2_info[58].mFileTimeHi = 0U;
  c2_info[59].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand.m";
  c2_info[59].name = "eml_rand_str2id";
  c2_info[59].dominantType = "char";
  c2_info[59].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_str2id.m";
  c2_info[59].fileTimeLo = 1313338822U;
  c2_info[59].fileTimeHi = 0U;
  c2_info[59].mFileTimeLo = 0U;
  c2_info[59].mFileTimeHi = 0U;
  c2_info[60].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand.m";
  c2_info[60].name = "eml_rand_mcg16807_stateful";
  c2_info[60].dominantType = "char";
  c2_info[60].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807_stateful.m";
  c2_info[60].fileTimeLo = 1313338820U;
  c2_info[60].fileTimeHi = 0U;
  c2_info[60].mFileTimeLo = 0U;
  c2_info[60].mFileTimeHi = 0U;
  c2_info[61].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807_stateful.m";
  c2_info[61].name = "eml_rand_mcg16807";
  c2_info[61].dominantType = "char";
  c2_info[61].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807.m";
  c2_info[61].fileTimeLo = 1313338820U;
  c2_info[61].fileTimeHi = 0U;
  c2_info[61].mFileTimeLo = 0U;
  c2_info[61].mFileTimeHi = 0U;
  c2_info[62].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807_stateful.m";
  c2_info[62].name = "eml_rand_mcg16807";
  c2_info[62].dominantType = "uint32";
  c2_info[62].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807.m";
  c2_info[62].fileTimeLo = 1313338820U;
  c2_info[62].fileTimeHi = 0U;
  c2_info[62].mFileTimeLo = 0U;
  c2_info[62].mFileTimeHi = 0U;
  c2_info[63].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807.m!genrandu";
  c2_info[63].name = "mtimes";
  c2_info[63].dominantType = "double";
  c2_info[63].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[63].fileTimeLo = 1289510692U;
  c2_info[63].fileTimeHi = 0U;
  c2_info[63].mFileTimeLo = 0U;
  c2_info[63].mFileTimeHi = 0U;
}

static void c2_b_info_helper(c2_ResolvedFunctionInfo c2_info[108])
{
  c2_info[64].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand.m";
  c2_info[64].name = "eml_rand_shr3cong_stateful";
  c2_info[64].dominantType = "char";
  c2_info[64].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong_stateful.m";
  c2_info[64].fileTimeLo = 1313338822U;
  c2_info[64].fileTimeHi = 0U;
  c2_info[64].mFileTimeLo = 0U;
  c2_info[64].mFileTimeHi = 0U;
  c2_info[65].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong_stateful.m";
  c2_info[65].name = "eml_rand_shr3cong";
  c2_info[65].dominantType = "char";
  c2_info[65].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m";
  c2_info[65].fileTimeLo = 1313338820U;
  c2_info[65].fileTimeHi = 0U;
  c2_info[65].mFileTimeLo = 0U;
  c2_info[65].mFileTimeHi = 0U;
  c2_info[66].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong_stateful.m";
  c2_info[66].name = "eml_rand_shr3cong";
  c2_info[66].dominantType = "uint32";
  c2_info[66].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m";
  c2_info[66].fileTimeLo = 1313338820U;
  c2_info[66].fileTimeHi = 0U;
  c2_info[66].mFileTimeLo = 0U;
  c2_info[66].mFileTimeHi = 0U;
  c2_info[67].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m!genrandu";
  c2_info[67].name = "mtimes";
  c2_info[67].dominantType = "double";
  c2_info[67].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[67].fileTimeLo = 1289510692U;
  c2_info[67].fileTimeHi = 0U;
  c2_info[67].mFileTimeLo = 0U;
  c2_info[67].mFileTimeHi = 0U;
  c2_info[68].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand.m";
  c2_info[68].name = "eml_rand_mt19937ar_stateful";
  c2_info[68].dominantType = "char";
  c2_info[68].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar_stateful.m";
  c2_info[68].fileTimeLo = 1313338820U;
  c2_info[68].fileTimeHi = 0U;
  c2_info[68].mFileTimeLo = 0U;
  c2_info[68].mFileTimeHi = 0U;
  c2_info[69].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar_stateful.m";
  c2_info[69].name = "eml_rand_mt19937ar";
  c2_info[69].dominantType = "char";
  c2_info[69].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m";
  c2_info[69].fileTimeLo = 1313338820U;
  c2_info[69].fileTimeHi = 0U;
  c2_info[69].mFileTimeLo = 0U;
  c2_info[69].mFileTimeHi = 0U;
  c2_info[70].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar_stateful.m";
  c2_info[70].name = "eml_rand_mt19937ar";
  c2_info[70].dominantType = "uint32";
  c2_info[70].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m";
  c2_info[70].fileTimeLo = 1313338820U;
  c2_info[70].fileTimeHi = 0U;
  c2_info[70].mFileTimeLo = 0U;
  c2_info[70].mFileTimeHi = 0U;
  c2_info[71].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!genrandu";
  c2_info[71].name = "eps";
  c2_info[71].dominantType = "";
  c2_info[71].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/eps.m";
  c2_info[71].fileTimeLo = 1326718996U;
  c2_info[71].fileTimeHi = 0U;
  c2_info[71].mFileTimeLo = 0U;
  c2_info[71].mFileTimeHi = 0U;
  c2_info[72].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/eps.m";
  c2_info[72].name = "eml_eps";
  c2_info[72].dominantType = "char";
  c2_info[72].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_eps.m";
  c2_info[72].fileTimeLo = 1326718996U;
  c2_info[72].fileTimeHi = 0U;
  c2_info[72].mFileTimeLo = 0U;
  c2_info[72].mFileTimeHi = 0U;
  c2_info[73].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_eps.m";
  c2_info[73].name = "eml_float_model";
  c2_info[73].dominantType = "char";
  c2_info[73].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_float_model.m";
  c2_info[73].fileTimeLo = 1326718996U;
  c2_info[73].fileTimeHi = 0U;
  c2_info[73].mFileTimeLo = 0U;
  c2_info[73].mFileTimeHi = 0U;
  c2_info[74].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!is_valid_state";
  c2_info[74].name = "isequal";
  c2_info[74].dominantType = "double";
  c2_info[74].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/isequal.m";
  c2_info[74].fileTimeLo = 1286813358U;
  c2_info[74].fileTimeHi = 0U;
  c2_info[74].mFileTimeLo = 0U;
  c2_info[74].mFileTimeHi = 0U;
  c2_info[75].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_isequal_core.m!isequal_scalar";
  c2_info[75].name = "isnan";
  c2_info[75].dominantType = "double";
  c2_info[75].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/isnan.m";
  c2_info[75].fileTimeLo = 1286813360U;
  c2_info[75].fileTimeHi = 0U;
  c2_info[75].mFileTimeLo = 0U;
  c2_info[75].mFileTimeHi = 0U;
  c2_info[76].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!genrandu";
  c2_info[76].name = "mtimes";
  c2_info[76].dominantType = "double";
  c2_info[76].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[76].fileTimeLo = 1289510692U;
  c2_info[76].fileTimeHi = 0U;
  c2_info[76].mFileTimeLo = 0U;
  c2_info[76].mFileTimeHi = 0U;
  c2_info[77].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!is_valid_state";
  c2_info[77].name = "eml_index_class";
  c2_info[77].dominantType = "";
  c2_info[77].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[77].fileTimeLo = 1323161578U;
  c2_info[77].fileTimeHi = 0U;
  c2_info[77].mFileTimeLo = 0U;
  c2_info[77].mFileTimeHi = 0U;
  c2_info[78].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!is_valid_state";
  c2_info[78].name = "eml_index_plus";
  c2_info[78].dominantType = "double";
  c2_info[78].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c2_info[78].fileTimeLo = 1286813378U;
  c2_info[78].fileTimeHi = 0U;
  c2_info[78].mFileTimeLo = 0U;
  c2_info[78].mFileTimeHi = 0U;
  c2_info[79].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!genrandu";
  c2_info[79].name = "eml_error";
  c2_info[79].dominantType = "char";
  c2_info[79].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_error.m";
  c2_info[79].fileTimeLo = 1305309000U;
  c2_info[79].fileTimeHi = 0U;
  c2_info[79].mFileTimeLo = 0U;
  c2_info[79].mFileTimeHi = 0U;
  c2_info[80].context = "";
  c2_info[80].name = "ceil";
  c2_info[80].dominantType = "double";
  c2_info[80].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/ceil.m";
  c2_info[80].fileTimeLo = 1286813306U;
  c2_info[80].fileTimeHi = 0U;
  c2_info[80].mFileTimeLo = 0U;
  c2_info[80].mFileTimeHi = 0U;
  c2_info[81].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/ceil.m";
  c2_info[81].name = "eml_scalar_ceil";
  c2_info[81].dominantType = "double";
  c2_info[81].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_ceil.m";
  c2_info[81].fileTimeLo = 1286813320U;
  c2_info[81].fileTimeHi = 0U;
  c2_info[81].mFileTimeLo = 0U;
  c2_info[81].mFileTimeHi = 0U;
  c2_info[82].context = "";
  c2_info[82].name = "randn";
  c2_info[82].dominantType = "double";
  c2_info[82].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/randn.m";
  c2_info[82].fileTimeLo = 1313338824U;
  c2_info[82].fileTimeHi = 0U;
  c2_info[82].mFileTimeLo = 0U;
  c2_info[82].mFileTimeHi = 0U;
  c2_info[83].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/randn.m";
  c2_info[83].name = "eml_is_rand_extrinsic";
  c2_info[83].dominantType = "";
  c2_info[83].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_is_rand_extrinsic.m";
  c2_info[83].fileTimeLo = 1334062490U;
  c2_info[83].fileTimeHi = 0U;
  c2_info[83].mFileTimeLo = 0U;
  c2_info[83].mFileTimeHi = 0U;
  c2_info[84].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/randn.m";
  c2_info[84].name = "eml_randn";
  c2_info[84].dominantType = "char";
  c2_info[84].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_randn.m";
  c2_info[84].fileTimeLo = 1313338822U;
  c2_info[84].fileTimeHi = 0U;
  c2_info[84].mFileTimeLo = 0U;
  c2_info[84].mFileTimeHi = 0U;
  c2_info[85].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_randn.m";
  c2_info[85].name = "eml_rand_str2id";
  c2_info[85].dominantType = "char";
  c2_info[85].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_str2id.m";
  c2_info[85].fileTimeLo = 1313338822U;
  c2_info[85].fileTimeHi = 0U;
  c2_info[85].mFileTimeLo = 0U;
  c2_info[85].mFileTimeHi = 0U;
  c2_info[86].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_randn.m";
  c2_info[86].name = "eml_rand_shr3cong";
  c2_info[86].dominantType = "char";
  c2_info[86].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m";
  c2_info[86].fileTimeLo = 1313338820U;
  c2_info[86].fileTimeHi = 0U;
  c2_info[86].mFileTimeLo = 0U;
  c2_info[86].mFileTimeHi = 0U;
  c2_info[87].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_randn.m";
  c2_info[87].name = "eml_tolower";
  c2_info[87].dominantType = "char";
  c2_info[87].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_tolower.m";
  c2_info[87].fileTimeLo = 1286813400U;
  c2_info[87].fileTimeHi = 0U;
  c2_info[87].mFileTimeLo = 0U;
  c2_info[87].mFileTimeHi = 0U;
  c2_info[88].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_randn.m";
  c2_info[88].name = "eml_rand";
  c2_info[88].dominantType = "char";
  c2_info[88].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand.m";
  c2_info[88].fileTimeLo = 1313338820U;
  c2_info[88].fileTimeHi = 0U;
  c2_info[88].mFileTimeLo = 0U;
  c2_info[88].mFileTimeHi = 0U;
  c2_info[89].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807.m!genrandn";
  c2_info[89].name = "mtimes";
  c2_info[89].dominantType = "double";
  c2_info[89].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[89].fileTimeLo = 1289510692U;
  c2_info[89].fileTimeHi = 0U;
  c2_info[89].mFileTimeLo = 0U;
  c2_info[89].mFileTimeHi = 0U;
  c2_info[90].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m!genrandn";
  c2_info[90].name = "mtimes";
  c2_info[90].dominantType = "double";
  c2_info[90].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[90].fileTimeLo = 1289510692U;
  c2_info[90].fileTimeHi = 0U;
  c2_info[90].mFileTimeLo = 0U;
  c2_info[90].mFileTimeHi = 0U;
  c2_info[91].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m!genrandn";
  c2_info[91].name = "abs";
  c2_info[91].dominantType = "double";
  c2_info[91].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[91].fileTimeLo = 1286813294U;
  c2_info[91].fileTimeHi = 0U;
  c2_info[91].mFileTimeLo = 0U;
  c2_info[91].mFileTimeHi = 0U;
  c2_info[92].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m!genrandn";
  c2_info[92].name = "mrdivide";
  c2_info[92].dominantType = "double";
  c2_info[92].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c2_info[92].fileTimeLo = 1342801944U;
  c2_info[92].fileTimeHi = 0U;
  c2_info[92].mFileTimeLo = 1319724566U;
  c2_info[92].mFileTimeHi = 0U;
  c2_info[93].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m!genrandn";
  c2_info[93].name = "exp";
  c2_info[93].dominantType = "double";
  c2_info[93].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/exp.m";
  c2_info[93].fileTimeLo = 1286813340U;
  c2_info[93].fileTimeHi = 0U;
  c2_info[93].mFileTimeLo = 0U;
  c2_info[93].mFileTimeHi = 0U;
  c2_info[94].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!mtziggurat";
  c2_info[94].name = "mtimes";
  c2_info[94].dominantType = "double";
  c2_info[94].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c2_info[94].fileTimeLo = 1289510692U;
  c2_info[94].fileTimeHi = 0U;
  c2_info[94].mFileTimeLo = 0U;
  c2_info[94].mFileTimeHi = 0U;
  c2_info[95].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!mtziggurat";
  c2_info[95].name = "mrdivide";
  c2_info[95].dominantType = "double";
  c2_info[95].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c2_info[95].fileTimeLo = 1342801944U;
  c2_info[95].fileTimeHi = 0U;
  c2_info[95].mFileTimeLo = 1319724566U;
  c2_info[95].mFileTimeHi = 0U;
  c2_info[96].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!mtziggurat";
  c2_info[96].name = "abs";
  c2_info[96].dominantType = "double";
  c2_info[96].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m";
  c2_info[96].fileTimeLo = 1286813294U;
  c2_info[96].fileTimeHi = 0U;
  c2_info[96].mFileTimeLo = 0U;
  c2_info[96].mFileTimeHi = 0U;
  c2_info[97].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar.m!mtziggurat";
  c2_info[97].name = "exp";
  c2_info[97].dominantType = "double";
  c2_info[97].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/exp.m";
  c2_info[97].fileTimeLo = 1286813340U;
  c2_info[97].fileTimeHi = 0U;
  c2_info[97].mFileTimeLo = 0U;
  c2_info[97].mFileTimeHi = 0U;
  c2_info[98].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_randn.m";
  c2_info[98].name = "eml_rand_mcg16807";
  c2_info[98].dominantType = "uint32";
  c2_info[98].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807.m";
  c2_info[98].fileTimeLo = 1313338820U;
  c2_info[98].fileTimeHi = 0U;
  c2_info[98].mFileTimeLo = 0U;
  c2_info[98].mFileTimeHi = 0U;
  c2_info[99].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_randn.m";
  c2_info[99].name = "eml_rand_shr3cong";
  c2_info[99].dominantType = "uint32";
  c2_info[99].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong.m";
  c2_info[99].fileTimeLo = 1313338820U;
  c2_info[99].fileTimeHi = 0U;
  c2_info[99].mFileTimeLo = 0U;
  c2_info[99].mFileTimeHi = 0U;
  c2_info[100].context = "";
  c2_info[100].name = "min";
  c2_info[100].dominantType = "double";
  c2_info[100].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/min.m";
  c2_info[100].fileTimeLo = 1311246318U;
  c2_info[100].fileTimeHi = 0U;
  c2_info[100].mFileTimeLo = 0U;
  c2_info[100].mFileTimeHi = 0U;
  c2_info[101].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/min.m";
  c2_info[101].name = "eml_min_or_max";
  c2_info[101].dominantType = "char";
  c2_info[101].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c2_info[101].fileTimeLo = 1334062490U;
  c2_info[101].fileTimeHi = 0U;
  c2_info[101].mFileTimeLo = 0U;
  c2_info[101].mFileTimeHi = 0U;
  c2_info[102].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_bin_extremum";
  c2_info[102].name = "eml_scalar_eg";
  c2_info[102].dominantType = "double";
  c2_info[102].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c2_info[102].fileTimeLo = 1286813396U;
  c2_info[102].fileTimeHi = 0U;
  c2_info[102].mFileTimeLo = 0U;
  c2_info[102].mFileTimeHi = 0U;
  c2_info[103].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_bin_extremum";
  c2_info[103].name = "eml_scalexp_alloc";
  c2_info[103].dominantType = "double";
  c2_info[103].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m";
  c2_info[103].fileTimeLo = 1330599434U;
  c2_info[103].fileTimeHi = 0U;
  c2_info[103].mFileTimeLo = 0U;
  c2_info[103].mFileTimeHi = 0U;
  c2_info[104].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_bin_extremum";
  c2_info[104].name = "eml_index_class";
  c2_info[104].dominantType = "";
  c2_info[104].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c2_info[104].fileTimeLo = 1323161578U;
  c2_info[104].fileTimeHi = 0U;
  c2_info[104].mFileTimeLo = 0U;
  c2_info[104].mFileTimeHi = 0U;
  c2_info[105].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_scalar_bin_extremum";
  c2_info[105].name = "eml_scalar_eg";
  c2_info[105].dominantType = "double";
  c2_info[105].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c2_info[105].fileTimeLo = 1286813396U;
  c2_info[105].fileTimeHi = 0U;
  c2_info[105].mFileTimeLo = 0U;
  c2_info[105].mFileTimeHi = 0U;
  c2_info[106].context = "";
  c2_info[106].name = "rand";
  c2_info[106].dominantType = "double";
  c2_info[106].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/randfun/rand.m";
  c2_info[106].fileTimeLo = 1313338822U;
  c2_info[106].fileTimeHi = 0U;
  c2_info[106].mFileTimeLo = 0U;
  c2_info[106].mFileTimeHi = 0U;
  c2_info[107].context = "";
  c2_info[107].name = "isinf";
  c2_info[107].dominantType = "double";
  c2_info[107].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/isinf.m";
  c2_info[107].fileTimeLo = 1286813360U;
  c2_info[107].fileTimeHi = 0U;
  c2_info[107].mFileTimeLo = 0U;
  c2_info[107].mFileTimeHi = 0U;
}

static real_T c2_mpower(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_a)
{
  real_T c2_b_a;
  real_T c2_c_a;
  real_T c2_ak;
  c2_b_a = c2_a;
  c2_c_a = c2_b_a;
  c2_eml_scalar_eg(chartInstance);
  c2_ak = c2_c_a;
  return muDoubleScalarPower(c2_ak, 2.0);
}

static void c2_eml_scalar_eg(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

static real_T c2_sqrt(SFc2_Hunt_crossley_IdentInstanceStruct *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_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  int32_T c2_i123;
  static char_T c2_varargin_1[30] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o',
    'o', 'l', 'b', 'o', 'x', ':', 's', 'q', 'r', 't', '_', 'd', 'o', 'm', 'a',
    'i', 'n', 'E', 'r', 'r', 'o', 'r' };

  char_T c2_u[30];
  const mxArray *c2_y = NULL;
  for (c2_i123 = 0; c2_i123 < 30; c2_i123++) {
    c2_u[c2_i123] = c2_varargin_1[c2_i123];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 10, 0U, 1U, 0U, 2, 1, 30), FALSE);
  sf_mex_call_debug("error", 0U, 1U, 14, sf_mex_call_debug("message", 1U, 1U, 14,
    c2_y));
}

static real_T c2_abs(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                     real_T c2_x)
{
  real_T c2_b_x;
  c2_b_x = c2_x;
  return muDoubleScalarAbs(c2_b_x);
}

static void c2_mean(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                    real_T c2_x[2002], real_T c2_y[2])
{
  int32_T c2_ix;
  int32_T c2_iy;
  int32_T c2_i;
  int32_T c2_ixstart;
  int32_T c2_a;
  real_T c2_s;
  int32_T c2_k;
  int32_T c2_b_a;
  int32_T c2_c_a;
  int32_T c2_i124;
  c2_ix = 0;
  c2_iy = 0;
  c2_check_forloop_overflow_error(chartInstance);
  for (c2_i = 1; c2_i < 3; c2_i++) {
    c2_ixstart = c2_ix;
    c2_a = c2_ixstart + 1;
    c2_ixstart = c2_a;
    c2_ix = c2_ixstart;
    c2_s = c2_x[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
      (real_T)c2_ix), 1, 2002, 1, 0) - 1];
    c2_check_forloop_overflow_error(chartInstance);
    for (c2_k = 2; c2_k < 1002; c2_k++) {
      c2_b_a = c2_ix + 1;
      c2_ix = c2_b_a;
      c2_s += c2_x[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK(
        "", (real_T)c2_ix), 1, 2002, 1, 0) - 1];
    }

    c2_c_a = c2_iy + 1;
    c2_iy = c2_c_a;
    c2_y[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("", (real_T)
      c2_iy), 1, 2, 1, 0) - 1] = c2_s;
  }

  for (c2_i124 = 0; c2_i124 < 2; c2_i124++) {
    c2_y[c2_i124] /= 1001.0;
  }
}

static void c2_check_forloop_overflow_error
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static real_T c2_log10(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_x)
{
  real_T c2_b_x;
  c2_b_x = c2_x;
  c2_b_log10(chartInstance, &c2_b_x);
  return c2_b_x;
}

static void c2_b_eml_error(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  int32_T c2_i125;
  static char_T c2_varargin_1[31] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o',
    'o', 'l', 'b', 'o', 'x', ':', 'l', 'o', 'g', '1', '0', '_', 'd', 'o', 'm',
    'a', 'i', 'n', 'E', 'r', 'r', 'o', 'r' };

  char_T c2_u[31];
  const mxArray *c2_y = NULL;
  for (c2_i125 = 0; c2_i125 < 31; c2_i125++) {
    c2_u[c2_i125] = c2_varargin_1[c2_i125];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 10, 0U, 1U, 0U, 2, 1, 31), FALSE);
  sf_mex_call_debug("error", 0U, 1U, 14, sf_mex_call_debug("message", 1U, 1U, 14,
    c2_y));
}

static real_T c2_b_mpower(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_a, real_T c2_b)
{
  real_T c2_b_a;
  real_T c2_b_b;
  real_T c2_c_a;
  real_T c2_c_b;
  real_T c2_ak;
  real_T c2_bk;
  real_T c2_x;
  real_T c2_b_x;
  c2_b_a = c2_a;
  c2_b_b = c2_b;
  c2_c_a = c2_b_a;
  c2_c_b = c2_b_b;
  c2_eml_scalar_eg(chartInstance);
  c2_ak = c2_c_a;
  c2_bk = c2_c_b;
  if (c2_ak < 0.0) {
    c2_x = c2_bk;
    c2_b_x = c2_x;
    c2_b_x = muDoubleScalarFloor(c2_b_x);
    if (c2_b_x != c2_bk) {
      c2_c_eml_error(chartInstance);
    }
  }

  return muDoubleScalarPower(c2_ak, c2_bk);
}

static void c2_c_eml_error(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  int32_T c2_i126;
  static char_T c2_varargin_1[31] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o',
    'o', 'l', 'b', 'o', 'x', ':', 'p', 'o', 'w', 'e', 'r', '_', 'd', 'o', 'm',
    'a', 'i', 'n', 'E', 'r', 'r', 'o', 'r' };

  char_T c2_u[31];
  const mxArray *c2_y = NULL;
  for (c2_i126 = 0; c2_i126 < 31; c2_i126++) {
    c2_u[c2_i126] = c2_varargin_1[c2_i126];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 10, 0U, 1U, 0U, 2, 1, 31), FALSE);
  sf_mex_call_debug("error", 0U, 1U, 14, sf_mex_call_debug("message", 1U, 1U, 14,
    c2_y));
}

static real_T c2_rand(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  real_T c2_r;
  uint32_T c2_hoistedGlobal;
  uint32_T c2_e_state;
  uint32_T c2_f_state;
  real_T c2_b_r;
  uint32_T c2_g_state;
  real_T c2_d13;
  int32_T c2_i127;
  real_T c2_d14;
  if (!chartInstance->c2_method_not_empty) {
    chartInstance->c2_method = 7U;
    chartInstance->c2_method_not_empty = TRUE;
  }

  if (chartInstance->c2_method == 4U) {
    if (!chartInstance->c2_state_not_empty) {
      chartInstance->c2_state = 1144108930U;
      chartInstance->c2_state_not_empty = TRUE;
    }

    c2_hoistedGlobal = chartInstance->c2_state;
    c2_e_state = c2_hoistedGlobal;
    c2_f_state = c2_e_state;
    c2_genrandu(chartInstance, c2_f_state, &c2_g_state, &c2_b_r);
    c2_f_state = c2_g_state;
    c2_d13 = c2_b_r;
    chartInstance->c2_state = c2_f_state;
    c2_r = c2_d13;
  } else if (chartInstance->c2_method == 5U) {
    if (!chartInstance->c2_b_state_not_empty) {
      for (c2_i127 = 0; c2_i127 < 2; c2_i127++) {
        chartInstance->c2_b_state[c2_i127] = 362436069U + 158852560U * (uint32_T)
          c2_i127;
      }

      chartInstance->c2_b_state_not_empty = TRUE;
    }

    c2_d14 = c2_c_eml_rand_shr3cong(chartInstance, chartInstance->c2_b_state);
    c2_r = c2_d14;
  } else {
    c2_r = c2_eml_rand_mt19937ar_stateful(chartInstance);
  }

  return c2_r;
}

static void c2_genrandu(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  uint32_T c2_s, uint32_T *c2_e_state, real_T *c2_r)
{
  uint32_T c2_u0;
  uint32_T c2_hi;
  uint32_T c2_lo;
  uint32_T c2_test1;
  uint32_T c2_test2;
  real_T c2_a;
  c2_u0 = 127773U;
  if (c2_u0 == 0) {
    c2_hi = MAX_uint32_T;
  } else {
    c2_hi = c2_s / c2_u0;
  }

  c2_lo = c2_s - c2_hi * 127773U;
  c2_test1 = 16807U * c2_lo;
  c2_test2 = 2836U * c2_hi;
  if (c2_test1 < c2_test2) {
    *c2_e_state = (c2_test1 - c2_test2) + 2147483647U;
  } else {
    *c2_e_state = c2_test1 - c2_test2;
  }

  c2_a = (real_T)*c2_e_state;
  *c2_r = c2_a * 4.6566128752457969E-10;
}

static void c2_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2], uint32_T c2_f_state[2], real_T *c2_r)
{
  int32_T c2_i128;
  for (c2_i128 = 0; c2_i128 < 2; c2_i128++) {
    c2_f_state[c2_i128] = c2_e_state[c2_i128];
  }

  *c2_r = c2_c_eml_rand_shr3cong(chartInstance, c2_f_state);
}

static real_T c2_eml_rand_mt19937ar_stateful
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  uint32_T c2_uv3[625];
  int32_T c2_i129;
  int32_T c2_i130;
  uint32_T c2_e_state[625];
  real_T c2_b_r;
  int32_T c2_i131;
  real_T c2_d15;
  if (!chartInstance->c2_c_state_not_empty) {
    c2_eml_rand_mt19937ar(chartInstance, c2_uv3);
    for (c2_i129 = 0; c2_i129 < 625; c2_i129++) {
      chartInstance->c2_c_state[c2_i129] = c2_uv3[c2_i129];
    }

    chartInstance->c2_c_state_not_empty = TRUE;
  }

  for (c2_i130 = 0; c2_i130 < 625; c2_i130++) {
    c2_e_state[c2_i130] = chartInstance->c2_c_state[c2_i130];
  }

  c2_b_r = c2_c_genrandu(chartInstance, c2_e_state);
  for (c2_i131 = 0; c2_i131 < 625; c2_i131++) {
    chartInstance->c2_c_state[c2_i131] = c2_e_state[c2_i131];
  }

  c2_d15 = c2_b_r;
  return c2_d15;
}

static void c2_eml_rand_mt19937ar(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[625])
{
  real_T c2_d16;
  int32_T c2_i132;
  c2_d16 = 5489.0;
  for (c2_i132 = 0; c2_i132 < 625; c2_i132++) {
    c2_e_state[c2_i132] = 0U;
  }

  c2_b_twister_state_vector(chartInstance, c2_e_state, c2_d16);
}

static void c2_twister_state_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], real_T c2_seed, uint32_T c2_b_mt[625])
{
  int32_T c2_i133;
  for (c2_i133 = 0; c2_i133 < 625; c2_i133++) {
    c2_b_mt[c2_i133] = c2_mt[c2_i133];
  }

  c2_b_twister_state_vector(chartInstance, c2_b_mt, c2_seed);
}

static void c2_b_genrandu(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  uint32_T c2_mt[625], uint32_T c2_b_mt[625], real_T *c2_r)
{
  int32_T c2_i134;
  for (c2_i134 = 0; c2_i134 < 625; c2_i134++) {
    c2_b_mt[c2_i134] = c2_mt[c2_i134];
  }

  *c2_r = c2_c_genrandu(chartInstance, c2_b_mt);
}

static void c2_assert_valid_state(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

static void c2_genrand_uint32_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], uint32_T c2_b_mt[625], uint32_T c2_u[2])
{
  int32_T c2_i135;
  for (c2_i135 = 0; c2_i135 < 625; c2_i135++) {
    c2_b_mt[c2_i135] = c2_mt[c2_i135];
  }

  c2_b_genrand_uint32_vector(chartInstance, c2_b_mt, c2_u);
}

static void c2_d_eml_error(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  int32_T c2_i136;
  static char_T c2_varargin_1[37] = { 'C', 'o', 'd', 'e', 'r', ':', 'M', 'A',
    'T', 'L', 'A', 'B', ':', 'r', 'a', 'n', 'd', '_', 'i', 'n', 'v', 'a', 'l',
    'i', 'd', 'T', 'w', 'i', 's', 't', 'e', 'r', 'S', 't', 'a', 't', 'e' };

  char_T c2_u[37];
  const mxArray *c2_y = NULL;
  for (c2_i136 = 0; c2_i136 < 37; c2_i136++) {
    c2_u[c2_i136] = c2_varargin_1[c2_i136];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u, 10, 0U, 1U, 0U, 2, 1, 37), FALSE);
  sf_mex_call_debug("error", 0U, 1U, 14, sf_mex_call_debug("message", 1U, 1U, 14,
    c2_y));
}

static void c2_randn(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
                     real_T c2_r[2])
{
  int32_T c2_i137;
  static uint32_T c2_uv4[2] = { 362436069U, 0U };

  int32_T c2_k;
  real_T c2_b_k;
  uint32_T c2_e_state;
  real_T c2_d17;
  int32_T c2_i138;
  int32_T c2_c_k;
  real_T c2_d_k;
  real_T c2_d18;
  uint32_T c2_uv5[625];
  int32_T c2_i139;
  int32_T c2_e_k;
  real_T c2_f_k;
  int32_T c2_i140;
  uint32_T c2_f_state[625];
  real_T c2_d19;
  int32_T c2_i141;
  uint32_T c2_hoistedGlobal;
  int32_T c2_g_k;
  real_T c2_h_k;
  uint32_T c2_u1;
  real_T c2_d20;
  int32_T c2_i_k;
  real_T c2_d21;
  if (!chartInstance->c2_b_method_not_empty) {
    chartInstance->c2_b_method = 0U;
    chartInstance->c2_b_method_not_empty = TRUE;
    for (c2_i137 = 0; c2_i137 < 2; c2_i137++) {
      chartInstance->c2_d_state[c2_i137] = c2_uv4[c2_i137];
    }

    if ((real_T)chartInstance->c2_d_state[1] == 0.0) {
      chartInstance->c2_d_state[1] = 521288629U;
    }

    chartInstance->c2_d_state_not_empty = TRUE;
  }

  if (chartInstance->c2_b_method == 0U) {
    if (!chartInstance->c2_method_not_empty) {
      chartInstance->c2_method = 7U;
      chartInstance->c2_method_not_empty = TRUE;
    }

    if (chartInstance->c2_method == 4U) {
      if (!chartInstance->c2_state_not_empty) {
        chartInstance->c2_state = 1144108930U;
        chartInstance->c2_state_not_empty = TRUE;
      }

      for (c2_k = 0; c2_k < 2; c2_k++) {
        c2_b_k = 1.0 + (real_T)c2_k;
        c2_e_state = chartInstance->c2_state;
        c2_d17 = c2_b_eml_rand_mcg16807(chartInstance, &c2_e_state);
        chartInstance->c2_state = c2_e_state;
        c2_r[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
          c2_b_k), 1, 2, 1, 0) - 1] = c2_d17;
      }
    } else if (chartInstance->c2_method == 5U) {
      if (!chartInstance->c2_b_state_not_empty) {
        for (c2_i138 = 0; c2_i138 < 2; c2_i138++) {
          chartInstance->c2_b_state[c2_i138] = 362436069U + 158852560U *
            (uint32_T)c2_i138;
        }

        chartInstance->c2_b_state_not_empty = TRUE;
      }

      for (c2_c_k = 0; c2_c_k < 2; c2_c_k++) {
        c2_d_k = 1.0 + (real_T)c2_c_k;
        c2_d18 = c2_d_eml_rand_shr3cong(chartInstance, chartInstance->c2_b_state);
        c2_r[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
          c2_d_k), 1, 2, 1, 0) - 1] = c2_d18;
      }
    } else {
      if (!chartInstance->c2_c_state_not_empty) {
        c2_eml_rand_mt19937ar(chartInstance, c2_uv5);
        for (c2_i139 = 0; c2_i139 < 625; c2_i139++) {
          chartInstance->c2_c_state[c2_i139] = c2_uv5[c2_i139];
        }

        chartInstance->c2_c_state_not_empty = TRUE;
      }

      for (c2_e_k = 0; c2_e_k < 2; c2_e_k++) {
        c2_f_k = 1.0 + (real_T)c2_e_k;
        for (c2_i140 = 0; c2_i140 < 625; c2_i140++) {
          c2_f_state[c2_i140] = chartInstance->c2_c_state[c2_i140];
        }

        c2_d19 = c2_c_eml_rand_mt19937ar(chartInstance, c2_f_state);
        for (c2_i141 = 0; c2_i141 < 625; c2_i141++) {
          chartInstance->c2_c_state[c2_i141] = c2_f_state[c2_i141];
        }

        c2_r[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
          c2_f_k), 1, 2, 1, 0) - 1] = c2_d19;
      }
    }
  } else {
    c2_hoistedGlobal = chartInstance->c2_b_method;
    if (c2_hoistedGlobal == 4U) {
      for (c2_g_k = 0; c2_g_k < 2; c2_g_k++) {
        c2_h_k = 1.0 + (real_T)c2_g_k;
        c2_u1 = chartInstance->c2_d_state[0];
        c2_d20 = c2_b_eml_rand_mcg16807(chartInstance, &c2_u1);
        chartInstance->c2_d_state[0] = c2_u1;
        c2_r[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
          c2_h_k), 1, 2, 1, 0) - 1] = c2_d20;
      }
    } else {
      for (c2_i_k = 0; c2_i_k < 2; c2_i_k++) {
        c2_h_k = 1.0 + (real_T)c2_i_k;
        c2_d21 = c2_d_eml_rand_shr3cong(chartInstance, chartInstance->c2_d_state);
        c2_r[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
          c2_h_k), 1, 2, 1, 0) - 1] = c2_d21;
      }
    }
  }
}

static void c2_eml_rand_mcg16807(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state, uint32_T *c2_f_state, real_T *c2_r)
{
  *c2_f_state = c2_e_state;
  *c2_r = c2_b_eml_rand_mcg16807(chartInstance, c2_f_state);
}

static void c2_b_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2], uint32_T c2_f_state[2], real_T *c2_r)
{
  int32_T c2_i142;
  for (c2_i142 = 0; c2_i142 < 2; c2_i142++) {
    c2_f_state[c2_i142] = c2_e_state[c2_i142];
  }

  *c2_r = c2_d_eml_rand_shr3cong(chartInstance, c2_f_state);
}

static void c2_b_eml_rand_mt19937ar(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[625], uint32_T c2_f_state[625], real_T
  *c2_r)
{
  int32_T c2_i143;
  for (c2_i143 = 0; c2_i143 < 625; c2_i143++) {
    c2_f_state[c2_i143] = c2_e_state[c2_i143];
  }

  *c2_r = c2_c_eml_rand_mt19937ar(chartInstance, c2_f_state);
}

static real_T c2_b_rand(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  real_T c2_r;
  uint32_T c2_hoistedGlobal;
  uint32_T c2_e_state;
  uint32_T c2_f_state;
  real_T c2_b_r;
  uint32_T c2_g_state;
  real_T c2_d22;
  int32_T c2_i144;
  real_T c2_d23;
  if (!chartInstance->c2_method_not_empty) {
    chartInstance->c2_method = 7U;
    chartInstance->c2_method_not_empty = TRUE;
  }

  if (chartInstance->c2_method == 4U) {
    if (!chartInstance->c2_state_not_empty) {
      chartInstance->c2_state = 1144108930U;
      chartInstance->c2_state_not_empty = TRUE;
    }

    c2_hoistedGlobal = chartInstance->c2_state;
    c2_e_state = c2_hoistedGlobal;
    c2_f_state = c2_e_state;
    c2_genrandu(chartInstance, c2_f_state, &c2_g_state, &c2_b_r);
    c2_f_state = c2_g_state;
    c2_d22 = c2_b_r;
    chartInstance->c2_state = c2_f_state;
    c2_r = c2_d22;
  } else if (chartInstance->c2_method == 5U) {
    if (!chartInstance->c2_b_state_not_empty) {
      for (c2_i144 = 0; c2_i144 < 2; c2_i144++) {
        chartInstance->c2_b_state[c2_i144] = 362436069U + 158852560U * (uint32_T)
          c2_i144;
      }

      chartInstance->c2_b_state_not_empty = TRUE;
    }

    c2_d23 = c2_c_eml_rand_shr3cong(chartInstance, chartInstance->c2_b_state);
    c2_r = c2_d23;
  } else {
    c2_r = c2_b_eml_rand_mt19937ar_stateful(chartInstance);
  }

  return c2_r;
}

static real_T c2_b_eml_rand_mt19937ar_stateful
  (SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  uint32_T c2_uv6[625];
  int32_T c2_i145;
  int32_T c2_i146;
  uint32_T c2_e_state[625];
  real_T c2_b_r;
  int32_T c2_i147;
  real_T c2_d24;
  if (!chartInstance->c2_c_state_not_empty) {
    c2_eml_rand_mt19937ar(chartInstance, c2_uv6);
    for (c2_i145 = 0; c2_i145 < 625; c2_i145++) {
      chartInstance->c2_c_state[c2_i145] = c2_uv6[c2_i145];
    }

    chartInstance->c2_c_state_not_empty = TRUE;
  }

  for (c2_i146 = 0; c2_i146 < 625; c2_i146++) {
    c2_e_state[c2_i146] = chartInstance->c2_c_state[c2_i146];
  }

  c2_b_r = c2_c_genrandu(chartInstance, c2_e_state);
  for (c2_i147 = 0; c2_i147 < 625; c2_i147++) {
    chartInstance->c2_c_state[c2_i147] = c2_e_state[c2_i147];
  }

  c2_d24 = c2_b_r;
  return c2_d24;
}

static real_T c2_b_mean(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T c2_x[100])
{
  real_T c2_b_y;
  int32_T c2_k;
  int32_T c2_b_k;
  real_T c2_b_x;
  real_T c2_c_x;
  c2_b_y = c2_x[0];
  c2_check_forloop_overflow_error(chartInstance);
  for (c2_k = 2; c2_k < 101; c2_k++) {
    c2_b_k = c2_k;
    c2_b_y += c2_x[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK(
      "", (real_T)c2_b_k), 1, 100, 1, 0) - 1];
  }

  c2_b_x = c2_b_y;
  c2_c_x = c2_b_x;
  return c2_c_x / 100.0;
}

static real_T c2_j_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_unifrnd, const char_T *c2_identifier)
{
  real_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_k_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_unifrnd), &c2_thisId);
  sf_mex_destroy(&c2_unifrnd);
  return c2_y;
}

static real_T c2_k_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  real_T c2_y;
  real_T c2_d25;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_d25, 0, 0, 0U, 0, 0U, 0);
  c2_y = c2_d25;
  sf_mex_destroy(&c2_u);
  return c2_y;
}

static void c2_l_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_kde_x, const char_T *c2_identifier, real_T
  c2_y[100])
{
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_m_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_kde_x), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_kde_x);
}

static void c2_m_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  real_T c2_y[100])
{
  real_T c2_dv12[100];
  int32_T c2_i148;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_dv12, 1, 0, 0U, 1, 0U, 2, 1,
                100);
  for (c2_i148 = 0; c2_i148 < 100; c2_i148++) {
    c2_y[c2_i148] = c2_dv12[c2_i148];
  }

  sf_mex_destroy(&c2_u);
}

static const mxArray *c2_i_sf_marshallOut(void *chartInstanceVoid, void
  *c2_inData)
{
  const mxArray *c2_mxArrayOutData = NULL;
  int32_T c2_u;
  const mxArray *c2_y = NULL;
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)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_n_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  int32_T c2_y;
  int32_T c2_i149;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_i149, 1, 6, 0U, 0, 0U, 0);
  c2_y = c2_i149;
  sf_mex_destroy(&c2_u);
  return c2_y;
}

static void c2_g_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_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)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_n_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 uint32_T c2_o_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_c_method, const char_T *c2_identifier)
{
  uint32_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_p_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_c_method),
    &c2_thisId);
  sf_mex_destroy(&c2_c_method);
  return c2_y;
}

static uint32_T c2_p_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  uint32_T c2_y;
  uint32_T c2_u2;
  if (mxIsEmpty(c2_u)) {
    chartInstance->c2_method_not_empty = FALSE;
  } else {
    chartInstance->c2_method_not_empty = TRUE;
    sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_u2, 1, 7, 0U, 0, 0U, 0);
    c2_y = c2_u2;
  }

  sf_mex_destroy(&c2_u);
  return c2_y;
}

static uint32_T c2_q_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_c_method, const char_T *c2_identifier)
{
  uint32_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_r_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_c_method),
    &c2_thisId);
  sf_mex_destroy(&c2_c_method);
  return c2_y;
}

static uint32_T c2_r_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  uint32_T c2_y;
  uint32_T c2_u3;
  if (mxIsEmpty(c2_u)) {
    chartInstance->c2_b_method_not_empty = FALSE;
  } else {
    chartInstance->c2_b_method_not_empty = TRUE;
    sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_u3, 1, 7, 0U, 0, 0U, 0);
    c2_y = c2_u3;
  }

  sf_mex_destroy(&c2_u);
  return c2_y;
}

static uint32_T c2_s_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier)
{
  uint32_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_t_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_e_state), &c2_thisId);
  sf_mex_destroy(&c2_e_state);
  return c2_y;
}

static uint32_T c2_t_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  uint32_T c2_y;
  uint32_T c2_u4;
  if (mxIsEmpty(c2_u)) {
    chartInstance->c2_state_not_empty = FALSE;
  } else {
    chartInstance->c2_state_not_empty = TRUE;
    sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_u4, 1, 7, 0U, 0, 0U, 0);
    c2_y = c2_u4;
  }

  sf_mex_destroy(&c2_u);
  return c2_y;
}

static void c2_u_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier,
  uint32_T c2_y[625])
{
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_v_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_e_state), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_e_state);
}

static void c2_v_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  uint32_T c2_y[625])
{
  uint32_T c2_uv7[625];
  int32_T c2_i150;
  if (mxIsEmpty(c2_u)) {
    chartInstance->c2_c_state_not_empty = FALSE;
  } else {
    chartInstance->c2_c_state_not_empty = TRUE;
    sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_uv7, 1, 7, 0U, 1, 0U, 1, 625);
    for (c2_i150 = 0; c2_i150 < 625; c2_i150++) {
      c2_y[c2_i150] = c2_uv7[c2_i150];
    }
  }

  sf_mex_destroy(&c2_u);
}

static void c2_w_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier,
  uint32_T c2_y[2])
{
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_x_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_e_state), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_e_state);
}

static void c2_x_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  uint32_T c2_y[2])
{
  uint32_T c2_uv8[2];
  int32_T c2_i151;
  if (mxIsEmpty(c2_u)) {
    chartInstance->c2_b_state_not_empty = FALSE;
  } else {
    chartInstance->c2_b_state_not_empty = TRUE;
    sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_uv8, 1, 7, 0U, 1, 0U, 1, 2);
    for (c2_i151 = 0; c2_i151 < 2; c2_i151++) {
      c2_y[c2_i151] = c2_uv8[c2_i151];
    }
  }

  sf_mex_destroy(&c2_u);
}

static void c2_y_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_e_state, const char_T *c2_identifier,
  uint32_T c2_y[2])
{
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_ab_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_e_state), &c2_thisId, c2_y);
  sf_mex_destroy(&c2_e_state);
}

static void c2_ab_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId,
  uint32_T c2_y[2])
{
  uint32_T c2_uv9[2];
  int32_T c2_i152;
  if (mxIsEmpty(c2_u)) {
    chartInstance->c2_d_state_not_empty = FALSE;
  } else {
    chartInstance->c2_d_state_not_empty = TRUE;
    sf_mex_import(c2_parentId, sf_mex_dup(c2_u), c2_uv9, 1, 7, 0U, 1, 0U, 1, 2);
    for (c2_i152 = 0; c2_i152 < 2; c2_i152++) {
      c2_y[c2_i152] = c2_uv9[c2_i152];
    }
  }

  sf_mex_destroy(&c2_u);
}

static uint8_T c2_bb_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_b_is_active_c2_Hunt_crossley_Ident, const
  char_T *c2_identifier)
{
  uint8_T c2_y;
  emlrtMsgIdentifier c2_thisId;
  c2_thisId.fIdentifier = c2_identifier;
  c2_thisId.fParent = NULL;
  c2_y = c2_cb_emlrt_marshallIn(chartInstance, sf_mex_dup
    (c2_b_is_active_c2_Hunt_crossley_Ident), &c2_thisId);
  sf_mex_destroy(&c2_b_is_active_c2_Hunt_crossley_Ident);
  return c2_y;
}

static uint8_T c2_cb_emlrt_marshallIn(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c2_u, const emlrtMsgIdentifier *c2_parentId)
{
  uint8_T c2_y;
  uint8_T c2_u5;
  sf_mex_import(c2_parentId, sf_mex_dup(c2_u), &c2_u5, 1, 3, 0U, 0, 0U, 0);
  c2_y = c2_u5;
  sf_mex_destroy(&c2_u);
  return c2_y;
}

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

  *c2_x = muDoubleScalarSqrt(*c2_x);
}

static void c2_b_log10(SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance,
  real_T *c2_x)
{
  if (*c2_x < 0.0) {
    c2_b_eml_error(chartInstance);
  }

  *c2_x = muDoubleScalarLog10(*c2_x);
}

static real_T c2_c_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2])
{
  uint32_T c2_icng;
  uint32_T c2_jsr;
  uint32_T c2_u6;
  uint32_T c2_u7;
  uint32_T c2_ui;
  uint32_T c2_b_ui;
  real_T c2_a;
  real_T c2_b_r;
  c2_icng = c2_e_state[0];
  c2_jsr = c2_e_state[1];
  c2_u6 = c2_jsr;
  c2_u7 = c2_icng;
  c2_u7 = 69069U * c2_u7 + 1234567U;
  c2_u6 ^= c2_u6 << 13U;
  c2_u6 ^= c2_u6 >> 17U;
  c2_u6 ^= c2_u6 << 5U;
  c2_ui = c2_u7 + c2_u6;
  c2_e_state[0] = c2_u7;
  c2_e_state[1] = c2_u6;
  c2_b_ui = c2_ui;
  c2_a = (real_T)c2_b_ui;
  c2_b_r = c2_a * 2.328306436538696E-10;
  return c2_b_r;
}

static void c2_b_twister_state_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], real_T c2_seed)
{
  real_T c2_d26;
  uint32_T c2_u8;
  uint32_T c2_r;
  int32_T c2_mti;
  real_T c2_b_mti;
  real_T c2_d27;
  uint32_T c2_u9;
  c2_d26 = c2_seed;
  if (c2_d26 < 4.294967296E+9) {
    if (c2_d26 >= 0.0) {
      c2_u8 = (uint32_T)c2_d26;
    } else {
      c2_u8 = 0U;
    }
  } else if (c2_d26 >= 4.294967296E+9) {
    c2_u8 = MAX_uint32_T;
  } else {
    c2_u8 = 0U;
  }

  c2_r = c2_u8;
  c2_mt[0] = c2_r;
  for (c2_mti = 0; c2_mti < 623; c2_mti++) {
    c2_b_mti = 2.0 + (real_T)c2_mti;
    c2_d27 = muDoubleScalarRound(c2_b_mti - 1.0);
    if (c2_d27 < 4.294967296E+9) {
      if (c2_d27 >= 0.0) {
        c2_u9 = (uint32_T)c2_d27;
      } else {
        c2_u9 = 0U;
      }
    } else if (c2_d27 >= 4.294967296E+9) {
      c2_u9 = MAX_uint32_T;
    } else {
      c2_u9 = 0U;
    }

    c2_r = (c2_r ^ c2_r >> 30U) * 1812433253U + c2_u9;
    c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
      c2_b_mti), 1, 625, 1, 0) - 1] = c2_r;
  }

  c2_mt[624] = 624U;
}

static real_T c2_c_genrandu(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625])
{
  real_T c2_r;
  uint32_T c2_u[2];
  real_T c2_a;
  real_T c2_y;
  real_T c2_b;
  boolean_T c2_b0;
  boolean_T c2_isvalid;
  int32_T c2_k;
  int32_T c2_b_a;
  real_T c2_d28;
  boolean_T guard1 = FALSE;
  int32_T exitg1;
  boolean_T exitg2;

  /* <LEGAL>   This is a uniform (0,1) pseudorandom number generator based on: */
  /* <LEGAL> */
  /* <LEGAL>    A C-program for MT19937, with initialization improved 2002/1/26. */
  /* <LEGAL>    Coded by Takuji Nishimura and Makoto Matsumoto. */
  /* <LEGAL> */
  /* <LEGAL>    Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, */
  /* <LEGAL>    All rights reserved. */
  /* <LEGAL> */
  /* <LEGAL>    Redistribution and use in source and binary forms, with or without */
  /* <LEGAL>    modification, are permitted provided that the following conditions */
  /* <LEGAL>    are met: */
  /* <LEGAL> */
  /* <LEGAL>      1. Redistributions of source code must retain the above copyright */
  /* <LEGAL>         notice, this list of conditions and the following disclaimer. */
  /* <LEGAL> */
  /* <LEGAL>      2. Redistributions in binary form must reproduce the above copyright */
  /* <LEGAL>         notice, this list of conditions and the following disclaimer in the */
  /* <LEGAL>         documentation and/or other materials provided with the distribution. */
  /* <LEGAL> */
  /* <LEGAL>      3. The names of its contributors may not be used to endorse or promote */
  /* <LEGAL>         products derived from this software without specific prior written */
  /* <LEGAL>         permission. */
  /* <LEGAL> */
  /* <LEGAL>    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
  /* <LEGAL>    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
  /* <LEGAL>    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
  /* <LEGAL>    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
  /* <LEGAL>    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
  /* <LEGAL>    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
  /* <LEGAL>    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
  /* <LEGAL>    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  /* <LEGAL>    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
  /* <LEGAL>    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
  /* <LEGAL>    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  do {
    exitg1 = 0;
    c2_b_genrand_uint32_vector(chartInstance, c2_mt, c2_u);
    c2_u[0] >>= 5U;
    c2_u[1] >>= 6U;
    c2_a = (real_T)c2_u[0];
    c2_y = c2_a * 6.7108864E+7;
    c2_b = c2_y + (real_T)c2_u[1];
    c2_r = 1.1102230246251565E-16 * c2_b;
    if (c2_r == 0.0) {
      guard1 = FALSE;
      if ((real_T)c2_mt[624] >= 1.0) {
        if ((real_T)c2_mt[624] < 625.0) {
          c2_b0 = TRUE;
        } else {
          guard1 = TRUE;
        }
      } else {
        guard1 = TRUE;
      }

      if (guard1 == TRUE) {
        c2_b0 = FALSE;
      }

      c2_isvalid = c2_b0;
      if (c2_isvalid) {
        c2_isvalid = FALSE;
        c2_k = 1;
        exitg2 = FALSE;
        while ((exitg2 == FALSE) && (c2_k < 625)) {
          if ((real_T)c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
               _SFD_INTEGER_CHECK("", (real_T)c2_k), 1, 625, 1, 0) - 1] == 0.0)
          {
            c2_b_a = c2_k + 1;
            c2_k = c2_b_a;
          } else {
            c2_isvalid = TRUE;
            exitg2 = TRUE;
          }
        }
      }

      if (!c2_isvalid) {
        c2_d_eml_error(chartInstance);
        c2_d28 = 5489.0;
        c2_b_twister_state_vector(chartInstance, c2_mt, c2_d28);
      }
    } else {
      exitg1 = 1;
    }
  } while (exitg1 == 0);

  return c2_r;
}

static void c2_b_genrand_uint32_vector(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_mt[625], uint32_T c2_u[2])
{
  int32_T c2_i153;
  int32_T c2_j;
  real_T c2_b_j;
  uint32_T c2_mti;
  int32_T c2_kk;
  real_T c2_b_kk;
  uint32_T c2_y;
  uint32_T c2_b_y;
  uint32_T c2_c_y;
  int32_T c2_c_kk;
  uint32_T c2_d_y;
  uint32_T c2_e_y;
  uint32_T c2_f_y;
  uint32_T c2_g_y;
  for (c2_i153 = 0; c2_i153 < 2; c2_i153++) {
    c2_u[c2_i153] = 0U;
  }

  for (c2_j = 0; c2_j < 2; c2_j++) {
    c2_b_j = 1.0 + (real_T)c2_j;
    c2_mti = c2_mt[624] + 1U;
    if ((real_T)c2_mti >= 625.0) {
      for (c2_kk = 0; c2_kk < 227; c2_kk++) {
        c2_b_kk = 1.0 + (real_T)c2_kk;
        c2_y = (c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
                 _SFD_INTEGER_CHECK("", c2_b_kk), 1, 625, 1, 0) - 1] &
                2147483648U) | (c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
          _SFD_INTEGER_CHECK("", c2_b_kk + 1.0), 1, 625, 1, 0) - 1] &
          2147483647U);
        c2_b_y = c2_y;
        c2_c_y = c2_b_y;
        if ((real_T)(c2_c_y & 1U) == 0.0) {
          c2_c_y >>= 1U;
        } else {
          c2_c_y = c2_c_y >> 1U ^ 2567483615U;
        }

        c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
          c2_b_kk), 1, 625, 1, 0) - 1] = c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("",
          (int32_T)_SFD_INTEGER_CHECK("", c2_b_kk + 397.0), 1, 625, 1, 0) - 1] ^
          c2_c_y;
      }

      for (c2_c_kk = 0; c2_c_kk < 396; c2_c_kk++) {
        c2_b_kk = 228.0 + (real_T)c2_c_kk;
        c2_y = (c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
                 _SFD_INTEGER_CHECK("", c2_b_kk), 1, 625, 1, 0) - 1] &
                2147483648U) | (c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
          _SFD_INTEGER_CHECK("", c2_b_kk + 1.0), 1, 625, 1, 0) - 1] &
          2147483647U);
        c2_d_y = c2_y;
        c2_e_y = c2_d_y;
        if ((real_T)(c2_e_y & 1U) == 0.0) {
          c2_e_y >>= 1U;
        } else {
          c2_e_y = c2_e_y >> 1U ^ 2567483615U;
        }

        c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
          c2_b_kk), 1, 625, 1, 0) - 1] = c2_mt[_SFD_EML_ARRAY_BOUNDS_CHECK("",
          (int32_T)_SFD_INTEGER_CHECK("", (c2_b_kk + 1.0) - 228.0), 1, 625, 1, 0)
          - 1] ^ c2_e_y;
      }

      c2_y = (c2_mt[623] & 2147483648U) | (c2_mt[0] & 2147483647U);
      c2_f_y = c2_y;
      c2_g_y = c2_f_y;
      if ((real_T)(c2_g_y & 1U) == 0.0) {
        c2_g_y >>= 1U;
      } else {
        c2_g_y = c2_g_y >> 1U ^ 2567483615U;
      }

      c2_mt[623] = c2_mt[396] ^ c2_g_y;
      c2_mti = 1U;
    }

    c2_y = c2_mt[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
      (uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_mti), 1, 625, 1, 0) - 1];
    c2_mt[624] = c2_mti;
    c2_y ^= c2_y >> 11U;
    c2_y ^= c2_y << 7U & 2636928640U;
    c2_y ^= c2_y << 15U & 4022730752U;
    c2_y ^= c2_y >> 18U;
    c2_u[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("", c2_b_j),
      1, 2, 1, 0) - 1] = c2_y;
  }
}

static real_T c2_b_eml_rand_mcg16807(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T *c2_e_state)
{
  uint32_T c2_f_state;
  uint32_T c2_g_state;
  real_T c2_b_r;
  uint32_T c2_h_state;
  real_T c2_c_r;
  real_T c2_t;
  uint32_T c2_i_state;
  real_T c2_b_t;
  real_T c2_b;
  real_T c2_y;
  real_T c2_b_b;
  real_T c2_b_y;
  real_T c2_a;
  real_T c2_c_b;
  real_T c2_c_y;
  real_T c2_b_a;
  real_T c2_d_b;
  real_T c2_d_y;
  real_T c2_e_b;
  real_T c2_e_y;
  real_T c2_c_a;
  real_T c2_f_b;
  c2_f_state = *c2_e_state;
  c2_g_state = c2_f_state;
  do {
    c2_genrandu(chartInstance, c2_g_state, &c2_h_state, &c2_b_r);
    c2_g_state = c2_h_state;
    c2_c_r = c2_b_r;
    c2_genrandu(chartInstance, c2_g_state, &c2_i_state, &c2_t);
    c2_g_state = c2_i_state;
    c2_b_t = c2_t;
    c2_b = c2_c_r;
    c2_y = 2.0 * c2_b;
    c2_c_r = c2_y - 1.0;
    c2_b_b = c2_b_t;
    c2_b_y = 2.0 * c2_b_b;
    c2_b_t = c2_b_y - 1.0;
    c2_a = c2_b_t;
    c2_c_b = c2_b_t;
    c2_c_y = c2_a * c2_c_b;
    c2_b_a = c2_c_r;
    c2_d_b = c2_c_r;
    c2_d_y = c2_b_a * c2_d_b;
    c2_b_t = c2_c_y + c2_d_y;
  } while (!(c2_b_t <= 1.0));

  c2_e_b = muDoubleScalarLog(c2_b_t);
  c2_e_y = -2.0 * c2_e_b;
  c2_c_a = c2_c_r;
  c2_f_b = muDoubleScalarSqrt(c2_e_y / c2_b_t);
  c2_c_r = c2_c_a * c2_f_b;
  *c2_e_state = c2_g_state;
  return c2_c_r;
}

static real_T c2_d_eml_rand_shr3cong(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[2])
{
  uint32_T c2_icng;
  uint32_T c2_jsr;
  uint32_T c2_b_icng;
  uint32_T c2_b_jsr;
  uint32_T c2_c_jsr;
  uint32_T c2_c_icng;
  uint32_T c2_ui;
  uint32_T c2_b_ui;
  uint32_T c2_j;
  uint32_T c2_jp1;
  int32_T c2_i;
  real_T c2_a;
  real_T c2_y;
  real_T c2_b_a;
  static real_T c2_dv13[65] = { 0.340945, 0.4573146, 0.5397793, 0.6062427,
    0.6631691, 0.7136975, 0.7596125, 0.8020356, 0.8417227, 0.8792102, 0.9148948,
    0.9490791, 0.9820005, 1.0138492, 1.044781, 1.0749254, 1.1043917, 1.1332738,
    1.161653, 1.189601, 1.2171815, 1.2444516, 1.2714635, 1.298265, 1.3249008,
    1.3514125, 1.3778399, 1.4042211, 1.4305929, 1.4569915, 1.4834527, 1.5100122,
    1.5367061, 1.5635712, 1.5906454, 1.617968, 1.6455802, 1.6735255, 1.7018503,
    1.7306045, 1.7598422, 1.7896223, 1.8200099, 1.851077, 1.8829044, 1.9155831,
    1.9492166, 1.9839239, 2.0198431, 2.0571356, 2.095993, 2.136645, 2.1793713,
    2.2245175, 2.2725186, 2.3239338, 2.3795008, 2.4402218, 2.5075117, 2.5834658,
    2.6713916, 2.7769942, 2.7769942, 2.7769942, 2.7769942 };

  real_T c2_b;
  real_T c2_b_r;
  real_T c2_x;
  real_T c2_b_x;
  real_T c2_b_y;
  real_T c2_c_r;
  real_T c2_c_x;
  real_T c2_d_x;
  real_T c2_c_y;
  real_T c2_A;
  real_T c2_B;
  real_T c2_e_x;
  real_T c2_d_y;
  real_T c2_f_x;
  real_T c2_e_y;
  real_T c2_g_x;
  uint32_T c2_d_icng;
  uint32_T c2_d_jsr;
  uint32_T c2_e_jsr;
  uint32_T c2_e_icng;
  uint32_T c2_c_ui;
  real_T c2_c_a;
  real_T c2_f_y;
  real_T c2_g_y;
  real_T c2_s;
  real_T c2_b_b;
  real_T c2_h_y;
  real_T c2_c_b;
  real_T c2_i_y;
  real_T c2_d_b;
  real_T c2_j_y;
  real_T c2_e_b;
  real_T c2_k_y;
  real_T c2_d_a;
  real_T c2_f_b;
  real_T c2_l_y;
  real_T c2_g_b;
  real_T c2_m_y;
  real_T c2_h_b;
  real_T c2_n_y;
  real_T c2_e_a;
  real_T c2_i_b;
  real_T c2_o_y;
  real_T c2_h_x;
  real_T c2_i_x;
  real_T c2_f_a;
  real_T c2_p_y;
  real_T c2_b_A;
  real_T c2_b_B;
  real_T c2_j_x;
  real_T c2_q_y;
  real_T c2_k_x;
  real_T c2_r_y;
  real_T c2_s_y;
  real_T c2_j_b;
  real_T c2_t_y;
  real_T c2_g_a;
  real_T c2_k_b;
  real_T c2_u_y;
  uint32_T c2_f_icng;
  uint32_T c2_f_jsr;
  uint32_T c2_g_jsr;
  uint32_T c2_g_icng;
  uint32_T c2_d_ui;
  real_T c2_h_a;
  real_T c2_v_y;
  real_T c2_c_A;
  real_T c2_l_x;
  real_T c2_m_x;
  uint32_T c2_h_icng;
  uint32_T c2_h_jsr;
  uint32_T c2_i_jsr;
  uint32_T c2_i_icng;
  uint32_T c2_e_ui;
  real_T c2_i_a;
  real_T c2_w_y;
  real_T c2_l_b;
  real_T c2_x_y;
  real_T c2_j_a;
  real_T c2_m_b;
  real_T c2_y_y;
  c2_icng = c2_e_state[0];
  c2_jsr = c2_e_state[1];
  c2_b_icng = c2_icng;
  c2_b_jsr = c2_jsr;
  c2_c_jsr = c2_b_jsr;
  c2_c_icng = c2_b_icng;
  c2_c_icng = 69069U * c2_c_icng + 1234567U;
  c2_c_jsr ^= c2_c_jsr << 13U;
  c2_c_jsr ^= c2_c_jsr >> 17U;
  c2_c_jsr ^= c2_c_jsr << 5U;
  c2_ui = c2_c_icng + c2_c_jsr;
  c2_icng = c2_c_icng;
  c2_jsr = c2_c_jsr;
  c2_b_ui = c2_ui;
  c2_j = (c2_b_ui & 63U) + 1U;
  c2_j;
  c2_jp1 = c2_j + 1U;
  c2_i = (int32_T)c2_b_ui;
  c2_a = (real_T)c2_i;
  c2_y = c2_a * 4.6566128730773926E-10;
  c2_b_a = c2_y;
  c2_b = c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
    (uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_jp1), 1, 65, 1, 0) - 1];
  c2_b_r = c2_b_a * c2_b;
  c2_x = c2_b_r;
  c2_b_x = c2_x;
  c2_b_y = muDoubleScalarAbs(c2_b_x);
  if (c2_b_y <= c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("",
       (int32_T)(uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_j), 1, 65, 1, 0) - 1])
  {
    c2_c_r = c2_b_r;
  } else {
    c2_c_x = c2_b_r;
    c2_d_x = c2_c_x;
    c2_c_y = muDoubleScalarAbs(c2_d_x);
    c2_A = c2_c_y - c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("",
      (int32_T)(uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_j), 1, 65, 1, 0) - 1];
    c2_B = c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
      (uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_jp1), 1, 65, 1, 0) - 1] -
      c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
      (uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_j), 1, 65, 1, 0) - 1];
    c2_e_x = c2_A;
    c2_d_y = c2_B;
    c2_f_x = c2_e_x;
    c2_e_y = c2_d_y;
    c2_g_x = c2_f_x / c2_e_y;
    c2_d_icng = c2_icng;
    c2_d_jsr = c2_jsr;
    c2_e_jsr = c2_d_jsr;
    c2_e_icng = c2_d_icng;
    c2_e_icng = 69069U * c2_e_icng + 1234567U;
    c2_e_jsr ^= c2_e_jsr << 13U;
    c2_e_jsr ^= c2_e_jsr >> 17U;
    c2_e_jsr ^= c2_e_jsr << 5U;
    c2_c_ui = c2_e_icng + c2_e_jsr;
    c2_icng = c2_e_icng;
    c2_jsr = c2_e_jsr;
    c2_b_ui = c2_c_ui;
    c2_i = (int32_T)c2_b_ui;
    c2_c_a = (real_T)c2_i;
    c2_f_y = c2_c_a * 2.328306436538696E-10;
    c2_g_y = 0.5 + c2_f_y;
    c2_s = c2_g_x + c2_g_y;
    if (c2_s > 1.301198) {
      if (c2_b_r < 0.0) {
        c2_b_b = c2_g_x;
        c2_h_y = 0.4878992 * c2_b_b;
        c2_c_r = c2_h_y - 0.4878992;
      } else {
        c2_c_b = c2_g_x;
        c2_i_y = 0.4878992 * c2_c_b;
        c2_c_r = 0.4878992 - c2_i_y;
      }
    } else if (c2_s <= 0.9689279) {
      c2_c_r = c2_b_r;
    } else {
      c2_d_b = c2_g_x;
      c2_j_y = 0.4878992 * c2_d_b;
      c2_g_x = 0.4878992 - c2_j_y;
      c2_e_b = c2_g_x;
      c2_k_y = -0.5 * c2_e_b;
      c2_d_a = c2_k_y;
      c2_f_b = c2_g_x;
      c2_l_y = c2_d_a * c2_f_b;
      c2_g_b = muDoubleScalarExp(c2_l_y);
      c2_m_y = 12.37586 * c2_g_b;
      if (c2_g_y > 12.67706 - c2_m_y) {
        if (c2_b_r < 0.0) {
          c2_c_r = -c2_g_x;
        } else {
          c2_c_r = c2_g_x;
        }
      } else {
        c2_h_b = c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("",
          (int32_T)(uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_jp1), 1, 65, 1, 0)
          - 1];
        c2_n_y = -0.5 * c2_h_b;
        c2_e_a = c2_n_y;
        c2_i_b = c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("",
          (int32_T)(uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_jp1), 1, 65, 1, 0)
          - 1];
        c2_o_y = c2_e_a * c2_i_b;
        c2_h_x = c2_o_y;
        c2_i_x = c2_h_x;
        c2_i_x = muDoubleScalarExp(c2_i_x);
        c2_f_a = c2_g_y;
        c2_p_y = c2_f_a * 0.01958303;
        c2_b_A = c2_p_y;
        c2_b_B = c2_dv13[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("",
          (int32_T)(uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_jp1), 1, 65, 1, 0)
          - 1];
        c2_j_x = c2_b_A;
        c2_q_y = c2_b_B;
        c2_k_x = c2_j_x;
        c2_r_y = c2_q_y;
        c2_s_y = c2_k_x / c2_r_y;
        c2_j_b = c2_b_r;
        c2_t_y = -0.5 * c2_j_b;
        c2_g_a = c2_t_y;
        c2_k_b = c2_b_r;
        c2_u_y = c2_g_a * c2_k_b;
        if (c2_i_x + c2_s_y <= muDoubleScalarExp(c2_u_y)) {
          c2_c_r = c2_b_r;
        } else {
          do {
            c2_f_icng = c2_icng;
            c2_f_jsr = c2_jsr;
            c2_g_jsr = c2_f_jsr;
            c2_g_icng = c2_f_icng;
            c2_g_icng = 69069U * c2_g_icng + 1234567U;
            c2_g_jsr ^= c2_g_jsr << 13U;
            c2_g_jsr ^= c2_g_jsr >> 17U;
            c2_g_jsr ^= c2_g_jsr << 5U;
            c2_d_ui = c2_g_icng + c2_g_jsr;
            c2_icng = c2_g_icng;
            c2_jsr = c2_g_jsr;
            c2_b_ui = c2_d_ui;
            c2_i = (int32_T)c2_b_ui;
            c2_h_a = (real_T)c2_i;
            c2_v_y = c2_h_a * 2.328306436538696E-10;
            c2_c_A = muDoubleScalarLog(0.5 + c2_v_y);
            c2_l_x = c2_c_A;
            c2_m_x = c2_l_x;
            c2_g_x = c2_m_x / 2.776994;
            c2_h_icng = c2_icng;
            c2_h_jsr = c2_jsr;
            c2_i_jsr = c2_h_jsr;
            c2_i_icng = c2_h_icng;
            c2_i_icng = 69069U * c2_i_icng + 1234567U;
            c2_i_jsr ^= c2_i_jsr << 13U;
            c2_i_jsr ^= c2_i_jsr >> 17U;
            c2_i_jsr ^= c2_i_jsr << 5U;
            c2_e_ui = c2_i_icng + c2_i_jsr;
            c2_icng = c2_i_icng;
            c2_jsr = c2_i_jsr;
            c2_b_ui = c2_e_ui;
            c2_i = (int32_T)c2_b_ui;
            c2_i_a = (real_T)c2_i;
            c2_w_y = c2_i_a * 2.328306436538696E-10;
            c2_l_b = muDoubleScalarLog(0.5 + c2_w_y);
            c2_x_y = -2.0 * c2_l_b;
            c2_j_a = c2_g_x;
            c2_m_b = c2_g_x;
            c2_y_y = c2_j_a * c2_m_b;
          } while (!(c2_x_y > c2_y_y));

          if (c2_b_r < 0.0) {
            c2_c_r = c2_g_x - 2.776994;
          } else {
            c2_c_r = 2.776994 - c2_g_x;
          }
        }
      }
    }
  }

  c2_e_state[0] = c2_icng;
  c2_e_state[1] = c2_jsr;
  return c2_c_r;
}

static real_T c2_c_eml_rand_mt19937ar(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance, uint32_T c2_e_state[625])
{
  uint32_T c2_u32[2];
  uint32_T c2_i;
  uint32_T c2_ip1;
  real_T c2_a;
  real_T c2_y;
  real_T c2_b_a;
  real_T c2_b_y;
  real_T c2_u;
  real_T c2_c_a;
  static real_T c2_dv14[257] = { 0.0, 0.215241895984875, 0.286174591792068,
    0.335737519214422, 0.375121332878378, 0.408389134611989, 0.43751840220787,
    0.46363433679088, 0.487443966139235, 0.50942332960209, 0.529909720661557,
    0.549151702327164, 0.567338257053817, 0.584616766106378, 0.601104617755991,
    0.61689699000775, 0.63207223638606, 0.646695714894993, 0.660822574244419,
    0.674499822837293, 0.687767892795788, 0.700661841106814, 0.713212285190975,
    0.725446140909999, 0.737387211434295, 0.749056662017815, 0.760473406430107,
    0.771654424224568, 0.782615023307232, 0.793369058840623, 0.80392911698997,
    0.814306670135215, 0.824512208752291, 0.834555354086381, 0.844444954909153,
    0.854189171008163, 0.863795545553308, 0.87327106808886, 0.882622229585165,
    0.891855070732941, 0.900975224461221, 0.909987953496718, 0.91889818364959,
    0.927710533401999, 0.936429340286575, 0.945058684468165, 0.953602409881086,
    0.96206414322304, 0.970447311064224, 0.978755155294224, 0.986990747099062,
    0.99515699963509, 1.00325667954467, 1.01129241744, 1.01926671746548,
    1.02718196603564, 1.03504043983344, 1.04284431314415, 1.05059566459093,
    1.05829648333067, 1.06594867476212, 1.07355406579244, 1.0811144097034,
    1.08863139065398, 1.09610662785202, 1.10354167942464, 1.11093804601357,
    1.11829717411934, 1.12562045921553, 1.13290924865253, 1.14016484436815,
    1.14738850542085, 1.15458145035993, 1.16174485944561, 1.16887987673083,
    1.17598761201545, 1.18306914268269, 1.19012551542669, 1.19715774787944,
    1.20416683014438, 1.2111537262437, 1.21811937548548, 1.22506469375653,
    1.23199057474614, 1.23889789110569, 1.24578749554863, 1.2526602218949,
    1.25951688606371, 1.26635828701823, 1.27318520766536, 1.27999841571382,
    1.28679866449324, 1.29358669373695, 1.30036323033084, 1.30712898903073,
    1.31388467315022, 1.32063097522106, 1.32736857762793, 1.33409815321936,
    1.3408203658964, 1.34753587118059, 1.35424531676263, 1.36094934303328,
    1.36764858359748, 1.37434366577317, 1.38103521107586, 1.38772383568998,
    1.39441015092814, 1.40109476367925, 1.4077782768464, 1.41446128977547,
    1.42114439867531, 1.42782819703026, 1.43451327600589, 1.44120022484872,
    1.44788963128058, 1.45458208188841, 1.46127816251028, 1.46797845861808,
    1.47468355569786, 1.48139403962819, 1.48811049705745, 1.49483351578049,
    1.50156368511546, 1.50830159628131, 1.51504784277671, 1.521803020761,
    1.52856772943771, 1.53534257144151, 1.542128153229, 1.54892508547417,
    1.55573398346918, 1.56255546753104, 1.56939016341512, 1.57623870273591,
    1.58310172339603, 1.58997987002419, 1.59687379442279, 1.60378415602609,
    1.61071162236983, 1.61765686957301, 1.62462058283303, 1.63160345693487,
    1.63860619677555, 1.64562951790478, 1.65267414708306, 1.65974082285818,
    1.66683029616166, 1.67394333092612, 1.68108070472517, 1.68824320943719,
    1.69543165193456, 1.70264685479992, 1.7098896570713, 1.71716091501782,
    1.72446150294804, 1.73179231405296, 1.73915426128591, 1.74654827828172,
    1.75397532031767, 1.76143636531891, 1.76893241491127, 1.77646449552452,
    1.78403365954944, 1.79164098655216, 1.79928758454972, 1.80697459135082,
    1.81470317596628, 1.82247454009388, 1.83028991968276, 1.83815058658281,
    1.84605785028518, 1.8540130597602, 1.86201760539967, 1.87007292107127,
    1.878180486293, 1.88634182853678, 1.8945585256707, 1.90283220855043,
    1.91116456377125, 1.91955733659319, 1.92801233405266, 1.93653142827569,
    1.94511656000868, 1.95376974238465, 1.96249306494436, 1.97128869793366,
    1.98015889690048, 1.98910600761744, 1.99813247135842, 2.00724083056053,
    2.0164337349062, 2.02571394786385, 2.03508435372962, 2.04454796521753,
    2.05410793165065, 2.06376754781173, 2.07353026351874, 2.0833996939983,
    2.09337963113879, 2.10347405571488, 2.11368715068665, 2.12402331568952,
    2.13448718284602, 2.14508363404789, 2.15581781987674, 2.16669518035431,
    2.17772146774029, 2.18890277162636, 2.20024554661128, 2.21175664288416,
    2.22344334009251, 2.23531338492992, 2.24737503294739, 2.25963709517379,
    2.27210899022838, 2.28480080272449, 2.29772334890286, 2.31088825060137,
    2.32430801887113, 2.33799614879653, 2.35196722737914, 2.36623705671729,
    2.38082279517208, 2.39574311978193, 2.41101841390112, 2.42667098493715,
    2.44272531820036, 2.4592083743347, 2.47614993967052, 2.49358304127105,
    2.51154444162669, 2.53007523215985, 2.54922155032478, 2.56903545268184,
    2.58957598670829, 2.61091051848882, 2.63311639363158, 2.65628303757674,
    2.68051464328574, 2.70593365612306, 2.73268535904401, 2.76094400527999,
    2.79092117400193, 2.82287739682644, 2.85713873087322, 2.89412105361341,
    2.93436686720889, 2.97860327988184, 3.02783779176959, 3.08352613200214,
    3.147889289518, 3.2245750520478, 3.32024473383983, 3.44927829856143,
    3.65415288536101, 3.91075795952492 };

  real_T c2_b;
  real_T c2_b_r;
  real_T c2_b_u;
  real_T c2_d_a;
  static real_T c2_dv15[257] = { 1.0, 0.977101701267673, 0.959879091800108,
    0.9451989534423, 0.932060075959231, 0.919991505039348, 0.908726440052131,
    0.898095921898344, 0.887984660755834, 0.878309655808918, 0.869008688036857,
    0.860033621196332, 0.851346258458678, 0.842915653112205, 0.834716292986884,
    0.826726833946222, 0.818929191603703, 0.811307874312656, 0.803849483170964,
    0.796542330422959, 0.789376143566025, 0.782341832654803, 0.775431304981187,
    0.768637315798486, 0.761953346836795, 0.755373506507096, 0.748892447219157,
    0.742505296340151, 0.736207598126863, 0.729995264561476, 0.72386453346863,
    0.717811932630722, 0.711834248878248, 0.705928501332754, 0.700091918136512,
    0.694321916126117, 0.688616083004672, 0.682972161644995, 0.677388036218774,
    0.671861719897082, 0.66639134390875, 0.660975147776663, 0.655611470579697,
    0.650298743110817, 0.645035480820822, 0.639820277453057, 0.634651799287624,
    0.629528779924837, 0.624450015547027, 0.619414360605834, 0.614420723888914,
    0.609468064925773, 0.604555390697468, 0.599681752619125, 0.594846243767987,
    0.590047996332826, 0.585286179263371, 0.580559996100791, 0.575868682972354,
    0.571211506735253, 0.566587763256165, 0.561996775814525, 0.557437893618766,
    0.552910490425833, 0.548413963255266, 0.543947731190026, 0.539511234256952,
    0.535103932380458, 0.530725304403662, 0.526374847171684, 0.522052074672322,
    0.517756517229756, 0.513487720747327, 0.509245245995748, 0.505028667943468,
    0.500837575126149, 0.49667156905249, 0.492530263643869, 0.488413284705458,
    0.484320269426683, 0.480250865909047, 0.476204732719506, 0.47218153846773,
    0.468180961405694, 0.464202689048174, 0.460246417812843, 0.456311852678716,
    0.452398706861849, 0.448506701507203, 0.444635565395739, 0.440785034665804,
    0.436954852547985, 0.433144769112652, 0.429354541029442, 0.425583931338022,
    0.421832709229496, 0.418100649837848, 0.414387534040891, 0.410693148270188,
    0.407017284329473, 0.403359739221114, 0.399720314980197, 0.396098818515832,
    0.392495061459315, 0.388908860018789, 0.385340034840077, 0.381788410873393,
    0.378253817245619, 0.374736087137891, 0.371235057668239, 0.367750569779032,
    0.364282468129004, 0.360830600989648, 0.357394820145781, 0.353974980800077,
    0.350570941481406, 0.347182563956794, 0.343809713146851, 0.340452257044522,
    0.337110066637006, 0.333783015830718, 0.330470981379163, 0.327173842813601,
    0.323891482376391, 0.320623784956905, 0.317370638029914, 0.314131931596337,
    0.310907558126286, 0.307697412504292, 0.30450139197665, 0.301319396100803,
    0.298151326696685, 0.294997087799962, 0.291856585617095, 0.288729728482183,
    0.285616426815502, 0.282516593083708, 0.279430141761638, 0.276356989295668,
    0.273297054068577, 0.270250256365875, 0.267216518343561, 0.264195763997261,
    0.261187919132721, 0.258192911337619, 0.255210669954662, 0.252241126055942,
    0.249284212418529, 0.246339863501264, 0.24340801542275, 0.240488605940501,
    0.237581574431238, 0.23468686187233, 0.231804410824339, 0.228934165414681,
    0.226076071322381, 0.223230075763918, 0.220396127480152, 0.217574176724331,
    0.214764175251174, 0.211966076307031, 0.209179834621125, 0.206405406397881,
    0.203642749310335, 0.200891822494657, 0.198152586545776, 0.195425003514135,
    0.192709036903589, 0.190004651670465, 0.187311814223801, 0.1846304924268,
    0.181960655599523, 0.179302274522848, 0.176655321443735, 0.174019770081839,
    0.171395595637506, 0.168782774801212, 0.166181285764482, 0.163591108232366,
    0.161012223437511, 0.158444614155925, 0.15588826472448, 0.153343161060263,
    0.150809290681846, 0.148286642732575, 0.145775208005994, 0.143274978973514,
    0.140785949814445, 0.138308116448551, 0.135841476571254, 0.133386029691669,
    0.130941777173644, 0.12850872228, 0.126086870220186, 0.123676228201597,
    0.12127680548479, 0.11888861344291, 0.116511665625611, 0.114145977827839,
    0.111791568163838, 0.109448457146812, 0.107116667774684, 0.104796225622487,
    0.102487158941935, 0.10018949876881, 0.0979032790388625, 0.095628536713009,
    0.093365311912691, 0.0911136480663738, 0.0888735920682759,
    0.0866451944505581, 0.0844285095703535, 0.082223595813203,
    0.0800305158146631, 0.0778493367020961, 0.0756801303589272,
    0.0735229737139814, 0.0713779490588905, 0.0692451443970068,
    0.0671246538277886, 0.065016577971243, 0.0629210244377582, 0.06083810834954,
    0.0587679529209339, 0.0567106901062031, 0.0546664613248891,
    0.0526354182767924, 0.0506177238609479, 0.0486135532158687,
    0.0466230949019305, 0.0446465522512946, 0.0426841449164746,
    0.0407361106559411, 0.0388027074045262, 0.0368842156885674,
    0.0349809414617162, 0.0330932194585786, 0.0312214171919203,
    0.0293659397581334, 0.0275272356696031, 0.0257058040085489,
    0.0239022033057959, 0.0221170627073089, 0.0203510962300445,
    0.0186051212757247, 0.0168800831525432, 0.0151770883079353,
    0.0134974506017399, 0.0118427578579079, 0.0102149714397015,
    0.00861658276939875, 0.00705087547137324, 0.00552240329925101,
    0.00403797259336304, 0.00260907274610216, 0.0012602859304986,
    0.000477467764609386 };

  real_T c2_b_b;
  real_T c2_c_y;
  real_T c2_c_b;
  real_T c2_d_y;
  real_T c2_e_a;
  real_T c2_d_b;
  real_T c2_e_y;
  real_T c2_x;
  real_T c2_b_x;
  real_T c2_c_u;
  real_T c2_f_a;
  real_T c2_c_x;
  real_T c2_d_u;
  real_T c2_e_b;
  real_T c2_f_y;
  real_T c2_g_a;
  real_T c2_f_b;
  real_T c2_g_y;
  int32_T exitg1;
  c2_assert_valid_state(chartInstance);
  do {
    exitg1 = 0;
    c2_b_genrand_uint32_vector(chartInstance, c2_e_state, c2_u32);
    c2_i = (c2_u32[1] >> 24U) + 1U;
    c2_ip1 = c2_i + 1U;
    c2_a = (real_T)(c2_u32[0] >> 3U);
    c2_y = c2_a * 1.6777216E+7;
    c2_b_a = c2_y + (real_T)(c2_u32[1] & 16777215U);
    c2_b_y = c2_b_a * 2.2204460492503131E-16;
    c2_u = c2_b_y - 1.0;
    c2_c_a = c2_u;
    c2_b = c2_dv14[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
      (uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_ip1), 1, 257, 1, 0) - 1];
    c2_b_r = c2_c_a * c2_b;
    if (c2_abs(chartInstance, c2_b_r) <= c2_dv14[(int32_T)(uint32_T)
        _SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)(uint32_T)_SFD_INTEGER_CHECK("",
          (real_T)c2_i), 1, 257, 1, 0) - 1]) {
      exitg1 = 1;
    } else if ((real_T)c2_i < 256.0) {
      c2_b_u = c2_c_genrandu(chartInstance, c2_e_state);
      c2_u = c2_b_u;
      c2_d_a = c2_u;
      c2_b_b = c2_dv15[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("",
        (int32_T)(uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_i), 1, 257, 1, 0) -
        1] - c2_dv15[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
        (uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_ip1), 1, 257, 1, 0) - 1];
      c2_c_y = c2_d_a * c2_b_b;
      c2_c_b = c2_b_r;
      c2_d_y = -0.5 * c2_c_b;
      c2_e_a = c2_d_y;
      c2_d_b = c2_b_r;
      c2_e_y = c2_e_a * c2_d_b;
      c2_x = c2_e_y;
      c2_b_x = c2_x;
      c2_b_x = muDoubleScalarExp(c2_b_x);
      if (c2_dv15[(int32_T)(uint32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
           (uint32_T)_SFD_INTEGER_CHECK("", (real_T)c2_ip1), 1, 257, 1, 0) - 1]
          + c2_c_y < c2_b_x) {
        exitg1 = 1;
      }
    } else {
      do {
        c2_c_u = c2_c_genrandu(chartInstance, c2_e_state);
        c2_u = c2_c_u;
        c2_f_a = muDoubleScalarLog(c2_u);
        c2_c_x = c2_f_a * 0.273661237329758;
        c2_d_u = c2_c_genrandu(chartInstance, c2_e_state);
        c2_u = c2_d_u;
        c2_e_b = muDoubleScalarLog(c2_u);
        c2_f_y = -2.0 * c2_e_b;
        c2_g_a = c2_c_x;
        c2_f_b = c2_c_x;
        c2_g_y = c2_g_a * c2_f_b;
      } while (!(c2_f_y > c2_g_y));

      if (c2_b_r < 0.0) {
        c2_b_r = c2_c_x - 3.65415288536101;
      } else {
        c2_b_r = 3.65415288536101 - c2_c_x;
      }

      exitg1 = 1;
    }
  } while (exitg1 == 0);

  return c2_b_r;
}

static void init_dsm_address_info(SFc2_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

/* SFunction Glue Code */
void sf_c2_Hunt_crossley_Ident_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(401103423U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1016923723U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(626604519U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(2826539130U);
}

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

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

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

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

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

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(100);
      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)(100);
      pr[1] = (double)(2);
      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)(100);
      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)(2);
      pr[1] = (double)(2000);
      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));
    mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
  }

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

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

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

    {
      mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
      double *pr = mxGetPr(mxSize);
      pr[0] = (double)(2);
      pr[1] = (double)(1501);
      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)(2);
      pr[1] = (double)(2000);
      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)(2);
      pr[1] = (double)(100);
      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));
    mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
  }

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

  return(mxAutoinheritanceInfo);
}

static const mxArray *sf_get_sim_state_info_c2_Hunt_crossley_Ident(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[15],T\"Teta\",},{M[1],M[11],T\"flag\",},{M[1],M[13],T\"kde\",},{M[1],M[9],T\"teta\",},{M[4],M[0],T\"method\",S'l','i','p'{{M1x2[512 518],M[1],T\"C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/randfun/eml_rand.m\"}}},{M[4],M[0],T\"method\",S'l','i','p'{{M1x2[638 644],M[1],T\"C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/randfun/eml_randn.m\"}}},{M[4],M[0],T\"state\",S'l','i','p'{{M1x2[165 170],M[1],T\"C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/randfun/eml_rand_mcg16807_stateful.m\"}}},{M[4],M[0],T\"state\",S'l','i','p'{{M1x2[166 171],M[1],T\"C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/randfun/eml_rand_mt19937ar_stateful.m\"}}},{M[4],M[0],T\"state\",S'l','i','p'{{M1x2[165 170],M[1],T\"C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/randfun/eml_rand_shr3cong_stateful.m\"}}},{M[4],M[0],T\"state\",S'l','i','p'{{M1x2[645 650],M[1],T\"C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/randfun/eml_randn.m\"}}}}",
    "100 S'type','srcId','name','auxInfo'{{M[8],M[0],T\"is_active_c2_Hunt_crossley_Ident\",}}"
  };

  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 11, 10);
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
  sf_c2_Hunt_crossley_Ident_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_Hunt_crossley_IdentInstanceStruct *chartInstance;
    chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *) ((ChartInfoStruct
      *)(ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart
          (_Hunt_crossley_IdentMachineNumber_,
           2,
           1,
           1,
           8,
           0,
           0,
           0,
           0,
           0,
           &(chartInstance->chartNumber),
           &(chartInstance->instanceNumber),
           ssGetPath(S),
           (void *)S);
        if (chartAlreadyPresent==0) {
          /* this is the first instance */
          init_script_number_translation(_Hunt_crossley_IdentMachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting
            (_Hunt_crossley_IdentMachineNumber_,chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(_Hunt_crossley_IdentMachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,2,0,1,"Teta");
          _SFD_SET_DATA_PROPS(1,1,1,0,"y");
          _SFD_SET_DATA_PROPS(2,1,1,0,"u");
          _SFD_SET_DATA_PROPS(3,1,1,0,"uc");
          _SFD_SET_DATA_PROPS(4,1,1,0,"TETA_old");
          _SFD_SET_DATA_PROPS(5,2,0,1,"teta");
          _SFD_SET_DATA_PROPS(6,2,0,1,"flag");
          _SFD_SET_DATA_PROPS(7,2,0,1,"kde");
          _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,20,0,0,0,7,1,18,7);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,7021);
        _SFD_CV_INIT_EML_IF(0,1,0,616,637,-1,670);
        _SFD_CV_INIT_EML_IF(0,1,1,686,700,732,6757);
        _SFD_CV_INIT_EML_IF(0,1,2,1090,1100,-1,-2);
        _SFD_CV_INIT_EML_IF(0,1,3,1378,1399,-1,3569);
        _SFD_CV_INIT_EML_IF(0,1,4,1962,2038,2077,2907);
        _SFD_CV_INIT_EML_IF(0,1,5,2446,2455,-1,-2);
        _SFD_CV_INIT_EML_IF(0,1,6,3001,3015,3140,3213);
        _SFD_CV_INIT_EML_IF(0,1,7,3239,3270,3322,3427);
        _SFD_CV_INIT_EML_IF(0,1,8,3322,3370,-1,3427);
        _SFD_CV_INIT_EML_IF(0,1,9,3440,3480,-1,3537);
        _SFD_CV_INIT_EML_IF(0,1,10,3650,3660,-1,6736);
        _SFD_CV_INIT_EML_IF(0,1,11,3726,3739,3831,3930);
        _SFD_CV_INIT_EML_IF(0,1,12,4194,4203,-1,4253);
        _SFD_CV_INIT_EML_IF(0,1,13,4266,4281,4696,4750);
        _SFD_CV_INIT_EML_IF(0,1,14,4696,4711,-1,-2);
        _SFD_CV_INIT_EML_IF(0,1,15,5186,5262,5302,6114);
        _SFD_CV_INIT_EML_IF(0,1,16,5687,5696,-1,-2);
        _SFD_CV_INIT_EML_IF(0,1,17,6209,6223,6338,6399);
        _SFD_CV_INIT_EML_IF(0,1,18,6516,6563,-1,6620);
        _SFD_CV_INIT_EML_IF(0,1,19,6633,6671,-1,6728);
        _SFD_CV_INIT_EML_FOR(0,1,0,599,612,674);
        _SFD_CV_INIT_EML_FOR(0,1,1,982,995,1373);
        _SFD_CV_INIT_EML_FOR(0,1,2,1532,1551,3549);
        _SFD_CV_INIT_EML_FOR(0,1,3,2191,2204,2862);
        _SFD_CV_INIT_EML_FOR(0,1,4,4059,4072,4759);
        _SFD_CV_INIT_EML_FOR(0,1,5,4814,4837,6732);
        _SFD_CV_INIT_EML_FOR(0,1,6,5416,5429,6069);
        _SFD_CV_INIT_EML_WHILE(0,1,0,3698,3720,4812);

        {
          static int condStart[] = { 1968, 1984, 2004, 2022 };

          static int condEnd[] = { 1977, 1997, 2017, 2036 };

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

          _SFD_CV_INIT_EML_MCDC(0,1,0,1966,2037,4,0,&(condStart[0]),&(condEnd[0]),
                                7,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 3243, 3256 };

          static int condEnd[] = { 3252, 3269 };

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

          _SFD_CV_INIT_EML_MCDC(0,1,1,3243,3269,2,4,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 3326, 3352 };

          static int condEnd[] = { 3348, 3369 };

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

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

        {
          static int condStart[] = { 3444, 3462 };

          static int condEnd[] = { 3458, 3479 };

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

          _SFD_CV_INIT_EML_MCDC(0,1,3,3444,3479,2,8,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 5192, 5208, 5228, 5246 };

          static int condEnd[] = { 5201, 5221, 5241, 5260 };

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

          _SFD_CV_INIT_EML_MCDC(0,1,4,5190,5261,4,10,&(condStart[0]),&(condEnd[0]),
                                7,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 6520, 6545 };

          static int condEnd[] = { 6541, 6562 };

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

          _SFD_CV_INIT_EML_MCDC(0,1,5,6520,6562,2,14,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        {
          static int condStart[] = { 6637, 6653 };

          static int condEnd[] = { 6649, 6670 };

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

          _SFD_CV_INIT_EML_MCDC(0,1,6,6637,6670,2,16,&(condStart[0]),&(condEnd[0]),
                                3,&(pfixExpr[0]));
        }

        _SFD_TRANS_COV_WTS(0,0,0,1,0);
        if (chartAlreadyPresent==0) {
          _SFD_TRANS_COV_MAPS(0,
                              0,NULL,NULL,
                              0,NULL,NULL,
                              1,NULL,NULL,
                              0,NULL,NULL);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 2;
          dimVector[1]= 1501;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_d_sf_marshallOut,(MexInFcnForType)
            c2_d_sf_marshallIn);
        }

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

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

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

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

        {
          unsigned int dimVector[2];
          dimVector[0]= 2;
          dimVector[1]= 2000;
          _SFD_SET_DATA_COMPILED_PROPS(5,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_c_sf_marshallOut,(MexInFcnForType)
            c2_c_sf_marshallIn);
        }

        _SFD_SET_DATA_COMPILED_PROPS(6,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)c2_b_sf_marshallIn);

        {
          unsigned int dimVector[2];
          dimVector[0]= 2;
          dimVector[1]= 100;
          _SFD_SET_DATA_COMPILED_PROPS(7,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)
            c2_sf_marshallIn);
        }

        {
          real_T *c2_flag;
          real_T (*c2_Teta)[3002];
          real_T (*c2_y)[100];
          real_T (*c2_u)[200];
          real_T (*c2_uc)[100];
          real_T (*c2_TETA_old)[4000];
          real_T (*c2_teta)[4000];
          real_T (*c2_kde)[200];
          c2_kde = (real_T (*)[200])ssGetOutputPortSignal(chartInstance->S, 4);
          c2_flag = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
          c2_teta = (real_T (*)[4000])ssGetOutputPortSignal(chartInstance->S, 2);
          c2_TETA_old = (real_T (*)[4000])ssGetInputPortSignal(chartInstance->S,
            3);
          c2_uc = (real_T (*)[100])ssGetInputPortSignal(chartInstance->S, 2);
          c2_u = (real_T (*)[200])ssGetInputPortSignal(chartInstance->S, 1);
          c2_y = (real_T (*)[100])ssGetInputPortSignal(chartInstance->S, 0);
          c2_Teta = (real_T (*)[3002])ssGetOutputPortSignal(chartInstance->S, 1);
          _SFD_SET_DATA_VALUE_PTR(0U, *c2_Teta);
          _SFD_SET_DATA_VALUE_PTR(1U, *c2_y);
          _SFD_SET_DATA_VALUE_PTR(2U, *c2_u);
          _SFD_SET_DATA_VALUE_PTR(3U, *c2_uc);
          _SFD_SET_DATA_VALUE_PTR(4U, *c2_TETA_old);
          _SFD_SET_DATA_VALUE_PTR(5U, *c2_teta);
          _SFD_SET_DATA_VALUE_PTR(6U, c2_flag);
          _SFD_SET_DATA_VALUE_PTR(7U, *c2_kde);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration
        (_Hunt_crossley_IdentMachineNumber_,chartInstance->chartNumber,
         chartInstance->instanceNumber);
    }
  }
}

static const char* sf_get_instance_specialization()
{
  return "7B4NDVrtfqa6u1SoBpEUrB";
}

static void sf_opaque_initialize_c2_Hunt_crossley_Ident(void *chartInstanceVar)
{
  chart_debug_initialization(((SFc2_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar)->S,0);
  initialize_params_c2_Hunt_crossley_Ident
    ((SFc2_Hunt_crossley_IdentInstanceStruct*) chartInstanceVar);
  initialize_c2_Hunt_crossley_Ident((SFc2_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

static void sf_opaque_enable_c2_Hunt_crossley_Ident(void *chartInstanceVar)
{
  enable_c2_Hunt_crossley_Ident((SFc2_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

static void sf_opaque_disable_c2_Hunt_crossley_Ident(void *chartInstanceVar)
{
  disable_c2_Hunt_crossley_Ident((SFc2_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

static void sf_opaque_gateway_c2_Hunt_crossley_Ident(void *chartInstanceVar)
{
  sf_c2_Hunt_crossley_Ident((SFc2_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

extern const mxArray* sf_internal_get_sim_state_c2_Hunt_crossley_Ident(SimStruct*
  S)
{
  ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
  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_Hunt_crossley_Ident
    ((SFc2_Hunt_crossley_IdentInstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
  prhs[3] = (mxArray*) sf_get_sim_state_info_c2_Hunt_crossley_Ident();/* 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_Hunt_crossley_Ident(SimStruct* S, const
  mxArray *st)
{
  ChartInfoStruct *chartInfo = (ChartInfoStruct*) ssGetUserData(S);
  mxArray *plhs[1] = { NULL };

  mxArray *prhs[4];
  int mxError = 0;
  prhs[0] = mxCreateString("chart_simctx_high2raw");
  prhs[1] = mxCreateDoubleScalar(ssGetSFuncBlockHandle(S));
  prhs[2] = mxDuplicateArray(st);      /* high level simctx */
  prhs[3] = (mxArray*) sf_get_sim_state_info_c2_Hunt_crossley_Ident();/* 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_high2raw'.\n");
  }

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

static const mxArray* sf_opaque_get_sim_state_c2_Hunt_crossley_Ident(SimStruct*
  S)
{
  return sf_internal_get_sim_state_c2_Hunt_crossley_Ident(S);
}

static void sf_opaque_set_sim_state_c2_Hunt_crossley_Ident(SimStruct* S, const
  mxArray *st)
{
  sf_internal_set_sim_state_c2_Hunt_crossley_Ident(S, st);
}

static void sf_opaque_terminate_c2_Hunt_crossley_Ident(void *chartInstanceVar)
{
  if (chartInstanceVar!=NULL) {
    SimStruct *S = ((SFc2_Hunt_crossley_IdentInstanceStruct*) chartInstanceVar
      )->S;
    if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
      sf_clear_rtw_identifier(S);
    }

    finalize_c2_Hunt_crossley_Ident((SFc2_Hunt_crossley_IdentInstanceStruct*)
      chartInstanceVar);
    free((void *)chartInstanceVar);
    ssSetUserData(S,NULL);
  }

  unload_Hunt_crossley_Ident_optimization_info();
}

static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
  initSimStructsc2_Hunt_crossley_Ident((SFc2_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

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

  if (sf_machine_global_initializer_called()) {
    initialize_params_c2_Hunt_crossley_Ident
      ((SFc2_Hunt_crossley_IdentInstanceStruct*)(((ChartInfoStruct *)
         ssGetUserData(S))->chartInstance));
  }
}

static void mdlSetWorkWidths_c2_Hunt_crossley_Ident(SimStruct *S)
{
  if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
    mxArray *infoStruct = load_Hunt_crossley_Ident_optimization_info();
    int_T chartIsInlinable =
      (int_T)sf_is_chart_inlinable(S,sf_get_instance_specialization(),infoStruct,
      2);
    ssSetStateflowIsInlinable(S,chartIsInlinable);
    ssSetRTWCG(S,sf_rtw_info_uint_prop(S,sf_get_instance_specialization(),
                infoStruct,2,"RTWCG"));
    ssSetEnableFcnIsTrivial(S,1);
    ssSetDisableFcnIsTrivial(S,1);
    ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
      sf_get_instance_specialization(),infoStruct,2,
      "gatewayCannotBeInlinedMultipleTimes"));
    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);
      sf_mark_chart_expressionable_inputs(S,sf_get_instance_specialization(),
        infoStruct,2,4);
      sf_mark_chart_reusable_outputs(S,sf_get_instance_specialization(),
        infoStruct,2,4);
    }

    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,(3912484706U));
  ssSetChecksum1(S,(165192411U));
  ssSetChecksum2(S,(3921950893U));
  ssSetChecksum3(S,(1288272194U));
  ssSetmdlDerivatives(S, NULL);
  ssSetExplicitFCSSCtrl(S,1);
  ssSupportsMultipleExecInstances(S,1);
}

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

static void mdlStart_c2_Hunt_crossley_Ident(SimStruct *S)
{
  SFc2_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc2_Hunt_crossley_IdentInstanceStruct *)malloc(sizeof
    (SFc2_Hunt_crossley_IdentInstanceStruct));
  memset(chartInstance, 0, sizeof(SFc2_Hunt_crossley_IdentInstanceStruct));
  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_Hunt_crossley_Ident;
  chartInstance->chartInfo.initializeChart =
    sf_opaque_initialize_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.terminateChart =
    sf_opaque_terminate_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.enableChart = sf_opaque_enable_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.disableChart =
    sf_opaque_disable_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.getSimState =
    sf_opaque_get_sim_state_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.setSimState =
    sf_opaque_set_sim_state_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.getSimStateInfo =
    sf_get_sim_state_info_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.mdlStart = mdlStart_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.mdlSetWorkWidths =
    mdlSetWorkWidths_c2_Hunt_crossley_Ident;
  chartInstance->chartInfo.extModeExec = NULL;
  chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
  chartInstance->chartInfo.storeCurrentConfiguration = NULL;
  chartInstance->S = S;
  ssSetUserData(S,(void *)(&(chartInstance->chartInfo)));/* 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_Hunt_crossley_Ident_method_dispatcher(SimStruct *S, int_T method, void
  *data)
{
  switch (method) {
   case SS_CALL_MDL_START:
    mdlStart_c2_Hunt_crossley_Ident(S);
    break;

   case SS_CALL_MDL_SET_WORK_WIDTHS:
    mdlSetWorkWidths_c2_Hunt_crossley_Ident(S);
    break;

   case SS_CALL_MDL_PROCESS_PARAMETERS:
    mdlProcessParameters_c2_Hunt_crossley_Ident(S);
    break;

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