text: /* Include files */
  
  #include <stddef.h>
  #include "blas.h"
  #include "VrSubsystem_sfun.h"
  #include "c1_VrSubsystem.h"
  #define CHARTINSTANCE_CHARTNUMBER      (chartInstance->chartNumber)
  #define CHARTINSTANCE_INSTANCENUMBER   (chartInstance->instanceNumber)
  #include "VrSubsystem_sfun_debug_macros.h"
  #define _SF_MEX_LISTEN_FOR_CTRL_C(S)   sf_mex_listen_for_ctrl_c_with_debugger(S, sfGlobalDebugInstanceStruct);
  
  static void chart_debug_initialization(SimStruct *S, unsigned int
    fullDebuggerInitialization);
  static void chart_debug_initialize_data_addresses(SimStruct *S);
  static const mxArray* sf_opaque_get_hover_data_for_msg(void *chartInstance,
    int32_T msgSSID);
  
  /* Type Definitions */
  
  /* Named Constants */
  #define CALL_EVENT                     (-1)
  
  /* Variable Declarations */
  
  /* Variable Definitions */
  static real_T _sfTime_;
  static const char * c1_debug_family_names[10] = { "pixelsFold", "remainder",
    "sideThreshold", "nextFold", "i", "endFold", "nargin", "nargout", "u", "y" };
  
  /* Function Declarations */
  static void initialize_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  static void initialize_params_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  static void enable_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct *chartInstance);
  static void disable_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct *chartInstance);
  static void c1_update_debugger_state_c1_VrSubsystem
    (SFc1_VrSubsystemInstanceStruct *chartInstance);
  static const mxArray *get_sim_state_c1_VrSubsystem
    (SFc1_VrSubsystemInstanceStruct *chartInstance);
  static void set_sim_state_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_st);
  static void finalize_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  static void sf_gateway_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  static void mdl_start_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  static void c1_chartstep_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  static void initSimStructsc1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
    c1_chartNumber, uint32_T c1_instanceNumber);
  static const mxArray *c1_sf_marshallOut(void *chartInstanceVoid, void *c1_inData);
  static void c1_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct *chartInstance,
    const mxArray *c1_b_y, const char_T *c1_identifier, real_T c1_c_y[128]);
  static void c1_b_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct *chartInstance,
    const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId, real_T c1_b_y
    [128]);
  static void c1_sf_marshallIn(void *chartInstanceVoid, const mxArray
    *c1_mxArrayInData, const char_T *c1_varName, void *c1_outData);
  static const mxArray *c1_b_sf_marshallOut(void *chartInstanceVoid, void
    *c1_inData);
  static const mxArray *c1_c_sf_marshallOut(void *chartInstanceVoid, void
    *c1_inData);
  static real_T c1_c_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId);
  static void c1_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
    *c1_mxArrayInData, const char_T *c1_varName, void *c1_outData);
  static real_T c1_mean(SFc1_VrSubsystemInstanceStruct *chartInstance, real_T
                        c1_x_data[], int32_T c1_x_sizes);
  static boolean_T c1_isequal(SFc1_VrSubsystemInstanceStruct *chartInstance,
    real_T c1_varargin_1_data[], int32_T c1_varargin_1_sizes);
  static const mxArray *c1_d_sf_marshallOut(void *chartInstanceVoid, void
    *c1_inData);
  static int32_T c1_d_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId);
  static void c1_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
    *c1_mxArrayInData, const char_T *c1_varName, void *c1_outData);
  static uint8_T c1_e_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_is_active_c1_VrSubsystem, const char_T
    *c1_identifier);
  static uint8_T c1_f_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId);
  static void init_dsm_address_info(SFc1_VrSubsystemInstanceStruct *chartInstance);
  static void init_simulink_io_address(SFc1_VrSubsystemInstanceStruct
    *chartInstance);
  
  /* Function Definitions */
  static void initialize_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    if (sf_is_first_init_cond(chartInstance->S)) {
      initSimStructsc1_VrSubsystem(chartInstance);
      chart_debug_initialize_data_addresses(chartInstance->S);
    }
  
    chartInstance->c1_sfEvent = CALL_EVENT;
    _sfTime_ = sf_get_time(chartInstance->S);
    chartInstance->c1_is_active_c1_VrSubsystem = 0U;
  }
  
  static void initialize_params_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    (void)chartInstance;
  }
  
  static void enable_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct *chartInstance)
  {
    _sfTime_ = sf_get_time(chartInstance->S);
  }
  
  static void disable_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct *chartInstance)
  {
    _sfTime_ = sf_get_time(chartInstance->S);
  }
  
  static void c1_update_debugger_state_c1_VrSubsystem
    (SFc1_VrSubsystemInstanceStruct *chartInstance)
  {
    (void)chartInstance;
  }
  
  static const mxArray *get_sim_state_c1_VrSubsystem
    (SFc1_VrSubsystemInstanceStruct *chartInstance)
  {
    const mxArray *c1_st;
    const mxArray *c1_b_y = NULL;
    const mxArray *c1_c_y = NULL;
    uint8_T c1_hoistedGlobal;
    uint8_T c1_b_u;
    const mxArray *c1_d_y = NULL;
    c1_st = NULL;
    c1_st = NULL;
    c1_b_y = NULL;
    sf_mex_assign(&c1_b_y, sf_mex_createcellmatrix(2, 1), false);
    c1_c_y = NULL;
    sf_mex_assign(&c1_c_y, sf_mex_create("y", *chartInstance->c1_y, 0, 0U, 1U, 0U,
      2, 1, 128), false);
    sf_mex_setcell(c1_b_y, 0, c1_c_y);
    c1_hoistedGlobal = chartInstance->c1_is_active_c1_VrSubsystem;
    c1_b_u = c1_hoistedGlobal;
    c1_d_y = NULL;
    sf_mex_assign(&c1_d_y, sf_mex_create("y", &c1_b_u, 3, 0U, 0U, 0U, 0), false);
    sf_mex_setcell(c1_b_y, 1, c1_d_y);
    sf_mex_assign(&c1_st, c1_b_y, false);
    return c1_st;
  }
  
  static void set_sim_state_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_st)
  {
    const mxArray *c1_b_u;
    real_T c1_dv0[128];
    int32_T c1_i0;
    chartInstance->c1_doneDoubleBufferReInit = true;
    c1_b_u = sf_mex_dup(c1_st);
    c1_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell("y", c1_b_u, 0)),
                        "y", c1_dv0);
    for (c1_i0 = 0; c1_i0 < 128; c1_i0++) {
      (*chartInstance->c1_y)[c1_i0] = c1_dv0[c1_i0];
    }
  
    chartInstance->c1_is_active_c1_VrSubsystem = c1_e_emlrt_marshallIn
      (chartInstance, sf_mex_dup(sf_mex_getcell("is_active_c1_VrSubsystem", c1_b_u,
         1)), "is_active_c1_VrSubsystem");
    sf_mex_destroy(&c1_b_u);
    c1_update_debugger_state_c1_VrSubsystem(chartInstance);
    sf_mex_destroy(&c1_st);
  }
  
  static void finalize_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    (void)chartInstance;
  }
  
  static void sf_gateway_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    int32_T c1_i1;
    int32_T c1_i2;
    _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
    _sfTime_ = sf_get_time(chartInstance->S);
    _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
    for (c1_i1 = 0; c1_i1 < 320; c1_i1++) {
      _SFD_DATA_RANGE_CHECK((*chartInstance->c1_u)[c1_i1], 0U, 1U, 0U,
                            chartInstance->c1_sfEvent, false);
    }
  
    chartInstance->c1_sfEvent = CALL_EVENT;
    c1_chartstep_c1_VrSubsystem(chartInstance);
    _SFD_SYMBOL_SCOPE_POP();
    _SFD_CHECK_FOR_STATE_INCONSISTENCY(_VrSubsystemMachineNumber_,
      chartInstance->chartNumber, chartInstance->instanceNumber);
    for (c1_i2 = 0; c1_i2 < 128; c1_i2++) {
      _SFD_DATA_RANGE_CHECK((*chartInstance->c1_y)[c1_i2], 1U, 1U, 0U,
                            chartInstance->c1_sfEvent, false);
    }
  }
  
  static void mdl_start_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    (void)chartInstance;
  }
  
  static void c1_chartstep_c1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    int32_T c1_i3;
    real_T c1_b_u[320];
    uint32_T c1_debug_family_var_map[10];
    real_T c1_pixelsFold;
    real_T c1_remainder;
    real_T c1_sideThreshold;
    real_T c1_nextFold;
    real_T c1_i;
    real_T c1_endFold;
    real_T c1_nargin = 1.0;
    real_T c1_nargout = 1.0;
    real_T c1_b_y[128];
    int32_T c1_i4;
    int32_T c1_b_i;
    const mxArray *c1_c_y = NULL;
    static char_T c1_c_u[30] = { 'C', 'o', 'd', 'e', 'r', ':', 'b', 'u', 'i', 'l',
      't', 'i', 'n', 's', ':', 'A', 's', 's', 'e', 'r', 't', 'i', 'o', 'n', 'F',
      'a', 'i', 'l', 'e', 'd' };
  
    const mxArray *c1_d_y = NULL;
    boolean_T c1_b0;
    boolean_T c1_b1;
    boolean_T c1_b2;
    int32_T c1_i5;
    int32_T c1_i6;
    int32_T c1_u_sizes;
    int32_T c1_loop_ub;
    int32_T c1_i7;
    real_T c1_u_data[320];
    int32_T c1_c_i;
    const mxArray *c1_e_y = NULL;
    const mxArray *c1_f_y = NULL;
    boolean_T c1_b3;
    boolean_T c1_b4;
    boolean_T c1_b5;
    int32_T c1_i8;
    int32_T c1_i9;
    int32_T c1_b_u_sizes;
    int32_T c1_b_loop_ub;
    int32_T c1_i10;
    real_T c1_b_u_data[320];
    int32_T c1_d_i;
    const mxArray *c1_g_y = NULL;
    const mxArray *c1_h_y = NULL;
    boolean_T c1_b6;
    boolean_T c1_b7;
    boolean_T c1_b8;
    int32_T c1_i11;
    int32_T c1_i12;
    int32_T c1_c_u_sizes;
    int32_T c1_c_loop_ub;
    int32_T c1_i13;
    real_T c1_c_u_data[320];
    int32_T c1_i14;
    _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
    for (c1_i3 = 0; c1_i3 < 320; c1_i3++) {
      c1_b_u[c1_i3] = (*chartInstance->c1_u)[c1_i3];
    }
  
    _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 10U, 10U, c1_debug_family_names,
      c1_debug_family_var_map);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_pixelsFold, 0U, c1_c_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c1_remainder, 1U, c1_c_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML(&c1_sideThreshold, 2U, c1_c_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nextFold, 3U, c1_c_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_i, 4U, c1_c_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_endFold, 5U, c1_c_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargin, 6U, c1_c_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c1_nargout, 7U, c1_c_sf_marshallOut,
      c1_b_sf_marshallIn);
    _SFD_SYMBOL_SCOPE_ADD_EML(c1_b_u, 8U, c1_b_sf_marshallOut);
    _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c1_b_y, 9U, c1_sf_marshallOut,
      c1_sf_marshallIn);
    CV_EML_FCN(0, 0);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
    c1_pixelsFold = 2.0;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
    c1_remainder = 64.0;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 15);
    for (c1_i4 = 0; c1_i4 < 128; c1_i4++) {
      c1_b_y[c1_i4] = 0.0;
    }
  
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 16);
    c1_sideThreshold = 32.0;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 18);
    c1_nextFold = 1.0;
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 19);
    c1_i = 1.0;
    c1_b_i = 0;
    while (c1_b_i < 32) {
      c1_i = 1.0 + (real_T)c1_b_i;
      CV_EML_FOR(0, 1, 0, 1);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 20);
      c1_endFold = c1_nextFold + 2.0;
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 21);
      if (c1_nextFold <= 500.0) {
      } else {
        c1_c_y = NULL;
        sf_mex_assign(&c1_c_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                      false);
        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                          sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
          1U, 1U, 14, c1_c_y));
      }
  
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 22);
      if (c1_endFold <= 500.0) {
      } else {
        c1_d_y = NULL;
        sf_mex_assign(&c1_d_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                      false);
        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                          sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
          1U, 1U, 14, c1_d_y));
      }
  
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 23);
      c1_b0 = (c1_nextFold > c1_endFold);
      c1_b1 = c1_b0;
      c1_b2 = c1_b1;
      if (c1_b2) {
        c1_i5 = 1;
        c1_i6 = 0;
      } else {
        c1_i5 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
          chartInstance->S, 1U, 822, 19, MAX_uint32_T, (int32_T)c1_nextFold, 1,
          320);
        c1_i6 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
          chartInstance->S, 1U, 822, 19, MAX_uint32_T, (int32_T)c1_endFold, 1, 320);
      }
  
      c1_u_sizes = (c1_i6 - c1_i5) + 1;
      c1_loop_ub = c1_i6 - c1_i5;
      for (c1_i7 = 0; c1_i7 <= c1_loop_ub; c1_i7++) {
        c1_u_data[c1_i7] = c1_b_u[(c1_i5 + c1_i7) - 1];
      }
  
      c1_b_y[(int32_T)c1_i - 1] = c1_mean(chartInstance, c1_u_data, c1_u_sizes);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 24);
      c1_nextFold = c1_endFold + 1.0;
      c1_b_i++;
      _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
    }
  
    CV_EML_FOR(0, 1, 0, 0);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 27);
    c1_i = 33.0;
    c1_c_i = 0;
    while (c1_c_i < 64) {
      c1_i = 33.0 + (real_T)c1_c_i;
      CV_EML_FOR(0, 1, 1, 1);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 28);
      c1_endFold = (c1_nextFold + 2.0) - 1.0;
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 29);
      if (c1_nextFold <= 500.0) {
      } else {
        c1_e_y = NULL;
        sf_mex_assign(&c1_e_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                      false);
        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                          sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
          1U, 1U, 14, c1_e_y));
      }
  
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 30);
      if (c1_endFold <= 500.0) {
      } else {
        c1_f_y = NULL;
        sf_mex_assign(&c1_f_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                      false);
        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                          sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
          1U, 1U, 14, c1_f_y));
      }
  
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 31);
      c1_b3 = (c1_nextFold > c1_endFold);
      c1_b4 = c1_b3;
      c1_b5 = c1_b4;
      if (c1_b5) {
        c1_i8 = 1;
        c1_i9 = 0;
      } else {
        c1_i8 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
          chartInstance->S, 1U, 1021, 19, MAX_uint32_T, (int32_T)c1_nextFold, 1,
          320);
        c1_i9 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
          chartInstance->S, 1U, 1021, 19, MAX_uint32_T, (int32_T)c1_endFold, 1,
          320);
      }
  
      c1_b_u_sizes = (c1_i9 - c1_i8) + 1;
      c1_b_loop_ub = c1_i9 - c1_i8;
      for (c1_i10 = 0; c1_i10 <= c1_b_loop_ub; c1_i10++) {
        c1_b_u_data[c1_i10] = c1_b_u[(c1_i8 + c1_i10) - 1];
      }
  
      c1_b_y[(int32_T)c1_i - 1] = c1_mean(chartInstance, c1_b_u_data, c1_b_u_sizes);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 32);
      c1_nextFold = c1_endFold + 1.0;
      c1_c_i++;
      _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
    }
  
    CV_EML_FOR(0, 1, 1, 0);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 35);
    c1_i = 97.0;
    c1_d_i = 0;
    while (c1_d_i < 32) {
      c1_i = 97.0 + (real_T)c1_d_i;
      CV_EML_FOR(0, 1, 2, 1);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 36);
      c1_endFold = c1_nextFold + 2.0;
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 37);
      if (c1_nextFold <= 500.0) {
      } else {
        c1_g_y = NULL;
        sf_mex_assign(&c1_g_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                      false);
        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                          sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
          1U, 1U, 14, c1_g_y));
      }
  
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 38);
      if (c1_endFold <= 500.0) {
      } else {
        c1_h_y = NULL;
        sf_mex_assign(&c1_h_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 30),
                      false);
        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                          sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
          1U, 1U, 14, c1_h_y));
      }
  
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 39);
      c1_b6 = (c1_nextFold > c1_endFold);
      c1_b7 = c1_b6;
      c1_b8 = c1_b7;
      if (c1_b8) {
        c1_i11 = 1;
        c1_i12 = 0;
      } else {
        c1_i11 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
          chartInstance->S, 1U, 1208, 19, MAX_uint32_T, (int32_T)c1_nextFold, 1,
          320);
        c1_i12 = sf_eml_array_bounds_check(sfGlobalDebugInstanceStruct,
          chartInstance->S, 1U, 1208, 19, MAX_uint32_T, (int32_T)c1_endFold, 1,
          320);
      }
  
      c1_c_u_sizes = (c1_i12 - c1_i11) + 1;
      c1_c_loop_ub = c1_i12 - c1_i11;
      for (c1_i13 = 0; c1_i13 <= c1_c_loop_ub; c1_i13++) {
        c1_c_u_data[c1_i13] = c1_b_u[(c1_i11 + c1_i13) - 1];
      }
  
      c1_b_y[(int32_T)c1_i - 1] = c1_mean(chartInstance, c1_c_u_data, c1_c_u_sizes);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 40);
      c1_nextFold = c1_endFold + 1.0;
      c1_d_i++;
      _SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
    }
  
    CV_EML_FOR(0, 1, 2, 0);
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -40);
    _SFD_SYMBOL_SCOPE_POP();
    for (c1_i14 = 0; c1_i14 < 128; c1_i14++) {
      (*chartInstance->c1_y)[c1_i14] = c1_b_y[c1_i14];
    }
  
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  }
  
  static void initSimStructsc1_VrSubsystem(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    (void)chartInstance;
  }
  
  static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
    c1_chartNumber, uint32_T c1_instanceNumber)
  {
    (void)c1_machineNumber;
    (void)c1_chartNumber;
    (void)c1_instanceNumber;
  }
  
  static const mxArray *c1_sf_marshallOut(void *chartInstanceVoid, void *c1_inData)
  {
    const mxArray *c1_mxArrayOutData = NULL;
    int32_T c1_i15;
    real_T c1_b_u[128];
    const mxArray *c1_b_y = NULL;
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)chartInstanceVoid;
    c1_mxArrayOutData = NULL;
    for (c1_i15 = 0; c1_i15 < 128; c1_i15++) {
      c1_b_u[c1_i15] = (*(real_T (*)[128])c1_inData)[c1_i15];
    }
  
    c1_b_y = NULL;
    sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_b_u, 0, 0U, 1U, 0U, 2, 1, 128),
                  false);
    sf_mex_assign(&c1_mxArrayOutData, c1_b_y, false);
    return c1_mxArrayOutData;
  }
  
  static void c1_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct *chartInstance,
    const mxArray *c1_b_y, const char_T *c1_identifier, real_T c1_c_y[128])
  {
    emlrtMsgIdentifier c1_thisId;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_b_y), &c1_thisId, c1_c_y);
    sf_mex_destroy(&c1_b_y);
  }
  
  static void c1_b_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct *chartInstance,
    const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId, real_T c1_b_y
    [128])
  {
    real_T c1_dv1[128];
    int32_T c1_i16;
    (void)chartInstance;
    sf_mex_import(c1_parentId, sf_mex_dup(c1_b_u), c1_dv1, 1, 0, 0U, 1, 0U, 2, 1,
                  128);
    for (c1_i16 = 0; c1_i16 < 128; c1_i16++) {
      c1_b_y[c1_i16] = c1_dv1[c1_i16];
    }
  
    sf_mex_destroy(&c1_b_u);
  }
  
  static void c1_sf_marshallIn(void *chartInstanceVoid, const mxArray
    *c1_mxArrayInData, const char_T *c1_varName, void *c1_outData)
  {
    const mxArray *c1_b_y;
    const char_T *c1_identifier;
    emlrtMsgIdentifier c1_thisId;
    real_T c1_c_y[128];
    int32_T c1_i17;
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)chartInstanceVoid;
    c1_b_y = sf_mex_dup(c1_mxArrayInData);
    c1_identifier = c1_varName;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_b_y), &c1_thisId, c1_c_y);
    sf_mex_destroy(&c1_b_y);
    for (c1_i17 = 0; c1_i17 < 128; c1_i17++) {
      (*(real_T (*)[128])c1_outData)[c1_i17] = c1_c_y[c1_i17];
    }
  
    sf_mex_destroy(&c1_mxArrayInData);
  }
  
  static const mxArray *c1_b_sf_marshallOut(void *chartInstanceVoid, void
    *c1_inData)
  {
    const mxArray *c1_mxArrayOutData = NULL;
    int32_T c1_i18;
    real_T c1_b_u[320];
    const mxArray *c1_b_y = NULL;
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)chartInstanceVoid;
    c1_mxArrayOutData = NULL;
    for (c1_i18 = 0; c1_i18 < 320; c1_i18++) {
      c1_b_u[c1_i18] = (*(real_T (*)[320])c1_inData)[c1_i18];
    }
  
    c1_b_y = NULL;
    sf_mex_assign(&c1_b_y, sf_mex_create("y", c1_b_u, 0, 0U, 1U, 0U, 1, 320),
                  false);
    sf_mex_assign(&c1_mxArrayOutData, c1_b_y, false);
    return c1_mxArrayOutData;
  }
  
  static const mxArray *c1_c_sf_marshallOut(void *chartInstanceVoid, void
    *c1_inData)
  {
    const mxArray *c1_mxArrayOutData = NULL;
    real_T c1_b_u;
    const mxArray *c1_b_y = NULL;
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)chartInstanceVoid;
    c1_mxArrayOutData = NULL;
    c1_b_u = *(real_T *)c1_inData;
    c1_b_y = NULL;
    sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 0, 0U, 0U, 0U, 0), false);
    sf_mex_assign(&c1_mxArrayOutData, c1_b_y, false);
    return c1_mxArrayOutData;
  }
  
  static real_T c1_c_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId)
  {
    real_T c1_b_y;
    real_T c1_d0;
    (void)chartInstance;
    sf_mex_import(c1_parentId, sf_mex_dup(c1_b_u), &c1_d0, 1, 0, 0U, 0, 0U, 0);
    c1_b_y = c1_d0;
    sf_mex_destroy(&c1_b_u);
    return c1_b_y;
  }
  
  static void c1_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
    *c1_mxArrayInData, const char_T *c1_varName, void *c1_outData)
  {
    const mxArray *c1_nargout;
    const char_T *c1_identifier;
    emlrtMsgIdentifier c1_thisId;
    real_T c1_b_y;
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)chartInstanceVoid;
    c1_nargout = sf_mex_dup(c1_mxArrayInData);
    c1_identifier = c1_varName;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_b_y = c1_c_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_nargout),
      &c1_thisId);
    sf_mex_destroy(&c1_nargout);
    *(real_T *)c1_outData = c1_b_y;
    sf_mex_destroy(&c1_mxArrayInData);
  }
  
  const mxArray *sf_c1_VrSubsystem_get_eml_resolved_functions_info(void)
  {
    const mxArray *c1_nameCaptureInfo = NULL;
    c1_nameCaptureInfo = NULL;
    sf_mex_assign(&c1_nameCaptureInfo, sf_mex_create("nameCaptureInfo", NULL, 0,
      0U, 1U, 0U, 2, 0, 1), false);
    return c1_nameCaptureInfo;
  }
  
  static real_T c1_mean(SFc1_VrSubsystemInstanceStruct *chartInstance, real_T
                        c1_x_data[], int32_T c1_x_sizes)
  {
    boolean_T c1_b9;
    const mxArray *c1_c_y = NULL;
    static char_T c1_b_u[36] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l',
      'b', 'o', 'x', ':', 'a', 'u', 't', 'o', 'D', 'i', 'm', 'I', 'n', 'c', 'o',
      'm', 'p', 'a', 't', 'i', 'b', 'i', 'l', 'i', 't', 'y' };
  
    int32_T c1_b_x_sizes;
    int32_T c1_loop_ub;
    int32_T c1_i19;
    real_T c1_b_x_data[320];
    boolean_T c1_b10;
    const mxArray *c1_d_y = NULL;
    static char_T c1_c_u[37] = { 'C', 'o', 'd', 'e', 'r', ':', 't', 'o', 'o', 'l',
      'b', 'o', 'x', ':', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd',
      'S', 'p', 'e', 'c', 'i', 'a', 'l', 'E', 'm', 'p', 't', 'y' };
  
    int32_T c1_c_x_sizes;
    int32_T c1_b_loop_ub;
    int32_T c1_i20;
    real_T c1_c_x_data[320];
    boolean_T c1_b11;
    const mxArray *c1_e_y = NULL;
    real_T c1_f_y;
    int32_T c1_vlen;
    int32_T c1_b_vlen;
    int32_T c1_k;
    int32_T c1_b_k;
    real_T c1_x;
    real_T c1_g_y;
    real_T c1_b_x;
    real_T c1_h_y;
    boolean_T guard1 = false;
    guard1 = false;
    if (c1_x_sizes == 1) {
      guard1 = true;
    } else if ((real_T)c1_x_sizes != 1.0) {
      guard1 = true;
    } else {
      c1_b9 = false;
    }
  
    if (guard1 == true) {
      c1_b9 = true;
    }
  
    if (c1_b9) {
    } else {
      c1_c_y = NULL;
      sf_mex_assign(&c1_c_y, sf_mex_create("y", c1_b_u, 10, 0U, 1U, 0U, 2, 1, 36),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_c_y));
    }
  
    c1_b_x_sizes = c1_x_sizes;
    c1_loop_ub = c1_x_sizes - 1;
    for (c1_i19 = 0; c1_i19 <= c1_loop_ub; c1_i19++) {
      c1_b_x_data[c1_i19] = c1_x_data[c1_i19];
    }
  
    c1_b10 = !c1_isequal(chartInstance, c1_b_x_data, c1_b_x_sizes);
    if (c1_b10) {
    } else {
      c1_d_y = NULL;
      sf_mex_assign(&c1_d_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 37),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_d_y));
    }
  
    c1_c_x_sizes = c1_x_sizes;
    c1_b_loop_ub = c1_x_sizes - 1;
    for (c1_i20 = 0; c1_i20 <= c1_b_loop_ub; c1_i20++) {
      c1_c_x_data[c1_i20] = c1_x_data[c1_i20];
    }
  
    c1_b11 = !c1_isequal(chartInstance, c1_c_x_data, c1_c_x_sizes);
    if (c1_b11) {
    } else {
      c1_e_y = NULL;
      sf_mex_assign(&c1_e_y, sf_mex_create("y", c1_c_u, 10, 0U, 1U, 0U, 2, 1, 37),
                    false);
      sf_mex_call_debug(sfGlobalDebugInstanceStruct, "error", 0U, 1U, 14,
                        sf_mex_call_debug(sfGlobalDebugInstanceStruct, "message",
        1U, 1U, 14, c1_e_y));
    }
  
    if (c1_x_sizes == 0) {
      c1_f_y = 0.0;
    } else {
      c1_vlen = c1_x_sizes;
      c1_f_y = c1_x_data[0];
      c1_b_vlen = c1_vlen;
      for (c1_k = 2; c1_k <= c1_b_vlen; c1_k++) {
        c1_b_k = c1_k - 1;
        c1_f_y += c1_x_data[c1_b_k];
      }
    }
  
    c1_x = c1_f_y;
    c1_g_y = (real_T)c1_x_sizes;
    c1_b_x = c1_x;
    c1_h_y = c1_g_y;
    return c1_b_x / c1_h_y;
  }
  
  static boolean_T c1_isequal(SFc1_VrSubsystemInstanceStruct *chartInstance,
    real_T c1_varargin_1_data[], int32_T c1_varargin_1_sizes)
  {
    boolean_T c1_p;
    boolean_T c1_b_p;
    int32_T c1_k;
    real_T c1_b_k;
    real_T c1_d1;
    real_T c1_d2;
    boolean_T c1_b12;
    boolean_T c1_c_p;
    int32_T exitg1;
    (void)chartInstance;
    (void)c1_varargin_1_data;
    c1_p = false;
    c1_b_p = false;
    c1_k = 0;
    do {
      exitg1 = 0;
      if (c1_k < 2) {
        c1_b_k = 1.0 + (real_T)c1_k;
        c1_d1 = c1_b_k;
        if (c1_d1 <= 1.0) {
          c1_d2 = (real_T)c1_varargin_1_sizes;
        } else {
          c1_d2 = 1.0;
        }
  
        if (c1_d2 != 0.0) {
          exitg1 = 1;
        } else {
          c1_k++;
        }
      } else {
        c1_b_p = true;
        exitg1 = 1;
      }
    } while (exitg1 == 0);
  
    c1_b12 = c1_b_p;
    c1_c_p = c1_b12;
    if (!c1_c_p) {
    } else {
      c1_p = true;
    }
  
    return c1_p;
  }
  
  static const mxArray *c1_d_sf_marshallOut(void *chartInstanceVoid, void
    *c1_inData)
  {
    const mxArray *c1_mxArrayOutData = NULL;
    int32_T c1_b_u;
    const mxArray *c1_b_y = NULL;
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)chartInstanceVoid;
    c1_mxArrayOutData = NULL;
    c1_b_u = *(int32_T *)c1_inData;
    c1_b_y = NULL;
    sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_b_u, 6, 0U, 0U, 0U, 0), false);
    sf_mex_assign(&c1_mxArrayOutData, c1_b_y, false);
    return c1_mxArrayOutData;
  }
  
  static int32_T c1_d_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId)
  {
    int32_T c1_b_y;
    int32_T c1_i21;
    (void)chartInstance;
    sf_mex_import(c1_parentId, sf_mex_dup(c1_b_u), &c1_i21, 1, 6, 0U, 0, 0U, 0);
    c1_b_y = c1_i21;
    sf_mex_destroy(&c1_b_u);
    return c1_b_y;
  }
  
  static void c1_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
    *c1_mxArrayInData, const char_T *c1_varName, void *c1_outData)
  {
    const mxArray *c1_b_sfEvent;
    const char_T *c1_identifier;
    emlrtMsgIdentifier c1_thisId;
    int32_T c1_b_y;
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)chartInstanceVoid;
    c1_b_sfEvent = sf_mex_dup(c1_mxArrayInData);
    c1_identifier = c1_varName;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_b_y = c1_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_b_sfEvent),
      &c1_thisId);
    sf_mex_destroy(&c1_b_sfEvent);
    *(int32_T *)c1_outData = c1_b_y;
    sf_mex_destroy(&c1_mxArrayInData);
  }
  
  static uint8_T c1_e_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_is_active_c1_VrSubsystem, const char_T
    *c1_identifier)
  {
    uint8_T c1_b_y;
    emlrtMsgIdentifier c1_thisId;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_b_y = c1_f_emlrt_marshallIn(chartInstance, sf_mex_dup
      (c1_b_is_active_c1_VrSubsystem), &c1_thisId);
    sf_mex_destroy(&c1_b_is_active_c1_VrSubsystem);
    return c1_b_y;
  }
  
  static uint8_T c1_f_emlrt_marshallIn(SFc1_VrSubsystemInstanceStruct
    *chartInstance, const mxArray *c1_b_u, const emlrtMsgIdentifier *c1_parentId)
  {
    uint8_T c1_b_y;
    uint8_T c1_u0;
    (void)chartInstance;
    sf_mex_import(c1_parentId, sf_mex_dup(c1_b_u), &c1_u0, 1, 3, 0U, 0, 0U, 0);
    c1_b_y = c1_u0;
    sf_mex_destroy(&c1_b_u);
    return c1_b_y;
  }
  
  static void init_dsm_address_info(SFc1_VrSubsystemInstanceStruct *chartInstance)
  {
    (void)chartInstance;
  }
  
  static void init_simulink_io_address(SFc1_VrSubsystemInstanceStruct
    *chartInstance)
  {
    chartInstance->c1_u = (real_T (*)[320])ssGetInputPortSignal_wrapper
      (chartInstance->S, 0);
    chartInstance->c1_y = (real_T (*)[128])ssGetOutputPortSignal_wrapper
      (chartInstance->S, 1);
  }
  
  /* SFunction Glue Code */
  #ifdef utFree
  #undef utFree
  #endif
  
  #ifdef utMalloc
  #undef utMalloc
  #endif
  
  #ifdef __cplusplus
  
  extern "C" void *utMalloc(size_t size);
  extern "C" void utFree(void*);
  
  #else
  
  extern void *utMalloc(size_t size);
  extern void utFree(void*);
  
  #endif
  
  void sf_c1_VrSubsystem_get_check_sum(mxArray *plhs[])
  {
    ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(4036331601U);
    ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(66590081U);
    ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(790853425U);
    ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(2614827068U);
  }
  
  mxArray* sf_c1_VrSubsystem_get_post_codegen_info(void);
  mxArray *sf_c1_VrSubsystem_get_autoinheritance_info(void)
  {
    const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
      "outputs", "locals", "postCodegenInfo" };
  
    mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1, 1, sizeof
      (autoinheritanceFields)/sizeof(autoinheritanceFields[0]),
      autoinheritanceFields);
  
    {
      mxArray *mxChecksum = mxCreateString("FceNuf2pPHn7SDpRKhluOH");
      mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
    }
  
    {
      const char *dataFields[] = { "size", "type", "complexity" };
  
      mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,1,mxREAL);
        double *pr = mxGetPr(mxSize);
        pr[0] = (double)(320);
        mxSetField(mxData,0,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,0,"type",mxType);
      }
  
      mxSetField(mxData,0,"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)(1);
        pr[1] = (double)(128);
        mxSetField(mxData,0,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,0,"type",mxType);
      }
  
      mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
      mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
    }
  
    {
      mxSetField(mxAutoinheritanceInfo,0,"locals",mxCreateDoubleMatrix(0,0,mxREAL));
    }
  
    {
      mxArray* mxPostCodegenInfo = sf_c1_VrSubsystem_get_post_codegen_info();
      mxSetField(mxAutoinheritanceInfo,0,"postCodegenInfo",mxPostCodegenInfo);
    }
  
    return(mxAutoinheritanceInfo);
  }
  
  mxArray *sf_c1_VrSubsystem_third_party_uses_info(void)
  {
    mxArray * mxcell3p = mxCreateCellMatrix(1,0);
    return(mxcell3p);
  }
  
  mxArray *sf_c1_VrSubsystem_jit_fallback_info(void)
  {
    const char *infoFields[] = { "fallbackType", "fallbackReason",
      "hiddenFallbackType", "hiddenFallbackReason", "incompatibleSymbol" };
  
    mxArray *mxInfo = mxCreateStructMatrix(1, 1, 5, infoFields);
    mxArray *fallbackType = mxCreateString("pre");
    mxArray *fallbackReason = mxCreateString("hasBreakpoints");
    mxArray *hiddenFallbackType = mxCreateString("none");
    mxArray *hiddenFallbackReason = mxCreateString("");
    mxArray *incompatibleSymbol = mxCreateString("");
    mxSetField(mxInfo, 0, infoFields[0], fallbackType);
    mxSetField(mxInfo, 0, infoFields[1], fallbackReason);
    mxSetField(mxInfo, 0, infoFields[2], hiddenFallbackType);
    mxSetField(mxInfo, 0, infoFields[3], hiddenFallbackReason);
    mxSetField(mxInfo, 0, infoFields[4], incompatibleSymbol);
    return mxInfo;
  }
  
  mxArray *sf_c1_VrSubsystem_updateBuildInfo_args_info(void)
  {
    mxArray *mxBIArgs = mxCreateCellMatrix(1,0);
    return mxBIArgs;
  }
  
  mxArray* sf_c1_VrSubsystem_get_post_codegen_info(void)
  {
    const char* fieldNames[] = { "exportedFunctionsUsedByThisChart",
      "exportedFunctionsChecksum" };
  
    mwSize dims[2] = { 1, 1 };
  
    mxArray* mxPostCodegenInfo = mxCreateStructArray(2, dims, sizeof(fieldNames)/
      sizeof(fieldNames[0]), fieldNames);
  
    {
      mxArray* mxExportedFunctionsChecksum = mxCreateString("");
      mwSize exp_dims[2] = { 0, 1 };
  
      mxArray* mxExportedFunctionsUsedByThisChart = mxCreateCellArray(2, exp_dims);
      mxSetField(mxPostCodegenInfo, 0, "exportedFunctionsUsedByThisChart",
                 mxExportedFunctionsUsedByThisChart);
      mxSetField(mxPostCodegenInfo, 0, "exportedFunctionsChecksum",
                 mxExportedFunctionsChecksum);
    }
  
    return mxPostCodegenInfo;
  }
  
  static const mxArray *sf_get_sim_state_info_c1_VrSubsystem(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\"y\",},{M[8],M[0],T\"is_active_c1_VrSubsystem\",}}"
    };
  
    mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
    mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
    sf_c1_VrSubsystem_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_VrSubsystemInstanceStruct *chartInstance =
        (SFc1_VrSubsystemInstanceStruct *)sf_get_chart_instance_ptr(S);
      if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
        /* do this only if simulation is starting */
        {
          unsigned int chartAlreadyPresent;
          chartAlreadyPresent = sf_debug_initialize_chart
            (sfGlobalDebugInstanceStruct,
             _VrSubsystemMachineNumber_,
             1,
             1,
             1,
             0,
             2,
             0,
             0,
             0,
             0,
             0,
             &(chartInstance->chartNumber),
             &(chartInstance->instanceNumber),
             (void *)S);
  
          /* Each instance must initialize its own list of scripts */
          init_script_number_translation(_VrSubsystemMachineNumber_,
            chartInstance->chartNumber,chartInstance->instanceNumber);
          if (chartAlreadyPresent==0) {
            /* this is the first instance */
            sf_debug_set_chart_disable_implicit_casting
              (sfGlobalDebugInstanceStruct,_VrSubsystemMachineNumber_,
               chartInstance->chartNumber,1);
            sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
              _VrSubsystemMachineNumber_,
              chartInstance->chartNumber,
              0,
              0,
              0);
            _SFD_SET_DATA_PROPS(0,1,1,0,"u");
            _SFD_SET_DATA_PROPS(1,2,0,1,"y");
            _SFD_STATE_INFO(0,0,2);
            _SFD_CH_SUBSTATE_COUNT(0);
            _SFD_CH_SUBSTATE_DECOMP(0);
          }
  
          _SFD_CV_INIT_CHART(0,0,0,0);
  
          {
            _SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
          }
  
          _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
  
          /* Initialization of MATLAB Function Model Coverage */
          _SFD_CV_INIT_EML(0,1,1,0,0,0,0,0,3,0,0,0);
          _SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,1259);
          _SFD_CV_INIT_EML_FOR(0,1,0,696,718,873);
          _SFD_CV_INIT_EML_FOR(0,1,1,875,915,1072);
          _SFD_CV_INIT_EML_FOR(0,1,2,1074,1104,1259);
  
          {
            unsigned int dimVector[1];
            dimVector[0]= 320U;
            _SFD_SET_DATA_COMPILED_PROPS(0,SF_DOUBLE,1,&(dimVector[0]),0,0,0,0.0,
              1.0,0,0,(MexFcnForType)c1_b_sf_marshallOut,(MexInFcnForType)NULL);
          }
  
          {
            unsigned int dimVector[2];
            dimVector[0]= 1U;
            dimVector[1]= 128U;
            _SFD_SET_DATA_COMPILED_PROPS(1,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
              1.0,0,0,(MexFcnForType)c1_sf_marshallOut,(MexInFcnForType)
              c1_sf_marshallIn);
          }
        }
      } else {
        sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
          _VrSubsystemMachineNumber_,chartInstance->chartNumber,
          chartInstance->instanceNumber);
      }
    }
  }
  
  static void chart_debug_initialize_data_addresses(SimStruct *S)
  {
    if (!sim_mode_is_rtw_gen(S)) {
      SFc1_VrSubsystemInstanceStruct *chartInstance =
        (SFc1_VrSubsystemInstanceStruct *)sf_get_chart_instance_ptr(S);
      if (ssIsFirstInitCond(S)) {
        /* do this only if simulation is starting and after we know the addresses of all data */
        {
          _SFD_SET_DATA_VALUE_PTR(0U, *chartInstance->c1_u);
          _SFD_SET_DATA_VALUE_PTR(1U, *chartInstance->c1_y);
        }
      }
    }
  }
  
  static const char* sf_get_instance_specialization(void)
  {
    return "sLbJztDaZSgr50q2q21UEV";
  }
  
  static void sf_opaque_initialize_c1_VrSubsystem(void *chartInstanceVar)
  {
    chart_debug_initialization(((SFc1_VrSubsystemInstanceStruct*) chartInstanceVar)
      ->S,0);
    initialize_params_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*)
      chartInstanceVar);
    initialize_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*) chartInstanceVar);
  }
  
  static void sf_opaque_enable_c1_VrSubsystem(void *chartInstanceVar)
  {
    enable_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*) chartInstanceVar);
  }
  
  static void sf_opaque_disable_c1_VrSubsystem(void *chartInstanceVar)
  {
    disable_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*) chartInstanceVar);
  }
  
  static void sf_opaque_gateway_c1_VrSubsystem(void *chartInstanceVar)
  {
    sf_gateway_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*) chartInstanceVar);
  }
  
  static const mxArray* sf_opaque_get_sim_state_c1_VrSubsystem(SimStruct* S)
  {
    return get_sim_state_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct *)
      sf_get_chart_instance_ptr(S));     /* raw sim ctx */
  }
  
  static void sf_opaque_set_sim_state_c1_VrSubsystem(SimStruct* S, const mxArray
    *st)
  {
    set_sim_state_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*)
      sf_get_chart_instance_ptr(S), st);
  }
  
  static void sf_opaque_terminate_c1_VrSubsystem(void *chartInstanceVar)
  {
    if (chartInstanceVar!=NULL) {
      SimStruct *S = ((SFc1_VrSubsystemInstanceStruct*) chartInstanceVar)->S;
      if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
        sf_clear_rtw_identifier(S);
        unload_VrSubsystem_optimization_info();
      }
  
      finalize_c1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*) chartInstanceVar);
      utFree(chartInstanceVar);
      if (ssGetUserData(S)!= NULL) {
        sf_free_ChartRunTimeInfo(S);
      }
  
      ssSetUserData(S,NULL);
    }
  }
  
  static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
  {
    initSimStructsc1_VrSubsystem((SFc1_VrSubsystemInstanceStruct*)
      chartInstanceVar);
  }
  
  extern unsigned int sf_machine_global_initializer_called(void);
  static void mdlProcessParameters_c1_VrSubsystem(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_VrSubsystem((SFc1_VrSubsystemInstanceStruct*)
        sf_get_chart_instance_ptr(S));
    }
  }
  
  static void mdlSetWorkWidths_c1_VrSubsystem(SimStruct *S)
  {
    ssMdlUpdateIsEmpty(S, 1);
    if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
      mxArray *infoStruct = load_VrSubsystem_optimization_info();
      int_T chartIsInlinable =
        (int_T)sf_is_chart_inlinable(sf_get_instance_specialization(),infoStruct,1);
      ssSetStateflowIsInlinable(S,chartIsInlinable);
      ssSetRTWCG(S,1);
      ssSetEnableFcnIsTrivial(S,1);
      ssSetDisableFcnIsTrivial(S,1);
      ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop
        (sf_get_instance_specialization(),infoStruct,1,
         "gatewayCannotBeInlinedMultipleTimes"));
      sf_set_chart_accesses_machine_info(S, sf_get_instance_specialization(),
        infoStruct, 1);
      sf_update_buildInfo(sf_get_instance_specialization(),infoStruct,1);
      if (chartIsInlinable) {
        ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
        sf_mark_chart_expressionable_inputs(S,sf_get_instance_specialization(),
          infoStruct,1,1);
        sf_mark_chart_reusable_outputs(S,sf_get_instance_specialization(),
          infoStruct,1,1);
      }
  
      {
        unsigned int outPortIdx;
        for (outPortIdx=1; outPortIdx<=1; ++outPortIdx) {
          ssSetOutputPortOptimizeInIR(S, outPortIdx, 1U);
        }
      }
  
      {
        unsigned int inPortIdx;
        for (inPortIdx=0; inPortIdx < 1; ++inPortIdx) {
          ssSetInputPortOptimizeInIR(S, inPortIdx, 1U);
        }
      }
  
      sf_set_rtw_dwork_info(S,sf_get_instance_specialization(),infoStruct,1);
      ssSetHasSubFunctions(S,!(chartIsInlinable));
    } else {
    }
  
    ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
    ssSetChecksum0(S,(886237707U));
    ssSetChecksum1(S,(2201187493U));
    ssSetChecksum2(S,(3980027091U));
    ssSetChecksum3(S,(226916010U));
    ssSetmdlDerivatives(S, NULL);
    ssSetExplicitFCSSCtrl(S,1);
    ssSetStateSemanticsClassicAndSynchronous(S, true);
    ssSupportsMultipleExecInstances(S,1);
  }
  
  static void mdlRTW_c1_VrSubsystem(SimStruct *S)
  {
    if (sim_mode_is_rtw_gen(S)) {
      ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
    }
  }
  
  static void mdlStart_c1_VrSubsystem(SimStruct *S)
  {
    SFc1_VrSubsystemInstanceStruct *chartInstance;
    chartInstance = (SFc1_VrSubsystemInstanceStruct *)utMalloc(sizeof
      (SFc1_VrSubsystemInstanceStruct));
    if (chartInstance==NULL) {
      sf_mex_error_message("Could not allocate memory for chart instance.");
    }
  
    memset(chartInstance, 0, sizeof(SFc1_VrSubsystemInstanceStruct));
    chartInstance->chartInfo.chartInstance = chartInstance;
    chartInstance->chartInfo.isEMLChart = 1;
    chartInstance->chartInfo.chartInitialized = 0;
    chartInstance->chartInfo.sFunctionGateway = sf_opaque_gateway_c1_VrSubsystem;
    chartInstance->chartInfo.initializeChart = sf_opaque_initialize_c1_VrSubsystem;
    chartInstance->chartInfo.terminateChart = sf_opaque_terminate_c1_VrSubsystem;
    chartInstance->chartInfo.enableChart = sf_opaque_enable_c1_VrSubsystem;
    chartInstance->chartInfo.disableChart = sf_opaque_disable_c1_VrSubsystem;
    chartInstance->chartInfo.getSimState = sf_opaque_get_sim_state_c1_VrSubsystem;
    chartInstance->chartInfo.setSimState = sf_opaque_set_sim_state_c1_VrSubsystem;
    chartInstance->chartInfo.getSimStateInfo =
      sf_get_sim_state_info_c1_VrSubsystem;
    chartInstance->chartInfo.zeroCrossings = NULL;
    chartInstance->chartInfo.outputs = NULL;
    chartInstance->chartInfo.derivatives = NULL;
    chartInstance->chartInfo.mdlRTW = mdlRTW_c1_VrSubsystem;
    chartInstance->chartInfo.mdlStart = mdlStart_c1_VrSubsystem;
    chartInstance->chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c1_VrSubsystem;
    chartInstance->chartInfo.callGetHoverDataForMsg = NULL;
    chartInstance->chartInfo.extModeExec = NULL;
    chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
    chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
    chartInstance->chartInfo.storeCurrentConfiguration = NULL;
    chartInstance->chartInfo.callAtomicSubchartUserFcn = NULL;
    chartInstance->chartInfo.callAtomicSubchartAutoFcn = NULL;
    chartInstance->chartInfo.debugInstance = sfGlobalDebugInstanceStruct;
    chartInstance->S = S;
    sf_init_ChartRunTimeInfo(S, &(chartInstance->chartInfo), false, 0);
    init_dsm_address_info(chartInstance);
    init_simulink_io_address(chartInstance);
    if (!sim_mode_is_rtw_gen(S)) {
    }
  
    chart_debug_initialization(S,1);
    mdl_start_c1_VrSubsystem(chartInstance);
  }
  
  void c1_VrSubsystem_method_dispatcher(SimStruct *S, int_T method, void *data)
  {
    switch (method) {
     case SS_CALL_MDL_START:
      mdlStart_c1_VrSubsystem(S);
      break;
  
     case SS_CALL_MDL_SET_WORK_WIDTHS:
      mdlSetWorkWidths_c1_VrSubsystem(S);
      break;
  
     case SS_CALL_MDL_PROCESS_PARAMETERS:
      mdlProcessParameters_c1_VrSubsystem(S);
      break;
  
     default:
      /* Unhandled method */
      sf_mex_error_message("Stateflow Internal Error:\n"
                           "Error calling c1_VrSubsystem_method_dispatcher.\n"
                           "Can't handle method %d.\n", method);
      break;
    }
  }
  