/* Include files */

#include "blascompat32.h"
#include "ental_sfun.h"
#include "c94_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 *c94_debug_family_names[14] = { "a", "b", "j", "i", "leva",
  "prava", "xij", "stred", "h_left", "nargin", "nargout", "H", "x", "u" };

/* Function Declarations */
static void initialize_c94_ental(SFc94_entalInstanceStruct *chartInstance);
static void initialize_params_c94_ental(SFc94_entalInstanceStruct *chartInstance);
static void enable_c94_ental(SFc94_entalInstanceStruct *chartInstance);
static void disable_c94_ental(SFc94_entalInstanceStruct *chartInstance);
static void c94_update_debugger_state_c94_ental(SFc94_entalInstanceStruct
  *chartInstance);
static const mxArray *get_sim_state_c94_ental(SFc94_entalInstanceStruct
  *chartInstance);
static void set_sim_state_c94_ental(SFc94_entalInstanceStruct *chartInstance,
  const mxArray *c94_st);
static void finalize_c94_ental(SFc94_entalInstanceStruct *chartInstance);
static void sf_c94_ental(SFc94_entalInstanceStruct *chartInstance);
static void c94_c94_ental(SFc94_entalInstanceStruct *chartInstance);
static void compInitSubchartSimstructsFcn_c94_ental(SFc94_entalInstanceStruct
  *chartInstance);
static void init_script_number_translation(uint32_T c94_machineNumber, uint32_T
  c94_chartNumber);
static const mxArray *c94_sf_marshall(void *chartInstanceVoid, void *c94_u);
static const mxArray *c94_b_sf_marshall(void *chartInstanceVoid, void *c94_u);
static const mxArray *c94_c_sf_marshall(void *chartInstanceVoid, void *c94_u);
static void c94_info_helper(c94_ResolvedFunctionInfo c94_info[40]);
static const mxArray *c94_d_sf_marshall(void *chartInstanceVoid, void *c94_u);
static void c94_emlrt_marshallIn(SFc94_entalInstanceStruct *chartInstance, const
  mxArray *c94_u, const char_T *c94_name, real_T c94_y[7185]);
static uint8_T c94_b_emlrt_marshallIn(SFc94_entalInstanceStruct *chartInstance,
  const mxArray *c94_b_is_active_c94_ental, const char_T *c94_name);
static void init_dsm_address_info(SFc94_entalInstanceStruct *chartInstance);

/* Function Definitions */
static void initialize_c94_ental(SFc94_entalInstanceStruct *chartInstance)
{
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  chartInstance->c94_is_active_c94_ental = 0U;
}

static void initialize_params_c94_ental(SFc94_entalInstanceStruct *chartInstance)
{
}

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

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

static void c94_update_debugger_state_c94_ental(SFc94_entalInstanceStruct
  *chartInstance)
{
}

static const mxArray *get_sim_state_c94_ental(SFc94_entalInstanceStruct
  *chartInstance)
{
  const mxArray *c94_st = NULL;
  const mxArray *c94_y = NULL;
  int32_T c94_i0;
  real_T c94_hoistedGlobal[7185];
  int32_T c94_i1;
  real_T c94_u[7185];
  const mxArray *c94_b_y = NULL;
  uint8_T c94_b_hoistedGlobal;
  uint8_T c94_b_u;
  const mxArray *c94_c_y = NULL;
  real_T (*c94_c_u)[7185];
  c94_c_u = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
  c94_st = NULL;
  c94_y = NULL;
  sf_mex_assign(&c94_y, sf_mex_createcellarray(2));
  for (c94_i0 = 0; c94_i0 < 7185; c94_i0 = c94_i0 + 1) {
    c94_hoistedGlobal[c94_i0] = (*c94_c_u)[c94_i0];
  }

  for (c94_i1 = 0; c94_i1 < 7185; c94_i1 = c94_i1 + 1) {
    c94_u[c94_i1] = c94_hoistedGlobal[c94_i1];
  }

  c94_b_y = NULL;
  sf_mex_assign(&c94_b_y, sf_mex_create("y", c94_u, 0, 0U, 1U, 0U, 2, 15, 479));
  sf_mex_setcell(c94_y, 0, c94_b_y);
  c94_b_hoistedGlobal = chartInstance->c94_is_active_c94_ental;
  c94_b_u = c94_b_hoistedGlobal;
  c94_c_y = NULL;
  sf_mex_assign(&c94_c_y, sf_mex_create("y", &c94_b_u, 3, 0U, 0U, 0U, 0));
  sf_mex_setcell(c94_y, 1, c94_c_y);
  sf_mex_assign(&c94_st, c94_y);
  return c94_st;
}

static void set_sim_state_c94_ental(SFc94_entalInstanceStruct *chartInstance,
  const mxArray *c94_st)
{
  const mxArray *c94_u;
  real_T c94_dv0[7185];
  int32_T c94_i2;
  real_T (*c94_b_u)[7185];
  c94_b_u = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
  chartInstance->c94_doneDoubleBufferReInit = TRUE;
  c94_u = sf_mex_dup(c94_st);
  c94_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c94_u, 0)), "u",
                       c94_dv0);
  for (c94_i2 = 0; c94_i2 < 7185; c94_i2 = c94_i2 + 1) {
    (*c94_b_u)[c94_i2] = c94_dv0[c94_i2];
  }

  chartInstance->c94_is_active_c94_ental = c94_b_emlrt_marshallIn(chartInstance,
    sf_mex_dup(sf_mex_getcell(c94_u, 1)),
    "is_active_c94_ental");
  sf_mex_destroy(&c94_u);
  c94_update_debugger_state_c94_ental(chartInstance);
  sf_mex_destroy(&c94_st);
}

static void finalize_c94_ental(SFc94_entalInstanceStruct *chartInstance)
{
}

static void sf_c94_ental(SFc94_entalInstanceStruct *chartInstance)
{
  int32_T c94_i3;
  int32_T c94_i4;
  int32_T c94_i5;
  int32_T c94_previousEvent;
  real_T (*c94_x)[7185];
  real_T (*c94_H)[1600];
  real_T (*c94_u)[7185];
  c94_x = (real_T (*)[7185])ssGetInputPortSignal(chartInstance->S, 1);
  c94_H = (real_T (*)[1600])ssGetInputPortSignal(chartInstance->S, 0);
  c94_u = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 20);
  for (c94_i3 = 0; c94_i3 < 7185; c94_i3 = c94_i3 + 1) {
    _SFD_DATA_RANGE_CHECK((*c94_u)[c94_i3], 0U);
  }

  for (c94_i4 = 0; c94_i4 < 1600; c94_i4 = c94_i4 + 1) {
    _SFD_DATA_RANGE_CHECK((*c94_H)[c94_i4], 1U);
  }

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

  c94_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  c94_c94_ental(chartInstance);
  _sfEvent_ = c94_previousEvent;
  sf_debug_check_for_state_inconsistency(_entalMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}

static void c94_c94_ental(SFc94_entalInstanceStruct *chartInstance)
{
  int32_T c94_i6;
  real_T c94_hoistedGlobal[1600];
  int32_T c94_i7;
  real_T c94_b_hoistedGlobal[7185];
  int32_T c94_i8;
  real_T c94_H[1600];
  int32_T c94_i9;
  real_T c94_x[7185];
  uint32_T c94_debug_family_var_map[14];
  static const char *c94_sv0[14] = { "a", "b", "j", "i", "leva", "prava", "xij",
    "stred", "h_left", "nargin", "nargout", "H", "x", "u"
  };

  real_T c94_a;
  real_T c94_b;
  real_T c94_j;
  real_T c94_i;
  real_T c94_leva;
  real_T c94_prava;
  real_T c94_xij;
  real_T c94_stred;
  real_T c94_h_left;
  real_T c94_nargin = 2.0;
  real_T c94_nargout = 1.0;
  real_T c94_u[7185];
  real_T c94_mtmp;
  int32_T c94_ix;
  int32_T c94_k;
  int32_T c94_b_a;
  real_T c94_b_mtmp;
  int32_T c94_i10;
  real_T c94_b_j;
  real_T c94_b_i;
  real_T c94_A;
  real_T c94_b_x;
  real_T c94_c_x;
  real_T c94_d_x;
  real_T c94_y;
  real_T c94_e_x;
  real_T c94_f_x;
  real_T c94_b_A;
  real_T c94_B;
  real_T c94_g_x;
  real_T c94_b_y;
  real_T c94_h_x;
  real_T c94_c_y;
  real_T c94_i_x;
  real_T c94_d_y;
  real_T c94_e_y;
  int32_T c94_i11;
  real_T (*c94_b_u)[7185];
  real_T (*c94_j_x)[7185];
  real_T (*c94_b_H)[1600];
  c94_j_x = (real_T (*)[7185])ssGetInputPortSignal(chartInstance->S, 1);
  c94_b_H = (real_T (*)[1600])ssGetInputPortSignal(chartInstance->S, 0);
  c94_b_u = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 20);
  for (c94_i6 = 0; c94_i6 < 1600; c94_i6 = c94_i6 + 1) {
    c94_hoistedGlobal[c94_i6] = (*c94_b_H)[c94_i6];
  }

  for (c94_i7 = 0; c94_i7 < 7185; c94_i7 = c94_i7 + 1) {
    c94_b_hoistedGlobal[c94_i7] = (*c94_j_x)[c94_i7];
  }

  for (c94_i8 = 0; c94_i8 < 1600; c94_i8 = c94_i8 + 1) {
    c94_H[c94_i8] = c94_hoistedGlobal[c94_i8];
  }

  for (c94_i9 = 0; c94_i9 < 7185; c94_i9 = c94_i9 + 1) {
    c94_x[c94_i9] = c94_b_hoistedGlobal[c94_i9];
  }

  sf_debug_symbol_scope_push_eml(0U, 14U, 14U, c94_sv0, c94_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c94_a, c94_c_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c94_b, c94_c_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c94_j, c94_c_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c94_i, c94_c_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c94_leva, c94_c_sf_marshall, 4U);
  sf_debug_symbol_scope_add_eml(&c94_prava, c94_c_sf_marshall, 5U);
  sf_debug_symbol_scope_add_eml(&c94_xij, c94_c_sf_marshall, 6U);
  sf_debug_symbol_scope_add_eml(&c94_stred, c94_c_sf_marshall, 7U);
  sf_debug_symbol_scope_add_eml(&c94_h_left, c94_c_sf_marshall, 8U);
  sf_debug_symbol_scope_add_eml(&c94_nargin, c94_c_sf_marshall, 9U);
  sf_debug_symbol_scope_add_eml(&c94_nargout, c94_c_sf_marshall, 10U);
  sf_debug_symbol_scope_add_eml(c94_H, c94_b_sf_marshall, 11U);
  sf_debug_symbol_scope_add_eml(c94_x, c94_sf_marshall, 12U);
  sf_debug_symbol_scope_add_eml(c94_u, c94_sf_marshall, 13U);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0, 3);
  c94_a = 1.0;
  _SFD_EML_CALL(0, 3);
  c94_mtmp = 1.0;
  c94_ix = 1;
  for (c94_k = 2; c94_k < 3; c94_k = c94_k + 1) {
    c94_b_a = c94_ix;
    c94_ix = c94_b_a + 1;
    if (1.0 + 1599.0 * (real_T)(_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)
          _SFD_INTEGER_CHECK("", (real_T)c94_ix), 1, 2, 1, 0) - 1) >
        c94_mtmp) {
      c94_mtmp = 1.0 + 1599.0 * (real_T)(_SFD_EML_ARRAY_BOUNDS_CHECK("",
        (int32_T)_SFD_INTEGER_CHECK("", (real_T)c94_ix), 1, 2, 1, 0) - 1);
    }
  }

  c94_b_mtmp = c94_mtmp;
  c94_b = c94_b_mtmp;
  _SFD_EML_CALL(0, 4);
  for (c94_i10 = 0; c94_i10 < 7185; c94_i10 = c94_i10 + 1) {
    c94_u[c94_i10] = 0.0;
  }

  c94_j = 1.0;
  c94_b_j = 1.0;
  while (c94_b_j <= 479.0) {
    c94_j = c94_b_j;
    CV_EML_FOR(0, 0, 1);
    c94_i = 1.0;
    c94_b_i = 1.0;
    while (c94_b_i <= 15.0) {
      c94_i = c94_b_i;
      CV_EML_FOR(0, 1, 1);
      _SFD_EML_CALL(0, 8);
      c94_leva = c94_a;
      _SFD_EML_CALL(0, 9);
      c94_prava = c94_b;
      _SFD_EML_CALL(0, 10);
      c94_xij = c94_x[(_SFD_EML_ARRAY_BOUNDS_CHECK("x", (int32_T)
        _SFD_INTEGER_CHECK("i", c94_i), 1, 15, 1, 0) - 1) + 15 * (
        _SFD_EML_ARRAY_BOUNDS_CHECK("x", (int32_T)_SFD_INTEGER_CHECK("j", c94_j),
        1, 479, 2, 0) - 1)];
      while (CV_EML_WHILE(0, 0, c94_prava - c94_leva > 1.0)) {
        _SFD_EML_CALL(0, 12);
        c94_A = c94_leva + c94_prava;
        c94_b_x = c94_A;
        c94_c_x = c94_b_x;
        c94_d_x = c94_c_x;
        c94_y = c94_d_x / 2.0;
        c94_e_x = c94_y;
        c94_stred = c94_e_x;
        c94_f_x = c94_stred;
        c94_stred = c94_f_x;
        c94_stred = muDoubleScalarCeil(c94_stred);
        _SFD_EML_CALL(0, 13);
        if (CV_EML_IF(0, 0, c94_xij >= c94_H[_SFD_EML_ARRAY_BOUNDS_CHECK("H",
              (int32_T)_SFD_INTEGER_CHECK("stred", c94_stred), 1, 1600, 1, 0)
                      - 1])) {
          _SFD_EML_CALL(0, 14);
          c94_leva = c94_stred;
        } else {
          _SFD_EML_CALL(0, 16);
          c94_prava = c94_stred;
        }

        sf_mex_listen_for_ctrl_c(chartInstance->S);
      }

      _SFD_EML_CALL(0, 19);
      c94_h_left = c94_H[_SFD_EML_ARRAY_BOUNDS_CHECK("H", (int32_T)
        _SFD_INTEGER_CHECK("leva", c94_leva), 1, 1600, 1, 0) - 1];
      _SFD_EML_CALL(0, 20);
      c94_b_A = c94_xij - c94_h_left;
      c94_B = c94_H[_SFD_EML_ARRAY_BOUNDS_CHECK("H", (int32_T)_SFD_INTEGER_CHECK
        ("prava", c94_prava), 1, 1600, 1, 0) - 1] - c94_h_left;
      c94_g_x = c94_b_A;
      c94_b_y = c94_B;
      c94_h_x = c94_g_x;
      c94_c_y = c94_b_y;
      c94_i_x = c94_h_x;
      c94_d_y = c94_c_y;
      c94_e_y = c94_i_x / c94_d_y;
      c94_u[(_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)_SFD_INTEGER_CHECK("i",
               c94_i), 1, 15, 1, 0) - 1) + 15 * (
        _SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)_SFD_INTEGER_CHECK("j", c94_j),
        1, 479, 2, 0) - 1)] = c94_e_y + c94_leva;
      c94_b_i = c94_b_i + 1.0;
      sf_mex_listen_for_ctrl_c(chartInstance->S);
    }

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

  CV_EML_FOR(0, 0, 0);
  _SFD_EML_CALL(0, -20);
  sf_debug_symbol_scope_pop();
  for (c94_i11 = 0; c94_i11 < 7185; c94_i11 = c94_i11 + 1) {
    (*c94_b_u)[c94_i11] = c94_u[c94_i11];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 20);
}

static void compInitSubchartSimstructsFcn_c94_ental(SFc94_entalInstanceStruct
  *chartInstance)
{
}

static void init_script_number_translation(uint32_T c94_machineNumber, uint32_T
  c94_chartNumber)
{
}

static const mxArray *c94_sf_marshall(void *chartInstanceVoid, void *c94_u)
{
  const mxArray *c94_y = NULL;
  int32_T c94_i12;
  int32_T c94_i13;
  int32_T c94_i14;
  real_T c94_b_u[7185];
  int32_T c94_i15;
  int32_T c94_i16;
  int32_T c94_i17;
  real_T c94_c_u[7185];
  const mxArray *c94_b_y = NULL;
  SFc94_entalInstanceStruct *chartInstance;
  chartInstance = (SFc94_entalInstanceStruct *)chartInstanceVoid;
  c94_y = NULL;
  c94_i12 = 0;
  for (c94_i13 = 0; c94_i13 < 479; c94_i13 = c94_i13 + 1) {
    for (c94_i14 = 0; c94_i14 < 15; c94_i14 = c94_i14 + 1) {
      c94_b_u[c94_i14 + c94_i12] = (*((real_T (*)[7185])c94_u))[c94_i14 +
        c94_i12];
    }

    c94_i12 = c94_i12 + 15;
  }

  c94_i15 = 0;
  for (c94_i16 = 0; c94_i16 < 479; c94_i16 = c94_i16 + 1) {
    for (c94_i17 = 0; c94_i17 < 15; c94_i17 = c94_i17 + 1) {
      c94_c_u[c94_i17 + c94_i15] = c94_b_u[c94_i17 + c94_i15];
    }

    c94_i15 = c94_i15 + 15;
  }

  c94_b_y = NULL;
  sf_mex_assign(&c94_b_y, sf_mex_create("y", c94_c_u, 0, 0U, 1U, 0U, 2, 15, 479));
  sf_mex_assign(&c94_y, c94_b_y);
  return c94_y;
}

static const mxArray *c94_b_sf_marshall(void *chartInstanceVoid, void *c94_u)
{
  const mxArray *c94_y = NULL;
  int32_T c94_i18;
  real_T c94_b_u[1600];
  int32_T c94_i19;
  real_T c94_c_u[1600];
  const mxArray *c94_b_y = NULL;
  SFc94_entalInstanceStruct *chartInstance;
  chartInstance = (SFc94_entalInstanceStruct *)chartInstanceVoid;
  c94_y = NULL;
  for (c94_i18 = 0; c94_i18 < 1600; c94_i18 = c94_i18 + 1) {
    c94_b_u[c94_i18] = (*((real_T (*)[1600])c94_u))[c94_i18];
  }

  for (c94_i19 = 0; c94_i19 < 1600; c94_i19 = c94_i19 + 1) {
    c94_c_u[c94_i19] = c94_b_u[c94_i19];
  }

  c94_b_y = NULL;
  sf_mex_assign(&c94_b_y, sf_mex_create("y", c94_c_u, 0, 0U, 1U, 0U, 2, 1, 1600));
  sf_mex_assign(&c94_y, c94_b_y);
  return c94_y;
}

static const mxArray *c94_c_sf_marshall(void *chartInstanceVoid, void *c94_u)
{
  const mxArray *c94_y = NULL;
  real_T c94_b_u;
  const mxArray *c94_b_y = NULL;
  SFc94_entalInstanceStruct *chartInstance;
  chartInstance = (SFc94_entalInstanceStruct *)chartInstanceVoid;
  c94_y = NULL;
  c94_b_u = *((real_T *)c94_u);
  c94_b_y = NULL;
  sf_mex_assign(&c94_b_y, sf_mex_create("y", &c94_b_u, 0, 0U, 0U, 0U, 0));
  sf_mex_assign(&c94_y, c94_b_y);
  return c94_y;
}

const mxArray *sf_c94_ental_get_eml_resolved_functions_info(void)
{
  const mxArray *c94_nameCaptureInfo = NULL;
  c94_ResolvedFunctionInfo c94_info[40];
  const mxArray *c94_m0 = NULL;
  int32_T c94_i20;
  c94_ResolvedFunctionInfo *c94_r0;
  c94_nameCaptureInfo = NULL;
  c94_info_helper(c94_info);
  sf_mex_assign(&c94_m0, sf_mex_createstruct("nameCaptureInfo", 1, 40));
  for (c94_i20 = 0; c94_i20 < 40; c94_i20 = c94_i20 + 1) {
    c94_r0 = &c94_info[c94_i20];
    sf_mex_addfield(c94_m0, sf_mex_create("nameCaptureInfo", c94_r0->context, 15,
      0U, 0U, 0U, 2, 1, strlen(c94_r0->context)), "context"
                    , "nameCaptureInfo", c94_i20);
    sf_mex_addfield(c94_m0, sf_mex_create("nameCaptureInfo", c94_r0->name, 15,
      0U, 0U, 0U, 2, 1, strlen(c94_r0->name)), "name",
                    "nameCaptureInfo", c94_i20);
    sf_mex_addfield(c94_m0, sf_mex_create("nameCaptureInfo",
      c94_r0->dominantType, 15, 0U, 0U, 0U, 2, 1, strlen(c94_r0->dominantType)),
                    "dominantType", "nameCaptureInfo", c94_i20);
    sf_mex_addfield(c94_m0, sf_mex_create("nameCaptureInfo", c94_r0->resolved,
      15, 0U, 0U, 0U, 2, 1, strlen(c94_r0->resolved)),
                    "resolved", "nameCaptureInfo", c94_i20);
    sf_mex_addfield(c94_m0, sf_mex_create("nameCaptureInfo", &c94_r0->fileLength,
      7, 0U, 0U, 0U, 0), "fileLength", "nameCaptureInfo",
                    c94_i20);
    sf_mex_addfield(c94_m0, sf_mex_create("nameCaptureInfo", &c94_r0->fileTime1,
      7, 0U, 0U, 0U, 0), "fileTime1", "nameCaptureInfo",
                    c94_i20);
    sf_mex_addfield(c94_m0, sf_mex_create("nameCaptureInfo", &c94_r0->fileTime2,
      7, 0U, 0U, 0U, 0), "fileTime2", "nameCaptureInfo",
                    c94_i20);
  }

  sf_mex_assign(&c94_nameCaptureInfo, c94_m0);
  return c94_nameCaptureInfo;
}

static void c94_info_helper(c94_ResolvedFunctionInfo c94_info[40])
{
  c94_info[0].context = "";
  c94_info[0].name = "size";
  c94_info[0].dominantType = "double";
  c94_info[0].resolved = "[B]size";
  c94_info[0].fileLength = 0U;
  c94_info[0].fileTime1 = 0U;
  c94_info[0].fileTime2 = 0U;
  c94_info[1].context = "";
  c94_info[1].name = "max";
  c94_info[1].dominantType = "double";
  c94_info[1].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c94_info[1].fileLength = 362U;
  c94_info[1].fileTime1 = 1245102360U;
  c94_info[1].fileTime2 = 0U;
  c94_info[2].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c94_info[2].name = "nargin";
  c94_info[2].dominantType = "";
  c94_info[2].resolved = "[B]nargin";
  c94_info[2].fileLength = 0U;
  c94_info[2].fileTime1 = 0U;
  c94_info[2].fileTime2 = 0U;
  c94_info[3].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c94_info[3].name = "gt";
  c94_info[3].dominantType = "double";
  c94_info[3].resolved = "[B]gt";
  c94_info[3].fileLength = 0U;
  c94_info[3].fileTime1 = 0U;
  c94_info[3].fileTime2 = 0U;
  c94_info[4].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c94_info[4].name = "le";
  c94_info[4].dominantType = "double";
  c94_info[4].resolved = "[B]le";
  c94_info[4].fileLength = 0U;
  c94_info[4].fileTime1 = 0U;
  c94_info[4].fileTime2 = 0U;
  c94_info[5].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c94_info[5].name = "nargout";
  c94_info[5].dominantType = "";
  c94_info[5].resolved = "[B]nargout";
  c94_info[5].fileLength = 0U;
  c94_info[5].fileTime1 = 0U;
  c94_info[5].fileTime2 = 0U;
  c94_info[6].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/datafun/max.m";
  c94_info[6].name = "eml_min_or_max";
  c94_info[6].dominantType = "char";
  c94_info[6].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[6].fileLength = 9967U;
  c94_info[6].fileTime1 = 1261951870U;
  c94_info[6].fileTime2 = 0U;
  c94_info[7].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[7].name = "ischar";
  c94_info[7].dominantType = "char";
  c94_info[7].resolved = "[B]ischar";
  c94_info[7].fileLength = 0U;
  c94_info[7].fileTime1 = 0U;
  c94_info[7].fileTime2 = 0U;
  c94_info[8].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[8].name = "strcmp";
  c94_info[8].dominantType = "char";
  c94_info[8].resolved = "[B]strcmp";
  c94_info[8].fileLength = 0U;
  c94_info[8].fileTime1 = 0U;
  c94_info[8].fileTime2 = 0U;
  c94_info[9].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[9].name = "isnumeric";
  c94_info[9].dominantType = "double";
  c94_info[9].resolved = "[B]isnumeric";
  c94_info[9].fileLength = 0U;
  c94_info[9].fileTime1 = 0U;
  c94_info[9].fileTime2 = 0U;
  c94_info[10].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[10].name = "isreal";
  c94_info[10].dominantType = "double";
  c94_info[10].resolved = "[B]isreal";
  c94_info[10].fileLength = 0U;
  c94_info[10].fileTime1 = 0U;
  c94_info[10].fileTime2 = 0U;
  c94_info[11].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[11].name = "eq";
  c94_info[11].dominantType = "double";
  c94_info[11].resolved = "[B]eq";
  c94_info[11].fileLength = 0U;
  c94_info[11].fileTime1 = 0U;
  c94_info[11].fileTime2 = 0U;
  c94_info[12].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[12].name = "eml_const_nonsingleton_dim";
  c94_info[12].dominantType = "double";
  c94_info[12].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_const_nonsingleton_dim.m";
  c94_info[12].fileLength = 1473U;
  c94_info[12].fileTime1 = 1240262002U;
  c94_info[12].fileTime2 = 0U;
  c94_info[13].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_const_nonsingleton_dim.m!local_const_nonsingleton_dim";
  c94_info[13].name = "not";
  c94_info[13].dominantType = "logical";
  c94_info[13].resolved = "[B]not";
  c94_info[13].fileLength = 0U;
  c94_info[13].fileTime1 = 0U;
  c94_info[13].fileTime2 = 0U;
  c94_info[14].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_const_nonsingleton_dim.m!local_const_nonsingleton_dim";
  c94_info[14].name = "ne";
  c94_info[14].dominantType = "double";
  c94_info[14].resolved = "[B]ne";
  c94_info[14].fileLength = 0U;
  c94_info[14].fileTime1 = 0U;
  c94_info[14].fileTime2 = 0U;
  c94_info[15].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[15].name = "eml_scalar_eg";
  c94_info[15].dominantType = "double";
  c94_info[15].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c94_info[15].fileLength = 3068U;
  c94_info[15].fileTime1 = 1240262010U;
  c94_info[15].fileTime2 = 0U;
  c94_info[16].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!any_enums";
  c94_info[16].name = "false";
  c94_info[16].dominantType = "";
  c94_info[16].resolved = "[B]false";
  c94_info[16].fileLength = 0U;
  c94_info[16].fileTime1 = 0U;
  c94_info[16].fileTime2 = 0U;
  c94_info[17].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c94_info[17].name = "isstruct";
  c94_info[17].dominantType = "double";
  c94_info[17].resolved = "[B]isstruct";
  c94_info[17].fileLength = 0U;
  c94_info[17].fileTime1 = 0U;
  c94_info[17].fileTime2 = 0U;
  c94_info[18].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m";
  c94_info[18].name = "isa";
  c94_info[18].dominantType = "double";
  c94_info[18].resolved = "[B]isa";
  c94_info[18].fileLength = 0U;
  c94_info[18].fileTime1 = 0U;
  c94_info[18].fileTime2 = 0U;
  c94_info[19].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!zerosum";
  c94_info[19].name = "class";
  c94_info[19].dominantType = "double";
  c94_info[19].resolved = "[B]class";
  c94_info[19].fileLength = 0U;
  c94_info[19].fileTime1 = 0U;
  c94_info[19].fileTime2 = 0U;
  c94_info[20].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_scalar_eg.m!zerosum";
  c94_info[20].name = "cast";
  c94_info[20].dominantType = "double";
  c94_info[20].resolved = "[B]cast";
  c94_info[20].fileLength = 0U;
  c94_info[20].fileTime1 = 0U;
  c94_info[20].fileTime2 = 0U;
  c94_info[21].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[21].name = "ones";
  c94_info[21].dominantType = "double";
  c94_info[21].resolved = "[B]ones";
  c94_info[21].fileLength = 0U;
  c94_info[21].fileTime1 = 0U;
  c94_info[21].fileTime2 = 0U;
  c94_info[22].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[22].name = "eml_index_class";
  c94_info[22].dominantType = "";
  c94_info[22].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m";
  c94_info[22].fileLength = 909U;
  c94_info[22].fileTime1 = 1192466782U;
  c94_info[22].fileTime2 = 0U;
  c94_info[23].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[23].name = "isempty";
  c94_info[23].dominantType = "double";
  c94_info[23].resolved = "[B]isempty";
  c94_info[23].fileLength = 0U;
  c94_info[23].fileTime1 = 0U;
  c94_info[23].fileTime2 = 0U;
  c94_info[24].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m";
  c94_info[24].name = "isscalar";
  c94_info[24].dominantType = "double";
  c94_info[24].resolved = "[B]isscalar";
  c94_info[24].fileLength = 0U;
  c94_info[24].fileTime1 = 0U;
  c94_info[24].fileTime2 = 0U;
  c94_info[25].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c94_info[25].name = "lt";
  c94_info[25].dominantType = "double";
  c94_info[25].resolved = "[B]lt";
  c94_info[25].fileLength = 0U;
  c94_info[25].fileTime1 = 0U;
  c94_info[25].fileTime2 = 0U;
  c94_info[26].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c94_info[26].name = "isnan";
  c94_info[26].dominantType = "double";
  c94_info[26].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/isnan.m";
  c94_info[26].fileLength = 541U;
  c94_info[26].fileTime1 = 1271405588U;
  c94_info[26].fileTime2 = 0U;
  c94_info[27].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c94_info[27].name = "true";
  c94_info[27].dominantType = "";
  c94_info[27].resolved = "[B]true";
  c94_info[27].fileLength = 0U;
  c94_info[27].fileTime1 = 0U;
  c94_info[27].fileTime2 = 0U;
  c94_info[28].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_min_or_max.m!eml_extremum_sub";
  c94_info[28].name = "eml_index_plus";
  c94_info[28].dominantType = "int32";
  c94_info[28].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_plus.m";
  c94_info[28].fileLength = 272U;
  c94_info[28].fileTime1 = 1192466784U;
  c94_info[28].fileTime2 = 0U;
  c94_info[29].context = "";
  c94_info[29].name = "zeros";
  c94_info[29].dominantType = "double";
  c94_info[29].resolved = "[B]zeros";
  c94_info[29].fileLength = 0U;
  c94_info[29].fileTime1 = 0U;
  c94_info[29].fileTime2 = 0U;
  c94_info[30].context = "";
  c94_info[30].name = "minus";
  c94_info[30].dominantType = "double";
  c94_info[30].resolved = "[B]minus";
  c94_info[30].fileLength = 0U;
  c94_info[30].fileTime1 = 0U;
  c94_info[30].fileTime2 = 0U;
  c94_info[31].context = "";
  c94_info[31].name = "plus";
  c94_info[31].dominantType = "double";
  c94_info[31].resolved = "[B]plus";
  c94_info[31].fileLength = 0U;
  c94_info[31].fileTime1 = 0U;
  c94_info[31].fileTime2 = 0U;
  c94_info[32].context = "";
  c94_info[32].name = "mrdivide";
  c94_info[32].dominantType = "double";
  c94_info[32].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c94_info[32].fileLength = 432U;
  c94_info[32].fileTime1 = 1277748222U;
  c94_info[32].fileTime2 = 0U;
  c94_info[33].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c94_info[33].name = "ge";
  c94_info[33].dominantType = "double";
  c94_info[33].resolved = "[B]ge";
  c94_info[33].fileLength = 0U;
  c94_info[33].fileTime1 = 0U;
  c94_info[33].fileTime2 = 0U;
  c94_info[34].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/mrdivide.p";
  c94_info[34].name = "rdivide";
  c94_info[34].dominantType = "double";
  c94_info[34].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c94_info[34].fileLength = 403U;
  c94_info[34].fileTime1 = 1245102420U;
  c94_info[34].fileTime2 = 0U;
  c94_info[35].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/rdivide.m";
  c94_info[35].name = "eml_div";
  c94_info[35].dominantType = "double";
  c94_info[35].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
  c94_info[35].fileLength = 4918U;
  c94_info[35].fileTime1 = 1267063410U;
  c94_info[35].fileTime2 = 0U;
  c94_info[36].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_div.m";
  c94_info[36].name = "isinteger";
  c94_info[36].dominantType = "double";
  c94_info[36].resolved = "[B]isinteger";
  c94_info[36].fileLength = 0U;
  c94_info[36].fileTime1 = 0U;
  c94_info[36].fileTime2 = 0U;
  c94_info[37].context = "";
  c94_info[37].name = "ceil";
  c94_info[37].dominantType = "double";
  c94_info[37].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/ceil.m";
  c94_info[37].fileLength = 329U;
  c94_info[37].fileTime1 = 1203447950U;
  c94_info[37].fileTime2 = 0U;
  c94_info[38].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/ceil.m";
  c94_info[38].name = "eml_scalar_ceil";
  c94_info[38].dominantType = "double";
  c94_info[38].resolved =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_ceil.m";
  c94_info[38].fileLength = 253U;
  c94_info[38].fileTime1 = 1203447980U;
  c94_info[38].fileTime2 = 0U;
  c94_info[39].context =
    "[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_ceil.m";
  c94_info[39].name = "isfloat";
  c94_info[39].dominantType = "double";
  c94_info[39].resolved = "[B]isfloat";
  c94_info[39].fileLength = 0U;
  c94_info[39].fileTime1 = 0U;
  c94_info[39].fileTime2 = 0U;
}

static const mxArray *c94_d_sf_marshall(void *chartInstanceVoid, void *c94_u)
{
  const mxArray *c94_y = NULL;
  boolean_T c94_b_u;
  const mxArray *c94_b_y = NULL;
  SFc94_entalInstanceStruct *chartInstance;
  chartInstance = (SFc94_entalInstanceStruct *)chartInstanceVoid;
  c94_y = NULL;
  c94_b_u = *((boolean_T *)c94_u);
  c94_b_y = NULL;
  sf_mex_assign(&c94_b_y, sf_mex_create("y", &c94_b_u, 11, 0U, 0U, 0U, 0));
  sf_mex_assign(&c94_y, c94_b_y);
  return c94_y;
}

static void c94_emlrt_marshallIn(SFc94_entalInstanceStruct *chartInstance, const
  mxArray *c94_u, const char_T *c94_name, real_T
  c94_y[7185])
{
  real_T c94_dv1[7185];
  int32_T c94_i21;
  sf_mex_import(c94_name, sf_mex_dup(c94_u), c94_dv1, 1, 0, 0U, 1, 0U, 2, 15,
                479);
  for (c94_i21 = 0; c94_i21 < 7185; c94_i21 = c94_i21 + 1) {
    c94_y[c94_i21] = c94_dv1[c94_i21];
  }

  sf_mex_destroy(&c94_u);
}

static uint8_T c94_b_emlrt_marshallIn(SFc94_entalInstanceStruct *chartInstance,
  const mxArray *c94_b_is_active_c94_ental, const
  char_T *c94_name)
{
  uint8_T c94_y;
  uint8_T c94_u0;
  sf_mex_import(c94_name, sf_mex_dup(c94_b_is_active_c94_ental), &c94_u0, 1, 3,
                0U, 0, 0U, 0);
  c94_y = c94_u0;
  sf_mex_destroy(&c94_b_is_active_c94_ental);
  return c94_y;
}

static void init_dsm_address_info(SFc94_entalInstanceStruct *chartInstance)
{
}

/* SFunction Glue Code */
void sf_c94_ental_get_check_sum(mxArray *plhs[])
{
  ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2552754116U);
  ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(145925301U);
  ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(3828244736U);
  ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(983709330U);
}

mxArray *sf_c94_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)(663926553U);
    pr[1] = (double)(1574201733U);
    pr[2] = (double)(256037192U);
    pr[3] = (double)(3800075615U);
    mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
  }

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

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

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

    mxArray *mxData = mxCreateStructMatrix(1,1,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));
    mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
  }

  return(mxAutoinheritanceInfo);
}

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

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

  mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
  mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
  sf_c94_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)) {
    SFc94_entalInstanceStruct *chartInstance;
    chartInstance = (SFc94_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_,
          94,
          1,
          1,
          3,
          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,2,0,1,"u");
          _SFD_SET_DATA_PROPS(1,1,1,0,"H");
          _SFD_SET_DATA_PROPS(2,1,1,0,"x");
          _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,1,0,0,2,1,0,0);
        _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,454);
        _SFD_CV_INIT_EML_IF(0,0,248,266,306,354);
        _SFD_CV_INIT_EML_FOR(0,0,74,92,454);
        _SFD_CV_INIT_EML_FOR(0,1,96,114,450);
        _SFD_CV_INIT_EML_WHILE(0,0,175,196,366);
        _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]= 15;
          dimVector[1]= 479;
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c94_sf_marshall);
        }

        {
          unsigned int dimVector[2];
          dimVector[0]= 1;
          dimVector[1]= 1600;
          _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
            1.0,0,0,(MexFcnForType)c94_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)c94_sf_marshall);
        }

        {
          real_T (*c94_u)[7185];
          real_T (*c94_H)[1600];
          real_T (*c94_x)[7185];
          c94_x = (real_T (*)[7185])ssGetInputPortSignal(chartInstance->S, 1);
          c94_H = (real_T (*)[1600])ssGetInputPortSignal(chartInstance->S, 0);
          c94_u = (real_T (*)[7185])ssGetOutputPortSignal(chartInstance->S, 1);
          _SFD_SET_DATA_VALUE_PTR(0U, *c94_u);
          _SFD_SET_DATA_VALUE_PTR(1U, *c94_H);
          _SFD_SET_DATA_VALUE_PTR(2U, *c94_x);
        }
      }
    } else {
      sf_debug_reset_current_state_configuration(_entalMachineNumber_,
        chartInstance->chartNumber,chartInstance->instanceNumber);
    }
  }
}

static void sf_opaque_initialize_c94_ental(void *chartInstanceVar)
{
  chart_debug_initialization(((SFc94_entalInstanceStruct*) chartInstanceVar)->S,
    0);
  initialize_params_c94_ental((SFc94_entalInstanceStruct*) chartInstanceVar);
  initialize_c94_ental((SFc94_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_enable_c94_ental(void *chartInstanceVar)
{
  enable_c94_ental((SFc94_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_disable_c94_ental(void *chartInstanceVar)
{
  disable_c94_ental((SFc94_entalInstanceStruct*) chartInstanceVar);
}

static void sf_opaque_gateway_c94_ental(void *chartInstanceVar)
{
  sf_c94_ental((SFc94_entalInstanceStruct*) chartInstanceVar);
}

static mxArray* sf_internal_get_sim_state_c94_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_c94_ental((SFc94_entalInstanceStruct*)
    chartInfo->chartInstance);         /* raw sim ctx */
  prhs[3] = sf_get_sim_state_info_c94_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_c94_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_c94_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_c94_ental((SFc94_entalInstanceStruct*)chartInfo->chartInstance,
    mxDuplicateArray(plhs[0]));
  mxDestroyArray(plhs[0]);
}

static mxArray* sf_opaque_get_sim_state_c94_ental(SimStruct* S)
{
  return sf_internal_get_sim_state_c94_ental(S);
}

static void sf_opaque_set_sim_state_c94_ental(SimStruct* S, const mxArray *st)
{
  sf_internal_set_sim_state_c94_ental(S, st);
}

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

    finalize_c94_ental((SFc94_entalInstanceStruct*) chartInstanceVar);
    free((void *)chartInstanceVar);
    ssSetUserData(S,NULL);
  }
}

static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
  compInitSubchartSimstructsFcn_c94_ental((SFc94_entalInstanceStruct*)
    chartInstanceVar);
}

extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c94_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_c94_ental((SFc94_entalInstanceStruct*)(((ChartInfoStruct *)
      ssGetUserData(S))->chartInstance));
  }
}

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

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

  ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
  ssSetChecksum0(S,(4191220833U));
  ssSetChecksum1(S,(1727343724U));
  ssSetChecksum2(S,(3395180861U));
  ssSetChecksum3(S,(2632880727U));
  ssSetmdlDerivatives(S, NULL);
  ssSetExplicitFCSSCtrl(S,1);
}

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

static void mdlStart_c94_ental(SimStruct *S)
{
  SFc94_entalInstanceStruct *chartInstance;
  chartInstance = (SFc94_entalInstanceStruct *)malloc(sizeof
    (SFc94_entalInstanceStruct));
  memset(chartInstance, 0, sizeof(SFc94_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_c94_ental;
  chartInstance->chartInfo.initializeChart = sf_opaque_initialize_c94_ental;
  chartInstance->chartInfo.terminateChart = sf_opaque_terminate_c94_ental;
  chartInstance->chartInfo.enableChart = sf_opaque_enable_c94_ental;
  chartInstance->chartInfo.disableChart = sf_opaque_disable_c94_ental;
  chartInstance->chartInfo.getSimState = sf_opaque_get_sim_state_c94_ental;
  chartInstance->chartInfo.setSimState = sf_opaque_set_sim_state_c94_ental;
  chartInstance->chartInfo.getSimStateInfo = sf_get_sim_state_info_c94_ental;
  chartInstance->chartInfo.zeroCrossings = NULL;
  chartInstance->chartInfo.outputs = NULL;
  chartInstance->chartInfo.derivatives = NULL;
  chartInstance->chartInfo.mdlRTW = mdlRTW_c94_ental;
  chartInstance->chartInfo.mdlStart = mdlStart_c94_ental;
  chartInstance->chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c94_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 c94_ental_method_dispatcher(SimStruct *S, int_T method, void *data)
{
  switch (method) {
   case SS_CALL_MDL_START:
    mdlStart_c94_ental(S);
    break;

   case SS_CALL_MDL_SET_WORK_WIDTHS:
    mdlSetWorkWidths_c94_ental(S);
    break;

   case SS_CALL_MDL_PROCESS_PARAMETERS:
    mdlProcessParameters_c94_ental(S);
    break;

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