/* Include files */

#include "blascompat32.h"
#include "ental_sfun.h"
#include "c1_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 *c1_debug_family_names[11] = { "M", "N", "j", "i", "nargin",
  "nargout", "H", "u", "TS", "h", "hTS" };

/* Function Declarations */
static void initialize_c1_ental(SFc1_entalInstanceStruct *chartInstance);
static void initialize_params_c1_ental(SFc1_entalInstanceStruct *chartInstance);
static void enable_c1_ental(SFc1_entalInstanceStruct *chartInstance);
static void disable_c1_ental(SFc1_entalInstanceStruct *chartInstance);
static void c1_update_debugger_state_c1_ental(SFc1_entalInstanceStruct
  *chartInstance);
static const mxArray *get_sim_state_c1_ental(SFc1_entalInstanceStruct
  *chartInstance);
static void set_sim_state_c1_ental(SFc1_entalInstanceStruct *chartInstance,
  const mxArray *c1_st);
static void finalize_c1_ental(SFc1_entalInstanceStruct *chartInstance);
static void sf_c1_ental(SFc1_entalInstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c1_ental(SFc1_entalInstanceStruct
  *chartInstance);
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
  c1_chartNumber);
static const mxArray *c1_sf_marshall(void *chartInstanceVoid, void *c1_u);
static const mxArray *c1_b_sf_marshall(void *chartInstanceVoid, void *c1_u);
static const mxArray *c1_c_sf_marshall(void *chartInstanceVoid, void *c1_u);
static const mxArray *c1_d_sf_marshall(void *chartInstanceVoid, void *c1_u);
static void c1_emlrt_marshallIn(SFc1_entalInstanceStruct *chartInstance, const
  mxArray *c1_h, const char_T *c1_name, real_T c1_y[7185]);
static real_T c1_b_emlrt_marshallIn(SFc1_entalInstanceStruct *chartInstance,
  const mxArray *c1_hTS, const char_T *c1_name);
static uint8_T c1_c_emlrt_marshallIn(SFc1_entalInstanceStruct *chartInstance,
  const mxArray *c1_b_is_active_c1_ental, const char_T *c1_name);
static void init_dsm_address_info(SFc1_entalInstanceStruct *chartInstance);

/* Function Definitions */
static void initialize_c1_ental(SFc1_entalInstanceStruct *chartInstance)
{
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  chartInstance->c1_is_active_c1_ental = 0U;
}

static void initialize_params_c1_ental(SFc1_entalInstanceStruct *chartInstance)
{
}

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

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

static void c1_update_debugger_state_c1_ental(SFc1_entalInstanceStruct
  *chartInstance)
{
}

static const mxArray *get_sim_state_c1_ental(SFc1_entalInstanceStruct
  *chartInstance)
{
  const mxArray *c1_st = NULL;
  const mxArray *c1_y = NULL;
  int32_T c1_i0;
  real_T c1_hoistedGlobal[7185];
  int32_T c1_i1;
  real_T c1_u[7185];
  const mxArray *c1_b_y = NULL;
  real_T c1_b_hoistedGlobal;
  real_T c1_b_u;
  const mxArray *c1_c_y = NULL;
  uint8_T c1_c_hoistedGlobal;
  uint8_T c1_c_u;
  const mxArray *c1_d_y = NULL;
  real_T *c1_hTS;
  real_T (*c1_h)[7185];
  c1_hTS = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c1_h = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
  c1_st = NULL;
  c1_y = NULL;
  sf_mex_assign(&c1_y, sf_mex_createcellarray(3));
  for (c1_i0 = 0; c1_i0 < 7185; c1_i0 = c1_i0 + 1) {
    c1_hoistedGlobal[c1_i0] = (*c1_h)[c1_i0];
  }

  for (c1_i1 = 0; c1_i1 < 7185; c1_i1 = c1_i1 + 1) {
    c1_u[c1_i1] = c1_hoistedGlobal[c1_i1];
  }

  c1_b_y = NULL;
  sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_u, 0, 0U, 1U, 0U, 2, 15, 479));
  sf_mex_setcell(c1_y, 0, c1_b_y);
  c1_b_hoistedGlobal = *c1_hTS;
  c1_b_u = c1_b_hoistedGlobal;
  c1_c_y = NULL;
  sf_mex_assign(&c1_c_y, sf_mex_create("y", &c1_b_u, 0, 0U, 0U, 0U, 0));
  sf_mex_setcell(c1_y, 1, c1_c_y);
  c1_c_hoistedGlobal = chartInstance->c1_is_active_c1_ental;
  c1_c_u = c1_c_hoistedGlobal;
  c1_d_y = NULL;
  sf_mex_assign(&c1_d_y, sf_mex_create("y", &c1_c_u, 3, 0U, 0U, 0U, 0));
  sf_mex_setcell(c1_y, 2, c1_d_y);
  sf_mex_assign(&c1_st, c1_y);
  return c1_st;
}

static void set_sim_state_c1_ental(SFc1_entalInstanceStruct *chartInstance,
  const mxArray *c1_st)
{
  const mxArray *c1_u;
  real_T c1_dv0[7185];
  int32_T c1_i2;
  real_T *c1_hTS;
  real_T (*c1_h)[7185];
  c1_hTS = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c1_h = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c1_doneDoubleBufferReInit = TRUE;
  c1_u = sf_mex_dup(c1_st);
  c1_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u, 0)), "h",
                      c1_dv0);
  for (c1_i2 = 0; c1_i2 < 7185; c1_i2 = c1_i2 + 1) {
    (*c1_h)[c1_i2] = c1_dv0[c1_i2];
  }

  *c1_hTS = c1_b_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c1_u,
    1)), "hTS");
  chartInstance->c1_is_active_c1_ental = c1_c_emlrt_marshallIn(chartInstance,
    sf_mex_dup(sf_mex_getcell(c1_u, 2)),
    "is_active_c1_ental");
  sf_mex_destroy(&c1_u);
  c1_update_debugger_state_c1_ental(chartInstance);
  sf_mex_destroy(&c1_st);
}

static void finalize_c1_ental(SFc1_entalInstanceStruct *chartInstance)
{
}

static void sf_c1_ental(SFc1_entalInstanceStruct *chartInstance)
{
  int32_T c1_i3;
  int32_T c1_i4;
  int32_T c1_i5;
  int32_T c1_previousEvent;
  int32_T c1_i6;
  real_T c1_hoistedGlobal[1600];
  int32_T c1_i7;
  real_T c1_b_hoistedGlobal[7185];
  real_T c1_c_hoistedGlobal;
  int32_T c1_i8;
  real_T c1_H[1600];
  int32_T c1_i9;
  real_T c1_u[7185];
  real_T c1_TS;
  uint32_T c1_debug_family_var_map[11];
  static const char *c1_sv0[11] = { "M", "N", "j", "i", "nargin", "nargout", "H",
    "u", "TS", "h", "hTS" };

  real_T c1_M;
  real_T c1_N;
  real_T c1_j;
  real_T c1_i;
  real_T c1_nargin = 3.0;
  real_T c1_nargout = 2.0;
  real_T c1_h[7185];
  real_T c1_hTS;
  int32_T c1_i10;
  real_T c1_b_j;
  real_T c1_b_i;
  real_T c1_x;
  real_T c1_b_x;
  real_T c1_c_x;
  real_T c1_d_x;
  real_T c1_e_x;
  real_T c1_f_x;
  real_T c1_g_x;
  real_T c1_h_x;
  int32_T c1_i11;
  real_T *c1_b_TS;
  real_T *c1_b_hTS;
  real_T (*c1_b_h)[7185];
  real_T (*c1_b_u)[7185];
  real_T (*c1_b_H)[1600];
  c1_b_hTS = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c1_b_TS = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c1_b_u = (real_T (*)[7185])ssGetInputPortSignal(chartInstance->S, 1);
  c1_b_h = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_H = (real_T (*)[1600])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0);
  for (c1_i3 = 0; c1_i3 < 1600; c1_i3 = c1_i3 + 1) {
    _SFD_DATA_RANGE_CHECK((*c1_b_H)[c1_i3], 0U);
  }

  for (c1_i4 = 0; c1_i4 < 7185; c1_i4 = c1_i4 + 1) {
    _SFD_DATA_RANGE_CHECK((*c1_b_h)[c1_i4], 1U);
  }

  for (c1_i5 = 0; c1_i5 < 7185; c1_i5 = c1_i5 + 1) {
    _SFD_DATA_RANGE_CHECK((*c1_b_u)[c1_i5], 2U);
  }

  _SFD_DATA_RANGE_CHECK(*c1_b_TS, 3U);
  _SFD_DATA_RANGE_CHECK(*c1_b_hTS, 4U);
  c1_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0);
  for (c1_i6 = 0; c1_i6 < 1600; c1_i6 = c1_i6 + 1) {
    c1_hoistedGlobal[c1_i6] = (*c1_b_H)[c1_i6];
  }

  for (c1_i7 = 0; c1_i7 < 7185; c1_i7 = c1_i7 + 1) {
    c1_b_hoistedGlobal[c1_i7] = (*c1_b_u)[c1_i7];
  }

  c1_c_hoistedGlobal = *c1_b_TS;
  for (c1_i8 = 0; c1_i8 < 1600; c1_i8 = c1_i8 + 1) {
    c1_H[c1_i8] = c1_hoistedGlobal[c1_i8];
  }

  for (c1_i9 = 0; c1_i9 < 7185; c1_i9 = c1_i9 + 1) {
    c1_u[c1_i9] = c1_b_hoistedGlobal[c1_i9];
  }

  c1_TS = c1_c_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 11U, 11U, c1_sv0, c1_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c1_M, c1_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c1_N, c1_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c1_j, c1_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c1_i, c1_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c1_nargin, c1_sf_marshall, 4U);
  sf_debug_symbol_scope_add_eml(&c1_nargout, c1_sf_marshall, 5U);
  sf_debug_symbol_scope_add_eml(c1_H, c1_c_sf_marshall, 6U);
  sf_debug_symbol_scope_add_eml(c1_u, c1_b_sf_marshall, 7U);
  sf_debug_symbol_scope_add_eml(&c1_TS, c1_sf_marshall, 8U);
  sf_debug_symbol_scope_add_eml(c1_h, c1_b_sf_marshall, 9U);
  sf_debug_symbol_scope_add_eml(&c1_hTS, c1_sf_marshall, 10U);
  CV_EML_FCN(0, 0);

  /* M=15; N=479; */
  _SFD_EML_CALL(0, 5);
  c1_M = 15.0;
  c1_N = 479.0;
  _SFD_EML_CALL(0, 6);
  for (c1_i10 = 0; c1_i10 < 7185; c1_i10 = c1_i10 + 1) {
    c1_h[c1_i10] = 0.0;
  }

  c1_j = 1.0;
  c1_b_j = 1.0;
  while (c1_b_j <= 479.0) {
    c1_j = c1_b_j;
    CV_EML_FOR(0, 0, 1);
    c1_i = 1.0;
    c1_b_i = 1.0;
    while (c1_b_i <= 15.0) {
      c1_i = c1_b_i;
      CV_EML_FOR(0, 1, 1);
      _SFD_EML_CALL(0, 9);
      c1_x = c1_u[(_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)_SFD_INTEGER_CHECK(
        "i", c1_i), 1, 15, 1, 0) - 1) + 15 * (
        _SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)_SFD_INTEGER_CHECK("j", c1_j),
        1, 479, 2, 0) - 1)];
      c1_b_x = c1_x;
      c1_c_x = c1_b_x;
      c1_b_x = c1_c_x;
      c1_d_x = c1_b_x;
      if (c1_d_x < 0.0) {
        c1_b_x = muDoubleScalarCeil(c1_d_x - 0.5);
      } else {
        c1_b_x = muDoubleScalarFloor(c1_d_x + 0.5);
      }

      c1_h[(_SFD_EML_ARRAY_BOUNDS_CHECK("h", (int32_T)_SFD_INTEGER_CHECK("i",
              c1_i), 1, 15, 1, 0) - 1) + 15 * (_SFD_EML_ARRAY_BOUNDS_CHECK
        ("h", (int32_T)_SFD_INTEGER_CHECK("j", c1_j), 1, 479, 2, 0) - 1)] =
        c1_H[_SFD_EML_ARRAY_BOUNDS_CHECK("H", (int32_T)
        _SFD_INTEGER_CHECK("round(u(i,j))", c1_b_x), 1, 1600, 1, 0) - 1];
      c1_b_i = c1_b_i + 1.0;
      sf_mex_listen_for_ctrl_c(chartInstance->S);
    }

    CV_EML_FOR(0, 1, 0);
    c1_b_j = c1_b_j + 1.0;
    sf_mex_listen_for_ctrl_c(chartInstance->S);
  }

  CV_EML_FOR(0, 0, 0);
  _SFD_EML_CALL(0, 13);
  c1_e_x = c1_TS;
  c1_f_x = c1_e_x;
  c1_g_x = c1_f_x;
  c1_f_x = c1_g_x;
  c1_h_x = c1_f_x;
  if (c1_h_x < 0.0) {
    c1_f_x = muDoubleScalarCeil(c1_h_x - 0.5);
  } else {
    c1_f_x = muDoubleScalarFloor(c1_h_x + 0.5);
  }

  c1_hTS = c1_H[_SFD_EML_ARRAY_BOUNDS_CHECK("H", (int32_T)_SFD_INTEGER_CHECK(
    "round(TS)", c1_f_x), 1, 1600, 1, 0) - 1];
  _SFD_EML_CALL(0, -13);
  sf_debug_symbol_scope_pop();
  for (c1_i11 = 0; c1_i11 < 7185; c1_i11 = c1_i11 + 1) {
    (*c1_b_h)[c1_i11] = c1_h[c1_i11];
  }

  *c1_b_hTS = c1_hTS;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0);
  _sfEvent_ = c1_previousEvent;
  sf_debug_check_for_state_inconsistency(_entalMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}

static void compInitSubchartSimstructsFcn_c1_ental(SFc1_entalInstanceStruct
  *chartInstance)
{
}

static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
  c1_chartNumber)
{
}

static const mxArray *c1_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
  const mxArray *c1_y = NULL;
  real_T c1_b_u;
  const mxArray *c1_b_y = NULL;
  SFc1_entalInstanceStruct *chartInstance;
  chartInstance = (SFc1_entalInstanceStruct *)chartInstanceVoid;
  c1_y = NULL;
  c1_b_u = *((real_T *)c1_u);
  c1_b_y = NULL;
  sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 0, 0U, 0U, 0U, 0));
  sf_mex_assign(&c1_y, c1_b_y);
  return c1_y;
}

static const mxArray *c1_b_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
  const mxArray *c1_y = NULL;
  int32_T c1_i12;
  int32_T c1_i13;
  int32_T c1_i14;
  real_T c1_b_u[7185];
  int32_T c1_i15;
  int32_T c1_i16;
  int32_T c1_i17;
  real_T c1_c_u[7185];
  const mxArray *c1_b_y = NULL;
  SFc1_entalInstanceStruct *chartInstance;
  chartInstance = (SFc1_entalInstanceStruct *)chartInstanceVoid;
  c1_y = NULL;
  c1_i12 = 0;
  for (c1_i13 = 0; c1_i13 < 479; c1_i13 = c1_i13 + 1) {
    for (c1_i14 = 0; c1_i14 < 15; c1_i14 = c1_i14 + 1) {
      c1_b_u[c1_i14 + c1_i12] = (*((real_T (*)[7185])c1_u))[c1_i14 + c1_i12];
    }

    c1_i12 = c1_i12 + 15;
  }

  c1_i15 = 0;
  for (c1_i16 = 0; c1_i16 < 479; c1_i16 = c1_i16 + 1) {
    for (c1_i17 = 0; c1_i17 < 15; c1_i17 = c1_i17 + 1) {
      c1_c_u[c1_i17 + c1_i15] = c1_b_u[c1_i17 + c1_i15];
    }

    c1_i15 = c1_i15 + 15;
  }

  c1_b_y = NULL;
  sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_c_u, 0, 0U, 1U, 0U, 2, 15, 479));
  sf_mex_assign(&c1_y, c1_b_y);
  return c1_y;
}

static const mxArray *c1_c_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
  const mxArray *c1_y = NULL;
  int32_T c1_i18;
  real_T c1_b_u[1600];
  int32_T c1_i19;
  real_T c1_c_u[1600];
  const mxArray *c1_b_y = NULL;
  SFc1_entalInstanceStruct *chartInstance;
  chartInstance = (SFc1_entalInstanceStruct *)chartInstanceVoid;
  c1_y = NULL;
  for (c1_i18 = 0; c1_i18 < 1600; c1_i18 = c1_i18 + 1) {
    c1_b_u[c1_i18] = (*((real_T (*)[1600])c1_u))[c1_i18];
  }

  for (c1_i19 = 0; c1_i19 < 1600; c1_i19 = c1_i19 + 1) {
    c1_c_u[c1_i19] = c1_b_u[c1_i19];
  }

  c1_b_y = NULL;
  sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_c_u, 0, 0U, 1U, 0U, 2, 1, 1600));
  sf_mex_assign(&c1_y, c1_b_y);
  return c1_y;
}

const mxArray *sf_c1_ental_get_eml_resolved_functions_info(void)
{
  const mxArray *c1_nameCaptureInfo = NULL;
  c1_ResolvedFunctionInfo c1_info[12];
  c1_ResolvedFunctionInfo (*c1_b_info)[12];
  const mxArray *c1_m0 = NULL;
  int32_T c1_i20;
  c1_ResolvedFunctionInfo *c1_r0;
  c1_nameCaptureInfo = NULL;
  c1_b_info = (c1_ResolvedFunctionInfo (*)[12])c1_info;
  (*c1_b_info)[0].context = "";
  (*c1_b_info)[0].name = "size";
  (*c1_b_info)[0].dominantType = "double";
  (*c1_b_info)[0].resolved = "[B]size";
  (*c1_b_info)[0].fileLength = 0U;
  (*c1_b_info)[0].fileTime1 = 0U;
  (*c1_b_info)[0].fileTime2 = 0U;
  (*c1_b_info)[1].context = "";
  (*c1_b_info)[1].name = "zeros";
  (*c1_b_info)[1].dominantType = "double";
  (*c1_b_info)[1].resolved = "[B]zeros";
  (*c1_b_info)[1].fileLength = 0U;
  (*c1_b_info)[1].fileTime1 = 0U;
  (*c1_b_info)[1].fileTime2 = 0U;
  (*c1_b_info)[2].context = "";
  (*c1_b_info)[2].name = "round";
  (*c1_b_info)[2].dominantType = "double";
  (*c1_b_info)[2].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/round.m";
  (*c1_b_info)[2].fileLength = 331U;
  (*c1_b_info)[2].fileTime1 = 1203448036U;
  (*c1_b_info)[2].fileTime2 = 0U;
  (*c1_b_info)[3].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/round.m";
  (*c1_b_info)[3].name = "nargin";
  (*c1_b_info)[3].dominantType = "";
  (*c1_b_info)[3].resolved = "[B]nargin";
  (*c1_b_info)[3].fileLength = 0U;
  (*c1_b_info)[3].fileTime1 = 0U;
  (*c1_b_info)[3].fileTime2 = 0U;
  (*c1_b_info)[4].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/round.m";
  (*c1_b_info)[4].name = "gt";
  (*c1_b_info)[4].dominantType = "double";
  (*c1_b_info)[4].resolved = "[B]gt";
  (*c1_b_info)[4].fileLength = 0U;
  (*c1_b_info)[4].fileTime1 = 0U;
  (*c1_b_info)[4].fileTime2 = 0U;
  (*c1_b_info)[5].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/round.m";
  (*c1_b_info)[5].name = "isa";
  (*c1_b_info)[5].dominantType = "double";
  (*c1_b_info)[5].resolved = "[B]isa";
  (*c1_b_info)[5].fileLength = 0U;
  (*c1_b_info)[5].fileTime1 = 0U;
  (*c1_b_info)[5].fileTime2 = 0U;
  (*c1_b_info)[6].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/round.m";
  (*c1_b_info)[6].name = "eml_scalar_round";
  (*c1_b_info)[6].dominantType = "double";
  (*c1_b_info)[6].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_round.m";
  (*c1_b_info)[6].fileLength = 523U;
  (*c1_b_info)[6].fileTime1 = 1203448008U;
  (*c1_b_info)[6].fileTime2 = 0U;
  (*c1_b_info)[7].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_round.m";
  (*c1_b_info)[7].name = "isfloat";
  (*c1_b_info)[7].dominantType = "double";
  (*c1_b_info)[7].resolved = "[B]isfloat";
  (*c1_b_info)[7].fileLength = 0U;
  (*c1_b_info)[7].fileTime1 = 0U;
  (*c1_b_info)[7].fileTime2 = 0U;
  (*c1_b_info)[8].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_round.m";
  (*c1_b_info)[8].name = "isreal";
  (*c1_b_info)[8].dominantType = "double";
  (*c1_b_info)[8].resolved = "[B]isreal";
  (*c1_b_info)[8].fileLength = 0U;
  (*c1_b_info)[8].fileTime1 = 0U;
  (*c1_b_info)[8].fileTime2 = 0U;
  (*c1_b_info)[9].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_round.m!scalar_round";
  (*c1_b_info)[9].name = "lt";
  (*c1_b_info)[9].dominantType = "double";
  (*c1_b_info)[9].resolved = "[B]lt";
  (*c1_b_info)[9].fileLength = 0U;
  (*c1_b_info)[9].fileTime1 = 0U;
  (*c1_b_info)[9].fileTime2 = 0U;
  (*c1_b_info)[10].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_round.m!scalar_round";
  (*c1_b_info)[10].name = "minus";
  (*c1_b_info)[10].dominantType = "double";
  (*c1_b_info)[10].resolved = "[B]minus";
  (*c1_b_info)[10].fileLength = 0U;
  (*c1_b_info)[10].fileTime1 = 0U;
  (*c1_b_info)[10].fileTime2 = 0U;
  (*c1_b_info)[11].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_round.m!scalar_round";
  (*c1_b_info)[11].name = "plus";
  (*c1_b_info)[11].dominantType = "double";
  (*c1_b_info)[11].resolved = "[B]plus";
  (*c1_b_info)[11].fileLength = 0U;
  (*c1_b_info)[11].fileTime1 = 0U;
  (*c1_b_info)[11].fileTime2 = 0U;
  sf_mex_assign(&c1_m0, sf_mex_createstruct("nameCaptureInfo", 1, 12));
  for (c1_i20 = 0; c1_i20 < 12; c1_i20 = c1_i20 + 1) {
    c1_r0 = &c1_info[c1_i20];
    sf_mex_addfield(c1_m0, sf_mex_create("nameCaptureInfo", c1_r0->context, 15,
      0U, 0U, 0U, 2, 1, strlen(c1_r0->context)), "context",
                    "nameCaptureInfo", c1_i20);
    sf_mex_addfield(c1_m0, sf_mex_create("nameCaptureInfo", c1_r0->name, 15, 0U,
      0U, 0U, 2, 1, strlen(c1_r0->name)), "name",
                    "nameCaptureInfo", c1_i20);
    sf_mex_addfield(c1_m0, sf_mex_create("nameCaptureInfo", c1_r0->dominantType,
      15, 0U, 0U, 0U, 2, 1, strlen(c1_r0->dominantType)),
                    "dominantType", "nameCaptureInfo", c1_i20);
    sf_mex_addfield(c1_m0, sf_mex_create("nameCaptureInfo", c1_r0->resolved, 15,
      0U, 0U, 0U, 2, 1, strlen(c1_r0->resolved)), "resolved"
                    , "nameCaptureInfo", c1_i20);
    sf_mex_addfield(c1_m0, sf_mex_create("nameCaptureInfo", &c1_r0->fileLength,
      7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
                    c1_i20);
    sf_mex_addfield(c1_m0, sf_mex_create("nameCaptureInfo", &c1_r0->fileTime1, 7,
      0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo", c1_i20
                    );
    sf_mex_addfield(c1_m0, sf_mex_create("nameCaptureInfo", &c1_r0->fileTime2, 7,
      0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo", c1_i20
                    );
  }

  sf_mex_assign(&c1_nameCaptureInfo, c1_m0);
  return c1_nameCaptureInfo;
}

static const mxArray *c1_d_sf_marshall(void *chartInstanceVoid, void *c1_u)
{
  const mxArray *c1_y = NULL;
  boolean_T c1_b_u;
  const mxArray *c1_b_y = NULL;
  SFc1_entalInstanceStruct *chartInstance;
  chartInstance = (SFc1_entalInstanceStruct *)chartInstanceVoid;
  c1_y = NULL;
  c1_b_u = *((boolean_T *)c1_u);
  c1_b_y = NULL;
  sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 11, 0U, 0U, 0U, 0));
  sf_mex_assign(&c1_y, c1_b_y);
  return c1_y;
}

static void c1_emlrt_marshallIn(SFc1_entalInstanceStruct *chartInstance, const
  mxArray *c1_h, const char_T *c1_name, real_T c1_y[
  7185])
{
  real_T c1_dv1[7185];
  int32_T c1_i21;
  sf_mex_import(c1_name, sf_mex_dup(c1_h), c1_dv1, 1, 0, 0U, 1, 0U, 2, 15, 479);
  for (c1_i21 = 0; c1_i21 < 7185; c1_i21 = c1_i21 + 1) {
    c1_y[c1_i21] = c1_dv1[c1_i21];
  }

  sf_mex_destroy(&c1_h);
}

static real_T c1_b_emlrt_marshallIn(SFc1_entalInstanceStruct *chartInstance,
  const mxArray *c1_hTS, const char_T *c1_name)
{
  real_T c1_y;
  real_T c1_d0;
  sf_mex_import(c1_name, sf_mex_dup(c1_hTS), &c1_d0, 1, 0, 0U, 0, 0U, 0);
  c1_y = c1_d0;
  sf_mex_destroy(&c1_hTS);
  return c1_y;
}

static uint8_T c1_c_emlrt_marshallIn(SFc1_entalInstanceStruct *chartInstance,
  const mxArray *c1_b_is_active_c1_ental, const char_T *
  c1_name)
{
  uint8_T c1_y;
  uint8_T c1_u0;
  sf_mex_import(c1_name, sf_mex_dup(c1_b_is_active_c1_ental), &c1_u0, 1, 3, 0U,
                0, 0U, 0);
  c1_y = c1_u0;
  sf_mex_destroy(&c1_b_is_active_c1_ental);
  return c1_y;
}

static void init_dsm_address_info(SFc1_entalInstanceStruct *chartInstance)
{
}

/* SFunction Glue Code */
void sf_c1_ental_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2582725331U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(2540704777U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(2369610717U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(351428973U);
}

mxArray *sf_c1_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)(990037136U);
    pr[1] = (double)(454326023U);
    pr[2] = (double)(835029925U);
    pr[3] = (double)(886261252U);
    mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
  }

  {
    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)(1);
      pr[1] = (double)(1600);
      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)(15);
      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));

    {
      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));
    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)(15);
      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)(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));
    mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
  }

  return(mxAutoinheritanceInfo);
}

static mxArray *sf_get_sim_state_info_c1_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[5],T\"h\",},{M[1],M[10],T\"hTS\",},{M[8],M[0],T\"is_active_c1_ental\",}}"
  };

  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 3, 10);
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
  sf_c1_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)) {
    SFc1_entalInstanceStruct *chartInstance;
    chartInstance = (SFc1_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_,
          1,
          1,
          1,
          5,
          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,"H");
          _SFD_SET_DATA_PROPS(1,2,0,1,"h");
          _SFD_SET_DATA_PROPS(2,1,1,0,"u");
          _SFD_SET_DATA_PROPS(3,1,1,0,"TS");
          _SFD_SET_DATA_PROPS(4,2,0,1,"hTS");
          _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,0,0,0,2,0,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,160);
        _SFD_CV_INIT_EML_FOR(0,0,81,91,141);
        _SFD_CV_INIT_EML_FOR(0,1,95,105,137);
        _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]= 1;
          dimVector[1]= 1600;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c1_c_sf_marshall);
        }

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

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

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

        {
          real_T *c1_TS;
          real_T *c1_hTS;
          real_T (*c1_H)[1600];
          real_T (*c1_h)[7185];
          real_T (*c1_u)[7185];
          c1_hTS = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
          c1_TS = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
          c1_u = (real_T (*)[7185])ssGetInputPortSignal(chartInstance->S, 1);
          c1_h = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
          c1_H = (real_T (*)[1600])ssGetInputPortSignal(chartInstance->S, 0);
          _SFD_SET_DATA_VALUE_PTR(0U, *c1_H);
          _SFD_SET_DATA_VALUE_PTR(1U, *c1_h);
          _SFD_SET_DATA_VALUE_PTR(2U, *c1_u);
          _SFD_SET_DATA_VALUE_PTR(3U, c1_TS);
          _SFD_SET_DATA_VALUE_PTR(4U, c1_hTS);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(_entalMachineNumber_,
        chartInstance->chartNumber,chartInstance->instanceNumber);
    }
  }
}

static void sf_opaque_initialize_c1_ental(void *chartInstanceVar)
{
  chart_debug_initialization(((SFc1_entalInstanceStruct*) chartInstanceVar)->S,0);
  initialize_params_c1_ental((SFc1_entalInstanceStruct*) chartInstanceVar);
  initialize_c1_ental((SFc1_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_enable_c1_ental(void *chartInstanceVar)
{
  enable_c1_ental((SFc1_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_disable_c1_ental(void *chartInstanceVar)
{
  disable_c1_ental((SFc1_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_gateway_c1_ental(void *chartInstanceVar)
{
  sf_c1_ental((SFc1_entalInstanceStruct*) chartInstanceVar);
}

static mxArray* sf_internal_get_sim_state_c1_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_c1_ental((SFc1_entalInstanceStruct*)
    chartInfo->chartInstance);         /* raw sim ctx */
  prhs[3] = sf_get_sim_state_info_c1_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_c1_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_c1_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_c1_ental((SFc1_entalInstanceStruct*)chartInfo->chartInstance,
    mxDuplicateArray(plhs[0]));
  mxDestroyArray(plhs[0]);
}

static mxArray* sf_opaque_get_sim_state_c1_ental(SimStruct* S)
{
  return sf_internal_get_sim_state_c1_ental(S);
}

static void sf_opaque_set_sim_state_c1_ental(SimStruct* S, const mxArray *st)
{
  sf_internal_set_sim_state_c1_ental(S, st);
}

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

    finalize_c1_ental((SFc1_entalInstanceStruct*) chartInstanceVar);
    free((void *)chartInstanceVar);
    ssSetUserData(S,NULL);
  }
}

static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
  compInitSubchartSimstructsFcn_c1_ental((SFc1_entalInstanceStruct*)
    chartInstanceVar);
}

extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c1_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_c1_ental((SFc1_entalInstanceStruct*)(((ChartInfoStruct *)
      ssGetUserData(S))->chartInstance));
  }
}

static void mdlSetWorkWidths_c1_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",1);
    ssSetStateflowIsInlinable(S,chartIsInlinable);
    ssSetRTWCG(S,sf_rtw_info_uint_prop(S,"ental","ental",1,"RTWCG"));
    ssSetEnableFcnIsTrivial(S,1);
    ssSetDisableFcnIsTrivial(S,1);
    ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop(S,"ental","ental",1,
      "gatewayCannotBeInlinedMultipleTimes"));
    if (chartIsInlinable) {
      ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
      ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
      sf_mark_chart_expressionable_inputs(S,"ental","ental",1,3);
      sf_mark_chart_reusable_outputs(S,"ental","ental",1,2);
    }

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

  ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
  ssSetChecksum0(S,(134803568U));
  ssSetChecksum1(S,(1202056735U));
  ssSetChecksum2(S,(3635676990U));
  ssSetChecksum3(S,(1033845480U));
  ssSetmdlDerivatives(S, NULL);
  ssSetExplicitFCSSCtrl(S,1);
}

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

static void mdlStart_c1_ental(SimStruct *S)
{
  SFc1_entalInstanceStruct *chartInstance;
  chartInstance = (SFc1_entalInstanceStruct *)malloc(sizeof
    (SFc1_entalInstanceStruct));
  memset(chartInstance, 0, sizeof(SFc1_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_c1_ental;
  chartInstance->chartInfo.initializeChart = sf_opaque_initialize_c1_ental;
  chartInstance->chartInfo.terminateChart = sf_opaque_terminate_c1_ental;
  chartInstance->chartInfo.enableChart = sf_opaque_enable_c1_ental;
  chartInstance->chartInfo.disableChart = sf_opaque_disable_c1_ental;
  chartInstance->chartInfo.getSimState = sf_opaque_get_sim_state_c1_ental;
  chartInstance->chartInfo.setSimState = sf_opaque_set_sim_state_c1_ental;
  chartInstance->chartInfo.getSimStateInfo = sf_get_sim_state_info_c1_ental;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c1_ental;
  chartInstance->chartInfo.mdlStart = mdlStart_c1_ental;
  chartInstance->chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c1_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 c1_ental_method_dispatcher(SimStruct *S, int_T method, void *data)
{
  switch (method) {
   case SS_CALL_MDL_START:
    mdlStart_c1_ental(S);
    break;

   case SS_CALL_MDL_SET_WORK_WIDTHS:
    mdlSetWorkWidths_c1_ental(S);
    break;

   case SS_CALL_MDL_PROCESS_PARAMETERS:
    mdlProcessParameters_c1_ental(S);
    break;

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