/* Include files */

#include "blascompat32.h"
#include "Hunt_crossley_Ident_sfun.h"
#include "c3_Hunt_crossley_Ident.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 * c3_debug_family_names[12] = { "landa", "phi", "L", "nargin",
  "nargout", "tetap", "PP", "in", "f", "out", "teta", "P" };

/* Function Declarations */
static void initialize_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void initialize_params_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void enable_c3_Hunt_crossley_Ident(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void disable_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void c3_update_debugger_state_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static const mxArray *get_sim_state_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void set_sim_state_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance, const mxArray *c3_st);
static void finalize_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void sf_c3_Hunt_crossley_Ident(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void c3_chartstep_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void initSimStructsc3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c3_machineNumber, uint32_T
  c3_chartNumber);
static const mxArray *c3_sf_marshallOut(void *chartInstanceVoid, void *c3_inData);
static void c3_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_P, const char_T *c3_identifier, real_T c3_y
  [4]);
static void c3_b_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId,
  real_T c3_y[4]);
static void c3_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData);
static const mxArray *c3_b_sf_marshallOut(void *chartInstanceVoid, void
  *c3_inData);
static void c3_c_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_teta, const char_T *c3_identifier, real_T
  c3_y[2]);
static void c3_d_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId,
  real_T c3_y[2]);
static void c3_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData);
static const mxArray *c3_c_sf_marshallOut(void *chartInstanceVoid, void
  *c3_inData);
static real_T c3_e_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId);
static void c3_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData);
static void c3_info_helper(c3_ResolvedFunctionInfo c3_info[29]);
static void c3_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void c3_b_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void c3_c_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static void c3_check_forloop_overflow_error
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance);
static void c3_d_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance);
static const mxArray *c3_d_sf_marshallOut(void *chartInstanceVoid, void
  *c3_inData);
static int32_T c3_f_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId);
static void c3_d_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData);
static uint8_T c3_g_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_b_is_active_c3_Hunt_crossley_Ident, const
  char_T *c3_identifier);
static uint8_T c3_h_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId);
static void init_dsm_address_info(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance);

/* Function Definitions */
static void initialize_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  chartInstance->c3_sfEvent = CALL_EVENT;
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  chartInstance->c3_is_active_c3_Hunt_crossley_Ident = 0U;
}

static void initialize_params_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

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

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

static void c3_update_debugger_state_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static const mxArray *get_sim_state_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  const mxArray *c3_st;
  const mxArray *c3_y = NULL;
  int32_T c3_i0;
  real_T c3_u[4];
  const mxArray *c3_b_y = NULL;
  int32_T c3_i1;
  real_T c3_b_u[2];
  const mxArray *c3_c_y = NULL;
  int32_T c3_i2;
  real_T c3_c_u[2];
  const mxArray *c3_d_y = NULL;
  uint8_T c3_hoistedGlobal;
  uint8_T c3_d_u;
  const mxArray *c3_e_y = NULL;
  real_T (*c3_teta)[2];
  real_T (*c3_out)[2];
  real_T (*c3_P)[4];
  c3_P = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 3);
  c3_teta = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 2);
  c3_out = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  c3_st = NULL;
  c3_st = NULL;
  c3_y = NULL;
  sf_mex_assign(&c3_y, sf_mex_createcellarray(4), FALSE);
  for (c3_i0 = 0; c3_i0 < 4; c3_i0++) {
    c3_u[c3_i0] = (*c3_P)[c3_i0];
  }

  c3_b_y = NULL;
  sf_mex_assign(&c3_b_y, sf_mex_create("y", c3_u, 0, 0U, 1U, 0U, 2, 2, 2), FALSE);
  sf_mex_setcell(c3_y, 0, c3_b_y);
  for (c3_i1 = 0; c3_i1 < 2; c3_i1++) {
    c3_b_u[c3_i1] = (*c3_out)[c3_i1];
  }

  c3_c_y = NULL;
  sf_mex_assign(&c3_c_y, sf_mex_create("y", c3_b_u, 0, 0U, 1U, 0U, 1, 2), FALSE);
  sf_mex_setcell(c3_y, 1, c3_c_y);
  for (c3_i2 = 0; c3_i2 < 2; c3_i2++) {
    c3_c_u[c3_i2] = (*c3_teta)[c3_i2];
  }

  c3_d_y = NULL;
  sf_mex_assign(&c3_d_y, sf_mex_create("y", c3_c_u, 0, 0U, 1U, 0U, 1, 2), FALSE);
  sf_mex_setcell(c3_y, 2, c3_d_y);
  c3_hoistedGlobal = chartInstance->c3_is_active_c3_Hunt_crossley_Ident;
  c3_d_u = c3_hoistedGlobal;
  c3_e_y = NULL;
  sf_mex_assign(&c3_e_y, sf_mex_create("y", &c3_d_u, 3, 0U, 0U, 0U, 0), FALSE);
  sf_mex_setcell(c3_y, 3, c3_e_y);
  sf_mex_assign(&c3_st, c3_y, FALSE);
  return c3_st;
}

static void set_sim_state_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance, const mxArray *c3_st)
{
  const mxArray *c3_u;
  real_T c3_dv0[4];
  int32_T c3_i3;
  real_T c3_dv1[2];
  int32_T c3_i4;
  real_T c3_dv2[2];
  int32_T c3_i5;
  real_T (*c3_P)[4];
  real_T (*c3_out)[2];
  real_T (*c3_teta)[2];
  c3_P = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 3);
  c3_teta = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 2);
  c3_out = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c3_doneDoubleBufferReInit = TRUE;
  c3_u = sf_mex_dup(c3_st);
  c3_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c3_u, 0)), "P",
                      c3_dv0);
  for (c3_i3 = 0; c3_i3 < 4; c3_i3++) {
    (*c3_P)[c3_i3] = c3_dv0[c3_i3];
  }

  c3_c_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c3_u, 1)),
                        "out", c3_dv1);
  for (c3_i4 = 0; c3_i4 < 2; c3_i4++) {
    (*c3_out)[c3_i4] = c3_dv1[c3_i4];
  }

  c3_c_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c3_u, 2)),
                        "teta", c3_dv2);
  for (c3_i5 = 0; c3_i5 < 2; c3_i5++) {
    (*c3_teta)[c3_i5] = c3_dv2[c3_i5];
  }

  chartInstance->c3_is_active_c3_Hunt_crossley_Ident = c3_g_emlrt_marshallIn
    (chartInstance, sf_mex_dup(sf_mex_getcell(c3_u, 3)),
     "is_active_c3_Hunt_crossley_Ident");
  sf_mex_destroy(&c3_u);
  c3_update_debugger_state_c3_Hunt_crossley_Ident(chartInstance);
  sf_mex_destroy(&c3_st);
}

static void finalize_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static void sf_c3_Hunt_crossley_Ident(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
  int32_T c3_i6;
  int32_T c3_i7;
  int32_T c3_i8;
  int32_T c3_i9;
  int32_T c3_i10;
  int32_T c3_i11;
  real_T *c3_f;
  real_T (*c3_P)[4];
  real_T (*c3_teta)[2];
  real_T (*c3_in)[2];
  real_T (*c3_PP)[4];
  real_T (*c3_tetap)[2];
  real_T (*c3_out)[2];
  c3_P = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 3);
  c3_teta = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 2);
  c3_f = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c3_in = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
  c3_PP = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 1);
  c3_tetap = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
  c3_out = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  for (c3_i6 = 0; c3_i6 < 2; c3_i6++) {
    _SFD_DATA_RANGE_CHECK((*c3_out)[c3_i6], 0U);
  }

  for (c3_i7 = 0; c3_i7 < 2; c3_i7++) {
    _SFD_DATA_RANGE_CHECK((*c3_tetap)[c3_i7], 1U);
  }

  for (c3_i8 = 0; c3_i8 < 4; c3_i8++) {
    _SFD_DATA_RANGE_CHECK((*c3_PP)[c3_i8], 2U);
  }

  for (c3_i9 = 0; c3_i9 < 2; c3_i9++) {
    _SFD_DATA_RANGE_CHECK((*c3_in)[c3_i9], 3U);
  }

  _SFD_DATA_RANGE_CHECK(*c3_f, 4U);
  for (c3_i10 = 0; c3_i10 < 2; c3_i10++) {
    _SFD_DATA_RANGE_CHECK((*c3_teta)[c3_i10], 5U);
  }

  for (c3_i11 = 0; c3_i11 < 4; c3_i11++) {
    _SFD_DATA_RANGE_CHECK((*c3_P)[c3_i11], 6U);
  }

  chartInstance->c3_sfEvent = CALL_EVENT;
  c3_chartstep_c3_Hunt_crossley_Ident(chartInstance);
  sf_debug_check_for_state_inconsistency(_Hunt_crossley_IdentMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}

static void c3_chartstep_c3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
  real_T c3_hoistedGlobal;
  int32_T c3_i12;
  real_T c3_tetap[2];
  int32_T c3_i13;
  real_T c3_PP[4];
  int32_T c3_i14;
  real_T c3_in[2];
  real_T c3_f;
  uint32_T c3_debug_family_var_map[12];
  real_T c3_landa;
  real_T c3_phi[2];
  real_T c3_L[2];
  real_T c3_nargin = 4.0;
  real_T c3_nargout = 3.0;
  real_T c3_out[2];
  real_T c3_teta[2];
  real_T c3_P[4];
  real_T c3_a;
  real_T c3_b;
  real_T c3_y;
  int32_T c3_i15;
  real_T c3_b_a[2];
  int32_T c3_i16;
  int32_T c3_i17;
  real_T c3_c_a[4];
  int32_T c3_i18;
  int32_T c3_i19;
  real_T c3_b_y[2];
  int32_T c3_i20;
  int32_T c3_i21;
  int32_T c3_i22;
  real_T c3_d_a[2];
  int32_T c3_i23;
  int32_T c3_i24;
  int32_T c3_i25;
  real_T c3_c_y[2];
  int32_T c3_i26;
  int32_T c3_i27;
  real_T c3_d_y;
  int32_T c3_k;
  int32_T c3_b_k;
  real_T c3_B;
  real_T c3_e_y;
  real_T c3_f_y;
  int32_T c3_i28;
  int32_T c3_i29;
  int32_T c3_i30;
  int32_T c3_i31;
  int32_T c3_i32;
  int32_T c3_i33;
  real_T c3_g_y[4];
  int32_T c3_i34;
  int32_T c3_i35;
  int32_T c3_i36;
  int32_T c3_i37;
  real_T c3_h_y[4];
  int32_T c3_i38;
  int32_T c3_i39;
  int32_T c3_i40;
  int32_T c3_i41;
  int32_T c3_i42;
  int32_T c3_i43;
  real_T c3_i_y;
  int32_T c3_c_k;
  int32_T c3_d_k;
  int32_T c3_i44;
  real_T c3_b_b;
  int32_T c3_i45;
  int32_T c3_i46;
  int32_T c3_i47;
  int32_T c3_i48;
  int32_T c3_i49;
  real_T *c3_b_f;
  real_T (*c3_b_out)[2];
  real_T (*c3_b_teta)[2];
  real_T (*c3_b_P)[4];
  real_T (*c3_b_in)[2];
  real_T (*c3_b_PP)[4];
  real_T (*c3_b_tetap)[2];
  c3_b_P = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 3);
  c3_b_teta = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 2);
  c3_b_f = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c3_b_in = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
  c3_b_PP = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 1);
  c3_b_tetap = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
  c3_b_out = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  c3_hoistedGlobal = *c3_b_f;
  for (c3_i12 = 0; c3_i12 < 2; c3_i12++) {
    c3_tetap[c3_i12] = (*c3_b_tetap)[c3_i12];
  }

  for (c3_i13 = 0; c3_i13 < 4; c3_i13++) {
    c3_PP[c3_i13] = (*c3_b_PP)[c3_i13];
  }

  for (c3_i14 = 0; c3_i14 < 2; c3_i14++) {
    c3_in[c3_i14] = (*c3_b_in)[c3_i14];
  }

  c3_f = c3_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 12U, 12U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c3_landa, 0U, c3_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c3_phi, 1U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_L, 2U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargin, 3U, c3_c_sf_marshallOut,
    c3_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargout, 4U, c3_c_sf_marshallOut,
    c3_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c3_tetap, 5U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c3_PP, 6U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c3_in, 7U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_f, 8U, c3_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c3_out, 9U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_teta, 10U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_P, 11U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 3);
  c3_landa = 1.0;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 10);
  c3_a = c3_in[0];
  c3_b = c3_in[1];
  c3_y = c3_a * c3_b;
  c3_phi[0] = c3_in[1];
  c3_phi[1] = c3_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 12);
  for (c3_i15 = 0; c3_i15 < 2; c3_i15++) {
    c3_b_a[c3_i15] = c3_phi[c3_i15];
  }

  for (c3_i16 = 0; c3_i16 < 2; c3_i16++) {
    c3_phi[c3_i16] = c3_b_a[c3_i16] * 1.0E-7;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 14);
  for (c3_i17 = 0; c3_i17 < 4; c3_i17++) {
    c3_c_a[c3_i17] = c3_PP[c3_i17];
  }

  for (c3_i18 = 0; c3_i18 < 2; c3_i18++) {
    c3_b_a[c3_i18] = c3_phi[c3_i18];
  }

  c3_eml_scalar_eg(chartInstance);
  c3_eml_scalar_eg(chartInstance);
  for (c3_i19 = 0; c3_i19 < 2; c3_i19++) {
    c3_b_y[c3_i19] = 0.0;
    c3_i20 = 0;
    for (c3_i21 = 0; c3_i21 < 2; c3_i21++) {
      c3_b_y[c3_i19] += c3_c_a[c3_i20 + c3_i19] * c3_b_a[c3_i21];
      c3_i20 += 2;
    }
  }

  for (c3_i22 = 0; c3_i22 < 2; c3_i22++) {
    c3_d_a[c3_i22] = c3_phi[c3_i22];
  }

  for (c3_i23 = 0; c3_i23 < 4; c3_i23++) {
    c3_c_a[c3_i23] = c3_PP[c3_i23];
  }

  c3_b_eml_scalar_eg(chartInstance);
  c3_b_eml_scalar_eg(chartInstance);
  c3_i24 = 0;
  for (c3_i25 = 0; c3_i25 < 2; c3_i25++) {
    c3_c_y[c3_i25] = 0.0;
    for (c3_i26 = 0; c3_i26 < 2; c3_i26++) {
      c3_c_y[c3_i25] += c3_d_a[c3_i26] * c3_c_a[c3_i26 + c3_i24];
    }

    c3_i24 += 2;
  }

  for (c3_i27 = 0; c3_i27 < 2; c3_i27++) {
    c3_b_a[c3_i27] = c3_phi[c3_i27];
  }

  c3_c_eml_scalar_eg(chartInstance);
  c3_c_eml_scalar_eg(chartInstance);
  c3_d_y = 0.0;
  c3_check_forloop_overflow_error(chartInstance);
  for (c3_k = 1; c3_k < 3; c3_k++) {
    c3_b_k = c3_k;
    c3_d_y += c3_c_y[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK
      ("", (real_T)c3_b_k), 1, 2, 1, 0) - 1] *
      c3_b_a[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
      (real_T)c3_b_k), 1, 2, 1, 0) - 1];
  }

  c3_B = c3_landa + c3_d_y;
  c3_e_y = c3_B;
  c3_f_y = c3_e_y;
  for (c3_i28 = 0; c3_i28 < 2; c3_i28++) {
    c3_L[c3_i28] = c3_b_y[c3_i28] / c3_f_y;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 15);
  for (c3_i29 = 0; c3_i29 < 2; c3_i29++) {
    c3_b_a[c3_i29] = c3_L[c3_i29];
  }

  for (c3_i30 = 0; c3_i30 < 2; c3_i30++) {
    c3_d_a[c3_i30] = c3_phi[c3_i30];
  }

  for (c3_i31 = 0; c3_i31 < 2; c3_i31++) {
    c3_i32 = 0;
    for (c3_i33 = 0; c3_i33 < 2; c3_i33++) {
      c3_g_y[c3_i32 + c3_i31] = c3_b_a[c3_i31] * c3_d_a[c3_i33];
      c3_i32 += 2;
    }
  }

  for (c3_i34 = 0; c3_i34 < 4; c3_i34++) {
    c3_c_a[c3_i34] = c3_PP[c3_i34];
  }

  c3_d_eml_scalar_eg(chartInstance);
  c3_d_eml_scalar_eg(chartInstance);
  for (c3_i35 = 0; c3_i35 < 2; c3_i35++) {
    c3_i36 = 0;
    for (c3_i37 = 0; c3_i37 < 2; c3_i37++) {
      c3_h_y[c3_i36 + c3_i35] = 0.0;
      c3_i38 = 0;
      for (c3_i39 = 0; c3_i39 < 2; c3_i39++) {
        c3_h_y[c3_i36 + c3_i35] += c3_g_y[c3_i38 + c3_i35] * c3_c_a[c3_i39 +
          c3_i36];
        c3_i38 += 2;
      }

      c3_i36 += 2;
    }
  }

  for (c3_i40 = 0; c3_i40 < 4; c3_i40++) {
    c3_h_y[c3_i40] = c3_PP[c3_i40] - c3_h_y[c3_i40];
  }

  for (c3_i41 = 0; c3_i41 < 4; c3_i41++) {
    c3_P[c3_i41] = c3_h_y[c3_i41];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 16);
  for (c3_i42 = 0; c3_i42 < 2; c3_i42++) {
    c3_d_a[c3_i42] = c3_phi[c3_i42];
  }

  for (c3_i43 = 0; c3_i43 < 2; c3_i43++) {
    c3_b_a[c3_i43] = c3_tetap[c3_i43];
  }

  c3_c_eml_scalar_eg(chartInstance);
  c3_c_eml_scalar_eg(chartInstance);
  c3_i_y = 0.0;
  c3_check_forloop_overflow_error(chartInstance);
  for (c3_c_k = 1; c3_c_k < 3; c3_c_k++) {
    c3_d_k = c3_c_k;
    c3_i_y += c3_d_a[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK
      ("", (real_T)c3_d_k), 1, 2, 1, 0) - 1] *
      c3_b_a[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
      (real_T)c3_d_k), 1, 2, 1, 0) - 1];
  }

  for (c3_i44 = 0; c3_i44 < 2; c3_i44++) {
    c3_b_a[c3_i44] = c3_L[c3_i44];
  }

  c3_b_b = c3_f - c3_i_y;
  for (c3_i45 = 0; c3_i45 < 2; c3_i45++) {
    c3_b_a[c3_i45] *= c3_b_b;
  }

  for (c3_i46 = 0; c3_i46 < 2; c3_i46++) {
    c3_out[c3_i46] = c3_tetap[c3_i46] + c3_b_a[c3_i46];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 17);
  c3_teta[0] = c3_out[0];
  c3_teta[1] = c3_out[1];
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 20);
  if (CV_EML_IF(0, 1, 0, c3_P[0] > 100000.0)) {
    _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 21);
    c3_P[0] = 100000.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 23);
  if (CV_EML_IF(0, 1, 1, c3_P[3] > 100000.0)) {
    _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 24);
    c3_P[3] = 100000.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -24);
  sf_debug_symbol_scope_pop();
  for (c3_i47 = 0; c3_i47 < 2; c3_i47++) {
    (*c3_b_out)[c3_i47] = c3_out[c3_i47];
  }

  for (c3_i48 = 0; c3_i48 < 2; c3_i48++) {
    (*c3_b_teta)[c3_i48] = c3_teta[c3_i48];
  }

  for (c3_i49 = 0; c3_i49 < 4; c3_i49++) {
    (*c3_b_P)[c3_i49] = c3_P[c3_i49];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
}

static void initSimStructsc3_Hunt_crossley_Ident
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static void init_script_number_translation(uint32_T c3_machineNumber, uint32_T
  c3_chartNumber)
{
}

static const mxArray *c3_sf_marshallOut(void *chartInstanceVoid, void *c3_inData)
{
  const mxArray *c3_mxArrayOutData = NULL;
  int32_T c3_i50;
  int32_T c3_i51;
  int32_T c3_i52;
  real_T c3_b_inData[4];
  int32_T c3_i53;
  int32_T c3_i54;
  int32_T c3_i55;
  real_T c3_u[4];
  const mxArray *c3_y = NULL;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_mxArrayOutData = NULL;
  c3_i50 = 0;
  for (c3_i51 = 0; c3_i51 < 2; c3_i51++) {
    for (c3_i52 = 0; c3_i52 < 2; c3_i52++) {
      c3_b_inData[c3_i52 + c3_i50] = (*(real_T (*)[4])c3_inData)[c3_i52 + c3_i50];
    }

    c3_i50 += 2;
  }

  c3_i53 = 0;
  for (c3_i54 = 0; c3_i54 < 2; c3_i54++) {
    for (c3_i55 = 0; c3_i55 < 2; c3_i55++) {
      c3_u[c3_i55 + c3_i53] = c3_b_inData[c3_i55 + c3_i53];
    }

    c3_i53 += 2;
  }

  c3_y = NULL;
  sf_mex_assign(&c3_y, sf_mex_create("y", c3_u, 0, 0U, 1U, 0U, 2, 2, 2), FALSE);
  sf_mex_assign(&c3_mxArrayOutData, c3_y, FALSE);
  return c3_mxArrayOutData;
}

static void c3_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_P, const char_T *c3_identifier, real_T c3_y
  [4])
{
  emlrtMsgIdentifier c3_thisId;
  c3_thisId.fIdentifier = c3_identifier;
  c3_thisId.fParent = NULL;
  c3_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c3_P), &c3_thisId, c3_y);
  sf_mex_destroy(&c3_P);
}

static void c3_b_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId,
  real_T c3_y[4])
{
  real_T c3_dv3[4];
  int32_T c3_i56;
  sf_mex_import(c3_parentId, sf_mex_dup(c3_u), c3_dv3, 1, 0, 0U, 1, 0U, 2, 2, 2);
  for (c3_i56 = 0; c3_i56 < 4; c3_i56++) {
    c3_y[c3_i56] = c3_dv3[c3_i56];
  }

  sf_mex_destroy(&c3_u);
}

static void c3_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData)
{
  const mxArray *c3_P;
  const char_T *c3_identifier;
  emlrtMsgIdentifier c3_thisId;
  real_T c3_y[4];
  int32_T c3_i57;
  int32_T c3_i58;
  int32_T c3_i59;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_P = sf_mex_dup(c3_mxArrayInData);
  c3_identifier = c3_varName;
  c3_thisId.fIdentifier = c3_identifier;
  c3_thisId.fParent = NULL;
  c3_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c3_P), &c3_thisId, c3_y);
  sf_mex_destroy(&c3_P);
  c3_i57 = 0;
  for (c3_i58 = 0; c3_i58 < 2; c3_i58++) {
    for (c3_i59 = 0; c3_i59 < 2; c3_i59++) {
      (*(real_T (*)[4])c3_outData)[c3_i59 + c3_i57] = c3_y[c3_i59 + c3_i57];
    }

    c3_i57 += 2;
  }

  sf_mex_destroy(&c3_mxArrayInData);
}

static const mxArray *c3_b_sf_marshallOut(void *chartInstanceVoid, void
  *c3_inData)
{
  const mxArray *c3_mxArrayOutData = NULL;
  int32_T c3_i60;
  real_T c3_b_inData[2];
  int32_T c3_i61;
  real_T c3_u[2];
  const mxArray *c3_y = NULL;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_mxArrayOutData = NULL;
  for (c3_i60 = 0; c3_i60 < 2; c3_i60++) {
    c3_b_inData[c3_i60] = (*(real_T (*)[2])c3_inData)[c3_i60];
  }

  for (c3_i61 = 0; c3_i61 < 2; c3_i61++) {
    c3_u[c3_i61] = c3_b_inData[c3_i61];
  }

  c3_y = NULL;
  sf_mex_assign(&c3_y, sf_mex_create("y", c3_u, 0, 0U, 1U, 0U, 1, 2), FALSE);
  sf_mex_assign(&c3_mxArrayOutData, c3_y, FALSE);
  return c3_mxArrayOutData;
}

static void c3_c_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_teta, const char_T *c3_identifier, real_T
  c3_y[2])
{
  emlrtMsgIdentifier c3_thisId;
  c3_thisId.fIdentifier = c3_identifier;
  c3_thisId.fParent = NULL;
  c3_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c3_teta), &c3_thisId, c3_y);
  sf_mex_destroy(&c3_teta);
}

static void c3_d_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId,
  real_T c3_y[2])
{
  real_T c3_dv4[2];
  int32_T c3_i62;
  sf_mex_import(c3_parentId, sf_mex_dup(c3_u), c3_dv4, 1, 0, 0U, 1, 0U, 1, 2);
  for (c3_i62 = 0; c3_i62 < 2; c3_i62++) {
    c3_y[c3_i62] = c3_dv4[c3_i62];
  }

  sf_mex_destroy(&c3_u);
}

static void c3_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData)
{
  const mxArray *c3_teta;
  const char_T *c3_identifier;
  emlrtMsgIdentifier c3_thisId;
  real_T c3_y[2];
  int32_T c3_i63;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_teta = sf_mex_dup(c3_mxArrayInData);
  c3_identifier = c3_varName;
  c3_thisId.fIdentifier = c3_identifier;
  c3_thisId.fParent = NULL;
  c3_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c3_teta), &c3_thisId, c3_y);
  sf_mex_destroy(&c3_teta);
  for (c3_i63 = 0; c3_i63 < 2; c3_i63++) {
    (*(real_T (*)[2])c3_outData)[c3_i63] = c3_y[c3_i63];
  }

  sf_mex_destroy(&c3_mxArrayInData);
}

static const mxArray *c3_c_sf_marshallOut(void *chartInstanceVoid, void
  *c3_inData)
{
  const mxArray *c3_mxArrayOutData = NULL;
  real_T c3_u;
  const mxArray *c3_y = NULL;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_mxArrayOutData = NULL;
  c3_u = *(real_T *)c3_inData;
  c3_y = NULL;
  sf_mex_assign(&c3_y, sf_mex_create("y", &c3_u, 0, 0U, 0U, 0U, 0), FALSE);
  sf_mex_assign(&c3_mxArrayOutData, c3_y, FALSE);
  return c3_mxArrayOutData;
}

static real_T c3_e_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId)
{
  real_T c3_y;
  real_T c3_d0;
  sf_mex_import(c3_parentId, sf_mex_dup(c3_u), &c3_d0, 1, 0, 0U, 0, 0U, 0);
  c3_y = c3_d0;
  sf_mex_destroy(&c3_u);
  return c3_y;
}

static void c3_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData)
{
  const mxArray *c3_nargout;
  const char_T *c3_identifier;
  emlrtMsgIdentifier c3_thisId;
  real_T c3_y;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_nargout = sf_mex_dup(c3_mxArrayInData);
  c3_identifier = c3_varName;
  c3_thisId.fIdentifier = c3_identifier;
  c3_thisId.fParent = NULL;
  c3_y = c3_e_emlrt_marshallIn(chartInstance, sf_mex_dup(c3_nargout), &c3_thisId);
  sf_mex_destroy(&c3_nargout);
  *(real_T *)c3_outData = c3_y;
  sf_mex_destroy(&c3_mxArrayInData);
}

const mxArray *sf_c3_Hunt_crossley_Ident_get_eml_resolved_functions_info(void)
{
  const mxArray *c3_nameCaptureInfo;
  c3_ResolvedFunctionInfo c3_info[29];
  const mxArray *c3_m0 = NULL;
  int32_T c3_i64;
  c3_ResolvedFunctionInfo *c3_r0;
  c3_nameCaptureInfo = NULL;
  c3_nameCaptureInfo = NULL;
  c3_info_helper(c3_info);
  sf_mex_assign(&c3_m0, sf_mex_createstruct("nameCaptureInfo", 1, 29), FALSE);
  for (c3_i64 = 0; c3_i64 < 29; c3_i64++) {
    c3_r0 = &c3_info[c3_i64];
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", c3_r0->context, 15,
      0U, 0U, 0U, 2, 1, strlen(c3_r0->context)), "context", "nameCaptureInfo",
                    c3_i64);
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", c3_r0->name, 15, 0U,
      0U, 0U, 2, 1, strlen(c3_r0->name)), "name", "nameCaptureInfo", c3_i64);
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", c3_r0->dominantType,
      15, 0U, 0U, 0U, 2, 1, strlen(c3_r0->dominantType)), "dominantType",
                    "nameCaptureInfo", c3_i64);
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", c3_r0->resolved, 15,
      0U, 0U, 0U, 2, 1, strlen(c3_r0->resolved)), "resolved", "nameCaptureInfo",
                    c3_i64);
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", &c3_r0->fileTimeLo,
      7, 0U, 0U, 0U, 0), "fileTimeLo", "nameCaptureInfo", c3_i64);
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", &c3_r0->fileTimeHi,
      7, 0U, 0U, 0U, 0), "fileTimeHi", "nameCaptureInfo", c3_i64);
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", &c3_r0->mFileTimeLo,
      7, 0U, 0U, 0U, 0), "mFileTimeLo", "nameCaptureInfo", c3_i64);
    sf_mex_addfield(c3_m0, sf_mex_create("nameCaptureInfo", &c3_r0->mFileTimeHi,
      7, 0U, 0U, 0U, 0), "mFileTimeHi", "nameCaptureInfo", c3_i64);
  }

  sf_mex_assign(&c3_nameCaptureInfo, c3_m0, FALSE);
  sf_mex_emlrtNameCapturePostProcessR2012a(&c3_nameCaptureInfo);
  return c3_nameCaptureInfo;
}

static void c3_info_helper(c3_ResolvedFunctionInfo c3_info[29])
{
  c3_info[0].context = "";
  c3_info[0].name = "mtimes";
  c3_info[0].dominantType = "double";
  c3_info[0].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c3_info[0].fileTimeLo = 1289510692U;
  c3_info[0].fileTimeHi = 0U;
  c3_info[0].mFileTimeLo = 0U;
  c3_info[0].mFileTimeHi = 0U;
  c3_info[1].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c3_info[1].name = "eml_index_class";
  c3_info[1].dominantType = "";
  c3_info[1].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c3_info[1].fileTimeLo = 1323161578U;
  c3_info[1].fileTimeHi = 0U;
  c3_info[1].mFileTimeLo = 0U;
  c3_info[1].mFileTimeHi = 0U;
  c3_info[2].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c3_info[2].name = "eml_scalar_eg";
  c3_info[2].dominantType = "double";
  c3_info[2].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c3_info[2].fileTimeLo = 1286813396U;
  c3_info[2].fileTimeHi = 0U;
  c3_info[2].mFileTimeLo = 0U;
  c3_info[2].mFileTimeHi = 0U;
  c3_info[3].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c3_info[3].name = "eml_xgemm";
  c3_info[3].dominantType = "char";
  c3_info[3].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xgemm.m";
  c3_info[3].fileTimeLo = 1299067772U;
  c3_info[3].fileTimeHi = 0U;
  c3_info[3].mFileTimeLo = 0U;
  c3_info[3].mFileTimeHi = 0U;
  c3_info[4].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xgemm.m";
  c3_info[4].name = "eml_blas_inline";
  c3_info[4].dominantType = "";
  c3_info[4].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_blas_inline.m";
  c3_info[4].fileTimeLo = 1299067768U;
  c3_info[4].fileTimeHi = 0U;
  c3_info[4].mFileTimeLo = 0U;
  c3_info[4].mFileTimeHi = 0U;
  c3_info[5].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemm.m!below_threshold";
  c3_info[5].name = "mtimes";
  c3_info[5].dominantType = "double";
  c3_info[5].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c3_info[5].fileTimeLo = 1289510692U;
  c3_info[5].fileTimeHi = 0U;
  c3_info[5].mFileTimeLo = 0U;
  c3_info[5].mFileTimeHi = 0U;
  c3_info[6].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemm.m";
  c3_info[6].name = "eml_index_class";
  c3_info[6].dominantType = "";
  c3_info[6].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c3_info[6].fileTimeLo = 1323161578U;
  c3_info[6].fileTimeHi = 0U;
  c3_info[6].mFileTimeLo = 0U;
  c3_info[6].mFileTimeHi = 0U;
  c3_info[7].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemm.m";
  c3_info[7].name = "eml_scalar_eg";
  c3_info[7].dominantType = "double";
  c3_info[7].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c3_info[7].fileTimeLo = 1286813396U;
  c3_info[7].fileTimeHi = 0U;
  c3_info[7].mFileTimeLo = 0U;
  c3_info[7].mFileTimeHi = 0U;
  c3_info[8].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xgemm.m";
  c3_info[8].name = "eml_refblas_xgemm";
  c3_info[8].dominantType = "char";
  c3_info[8].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xgemm.m";
  c3_info[8].fileTimeLo = 1299067774U;
  c3_info[8].fileTimeHi = 0U;
  c3_info[8].mFileTimeLo = 0U;
  c3_info[8].mFileTimeHi = 0U;
  c3_info[9].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c3_info[9].name = "eml_xdotu";
  c3_info[9].dominantType = "double";
  c3_info[9].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xdotu.m";
  c3_info[9].fileTimeLo = 1299067772U;
  c3_info[9].fileTimeHi = 0U;
  c3_info[9].mFileTimeLo = 0U;
  c3_info[9].mFileTimeHi = 0U;
  c3_info[10].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xdotu.m";
  c3_info[10].name = "eml_blas_inline";
  c3_info[10].dominantType = "";
  c3_info[10].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_blas_inline.m";
  c3_info[10].fileTimeLo = 1299067768U;
  c3_info[10].fileTimeHi = 0U;
  c3_info[10].mFileTimeLo = 0U;
  c3_info[10].mFileTimeHi = 0U;
  c3_info[11].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xdotu.m";
  c3_info[11].name = "eml_xdot";
  c3_info[11].dominantType = "double";
  c3_info[11].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xdot.m";
  c3_info[11].fileTimeLo = 1299067772U;
  c3_info[11].fileTimeHi = 0U;
  c3_info[11].mFileTimeLo = 0U;
  c3_info[11].mFileTimeHi = 0U;
  c3_info[12].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xdot.m";
  c3_info[12].name = "eml_blas_inline";
  c3_info[12].dominantType = "";
  c3_info[12].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_blas_inline.m";
  c3_info[12].fileTimeLo = 1299067768U;
  c3_info[12].fileTimeHi = 0U;
  c3_info[12].mFileTimeLo = 0U;
  c3_info[12].mFileTimeHi = 0U;
  c3_info[13].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m";
  c3_info[13].name = "eml_index_class";
  c3_info[13].dominantType = "";
  c3_info[13].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c3_info[13].fileTimeLo = 1323161578U;
  c3_info[13].fileTimeHi = 0U;
  c3_info[13].mFileTimeLo = 0U;
  c3_info[13].mFileTimeHi = 0U;
  c3_info[14].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xdot.m";
  c3_info[14].name = "eml_refblas_xdot";
  c3_info[14].dominantType = "double";
  c3_info[14].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdot.m";
  c3_info[14].fileTimeLo = 1299067772U;
  c3_info[14].fileTimeHi = 0U;
  c3_info[14].mFileTimeLo = 0U;
  c3_info[14].mFileTimeHi = 0U;
  c3_info[15].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdot.m";
  c3_info[15].name = "eml_refblas_xdotx";
  c3_info[15].dominantType = "char";
  c3_info[15].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdotx.m";
  c3_info[15].fileTimeLo = 1299067774U;
  c3_info[15].fileTimeHi = 0U;
  c3_info[15].mFileTimeLo = 0U;
  c3_info[15].mFileTimeHi = 0U;
  c3_info[16].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdotx.m";
  c3_info[16].name = "eml_scalar_eg";
  c3_info[16].dominantType = "double";
  c3_info[16].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c3_info[16].fileTimeLo = 1286813396U;
  c3_info[16].fileTimeHi = 0U;
  c3_info[16].mFileTimeLo = 0U;
  c3_info[16].mFileTimeHi = 0U;
  c3_info[17].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdotx.m";
  c3_info[17].name = "eml_index_class";
  c3_info[17].dominantType = "";
  c3_info[17].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c3_info[17].fileTimeLo = 1323161578U;
  c3_info[17].fileTimeHi = 0U;
  c3_info[17].mFileTimeLo = 0U;
  c3_info[17].mFileTimeHi = 0U;
  c3_info[18].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdotx.m";
  c3_info[18].name = "eml_index_minus";
  c3_info[18].dominantType = "double";
  c3_info[18].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_minus.m";
  c3_info[18].fileTimeLo = 1286813378U;
  c3_info[18].fileTimeHi = 0U;
  c3_info[18].mFileTimeLo = 0U;
  c3_info[18].mFileTimeHi = 0U;
  c3_info[19].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_minus.m";
  c3_info[19].name = "eml_index_class";
  c3_info[19].dominantType = "";
  c3_info[19].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c3_info[19].fileTimeLo = 1323161578U;
  c3_info[19].fileTimeHi = 0U;
  c3_info[19].mFileTimeLo = 0U;
  c3_info[19].mFileTimeHi = 0U;
  c3_info[20].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdotx.m";
  c3_info[20].name = "eml_index_times";
  c3_info[20].dominantType = "coder.internal.indexInt";
  c3_info[20].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_times.m";
  c3_info[20].fileTimeLo = 1286813380U;
  c3_info[20].fileTimeHi = 0U;
  c3_info[20].mFileTimeLo = 0U;
  c3_info[20].mFileTimeHi = 0U;
  c3_info[21].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_times.m";
  c3_info[21].name = "eml_index_class";
  c3_info[21].dominantType = "";
  c3_info[21].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c3_info[21].fileTimeLo = 1323161578U;
  c3_info[21].fileTimeHi = 0U;
  c3_info[21].mFileTimeLo = 0U;
  c3_info[21].mFileTimeHi = 0U;
  c3_info[22].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdotx.m";
  c3_info[22].name = "eml_index_plus";
  c3_info[22].dominantType = "coder.internal.indexInt";
  c3_info[22].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c3_info[22].fileTimeLo = 1286813378U;
  c3_info[22].fileTimeHi = 0U;
  c3_info[22].mFileTimeLo = 0U;
  c3_info[22].mFileTimeHi = 0U;
  c3_info[23].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c3_info[23].name = "eml_index_class";
  c3_info[23].dominantType = "";
  c3_info[23].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c3_info[23].fileTimeLo = 1323161578U;
  c3_info[23].fileTimeHi = 0U;
  c3_info[23].mFileTimeLo = 0U;
  c3_info[23].mFileTimeHi = 0U;
  c3_info[24].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/refblas/eml_refblas_xdotx.m";
  c3_info[24].name = "eml_int_forloop_overflow_check";
  c3_info[24].dominantType = "";
  c3_info[24].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m";
  c3_info[24].fileTimeLo = 1332159672U;
  c3_info[24].fileTimeHi = 0U;
  c3_info[24].mFileTimeLo = 0U;
  c3_info[24].mFileTimeHi = 0U;
  c3_info[25].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m!eml_int_forloop_overflow_check_helper";
  c3_info[25].name = "intmax";
  c3_info[25].dominantType = "char";
  c3_info[25].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/intmax.m";
  c3_info[25].fileTimeLo = 1311246316U;
  c3_info[25].fileTimeHi = 0U;
  c3_info[25].mFileTimeLo = 0U;
  c3_info[25].mFileTimeHi = 0U;
  c3_info[26].context = "";
  c3_info[26].name = "mrdivide";
  c3_info[26].dominantType = "double";
  c3_info[26].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c3_info[26].fileTimeLo = 1342801944U;
  c3_info[26].fileTimeHi = 0U;
  c3_info[26].mFileTimeLo = 1319724566U;
  c3_info[26].mFileTimeHi = 0U;
  c3_info[27].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c3_info[27].name = "rdivide";
  c3_info[27].dominantType = "double";
  c3_info[27].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c3_info[27].fileTimeLo = 1286813444U;
  c3_info[27].fileTimeHi = 0U;
  c3_info[27].mFileTimeLo = 0U;
  c3_info[27].mFileTimeHi = 0U;
  c3_info[28].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c3_info[28].name = "eml_div";
  c3_info[28].dominantType = "double";
  c3_info[28].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
  c3_info[28].fileTimeLo = 1313338810U;
  c3_info[28].fileTimeHi = 0U;
  c3_info[28].mFileTimeLo = 0U;
  c3_info[28].mFileTimeHi = 0U;
}

static void c3_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

static void c3_b_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

static void c3_c_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

static void c3_check_forloop_overflow_error
  (SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance)
{
}

static void c3_d_eml_scalar_eg(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

static const mxArray *c3_d_sf_marshallOut(void *chartInstanceVoid, void
  *c3_inData)
{
  const mxArray *c3_mxArrayOutData = NULL;
  int32_T c3_u;
  const mxArray *c3_y = NULL;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_mxArrayOutData = NULL;
  c3_u = *(int32_T *)c3_inData;
  c3_y = NULL;
  sf_mex_assign(&c3_y, sf_mex_create("y", &c3_u, 6, 0U, 0U, 0U, 0), FALSE);
  sf_mex_assign(&c3_mxArrayOutData, c3_y, FALSE);
  return c3_mxArrayOutData;
}

static int32_T c3_f_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId)
{
  int32_T c3_y;
  int32_T c3_i65;
  sf_mex_import(c3_parentId, sf_mex_dup(c3_u), &c3_i65, 1, 6, 0U, 0, 0U, 0);
  c3_y = c3_i65;
  sf_mex_destroy(&c3_u);
  return c3_y;
}

static void c3_d_sf_marshallIn(void *chartInstanceVoid, const mxArray
  *c3_mxArrayInData, const char_T *c3_varName, void *c3_outData)
{
  const mxArray *c3_b_sfEvent;
  const char_T *c3_identifier;
  emlrtMsgIdentifier c3_thisId;
  int32_T c3_y;
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)chartInstanceVoid;
  c3_b_sfEvent = sf_mex_dup(c3_mxArrayInData);
  c3_identifier = c3_varName;
  c3_thisId.fIdentifier = c3_identifier;
  c3_thisId.fParent = NULL;
  c3_y = c3_f_emlrt_marshallIn(chartInstance, sf_mex_dup(c3_b_sfEvent),
    &c3_thisId);
  sf_mex_destroy(&c3_b_sfEvent);
  *(int32_T *)c3_outData = c3_y;
  sf_mex_destroy(&c3_mxArrayInData);
}

static uint8_T c3_g_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_b_is_active_c3_Hunt_crossley_Ident, const
  char_T *c3_identifier)
{
  uint8_T c3_y;
  emlrtMsgIdentifier c3_thisId;
  c3_thisId.fIdentifier = c3_identifier;
  c3_thisId.fParent = NULL;
  c3_y = c3_h_emlrt_marshallIn(chartInstance, sf_mex_dup
    (c3_b_is_active_c3_Hunt_crossley_Ident), &c3_thisId);
  sf_mex_destroy(&c3_b_is_active_c3_Hunt_crossley_Ident);
  return c3_y;
}

static uint8_T c3_h_emlrt_marshallIn(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance, const mxArray *c3_u, const emlrtMsgIdentifier *c3_parentId)
{
  uint8_T c3_y;
  uint8_T c3_u0;
  sf_mex_import(c3_parentId, sf_mex_dup(c3_u), &c3_u0, 1, 3, 0U, 0, 0U, 0);
  c3_y = c3_u0;
  sf_mex_destroy(&c3_u);
  return c3_y;
}

static void init_dsm_address_info(SFc3_Hunt_crossley_IdentInstanceStruct
  *chartInstance)
{
}

/* SFunction Glue Code */
void sf_c3_Hunt_crossley_Ident_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2256733473U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2606489919U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1818896461U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3153322705U);
}

mxArray *sf_c3_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("SfuC4iKkkW89Mm1S7e4fDH");
    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)(2);
      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)(2);
      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)(2);
      pr[1] = (double)(1);
      mxSetField(mxData,2,"size",mxSize);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return(mxAutoinheritanceInfo);
}

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

  mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
  const char *infoEncStr[] = {
    "100 S1x4'type','srcId','name','auxInfo'{{M[1],M[10],T\"P\",},{M[1],M[14],T\"out\",},{M[1],M[5],T\"teta\",},{M[8],M[0],T\"is_active_c3_Hunt_crossley_Ident\",}}"
  };

  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 4, 10);
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
  sf_c3_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)) {
    SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
    chartInstance = (SFc3_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_,
           3,
           1,
           1,
           7,
           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,"out");
          _SFD_SET_DATA_PROPS(1,1,1,0,"tetap");
          _SFD_SET_DATA_PROPS(2,1,1,0,"PP");
          _SFD_SET_DATA_PROPS(3,1,1,0,"in");
          _SFD_SET_DATA_PROPS(4,1,1,0,"f");
          _SFD_SET_DATA_PROPS(5,2,0,1,"teta");
          _SFD_SET_DATA_PROPS(6,2,0,1,"P");
          _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,2,0,0,0,0,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,385);
        _SFD_CV_INIT_EML_IF(0,1,0,309,324,-1,344);
        _SFD_CV_INIT_EML_IF(0,1,1,345,360,-1,381);
        _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[1];
          dimVector[0]= 2;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c3_b_sf_marshallOut,(MexInFcnForType)
            c3_b_sf_marshallIn);
        }

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

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

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

        _SFD_SET_DATA_COMPILED_PROPS(4,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c3_c_sf_marshallOut,(MexInFcnForType)NULL);

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

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

        {
          real_T *c3_f;
          real_T (*c3_out)[2];
          real_T (*c3_tetap)[2];
          real_T (*c3_PP)[4];
          real_T (*c3_in)[2];
          real_T (*c3_teta)[2];
          real_T (*c3_P)[4];
          c3_P = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 3);
          c3_teta = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 2);
          c3_f = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
          c3_in = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
          c3_PP = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 1);
          c3_tetap = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
          c3_out = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
          _SFD_SET_DATA_VALUE_PTR(0U, *c3_out);
          _SFD_SET_DATA_VALUE_PTR(1U, *c3_tetap);
          _SFD_SET_DATA_VALUE_PTR(2U, *c3_PP);
          _SFD_SET_DATA_VALUE_PTR(3U, *c3_in);
          _SFD_SET_DATA_VALUE_PTR(4U, c3_f);
          _SFD_SET_DATA_VALUE_PTR(5U, *c3_teta);
          _SFD_SET_DATA_VALUE_PTR(6U, *c3_P);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration
        (_Hunt_crossley_IdentMachineNumber_,chartInstance->chartNumber,
         chartInstance->instanceNumber);
    }
  }
}

static const char* sf_get_instance_specialization()
{
  return "3oqcLW4fQ9eQ8JTSZMoyJG";
}

static void sf_opaque_initialize_c3_Hunt_crossley_Ident(void *chartInstanceVar)
{
  chart_debug_initialization(((SFc3_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar)->S,0);
  initialize_params_c3_Hunt_crossley_Ident
    ((SFc3_Hunt_crossley_IdentInstanceStruct*) chartInstanceVar);
  initialize_c3_Hunt_crossley_Ident((SFc3_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

static void sf_opaque_enable_c3_Hunt_crossley_Ident(void *chartInstanceVar)
{
  enable_c3_Hunt_crossley_Ident((SFc3_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

static void sf_opaque_disable_c3_Hunt_crossley_Ident(void *chartInstanceVar)
{
  disable_c3_Hunt_crossley_Ident((SFc3_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

static void sf_opaque_gateway_c3_Hunt_crossley_Ident(void *chartInstanceVar)
{
  sf_c3_Hunt_crossley_Ident((SFc3_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

extern const mxArray* sf_internal_get_sim_state_c3_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_c3_Hunt_crossley_Ident
    ((SFc3_Hunt_crossley_IdentInstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
  prhs[3] = (mxArray*) sf_get_sim_state_info_c3_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_c3_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_c3_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_c3_Hunt_crossley_Ident((SFc3_Hunt_crossley_IdentInstanceStruct*)
    chartInfo->chartInstance, mxDuplicateArray(plhs[0]));
  mxDestroyArray(plhs[0]);
}

static const mxArray* sf_opaque_get_sim_state_c3_Hunt_crossley_Ident(SimStruct*
  S)
{
  return sf_internal_get_sim_state_c3_Hunt_crossley_Ident(S);
}

static void sf_opaque_set_sim_state_c3_Hunt_crossley_Ident(SimStruct* S, const
  mxArray *st)
{
  sf_internal_set_sim_state_c3_Hunt_crossley_Ident(S, st);
}

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

    finalize_c3_Hunt_crossley_Ident((SFc3_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)
{
  initSimStructsc3_Hunt_crossley_Ident((SFc3_Hunt_crossley_IdentInstanceStruct*)
    chartInstanceVar);
}

extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c3_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_c3_Hunt_crossley_Ident
      ((SFc3_Hunt_crossley_IdentInstanceStruct*)(((ChartInfoStruct *)
         ssGetUserData(S))->chartInstance));
  }
}

static void mdlSetWorkWidths_c3_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,
      3);
    ssSetStateflowIsInlinable(S,chartIsInlinable);
    ssSetRTWCG(S,sf_rtw_info_uint_prop(S,sf_get_instance_specialization(),
                infoStruct,3,"RTWCG"));
    ssSetEnableFcnIsTrivial(S,1);
    ssSetDisableFcnIsTrivial(S,1);
    ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,
      sf_get_instance_specialization(),infoStruct,3,
      "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,3,4);
      sf_mark_chart_reusable_outputs(S,sf_get_instance_specialization(),
        infoStruct,3,3);
    }

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

  ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
  ssSetChecksum0(S,(3610220497U));
  ssSetChecksum1(S,(1142236927U));
  ssSetChecksum2(S,(4247481911U));
  ssSetChecksum3(S,(964022495U));
  ssSetmdlDerivatives(S, NULL);
  ssSetExplicitFCSSCtrl(S,1);
  ssSupportsMultipleExecInstances(S,1);
}

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

static void mdlStart_c3_Hunt_crossley_Ident(SimStruct *S)
{
  SFc3_Hunt_crossley_IdentInstanceStruct *chartInstance;
  chartInstance = (SFc3_Hunt_crossley_IdentInstanceStruct *)malloc(sizeof
    (SFc3_Hunt_crossley_IdentInstanceStruct));
  memset(chartInstance, 0, sizeof(SFc3_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_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.initializeChart =
    sf_opaque_initialize_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.terminateChart =
    sf_opaque_terminate_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.enableChart = sf_opaque_enable_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.disableChart =
    sf_opaque_disable_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.getSimState =
    sf_opaque_get_sim_state_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.setSimState =
    sf_opaque_set_sim_state_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.getSimStateInfo =
    sf_get_sim_state_info_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.mdlStart = mdlStart_c3_Hunt_crossley_Ident;
  chartInstance->chartInfo.mdlSetWorkWidths =
    mdlSetWorkWidths_c3_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 c3_Hunt_crossley_Ident_method_dispatcher(SimStruct *S, int_T method, void
  *data)
{
  switch (method) {
   case SS_CALL_MDL_START:
    mdlStart_c3_Hunt_crossley_Ident(S);
    break;

   case SS_CALL_MDL_SET_WORK_WIDTHS:
    mdlSetWorkWidths_c3_Hunt_crossley_Ident(S);
    break;

   case SS_CALL_MDL_PROCESS_PARAMETERS:
    mdlProcessParameters_c3_Hunt_crossley_Ident(S);
    break;

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