/* Include files */

#include "blascompat32.h"
#include "ental_sfun.h"
#include "c4_ental.h"
#include "mwmathutil.h"
#define CHARTINSTANCE_CHARTNUMBER      (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER   (chartInstance->instanceNumber)
#include "ental_sfun_debug_macros.h"

/* Type Definitions */

/* Named Constants */

/* Variable Declarations */

/* Variable Definitions */
static const char *c4_debug_family_names[13] = { "N", "epsR", "htcRV", "htcRM",
  "j", "nargin", "nargout", "matV", "matM", "Trol", "Tinf", "qqV", "qqM" };

/* Function Declarations */
static void initialize_c4_ental(SFc4_entalInstanceStruct *chartInstance);
static void initialize_params_c4_ental(SFc4_entalInstanceStruct *chartInstance);
static void enable_c4_ental(SFc4_entalInstanceStruct *chartInstance);
static void disable_c4_ental(SFc4_entalInstanceStruct *chartInstance);
static void c4_update_debugger_state_c4_ental(SFc4_entalInstanceStruct
  *chartInstance);
static const mxArray *get_sim_state_c4_ental(SFc4_entalInstanceStruct
  *chartInstance);
static void set_sim_state_c4_ental(SFc4_entalInstanceStruct *chartInstance,
  const mxArray *c4_st);
static void finalize_c4_ental(SFc4_entalInstanceStruct *chartInstance);
static void sf_c4_ental(SFc4_entalInstanceStruct *chartInstance);
static void c4_c4_ental(SFc4_entalInstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c4_ental(SFc4_entalInstanceStruct
  *chartInstance);
static void init_script_number_translation(uint32_T c4_machineNumber, uint32_T
  c4_chartNumber);
static real_T c4_power(SFc4_entalInstanceStruct *chartInstance, real_T c4_a,
  real_T c4_b);
static void c4_eml_error(SFc4_entalInstanceStruct *chartInstance);
static real_T c4_mpower(SFc4_entalInstanceStruct *chartInstance, real_T c4_a);
static const mxArray *c4_sf_marshall(void *chartInstanceVoid, void *c4_u);
static const mxArray *c4_b_sf_marshall(void *chartInstanceVoid, void *c4_u);
static const mxArray *c4_c_sf_marshall(void *chartInstanceVoid, void *c4_u);
static void c4_info_helper(c4_ResolvedFunctionInfo c4_info[46]);
static const mxArray *c4_d_sf_marshall(void *chartInstanceVoid, void *c4_u);
static void c4_emlrt_marshallIn(SFc4_entalInstanceStruct *chartInstance, const
  mxArray *c4_qqM, const char_T *c4_name, real_T c4_y[479]);
static uint8_T c4_b_emlrt_marshallIn(SFc4_entalInstanceStruct *chartInstance,
  const mxArray *c4_b_is_active_c4_ental, const char_T *c4_name);
static void init_dsm_address_info(SFc4_entalInstanceStruct *chartInstance);

/* Function Definitions */
static void initialize_c4_ental(SFc4_entalInstanceStruct *chartInstance)
{
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  chartInstance->c4_is_active_c4_ental = 0U;
}

static void initialize_params_c4_ental(SFc4_entalInstanceStruct *chartInstance)
{
}

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

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

static void c4_update_debugger_state_c4_ental(SFc4_entalInstanceStruct
  *chartInstance)
{
}

static const mxArray *get_sim_state_c4_ental(SFc4_entalInstanceStruct
  *chartInstance)
{
  const mxArray *c4_st = NULL;
  const mxArray *c4_y = NULL;
  int32_T c4_i0;
  real_T c4_hoistedGlobal[479];
  int32_T c4_i1;
  real_T c4_u[479];
  const mxArray *c4_b_y = NULL;
  int32_T c4_i2;
  real_T c4_b_hoistedGlobal[479];
  int32_T c4_i3;
  real_T c4_b_u[479];
  const mxArray *c4_c_y = NULL;
  uint8_T c4_c_hoistedGlobal;
  uint8_T c4_c_u;
  const mxArray *c4_d_y = NULL;
  real_T (*c4_qqV)[479];
  real_T (*c4_qqM)[479];
  c4_qqM = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 2);
  c4_qqV = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 1);
  c4_st = NULL;
  c4_y = NULL;
  sf_mex_assign(&c4_y, sf_mex_createcellarray(3));
  for (c4_i0 = 0; c4_i0 < 479; c4_i0 = c4_i0 + 1) {
    c4_hoistedGlobal[c4_i0] = (*c4_qqM)[c4_i0];
  }

  for (c4_i1 = 0; c4_i1 < 479; c4_i1 = c4_i1 + 1) {
    c4_u[c4_i1] = c4_hoistedGlobal[c4_i1];
  }

  c4_b_y = NULL;
  sf_mex_assign(&c4_b_y, sf_mex_create("y", c4_u, 0, 0U, 1U, 0U, 2, 1, 479));
  sf_mex_setcell(c4_y, 0, c4_b_y);
  for (c4_i2 = 0; c4_i2 < 479; c4_i2 = c4_i2 + 1) {
    c4_b_hoistedGlobal[c4_i2] = (*c4_qqV)[c4_i2];
  }

  for (c4_i3 = 0; c4_i3 < 479; c4_i3 = c4_i3 + 1) {
    c4_b_u[c4_i3] = c4_b_hoistedGlobal[c4_i3];
  }

  c4_c_y = NULL;
  sf_mex_assign(&c4_c_y, sf_mex_create("y", c4_b_u, 0, 0U, 1U, 0U, 2, 1, 479));
  sf_mex_setcell(c4_y, 1, c4_c_y);
  c4_c_hoistedGlobal = chartInstance->c4_is_active_c4_ental;
  c4_c_u = c4_c_hoistedGlobal;
  c4_d_y = NULL;
  sf_mex_assign(&c4_d_y, sf_mex_create("y", &c4_c_u, 3, 0U, 0U, 0U, 0));
  sf_mex_setcell(c4_y, 2, c4_d_y);
  sf_mex_assign(&c4_st, c4_y);
  return c4_st;
}

static void set_sim_state_c4_ental(SFc4_entalInstanceStruct *chartInstance,
  const mxArray *c4_st)
{
  const mxArray *c4_u;
  real_T c4_dv0[479];
  int32_T c4_i4;
  real_T c4_dv1[479];
  int32_T c4_i5;
  real_T (*c4_qqV)[479];
  real_T (*c4_qqM)[479];
  c4_qqM = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 2);
  c4_qqV = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c4_doneDoubleBufferReInit = TRUE;
  c4_u = sf_mex_dup(c4_st);
  c4_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c4_u, 0)), "qqM",
                      c4_dv0);
  for (c4_i4 = 0; c4_i4 < 479; c4_i4 = c4_i4 + 1) {
    (*c4_qqM)[c4_i4] = c4_dv0[c4_i4];
  }

  c4_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c4_u, 1)), "qqV",
                      c4_dv1);
  for (c4_i5 = 0; c4_i5 < 479; c4_i5 = c4_i5 + 1) {
    (*c4_qqV)[c4_i5] = c4_dv1[c4_i5];
  }

  chartInstance->c4_is_active_c4_ental = c4_b_emlrt_marshallIn(chartInstance,
    sf_mex_dup(sf_mex_getcell(c4_u, 2)),
    "is_active_c4_ental");
  sf_mex_destroy(&c4_u);
  c4_update_debugger_state_c4_ental(chartInstance);
  sf_mex_destroy(&c4_st);
}

static void finalize_c4_ental(SFc4_entalInstanceStruct *chartInstance)
{
}

static void sf_c4_ental(SFc4_entalInstanceStruct *chartInstance)
{
  int32_T c4_i6;
  int32_T c4_i7;
  int32_T c4_i8;
  int32_T c4_i9;
  int32_T c4_previousEvent;
  real_T *c4_Trol;
  real_T *c4_Tinf;
  real_T (*c4_qqM)[479];
  real_T (*c4_qqV)[479];
  real_T (*c4_matM)[2874];
  real_T (*c4_matV)[2874];
  c4_qqM = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 2);
  c4_Tinf = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c4_qqV = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 1);
  c4_Trol = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c4_matM = (real_T (*)[2874])ssGetInputPortSignal(chartInstance->S, 1);
  c4_matV = (real_T (*)[2874])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 3);
  for (c4_i6 = 0; c4_i6 < 2874; c4_i6 = c4_i6 + 1) {
    _SFD_DATA_RANGE_CHECK((*c4_matV)[c4_i6], 0U);
  }

  for (c4_i7 = 0; c4_i7 < 2874; c4_i7 = c4_i7 + 1) {
    _SFD_DATA_RANGE_CHECK((*c4_matM)[c4_i7], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c4_Trol, 2U);
  for (c4_i8 = 0; c4_i8 < 479; c4_i8 = c4_i8 + 1) {
    _SFD_DATA_RANGE_CHECK((*c4_qqV)[c4_i8], 3U);
  }

  _SFD_DATA_RANGE_CHECK(*c4_Tinf, 4U);
  for (c4_i9 = 0; c4_i9 < 479; c4_i9 = c4_i9 + 1) {
    _SFD_DATA_RANGE_CHECK((*c4_qqM)[c4_i9], 5U);
  }

  c4_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  c4_c4_ental(chartInstance);
  _sfEvent_ = c4_previousEvent;
  sf_debug_check_for_state_inconsistency(_entalMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}

static void c4_c4_ental(SFc4_entalInstanceStruct *chartInstance)
{
  int32_T c4_i10;
  real_T c4_hoistedGlobal[2874];
  int32_T c4_i11;
  real_T c4_b_hoistedGlobal[2874];
  real_T c4_c_hoistedGlobal;
  real_T c4_d_hoistedGlobal;
  int32_T c4_i12;
  real_T c4_matV[2874];
  int32_T c4_i13;
  real_T c4_matM[2874];
  real_T c4_Trol;
  real_T c4_Tinf;
  uint32_T c4_debug_family_var_map[13];
  static const char *c4_sv0[13] = { "N", "epsR", "htcRV", "htcRM", "j", "nargin",
    "nargout", "matV", "matM", "Trol", "Tinf", "qqV",
    "qqM" };

  real_T c4_N;
  real_T c4_epsR;
  real_T c4_htcRV[479];
  real_T c4_htcRM[479];
  real_T c4_j;
  real_T c4_nargin = 4.0;
  real_T c4_nargout = 2.0;
  real_T c4_qqV[479];
  real_T c4_qqM[479];
  real_T c4_b;
  real_T c4_y;
  real_T c4_b_b;
  real_T c4_b_y;
  int32_T c4_i14;
  int32_T c4_i15;
  int32_T c4_i16;
  int32_T c4_i17;
  real_T c4_b_j;
  real_T c4_a;
  real_T c4_c_y;
  real_T c4_b_a;
  real_T c4_d_y;
  real_T c4_c_a;
  real_T c4_c_b;
  real_T c4_e_y;
  real_T c4_d_a;
  real_T c4_d_b;
  real_T c4_f_y;
  real_T c4_e_a;
  real_T c4_g_y;
  real_T c4_f_a;
  real_T c4_h_y;
  real_T c4_A;
  real_T c4_x;
  real_T c4_b_x;
  real_T c4_c_x;
  real_T c4_i_y;
  real_T c4_g_a;
  real_T c4_e_b;
  real_T c4_j_y;
  real_T c4_h_a;
  real_T c4_f_b;
  real_T c4_k_y;
  real_T c4_i_a;
  real_T c4_l_y;
  real_T c4_j_a;
  real_T c4_m_y;
  real_T c4_k_a;
  real_T c4_g_b;
  real_T c4_n_y;
  real_T c4_l_a;
  real_T c4_h_b;
  real_T c4_o_y;
  real_T c4_m_a;
  real_T c4_p_y;
  real_T c4_n_a;
  real_T c4_q_y;
  real_T c4_b_A;
  real_T c4_d_x;
  real_T c4_e_x;
  real_T c4_f_x;
  real_T c4_r_y;
  real_T c4_o_a;
  real_T c4_i_b;
  real_T c4_s_y;
  real_T c4_p_a;
  real_T c4_j_b;
  real_T c4_t_y;
  int32_T c4_i18;
  int32_T c4_i19;
  real_T *c4_b_Trol;
  real_T *c4_b_Tinf;
  real_T (*c4_b_qqM)[479];
  real_T (*c4_b_qqV)[479];
  real_T (*c4_b_matM)[2874];
  real_T (*c4_b_matV)[2874];
  c4_b_qqM = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 2);
  c4_b_Tinf = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c4_b_qqV = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 1);
  c4_b_Trol = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c4_b_matM = (real_T (*)[2874])ssGetInputPortSignal(chartInstance->S, 1);
  c4_b_matV = (real_T (*)[2874])ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 3);
  for (c4_i10 = 0; c4_i10 < 2874; c4_i10 = c4_i10 + 1) {
    c4_hoistedGlobal[c4_i10] = (*c4_b_matV)[c4_i10];
  }

  for (c4_i11 = 0; c4_i11 < 2874; c4_i11 = c4_i11 + 1) {
    c4_b_hoistedGlobal[c4_i11] = (*c4_b_matM)[c4_i11];
  }

  c4_c_hoistedGlobal = *c4_b_Trol;
  c4_d_hoistedGlobal = *c4_b_Tinf;
  for (c4_i12 = 0; c4_i12 < 2874; c4_i12 = c4_i12 + 1) {
    c4_matV[c4_i12] = c4_hoistedGlobal[c4_i12];
  }

  for (c4_i13 = 0; c4_i13 < 2874; c4_i13 = c4_i13 + 1) {
    c4_matM[c4_i13] = c4_b_hoistedGlobal[c4_i13];
  }

  c4_Trol = c4_c_hoistedGlobal;
  c4_Tinf = c4_d_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 13U, 13U, c4_sv0, c4_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c4_N, c4_b_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c4_epsR, c4_b_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(c4_htcRV, c4_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(c4_htcRM, c4_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c4_j, c4_b_sf_marshall, 4U);
  sf_debug_symbol_scope_add_eml(&c4_nargin, c4_b_sf_marshall, 5U);
  sf_debug_symbol_scope_add_eml(&c4_nargout, c4_b_sf_marshall, 6U);
  sf_debug_symbol_scope_add_eml(c4_matV, c4_c_sf_marshall, 7U);
  sf_debug_symbol_scope_add_eml(c4_matM, c4_c_sf_marshall, 8U);
  sf_debug_symbol_scope_add_eml(&c4_Trol, c4_b_sf_marshall, 9U);
  sf_debug_symbol_scope_add_eml(&c4_Tinf, c4_b_sf_marshall, 10U);
  sf_debug_symbol_scope_add_eml(c4_qqV, c4_sf_marshall, 11U);
  sf_debug_symbol_scope_add_eml(c4_qqM, c4_sf_marshall, 12U);
  CV_EML_FCN(0, 0);

  /* N=479; */
  _SFD_EML_CALL(0, 5);
  c4_N = 479.0;
  _SFD_EML_CALL(0, 6);
  c4_Trol = c4_Trol + 273.15;
  _SFD_EML_CALL(0, 7);
  c4_Tinf = c4_Tinf + 273.15;
  _SFD_EML_CALL(0, 8);
  c4_b = c4_Trol;
  c4_y = 0.0003375 * c4_b;
  c4_b_b = c4_mpower(chartInstance, c4_Trol);
  c4_b_y = 4.017857143E-7 * c4_b_b;
  c4_epsR = (0.78828571429 + c4_y) - c4_b_y;
  _SFD_EML_CALL(0, 9);
  for (c4_i14 = 0; c4_i14 < 479; c4_i14 = c4_i14 + 1) {
    c4_qqV[c4_i14] = 0.0;
  }

  _SFD_EML_CALL(0, 9);
  for (c4_i15 = 0; c4_i15 < 479; c4_i15 = c4_i15 + 1) {
    c4_qqM[c4_i15] = c4_qqV[c4_i15];
  }

  _SFD_EML_CALL(0, 9);
  for (c4_i16 = 0; c4_i16 < 479; c4_i16 = c4_i16 + 1) {
    c4_htcRV[c4_i16] = c4_qqV[c4_i16];
  }

  _SFD_EML_CALL(0, 9);
  for (c4_i17 = 0; c4_i17 < 479; c4_i17 = c4_i17 + 1) {
    c4_htcRM[c4_i17] = c4_qqV[c4_i17];
  }

  c4_j = 1.0;
  c4_b_j = 1.0;
  while (c4_b_j <= 479.0) {
    c4_j = c4_b_j;
    CV_EML_FOR(0, 0, 1);
    _SFD_EML_CALL(0, 11);
    if (CV_EML_IF(0, 0, c4_matV[_SFD_EML_ARRAY_BOUNDS_CHECK("matV", (int32_T)
          _SFD_INTEGER_CHECK("j", c4_j), 1, 479, 1, 0) + 957] == 0.0)) {
      _SFD_EML_CALL(0, 12);
      c4_a = c4_epsR;
      c4_c_y = c4_a * 5.67051;
      c4_b_a = c4_c_y;
      c4_d_y = c4_b_a * 1.0E-8;
      c4_c_a = c4_d_y;
      c4_c_b = c4_mpower(chartInstance, c4_Trol) + c4_mpower(chartInstance,
        c4_Tinf);
      c4_e_y = c4_c_a * c4_c_b;
      c4_d_a = c4_e_y;
      c4_d_b = c4_Trol + c4_Tinf;
      c4_f_y = c4_d_a * c4_d_b;
      c4_htcRV[_SFD_EML_ARRAY_BOUNDS_CHECK("htcRV", (int32_T)_SFD_INTEGER_CHECK(
        "j", c4_j), 1, 479, 1, 0) - 1] = c4_matV[
        _SFD_EML_ARRAY_BOUNDS_CHECK("matV", (int32_T)_SFD_INTEGER_CHECK("j",
        c4_j), 1, 479, 1, 0) + 1915] + c4_f_y;
      _SFD_EML_CALL(0, 13);
      c4_e_a = -c4_htcRV[_SFD_EML_ARRAY_BOUNDS_CHECK("htcRV", (int32_T)
        _SFD_INTEGER_CHECK("j", c4_j), 1, 479, 1, 0) - 1];
      c4_g_y = c4_e_a * 3.1415926535897931;
      c4_f_a = c4_g_y;
      c4_h_y = c4_f_a * 0.5;
      c4_A = c4_matV[_SFD_EML_ARRAY_BOUNDS_CHECK("matV", (int32_T)
        _SFD_INTEGER_CHECK("j", c4_j), 1, 479, 1, 0) + 1436];
      c4_x = c4_A;
      c4_b_x = c4_x;
      c4_c_x = c4_b_x;
      c4_i_y = c4_c_x / 1000.0;
      c4_g_a = c4_h_y;
      c4_e_b = c4_i_y;
      c4_j_y = c4_g_a * c4_e_b;
      c4_h_a = c4_j_y;
      c4_f_b = c4_Trol - c4_Tinf;
      c4_k_y = c4_h_a * c4_f_b;
      c4_qqV[_SFD_EML_ARRAY_BOUNDS_CHECK("qqV", (int32_T)_SFD_INTEGER_CHECK("j",
        c4_j), 1, 479, 1, 0) - 1] = c4_k_y;
    }

    _SFD_EML_CALL(0, 15);
    if (CV_EML_IF(0, 1, c4_matM[_SFD_EML_ARRAY_BOUNDS_CHECK("matM", (int32_T)
          _SFD_INTEGER_CHECK("j", c4_j), 1, 479, 1, 0) + 957] == 0.0)) {
      _SFD_EML_CALL(0, 16);
      c4_i_a = c4_epsR;
      c4_l_y = c4_i_a * 5.67051;
      c4_j_a = c4_l_y;
      c4_m_y = c4_j_a * 1.0E-8;
      c4_k_a = c4_m_y;
      c4_g_b = c4_mpower(chartInstance, c4_Trol) + c4_mpower(chartInstance,
        c4_Tinf);
      c4_n_y = c4_k_a * c4_g_b;
      c4_l_a = c4_n_y;
      c4_h_b = c4_Trol + c4_Tinf;
      c4_o_y = c4_l_a * c4_h_b;
      c4_htcRM[_SFD_EML_ARRAY_BOUNDS_CHECK("htcRM", (int32_T)_SFD_INTEGER_CHECK(
        "j", c4_j), 1, 479, 1, 0) - 1] = c4_matM[
        _SFD_EML_ARRAY_BOUNDS_CHECK("matM", (int32_T)_SFD_INTEGER_CHECK("j",
        c4_j), 1, 479, 1, 0) + 1915] + c4_o_y;
      _SFD_EML_CALL(0, 17);
      c4_m_a = -c4_htcRM[_SFD_EML_ARRAY_BOUNDS_CHECK("htcRM", (int32_T)
        _SFD_INTEGER_CHECK("j", c4_j), 1, 479, 1, 0) - 1];
      c4_p_y = c4_m_a * 3.1415926535897931;
      c4_n_a = c4_p_y;
      c4_q_y = c4_n_a * 0.5;
      c4_b_A = c4_matM[_SFD_EML_ARRAY_BOUNDS_CHECK("matM", (int32_T)
        _SFD_INTEGER_CHECK("j", c4_j), 1, 479, 1, 0) + 1436];
      c4_d_x = c4_b_A;
      c4_e_x = c4_d_x;
      c4_f_x = c4_e_x;
      c4_r_y = c4_f_x / 1000.0;
      c4_o_a = c4_q_y;
      c4_i_b = c4_r_y;
      c4_s_y = c4_o_a * c4_i_b;
      c4_p_a = c4_s_y;
      c4_j_b = c4_Trol - c4_Tinf;
      c4_t_y = c4_p_a * c4_j_b;
      c4_qqM[_SFD_EML_ARRAY_BOUNDS_CHECK("qqM", (int32_T)_SFD_INTEGER_CHECK("j",
        c4_j), 1, 479, 1, 0) - 1] = c4_t_y;
    }

    c4_b_j = c4_b_j + 1.0;
    sf_mex_listen_for_ctrl_c(chartInstance->S);
  }

  CV_EML_FOR(0, 0, 0);
  _SFD_EML_CALL(0, -17);
  sf_debug_symbol_scope_pop();
  for (c4_i18 = 0; c4_i18 < 479; c4_i18 = c4_i18 + 1) {
    (*c4_b_qqV)[c4_i18] = c4_qqV[c4_i18];
  }

  for (c4_i19 = 0; c4_i19 < 479; c4_i19 = c4_i19 + 1) {
    (*c4_b_qqM)[c4_i19] = c4_qqM[c4_i19];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 3);
}

static void compInitSubchartSimstructsFcn_c4_ental(SFc4_entalInstanceStruct
  *chartInstance)
{
}

static void init_script_number_translation(uint32_T c4_machineNumber, uint32_T
  c4_chartNumber)
{
}

static real_T c4_power(SFc4_entalInstanceStruct *chartInstance, real_T c4_a,
  real_T c4_b)
{
  real_T c4_ak;
  real_T c4_bk;
  real_T c4_x;
  real_T c4_b_x;
  c4_ak = c4_a;
  c4_bk = c4_b;
  if (c4_ak < 0.0) {
    c4_x = c4_bk;
    c4_b_x = c4_x;
    c4_b_x = muDoubleScalarFloor(c4_b_x);
    if (c4_b_x != c4_bk) {
      c4_eml_error(chartInstance);
      goto label_1;
    }
  }

 label_1:
  ;
  return muDoubleScalarPower(c4_ak, c4_bk);
}

static void c4_eml_error(SFc4_entalInstanceStruct *chartInstance)
{
  int32_T c4_i20;
  static char_T c4_cv0[32] = { 'E', 'm', 'b', 'e', 'd', 'd', 'e', 'd', 'M', 'A',
    'T', 'L', 'A', 'B', ':', 'p', 'o', 'w', 'e', 'r', ':'
    , 'd', 'o', 'm', 'a', 'i', 'n', 'E', 'r', 'r', 'o', 'r' };

  char_T c4_u[32];
  const mxArray *c4_y = NULL;
  int32_T c4_i21;
  static char_T c4_cv1[102] = { 'D', 'o', 'm', 'a', 'i', 'n', ' ', 'e', 'r', 'r',
    'o', 'r', '.', ' ', 'T', 'o', ' ', 'c', 'o', 'm',
    'p', 'u', 't', 'e', ' ', 'c', 'o', 'm', 'p', 'l', 'e', 'x', ' ', 'r', 'e',
    's', 'u', 'l', 't', 's',
    ',', ' ', 'm', 'a', 'k', 'e', ' ', 'a', 't', ' ', 'l', 'e', 'a', 's', 't',
    ' ', 'o', 'n', 'e', ' ',
    'i', 'n', 'p', 'u', 't', ' ', 'c', 'o', 'm', 'p', 'l', 'e', 'x', ',', ' ',
    'e', '.', 'g', '.', ' ',
    '\'', 'p', 'o', 'w', 'e', 'r', '(', 'c', 'o', 'm', 'p', 'l', 'e', 'x', '(',
    'a', ')', ',', 'b', ')',
    '\'', '.' };

  char_T c4_b_u[102];
  const mxArray *c4_b_y = NULL;
  for (c4_i20 = 0; c4_i20 < 32; c4_i20 = c4_i20 + 1) {
    c4_u[c4_i20] = c4_cv0[c4_i20];
  }

  c4_y = NULL;
  sf_mex_assign(&c4_y, sf_mex_create("y", c4_u, 10, 0U, 1U, 0U, 2, 1, 32));
  for (c4_i21 = 0; c4_i21 < 102; c4_i21 = c4_i21 + 1) {
    c4_b_u[c4_i21] = c4_cv1[c4_i21];
  }

  c4_b_y = NULL;
  sf_mex_assign(&c4_b_y, sf_mex_create("y", c4_b_u, 10, 0U, 1U, 0U, 2, 1, 102));
  sf_mex_call_debug("error", 0U, 2U, 14, c4_y, 14, c4_b_y);
}

static real_T c4_mpower(SFc4_entalInstanceStruct *chartInstance, real_T c4_a)
{
  return c4_power(chartInstance, c4_a, 2.0);
}

static const mxArray *c4_sf_marshall(void *chartInstanceVoid, void *c4_u)
{
  const mxArray *c4_y = NULL;
  int32_T c4_i22;
  real_T c4_b_u[479];
  int32_T c4_i23;
  real_T c4_c_u[479];
  const mxArray *c4_b_y = NULL;
  SFc4_entalInstanceStruct *chartInstance;
  chartInstance = (SFc4_entalInstanceStruct *)chartInstanceVoid;
  c4_y = NULL;
  for (c4_i22 = 0; c4_i22 < 479; c4_i22 = c4_i22 + 1) {
    c4_b_u[c4_i22] = (*((real_T (*)[479])c4_u))[c4_i22];
  }

  for (c4_i23 = 0; c4_i23 < 479; c4_i23 = c4_i23 + 1) {
    c4_c_u[c4_i23] = c4_b_u[c4_i23];
  }

  c4_b_y = NULL;
  sf_mex_assign(&c4_b_y, sf_mex_create("y", c4_c_u, 0, 0U, 1U, 0U, 2, 1, 479));
  sf_mex_assign(&c4_y, c4_b_y);
  return c4_y;
}

static const mxArray *c4_b_sf_marshall(void *chartInstanceVoid, void *c4_u)
{
  const mxArray *c4_y = NULL;
  real_T c4_b_u;
  const mxArray *c4_b_y = NULL;
  SFc4_entalInstanceStruct *chartInstance;
  chartInstance = (SFc4_entalInstanceStruct *)chartInstanceVoid;
  c4_y = NULL;
  c4_b_u = *((real_T *)c4_u);
  c4_b_y = NULL;
  sf_mex_assign(&c4_b_y, sf_mex_create("y", &c4_b_u, 0, 0U, 0U, 0U, 0));
  sf_mex_assign(&c4_y, c4_b_y);
  return c4_y;
}

static const mxArray *c4_c_sf_marshall(void *chartInstanceVoid, void *c4_u)
{
  const mxArray *c4_y = NULL;
  int32_T c4_i24;
  int32_T c4_i25;
  int32_T c4_i26;
  real_T c4_b_u[2874];
  int32_T c4_i27;
  int32_T c4_i28;
  int32_T c4_i29;
  real_T c4_c_u[2874];
  const mxArray *c4_b_y = NULL;
  SFc4_entalInstanceStruct *chartInstance;
  chartInstance = (SFc4_entalInstanceStruct *)chartInstanceVoid;
  c4_y = NULL;
  c4_i24 = 0;
  for (c4_i25 = 0; c4_i25 < 6; c4_i25 = c4_i25 + 1) {
    for (c4_i26 = 0; c4_i26 < 479; c4_i26 = c4_i26 + 1) {
      c4_b_u[c4_i26 + c4_i24] = (*((real_T (*)[2874])c4_u))[c4_i26 + c4_i24];
    }

    c4_i24 = c4_i24 + 479;
  }

  c4_i27 = 0;
  for (c4_i28 = 0; c4_i28 < 6; c4_i28 = c4_i28 + 1) {
    for (c4_i29 = 0; c4_i29 < 479; c4_i29 = c4_i29 + 1) {
      c4_c_u[c4_i29 + c4_i27] = c4_b_u[c4_i29 + c4_i27];
    }

    c4_i27 = c4_i27 + 479;
  }

  c4_b_y = NULL;
  sf_mex_assign(&c4_b_y, sf_mex_create("y", c4_c_u, 0, 0U, 1U, 0U, 2, 479, 6));
  sf_mex_assign(&c4_y, c4_b_y);
  return c4_y;
}

const mxArray *sf_c4_ental_get_eml_resolved_functions_info(void)
{
  const mxArray *c4_nameCaptureInfo = NULL;
  c4_ResolvedFunctionInfo c4_info[46];
  const mxArray *c4_m0 = NULL;
  int32_T c4_i30;
  c4_ResolvedFunctionInfo *c4_r0;
  c4_nameCaptureInfo = NULL;
  c4_info_helper(c4_info);
  sf_mex_assign(&c4_m0, sf_mex_createstruct("nameCaptureInfo", 1, 46));
  for (c4_i30 = 0; c4_i30 < 46; c4_i30 = c4_i30 + 1) {
    c4_r0 = &c4_info[c4_i30];
    sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->context, 15,
      0U, 0U, 0U, 2, 1, strlen(c4_r0->context)), "context",
                    "nameCaptureInfo", c4_i30);
    sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->name, 15, 0U,
      0U, 0U, 2, 1, strlen(c4_r0->name)), "name",
                    "nameCaptureInfo", c4_i30);
    sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->dominantType,
      15, 0U, 0U, 0U, 2, 1, strlen(c4_r0->dominantType)),
                    "dominantType", "nameCaptureInfo", c4_i30);
    sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", c4_r0->resolved, 15,
      0U, 0U, 0U, 2, 1, strlen(c4_r0->resolved)), "resolved"
                    , "nameCaptureInfo", c4_i30);
    sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", &c4_r0->fileLength,
      7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
                    c4_i30);
    sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", &c4_r0->fileTime1, 7,
      0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo", c4_i30
                    );
    sf_mex_addfield(c4_m0, sf_mex_create("nameCaptureInfo", &c4_r0->fileTime2, 7,
      0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo", c4_i30
                    );
  }

  sf_mex_assign(&c4_nameCaptureInfo, c4_m0);
  return c4_nameCaptureInfo;
}

static void c4_info_helper(c4_ResolvedFunctionInfo c4_info[46])
{
  c4_info[0].context = "";
  c4_info[0].name = "size";
  c4_info[0].dominantType = "double";
  c4_info[0].resolved = "[B]size";
  c4_info[0].fileLength = 0U;
  c4_info[0].fileTime1 = 0U;
  c4_info[0].fileTime2 = 0U;
  c4_info[1].context = "";
  c4_info[1].name = "max";
  c4_info[1].dominantType = "double";
  c4_info[1].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c4_info[1].fileLength = 362U;
  c4_info[1].fileTime1 = 1245102360U;
  c4_info[1].fileTime2 = 0U;
  c4_info[2].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c4_info[2].name = "nargin";
  c4_info[2].dominantType = "";
  c4_info[2].resolved = "[B]nargin";
  c4_info[2].fileLength = 0U;
  c4_info[2].fileTime1 = 0U;
  c4_info[2].fileTime2 = 0U;
  c4_info[3].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c4_info[3].name = "gt";
  c4_info[3].dominantType = "double";
  c4_info[3].resolved = "[B]gt";
  c4_info[3].fileLength = 0U;
  c4_info[3].fileTime1 = 0U;
  c4_info[3].fileTime2 = 0U;
  c4_info[4].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c4_info[4].name = "le";
  c4_info[4].dominantType = "double";
  c4_info[4].resolved = "[B]le";
  c4_info[4].fileLength = 0U;
  c4_info[4].fileTime1 = 0U;
  c4_info[4].fileTime2 = 0U;
  c4_info[5].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c4_info[5].name = "nargout";
  c4_info[5].dominantType = "";
  c4_info[5].resolved = "[B]nargout";
  c4_info[5].fileLength = 0U;
  c4_info[5].fileTime1 = 0U;
  c4_info[5].fileTime2 = 0U;
  c4_info[6].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c4_info[6].name = "eml_min_or_max";
  c4_info[6].dominantType = "char";
  c4_info[6].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[6].fileLength = 9967U;
  c4_info[6].fileTime1 = 1261951870U;
  c4_info[6].fileTime2 = 0U;
  c4_info[7].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[7].name = "ischar";
  c4_info[7].dominantType = "char";
  c4_info[7].resolved = "[B]ischar";
  c4_info[7].fileLength = 0U;
  c4_info[7].fileTime1 = 0U;
  c4_info[7].fileTime2 = 0U;
  c4_info[8].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[8].name = "strcmp";
  c4_info[8].dominantType = "char";
  c4_info[8].resolved = "[B]strcmp";
  c4_info[8].fileLength = 0U;
  c4_info[8].fileTime1 = 0U;
  c4_info[8].fileTime2 = 0U;
  c4_info[9].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[9].name = "isnumeric";
  c4_info[9].dominantType = "double";
  c4_info[9].resolved = "[B]isnumeric";
  c4_info[9].fileLength = 0U;
  c4_info[9].fileTime1 = 0U;
  c4_info[9].fileTime2 = 0U;
  c4_info[10].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[10].name = "isreal";
  c4_info[10].dominantType = "double";
  c4_info[10].resolved = "[B]isreal";
  c4_info[10].fileLength = 0U;
  c4_info[10].fileTime1 = 0U;
  c4_info[10].fileTime2 = 0U;
  c4_info[11].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[11].name = "eq";
  c4_info[11].dominantType = "double";
  c4_info[11].resolved = "[B]eq";
  c4_info[11].fileLength = 0U;
  c4_info[11].fileTime1 = 0U;
  c4_info[11].fileTime2 = 0U;
  c4_info[12].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[12].name = "eml_const_nonsingleton_dim";
  c4_info[12].dominantType = "double";
  c4_info[12].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_const_nonsingleton_dim.m";
  c4_info[12].fileLength = 1473U;
  c4_info[12].fileTime1 = 1240262002U;
  c4_info[12].fileTime2 = 0U;
  c4_info[13].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_const_nonsingleton_dim.m!local_const_nonsingleton_dim";
  c4_info[13].name = "not";
  c4_info[13].dominantType = "logical";
  c4_info[13].resolved = "[B]not";
  c4_info[13].fileLength = 0U;
  c4_info[13].fileTime1 = 0U;
  c4_info[13].fileTime2 = 0U;
  c4_info[14].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_const_nonsingleton_dim.m!local_const_nonsingleton_dim";
  c4_info[14].name = "ne";
  c4_info[14].dominantType = "double";
  c4_info[14].resolved = "[B]ne";
  c4_info[14].fileLength = 0U;
  c4_info[14].fileTime1 = 0U;
  c4_info[14].fileTime2 = 0U;
  c4_info[15].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[15].name = "eml_scalar_eg";
  c4_info[15].dominantType = "double";
  c4_info[15].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c4_info[15].fileLength = 3068U;
  c4_info[15].fileTime1 = 1240262010U;
  c4_info[15].fileTime2 = 0U;
  c4_info[16].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!any_enums";
  c4_info[16].name = "false";
  c4_info[16].dominantType = "";
  c4_info[16].resolved = "[B]false";
  c4_info[16].fileLength = 0U;
  c4_info[16].fileTime1 = 0U;
  c4_info[16].fileTime2 = 0U;
  c4_info[17].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c4_info[17].name = "isstruct";
  c4_info[17].dominantType = "double";
  c4_info[17].resolved = "[B]isstruct";
  c4_info[17].fileLength = 0U;
  c4_info[17].fileTime1 = 0U;
  c4_info[17].fileTime2 = 0U;
  c4_info[18].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c4_info[18].name = "isa";
  c4_info[18].dominantType = "double";
  c4_info[18].resolved = "[B]isa";
  c4_info[18].fileLength = 0U;
  c4_info[18].fileTime1 = 0U;
  c4_info[18].fileTime2 = 0U;
  c4_info[19].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!zerosum";
  c4_info[19].name = "class";
  c4_info[19].dominantType = "double";
  c4_info[19].resolved = "[B]class";
  c4_info[19].fileLength = 0U;
  c4_info[19].fileTime1 = 0U;
  c4_info[19].fileTime2 = 0U;
  c4_info[20].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!zerosum";
  c4_info[20].name = "cast";
  c4_info[20].dominantType = "double";
  c4_info[20].resolved = "[B]cast";
  c4_info[20].fileLength = 0U;
  c4_info[20].fileTime1 = 0U;
  c4_info[20].fileTime2 = 0U;
  c4_info[21].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[21].name = "ones";
  c4_info[21].dominantType = "double";
  c4_info[21].resolved = "[B]ones";
  c4_info[21].fileLength = 0U;
  c4_info[21].fileTime1 = 0U;
  c4_info[21].fileTime2 = 0U;
  c4_info[22].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[22].name = "eml_index_class";
  c4_info[22].dominantType = "";
  c4_info[22].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c4_info[22].fileLength = 909U;
  c4_info[22].fileTime1 = 1192466782U;
  c4_info[22].fileTime2 = 0U;
  c4_info[23].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[23].name = "isempty";
  c4_info[23].dominantType = "double";
  c4_info[23].resolved = "[B]isempty";
  c4_info[23].fileLength = 0U;
  c4_info[23].fileTime1 = 0U;
  c4_info[23].fileTime2 = 0U;
  c4_info[24].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c4_info[24].name = "isscalar";
  c4_info[24].dominantType = "double";
  c4_info[24].resolved = "[B]isscalar";
  c4_info[24].fileLength = 0U;
  c4_info[24].fileTime1 = 0U;
  c4_info[24].fileTime2 = 0U;
  c4_info[25].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c4_info[25].name = "lt";
  c4_info[25].dominantType = "double";
  c4_info[25].resolved = "[B]lt";
  c4_info[25].fileLength = 0U;
  c4_info[25].fileTime1 = 0U;
  c4_info[25].fileTime2 = 0U;
  c4_info[26].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c4_info[26].name = "isnan";
  c4_info[26].dominantType = "double";
  c4_info[26].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/isnan.m";
  c4_info[26].fileLength = 541U;
  c4_info[26].fileTime1 = 1271405588U;
  c4_info[26].fileTime2 = 0U;
  c4_info[27].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c4_info[27].name = "true";
  c4_info[27].dominantType = "";
  c4_info[27].resolved = "[B]true";
  c4_info[27].fileLength = 0U;
  c4_info[27].fileTime1 = 0U;
  c4_info[27].fileTime2 = 0U;
  c4_info[28].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c4_info[28].name = "eml_index_plus";
  c4_info[28].dominantType = "int32";
  c4_info[28].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c4_info[28].fileLength = 272U;
  c4_info[28].fileTime1 = 1192466784U;
  c4_info[28].fileTime2 = 0U;
  c4_info[29].context = "";
  c4_info[29].name = "plus";
  c4_info[29].dominantType = "double";
  c4_info[29].resolved = "[B]plus";
  c4_info[29].fileLength = 0U;
  c4_info[29].fileTime1 = 0U;
  c4_info[29].fileTime2 = 0U;
  c4_info[30].context = "";
  c4_info[30].name = "mtimes";
  c4_info[30].dominantType = "double";
  c4_info[30].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c4_info[30].fileLength = 3425U;
  c4_info[30].fileTime1 = 1251031872U;
  c4_info[30].fileTime2 = 0U;
  c4_info[31].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mtimes.m";
  c4_info[31].name = "isinteger";
  c4_info[31].dominantType = "double";
  c4_info[31].resolved = "[B]isinteger";
  c4_info[31].fileLength = 0U;
  c4_info[31].fileTime1 = 0U;
  c4_info[31].fileTime2 = 0U;
  c4_info[32].context = "";
  c4_info[32].name = "uminus";
  c4_info[32].dominantType = "double";
  c4_info[32].resolved = "[B]uminus";
  c4_info[32].fileLength = 0U;
  c4_info[32].fileTime1 = 0U;
  c4_info[32].fileTime2 = 0U;
  c4_info[33].context = "";
  c4_info[33].name = "mpower";
  c4_info[33].dominantType = "double";
  c4_info[33].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mpower.m";
  c4_info[33].fileLength = 3710U;
  c4_info[33].fileTime1 = 1238434288U;
  c4_info[33].fileTime2 = 0U;
  c4_info[34].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mpower.m";
  c4_info[34].name = "ndims";
  c4_info[34].dominantType = "double";
  c4_info[34].resolved = "[B]ndims";
  c4_info[34].fileLength = 0U;
  c4_info[34].fileTime1 = 0U;
  c4_info[34].fileTime2 = 0U;
  c4_info[35].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mpower.m";
  c4_info[35].name = "power";
  c4_info[35].dominantType = "double";
  c4_info[35].resolved = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m";
  c4_info[35].fileLength = 5380U;
  c4_info[35].fileTime1 = 1228093898U;
  c4_info[35].fileTime2 = 0U;
  c4_info[36].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m";
  c4_info[36].name = "eml_scalexp_alloc";
  c4_info[36].dominantType = "double";
  c4_info[36].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m";
  c4_info[36].fileLength = 932U;
  c4_info[36].fileTime1 = 1261951870U;
  c4_info[36].fileTime2 = 0U;
  c4_info[37].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalexp_alloc.m";
  c4_info[37].name = "minus";
  c4_info[37].dominantType = "double";
  c4_info[37].resolved = "[B]minus";
  c4_info[37].fileLength = 0U;
  c4_info[37].fileTime1 = 0U;
  c4_info[37].fileTime2 = 0U;
  c4_info[38].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m";
  c4_info[38].name = "eml_scalar_floor";
  c4_info[38].dominantType = "double";
  c4_info[38].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_floor.m";
  c4_info[38].fileLength = 260U;
  c4_info[38].fileTime1 = 1209330790U;
  c4_info[38].fileTime2 = 0U;
  c4_info[39].context = "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/power.m";
  c4_info[39].name = "eml_error";
  c4_info[39].dominantType = "char";
  c4_info[39].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_error.m";
  c4_info[39].fileLength = 315U;
  c4_info[39].fileTime1 = 1213926744U;
  c4_info[39].fileTime2 = 0U;
  c4_info[40].context = "";
  c4_info[40].name = "zeros";
  c4_info[40].dominantType = "double";
  c4_info[40].resolved = "[B]zeros";
  c4_info[40].fileLength = 0U;
  c4_info[40].fileTime1 = 0U;
  c4_info[40].fileTime2 = 0U;
  c4_info[41].context = "";
  c4_info[41].name = "pi";
  c4_info[41].dominantType = "";
  c4_info[41].resolved = "[B]pi";
  c4_info[41].fileLength = 0U;
  c4_info[41].fileTime1 = 0U;
  c4_info[41].fileTime2 = 0U;
  c4_info[42].context = "";
  c4_info[42].name = "mrdivide";
  c4_info[42].dominantType = "double";
  c4_info[42].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c4_info[42].fileLength = 432U;
  c4_info[42].fileTime1 = 1277748222U;
  c4_info[42].fileTime2 = 0U;
  c4_info[43].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c4_info[43].name = "ge";
  c4_info[43].dominantType = "double";
  c4_info[43].resolved = "[B]ge";
  c4_info[43].fileLength = 0U;
  c4_info[43].fileTime1 = 0U;
  c4_info[43].fileTime2 = 0U;
  c4_info[44].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c4_info[44].name = "rdivide";
  c4_info[44].dominantType = "double";
  c4_info[44].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c4_info[44].fileLength = 403U;
  c4_info[44].fileTime1 = 1245102420U;
  c4_info[44].fileTime2 = 0U;
  c4_info[45].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c4_info[45].name = "eml_div";
  c4_info[45].dominantType = "double";
  c4_info[45].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
  c4_info[45].fileLength = 4918U;
  c4_info[45].fileTime1 = 1267063410U;
  c4_info[45].fileTime2 = 0U;
}

static const mxArray *c4_d_sf_marshall(void *chartInstanceVoid, void *c4_u)
{
  const mxArray *c4_y = NULL;
  boolean_T c4_b_u;
  const mxArray *c4_b_y = NULL;
  SFc4_entalInstanceStruct *chartInstance;
  chartInstance = (SFc4_entalInstanceStruct *)chartInstanceVoid;
  c4_y = NULL;
  c4_b_u = *((boolean_T *)c4_u);
  c4_b_y = NULL;
  sf_mex_assign(&c4_b_y, sf_mex_create("y", &c4_b_u, 11, 0U, 0U, 0U, 0));
  sf_mex_assign(&c4_y, c4_b_y);
  return c4_y;
}

static void c4_emlrt_marshallIn(SFc4_entalInstanceStruct *chartInstance, const
  mxArray *c4_qqM, const char_T *c4_name, real_T c4_y[
  479])
{
  real_T c4_dv2[479];
  int32_T c4_i31;
  sf_mex_import(c4_name, sf_mex_dup(c4_qqM), c4_dv2, 1, 0, 0U, 1, 0U, 2, 1, 479);
  for (c4_i31 = 0; c4_i31 < 479; c4_i31 = c4_i31 + 1) {
    c4_y[c4_i31] = c4_dv2[c4_i31];
  }

  sf_mex_destroy(&c4_qqM);
}

static uint8_T c4_b_emlrt_marshallIn(SFc4_entalInstanceStruct *chartInstance,
  const mxArray *c4_b_is_active_c4_ental, const char_T *
  c4_name)
{
  uint8_T c4_y;
  uint8_T c4_u0;
  sf_mex_import(c4_name, sf_mex_dup(c4_b_is_active_c4_ental), &c4_u0, 1, 3, 0U,
                0, 0U, 0);
  c4_y = c4_u0;
  sf_mex_destroy(&c4_b_is_active_c4_ental);
  return c4_y;
}

static void init_dsm_address_info(SFc4_entalInstanceStruct *chartInstance)
{
}

/* SFunction Glue Code */
void sf_c4_ental_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3147175736U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2903923098U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2452421346U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1481770708U);
}

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

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

  {
    mxArray *mxChecksum = mxCreateDoubleMatrix(4,1,mxREAL);
    double *pr = mxGetPr(mxChecksum);
    pr[0] = (double)(744538340U);
    pr[1] = (double)(3206332190U);
    pr[2] = (double)(623019444U);
    pr[3] = (double)(2734490566U);
    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)(479);
      pr[1] = (double)(6);
      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)(479);
      pr[1] = (double)(6);
      mxSetField(mxData,1,"size",mxSize);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return(mxAutoinheritanceInfo);
}

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

  mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
  const char *infoEncStr[] = {
    "100 S1x3'type','srcId','name','auxInfo'{{M[1],M[19],T\"qqM\",},{M[1],M[5],T\"qqV\",},{M[8],M[0],T\"is_active_c4_ental\",}}"
  };

  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 3, 10);
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
  sf_c4_ental_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)) {
    SFc4_entalInstanceStruct *chartInstance;
    chartInstance = (SFc4_entalInstanceStruct *) ((ChartInfoStruct *)
      (ssGetUserData(S)))->chartInstance;
    if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
      /* do this only if simulation is starting */
      {
        unsigned int chartAlreadyPresent;
        chartAlreadyPresent = sf_debug_initialize_chart(_entalMachineNumber_,
          4,
          1,
          1,
          6,
          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(_entalMachineNumber_,
            chartInstance->chartNumber);
          sf_debug_set_chart_disable_implicit_casting(_entalMachineNumber_,
            chartInstance->chartNumber,1);
          sf_debug_set_chart_event_thresholds(_entalMachineNumber_,
            chartInstance->chartNumber,
            0,
            0,
            0);
          _SFD_SET_DATA_PROPS(0,1,1,0,"matV");
          _SFD_SET_DATA_PROPS(1,1,1,0,"matM");
          _SFD_SET_DATA_PROPS(2,1,1,0,"Trol");
          _SFD_SET_DATA_PROPS(3,2,0,1,"qqV");
          _SFD_SET_DATA_PROPS(4,1,1,0,"Tinf");
          _SFD_SET_DATA_PROPS(5,2,0,1,"qqM");
          _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 EML Model Coverage */
        _SFD_CV_INIT_EML(0,1,2,0,0,1,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,574);
        _SFD_CV_INIT_EML_IF(0,0,235,250,-1,401);
        _SFD_CV_INIT_EML_IF(0,1,404,419,-1,569);
        _SFD_CV_INIT_EML_FOR(0,0,223,233,573);
        _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]= 479;
          dimVector[1]= 6;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c4_c_sf_marshall);
        }

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

        _SFD_SET_DATA_COMPILED_PROPS(2,SF_DOUBLE,0,NULL,0,0,0,0.0,1.0,0,0,
          (MexFcnForType)c4_b_sf_marshall);

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

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

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

        {
          real_T *c4_Trol;
          real_T *c4_Tinf;
          real_T (*c4_matV)[2874];
          real_T (*c4_matM)[2874];
          real_T (*c4_qqV)[479];
          real_T (*c4_qqM)[479];
          c4_qqM = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 2);
          c4_Tinf = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
          c4_qqV = (real_T (*)[479])ssGetOutputPortSignal(chartInstance->S, 1);
          c4_Trol = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
          c4_matM = (real_T (*)[2874])ssGetInputPortSignal(chartInstance->S, 1);
          c4_matV = (real_T (*)[2874])ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, *c4_matV);
          _SFD_SET_DATA_VALUE_PTR(1U, *c4_matM);
          _SFD_SET_DATA_VALUE_PTR(2U, c4_Trol);
          _SFD_SET_DATA_VALUE_PTR(3U, *c4_qqV);
          _SFD_SET_DATA_VALUE_PTR(4U, c4_Tinf);
          _SFD_SET_DATA_VALUE_PTR(5U, *c4_qqM);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(_entalMachineNumber_,
        chartInstance->chartNumber,chartInstance->instanceNumber);
    }
  }
}

static void sf_opaque_initialize_c4_ental(void *chartInstanceVar)
{
  chart_debug_initialization(((SFc4_entalInstanceStruct*) chartInstanceVar)->S,0);
  initialize_params_c4_ental((SFc4_entalInstanceStruct*) chartInstanceVar);
  initialize_c4_ental((SFc4_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_enable_c4_ental(void *chartInstanceVar)
{
  enable_c4_ental((SFc4_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_disable_c4_ental(void *chartInstanceVar)
{
  disable_c4_ental((SFc4_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_gateway_c4_ental(void *chartInstanceVar)
{
  sf_c4_ental((SFc4_entalInstanceStruct*) chartInstanceVar);
}

static mxArray* sf_internal_get_sim_state_c4_ental(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_c4_ental((SFc4_entalInstanceStruct*)
    chartInfo->chartInstance);         /* raw sim ctx */
  prhs[3] = sf_get_sim_state_info_c4_ental();/* 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];
}

static void sf_internal_set_sim_state_c4_ental(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_c4_ental();/* 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_c4_ental((SFc4_entalInstanceStruct*)chartInfo->chartInstance,
    mxDuplicateArray(plhs[0]));
  mxDestroyArray(plhs[0]);
}

static mxArray* sf_opaque_get_sim_state_c4_ental(SimStruct* S)
{
  return sf_internal_get_sim_state_c4_ental(S);
}

static void sf_opaque_set_sim_state_c4_ental(SimStruct* S, const mxArray *st)
{
  sf_internal_set_sim_state_c4_ental(S, st);
}

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

    finalize_c4_ental((SFc4_entalInstanceStruct*) chartInstanceVar);
    free((void *)chartInstanceVar);
    ssSetUserData(S,NULL);
  }
}

static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
  compInitSubchartSimstructsFcn_c4_ental((SFc4_entalInstanceStruct*)
    chartInstanceVar);
}

extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c4_ental(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_c4_ental((SFc4_entalInstanceStruct*)(((ChartInfoStruct *)
      ssGetUserData(S))->chartInstance));
  }
}

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

    sf_set_rtw_dwork_info(S,"ental","ental",4);
    ssSetHasSubFunctions(S,!(chartIsInlinable));
  } else {
  }

  ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
  ssSetChecksum0(S,(754895035U));
  ssSetChecksum1(S,(4192500020U));
  ssSetChecksum2(S,(1738874373U));
  ssSetChecksum3(S,(4057712386U));
  ssSetmdlDerivatives(S, NULL);
  ssSetExplicitFCSSCtrl(S,1);
}

static void mdlRTW_c4_ental(SimStruct *S)
{
  if (sim_mode_is_rtw_gen(S)) {
    sf_write_symbol_mapping(S, "ental", "ental",4);
    ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
  }
}

static void mdlStart_c4_ental(SimStruct *S)
{
  SFc4_entalInstanceStruct *chartInstance;
  chartInstance = (SFc4_entalInstanceStruct *)malloc(sizeof
    (SFc4_entalInstanceStruct));
  memset(chartInstance, 0, sizeof(SFc4_entalInstanceStruct));
  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_c4_ental;
  chartInstance->chartInfo.initializeChart = sf_opaque_initialize_c4_ental;
  chartInstance->chartInfo.terminateChart = sf_opaque_terminate_c4_ental;
  chartInstance->chartInfo.enableChart = sf_opaque_enable_c4_ental;
  chartInstance->chartInfo.disableChart = sf_opaque_disable_c4_ental;
  chartInstance->chartInfo.getSimState = sf_opaque_get_sim_state_c4_ental;
  chartInstance->chartInfo.setSimState = sf_opaque_set_sim_state_c4_ental;
  chartInstance->chartInfo.getSimStateInfo = sf_get_sim_state_info_c4_ental;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c4_ental;
  chartInstance->chartInfo.mdlStart = mdlStart_c4_ental;
  chartInstance->chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c4_ental;
  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 c4_ental_method_dispatcher(SimStruct *S, int_T method, void *data)
{
  switch (method) {
   case SS_CALL_MDL_START:
    mdlStart_c4_ental(S);
    break;

   case SS_CALL_MDL_SET_WORK_WIDTHS:
    mdlSetWorkWidths_c4_ental(S);
    break;

   case SS_CALL_MDL_PROCESS_PARAMETERS:
    mdlProcessParameters_c4_ental(S);
    break;

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