text: /* Include files */
  
  #include "MON_sl_after_replacement3_sfun.h"
  #include "c1_MON_sl_after_replacement3.h"
  #define CHARTINSTANCE_CHARTNUMBER      (chartInstance->chartNumber)
  #define CHARTINSTANCE_INSTANCENUMBER   (chartInstance->instanceNumber)
  #include "MON_sl_after_replacement3_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)
  #define c1_IN_NO_ACTIVE_CHILD          ((uint8_T)0U)
  
  /* Variable Declarations */
  
  /* Variable Definitions */
  static real_T _sfTime_;
  
  /* Function Declarations */
  static void initialize_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void initialize_params_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void enable_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void disable_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void c1_update_debugger_state_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static const mxArray *get_sim_state_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void set_sim_state_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_st);
  static void c1_set_sim_state_side_effects_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void finalize_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void sf_gateway_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void mdl_start_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void initSimStructsc1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *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 int32_T c1_emlrt_marshallIn(SFc1_MON_sl_after_replacement3InstanceStruct *
    chartInstance, const mxArray *c1_b_sfEvent, const char_T *c1_identifier);
  static int32_T c1_b_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_u, const emlrtMsgIdentifier *c1_parentId);
  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 uint8_T c1_c_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_b_MANUAL, const char_T *c1_identifier);
  static uint8_T c1_d_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_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 const mxArray *c1_e_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_b_setSimStateSideEffectsInfo, const char_T *c1_identifier);
  static const mxArray *c1_f_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_u, const emlrtMsgIdentifier *c1_parentId);
  static const mxArray *sf_get_hover_data_for_msg
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, int32_T c1_ssid);
  static void c1_init_sf_message_store_memory
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  static void init_dsm_address_info(SFc1_MON_sl_after_replacement3InstanceStruct
    *chartInstance);
  static void init_simulink_io_address
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance);
  
  /* Function Definitions */
  static void initialize_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    if (sf_is_first_init_cond(chartInstance->S)) {
      initSimStructsc1_MON_sl_after_replacement3(chartInstance);
      chart_debug_initialize_data_addresses(chartInstance->S);
    }
  
    chartInstance->c1_sfEvent = CALL_EVENT;
    _sfTime_ = sf_get_time(chartInstance->S);
    chartInstance->c1_doSetSimStateSideEffects = 0U;
    chartInstance->c1_setSimStateSideEffectsInfo = NULL;
    chartInstance->c1_is_active_c1_MON_sl_after_replacement3 = 0U;
    if (!(sf_get_output_port_reusable(chartInstance->S, 1) != 0)) {
      *chartInstance->c1_r = 0;
      _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 1U, 0U,
                            chartInstance->c1_sfEvent, false);
    }
  }
  
  static void initialize_params_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    real_T c1_d0;
    real_T c1_d1;
    real_T c1_d2;
    real_T c1_d3;
    real_T c1_d4;
    real_T c1_d5;
    real_T c1_d6;
    sf_mex_import_named("MANUAL", sf_mex_get_sfun_param(chartInstance->S, 4, 0),
                        &c1_d0, 0, 0, 0U, 0, 0U, 0);
    chartInstance->c1_MANUAL = (uint8_T)c1_d0;
    sf_mex_import_named("LO", sf_mex_get_sfun_param(chartInstance->S, 3, 0),
                        &c1_d1, 0, 0, 0U, 0, 0U, 0);
    chartInstance->c1_LO = (uint8_T)c1_d1;
    sf_mex_import_named("MED", sf_mex_get_sfun_param(chartInstance->S, 6, 0),
                        &c1_d2, 0, 0, 0U, 0, 0U, 0);
    chartInstance->c1_MED = (uint8_T)c1_d2;
    sf_mex_import_named("MAX", sf_mex_get_sfun_param(chartInstance->S, 5, 0),
                        &c1_d3, 0, 0, 0U, 0, 0U, 0);
    chartInstance->c1_MAX = (uint8_T)c1_d3;
    sf_mex_import_named("BRAKE_PRESSURE_LO", sf_mex_get_sfun_param
                        (chartInstance->S, 0, 0), &c1_d4, 0, 0, 0U, 0, 0U, 0);
    chartInstance->c1_BRAKE_PRESSURE_LO = (int32_T)c1_d4;
    sf_mex_import_named("BRAKE_PRESSURE_MAX", sf_mex_get_sfun_param
                        (chartInstance->S, 1, 0), &c1_d5, 0, 0, 0U, 0, 0U, 0);
    chartInstance->c1_BRAKE_PRESSURE_MAX = (int32_T)c1_d5;
    sf_mex_import_named("BRAKE_PRESSURE_MED", sf_mex_get_sfun_param
                        (chartInstance->S, 2, 0), &c1_d6, 0, 0, 0U, 0, 0U, 0);
    chartInstance->c1_BRAKE_PRESSURE_MED = (int32_T)c1_d6;
  }
  
  static void enable_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    _sfTime_ = sf_get_time(chartInstance->S);
  }
  
  static void disable_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    _sfTime_ = sf_get_time(chartInstance->S);
  }
  
  static void c1_update_debugger_state_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    (void)chartInstance;
  }
  
  static const mxArray *get_sim_state_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    const mxArray *c1_st;
    const mxArray *c1_y = NULL;
    int32_T c1_hoistedGlobal;
    int32_T c1_u;
    const mxArray *c1_b_y = NULL;
    uint8_T c1_b_hoistedGlobal;
    uint8_T c1_b_u;
    const mxArray *c1_c_y = NULL;
    c1_st = NULL;
    c1_st = NULL;
    c1_y = NULL;
    sf_mex_assign(&c1_y, sf_mex_createcellmatrix(2, 1), false);
    c1_hoistedGlobal = *chartInstance->c1_r;
    c1_u = c1_hoistedGlobal;
    c1_b_y = NULL;
    sf_mex_assign(&c1_b_y, sf_mex_create("y", &c1_u, 6, 0U, 0U, 0U, 0), false);
    sf_mex_setcell(c1_y, 0, c1_b_y);
    c1_b_hoistedGlobal = chartInstance->c1_is_active_c1_MON_sl_after_replacement3;
    c1_b_u = c1_b_hoistedGlobal;
    c1_c_y = NULL;
    sf_mex_assign(&c1_c_y, sf_mex_create("y", &c1_b_u, 3, 0U, 0U, 0U, 0), false);
    sf_mex_setcell(c1_y, 1, c1_c_y);
    sf_mex_assign(&c1_st, c1_y, false);
    return c1_st;
  }
  
  static void set_sim_state_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_st)
  {
    const mxArray *c1_u;
    chartInstance->c1_doneDoubleBufferReInit = true;
    c1_u = sf_mex_dup(c1_st);
    *chartInstance->c1_r = c1_emlrt_marshallIn(chartInstance, sf_mex_dup
      (sf_mex_getcell("r", c1_u, 0)), "r");
    chartInstance->c1_is_active_c1_MON_sl_after_replacement3 =
      c1_c_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(
      "is_active_c1_MON_sl_after_replacement3", c1_u, 1)),
      "is_active_c1_MON_sl_after_replacement3");
    sf_mex_assign(&chartInstance->c1_setSimStateSideEffectsInfo,
                  c1_e_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(
      "setSimStateSideEffectsInfo", c1_u, 2)), "setSimStateSideEffectsInfo"), true);
    sf_mex_destroy(&c1_u);
    chartInstance->c1_doSetSimStateSideEffects = 1U;
    c1_update_debugger_state_c1_MON_sl_after_replacement3(chartInstance);
    sf_mex_destroy(&c1_st);
  }
  
  static void c1_set_sim_state_side_effects_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    if (chartInstance->c1_doSetSimStateSideEffects != 0) {
      chartInstance->c1_doSetSimStateSideEffects = 0U;
    }
  }
  
  static void finalize_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    sf_mex_destroy(&chartInstance->c1_setSimStateSideEffectsInfo);
  }
  
  static void sf_gateway_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    boolean_T c1_out;
    boolean_T c1_b_out;
    boolean_T c1_c_out;
    boolean_T guard1 = false;
    boolean_T guard2 = false;
    c1_set_sim_state_side_effects_c1_MON_sl_after_replacement3(chartInstance);
    _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
    _sfTime_ = sf_get_time(chartInstance->S);
    _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
    _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_pedal, 1U, 1U, 0U,
                          chartInstance->c1_sfEvent, false);
    _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_mode, 0U, 1U, 0U,
                          chartInstance->c1_sfEvent, false);
    chartInstance->c1_sfEvent = CALL_EVENT;
    _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 0U, chartInstance->c1_sfEvent);
    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 1U, chartInstance->c1_sfEvent);
    c1_out = (CV_TRANSITION_EVAL(1U, (int32_T)_SFD_CCP_CALL(1U, 0,
                CV_RELATIONAL_EVAL(5U, 1U, 0, (real_T)*chartInstance->c1_mode,
      (real_T)chartInstance->c1_LO, 0, 0U, *chartInstance->c1_mode ==
      chartInstance->c1_LO) != 0U, chartInstance->c1_sfEvent)) != 0);
    guard1 = false;
    guard2 = false;
    if (c1_out) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 1U, chartInstance->c1_sfEvent);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 3U, chartInstance->c1_sfEvent);
      *chartInstance->c1_r = chartInstance->c1_BRAKE_PRESSURE_LO;
      _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 3U,
                            chartInstance->c1_sfEvent, false);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 11U, chartInstance->c1_sfEvent);
      guard2 = true;
    } else {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 2U, chartInstance->c1_sfEvent);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 4U, chartInstance->c1_sfEvent);
      c1_b_out = (CV_TRANSITION_EVAL(4U, (int32_T)_SFD_CCP_CALL(4U, 0,
        CV_RELATIONAL_EVAL(5U, 4U, 0, (real_T)*chartInstance->c1_mode, (real_T)
                           chartInstance->c1_MED, 0, 0U, *chartInstance->c1_mode ==
                           chartInstance->c1_MED) != 0U, chartInstance->c1_sfEvent))
                  != 0);
      if (c1_b_out) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 4U, chartInstance->c1_sfEvent);
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 6U, chartInstance->c1_sfEvent);
        *chartInstance->c1_r = chartInstance->c1_BRAKE_PRESSURE_MED;
        _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 6U,
                              chartInstance->c1_sfEvent, false);
        guard2 = true;
      } else {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 5U, chartInstance->c1_sfEvent);
        _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG, 7U,
                     chartInstance->c1_sfEvent);
        c1_c_out = (CV_TRANSITION_EVAL(7U, (int32_T)_SFD_CCP_CALL(7U, 0,
          CV_RELATIONAL_EVAL(5U, 7U, 0, (real_T)*chartInstance->c1_mode, (real_T)
                             chartInstance->c1_MAX, 0, 0U, *chartInstance->c1_mode
                             == chartInstance->c1_MAX) != 0U,
          chartInstance->c1_sfEvent)) != 0);
        if (c1_c_out) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 7U, chartInstance->c1_sfEvent);
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 9U, chartInstance->c1_sfEvent);
          *chartInstance->c1_r = chartInstance->c1_BRAKE_PRESSURE_MAX;
          _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 9U,
                                chartInstance->c1_sfEvent, false);
          guard1 = true;
        } else {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 13U, chartInstance->c1_sfEvent);
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 8U, chartInstance->c1_sfEvent);
          *chartInstance->c1_r = *chartInstance->c1_pedal;
          _SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c1_r, 2U, 5U, 8U,
                                chartInstance->c1_sfEvent, false);
        }
      }
    }
  
    if (guard2 == true) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 10U, chartInstance->c1_sfEvent);
      guard1 = true;
    }
  
    if (guard1 == true) {
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 14U, chartInstance->c1_sfEvent);
    }
  
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG, 12U, chartInstance->c1_sfEvent);
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
    _SFD_SYMBOL_SCOPE_POP();
    _SFD_CHECK_FOR_STATE_INCONSISTENCY(_MON_sl_after_replacement3MachineNumber_,
      chartInstance->chartNumber, chartInstance->instanceNumber);
  }
  
  static void mdl_start_c1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    c1_init_sf_message_store_memory(chartInstance);
  }
  
  static void initSimStructsc1_MON_sl_after_replacement3
    (SFc1_MON_sl_after_replacement3InstanceStruct *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;
  }
  
  const mxArray *sf_c1_MON_sl_after_replacement3_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 const mxArray *c1_sf_marshallOut(void *chartInstanceVoid, void *c1_inData)
  {
    const mxArray *c1_mxArrayOutData = NULL;
    int32_T c1_u;
    const mxArray *c1_y = NULL;
    SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance;
    chartInstance = (SFc1_MON_sl_after_replacement3InstanceStruct *)
      chartInstanceVoid;
    c1_mxArrayOutData = NULL;
    c1_u = *(int32_T *)c1_inData;
    c1_y = NULL;
    sf_mex_assign(&c1_y, sf_mex_create("y", &c1_u, 6, 0U, 0U, 0U, 0), false);
    sf_mex_assign(&c1_mxArrayOutData, c1_y, false);
    return c1_mxArrayOutData;
  }
  
  static int32_T c1_emlrt_marshallIn(SFc1_MON_sl_after_replacement3InstanceStruct *
    chartInstance, const mxArray *c1_b_sfEvent, const char_T *c1_identifier)
  {
    int32_T c1_y;
    emlrtMsgIdentifier c1_thisId;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_y = c1_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_b_sfEvent),
      &c1_thisId);
    sf_mex_destroy(&c1_b_sfEvent);
    return c1_y;
  }
  
  static int32_T c1_b_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_u, const emlrtMsgIdentifier *c1_parentId)
  {
    int32_T c1_y;
    int32_T c1_i0;
    (void)chartInstance;
    sf_mex_import(c1_parentId, sf_mex_dup(c1_u), &c1_i0, 1, 6, 0U, 0, 0U, 0);
    c1_y = c1_i0;
    sf_mex_destroy(&c1_u);
    return c1_y;
  }
  
  static void c1_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_y;
    SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance;
    chartInstance = (SFc1_MON_sl_after_replacement3InstanceStruct *)
      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_y = c1_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_b_sfEvent),
      &c1_thisId);
    sf_mex_destroy(&c1_b_sfEvent);
    *(int32_T *)c1_outData = c1_y;
    sf_mex_destroy(&c1_mxArrayInData);
  }
  
  static const mxArray *c1_b_sf_marshallOut(void *chartInstanceVoid, void
    *c1_inData)
  {
    const mxArray *c1_mxArrayOutData = NULL;
    uint8_T c1_u;
    const mxArray *c1_y = NULL;
    SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance;
    chartInstance = (SFc1_MON_sl_after_replacement3InstanceStruct *)
      chartInstanceVoid;
    c1_mxArrayOutData = NULL;
    c1_u = *(uint8_T *)c1_inData;
    c1_y = NULL;
    sf_mex_assign(&c1_y, sf_mex_create("y", &c1_u, 3, 0U, 0U, 0U, 0), false);
    sf_mex_assign(&c1_mxArrayOutData, c1_y, false);
    return c1_mxArrayOutData;
  }
  
  static uint8_T c1_c_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_b_MANUAL, const char_T *c1_identifier)
  {
    uint8_T c1_y;
    emlrtMsgIdentifier c1_thisId;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_y = c1_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_b_MANUAL),
      &c1_thisId);
    sf_mex_destroy(&c1_b_MANUAL);
    return c1_y;
  }
  
  static uint8_T c1_d_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_u, const emlrtMsgIdentifier *c1_parentId)
  {
    uint8_T c1_y;
    uint8_T c1_u0;
    (void)chartInstance;
    sf_mex_import(c1_parentId, sf_mex_dup(c1_u), &c1_u0, 1, 3, 0U, 0, 0U, 0);
    c1_y = c1_u0;
    sf_mex_destroy(&c1_u);
    return c1_y;
  }
  
  static void c1_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
    *c1_mxArrayInData, const char_T *c1_varName, void *c1_outData)
  {
    const mxArray *c1_b_MANUAL;
    const char_T *c1_identifier;
    emlrtMsgIdentifier c1_thisId;
    uint8_T c1_y;
    SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance;
    chartInstance = (SFc1_MON_sl_after_replacement3InstanceStruct *)
      chartInstanceVoid;
    c1_b_MANUAL = sf_mex_dup(c1_mxArrayInData);
    c1_identifier = c1_varName;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    c1_y = c1_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c1_b_MANUAL),
      &c1_thisId);
    sf_mex_destroy(&c1_b_MANUAL);
    *(uint8_T *)c1_outData = c1_y;
    sf_mex_destroy(&c1_mxArrayInData);
  }
  
  static const mxArray *c1_e_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_b_setSimStateSideEffectsInfo, const char_T *c1_identifier)
  {
    const mxArray *c1_y = NULL;
    emlrtMsgIdentifier c1_thisId;
    c1_y = NULL;
    c1_thisId.fIdentifier = c1_identifier;
    c1_thisId.fParent = NULL;
    c1_thisId.bParentIsCell = false;
    sf_mex_assign(&c1_y, c1_f_emlrt_marshallIn(chartInstance, sf_mex_dup
      (c1_b_setSimStateSideEffectsInfo), &c1_thisId), false);
    sf_mex_destroy(&c1_b_setSimStateSideEffectsInfo);
    return c1_y;
  }
  
  static const mxArray *c1_f_emlrt_marshallIn
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, const mxArray
     *c1_u, const emlrtMsgIdentifier *c1_parentId)
  {
    const mxArray *c1_y = NULL;
    (void)chartInstance;
    (void)c1_parentId;
    c1_y = NULL;
    sf_mex_assign(&c1_y, sf_mex_duplicatearraysafe(&c1_u), false);
    sf_mex_destroy(&c1_u);
    return c1_y;
  }
  
  static const mxArray *sf_get_hover_data_for_msg
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance, int32_T c1_ssid)
  {
    (void)chartInstance;
    (void)c1_ssid;
    return NULL;
  }
  
  static void c1_init_sf_message_store_memory
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    (void)chartInstance;
  }
  
  static void init_dsm_address_info(SFc1_MON_sl_after_replacement3InstanceStruct
    *chartInstance)
  {
    (void)chartInstance;
  }
  
  static void init_simulink_io_address
    (SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance)
  {
    chartInstance->c1_mode = (int32_T *)ssGetInputPortSignal_wrapper
      (chartInstance->S, 0);
    chartInstance->c1_pedal = (int32_T *)ssGetInputPortSignal_wrapper
      (chartInstance->S, 1);
    chartInstance->c1_r = (int32_T *)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_MON_sl_after_replacement3_get_check_sum(mxArray *plhs[])
  {
    ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3008182396U);
    ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(3537031735U);
    ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1834105947U);
    ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(986031459U);
  }
  
  mxArray* sf_c1_MON_sl_after_replacement3_get_post_codegen_info(void);
  mxArray *sf_c1_MON_sl_after_replacement3_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("zvoJrMZ2TLHvPtz6zVPShE");
      mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
    }
  
    {
      const char *dataFields[] = { "size", "type", "complexity" };
  
      mxArray *mxData = mxCreateStructMatrix(1,2,3,dataFields);
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        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(8));
        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));
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        mxSetField(mxData,1,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(8));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,1,"type",mxType);
      }
  
      mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
      mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
    }
  
    {
      const char *dataFields[] = { "size", "type", "complexity" };
  
      mxArray *mxData = mxCreateStructMatrix(1,7,3,dataFields);
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        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(8));
        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));
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        mxSetField(mxData,1,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(8));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,1,"type",mxType);
      }
  
      mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        mxSetField(mxData,2,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(8));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,2,"type",mxType);
      }
  
      mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        mxSetField(mxData,3,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(3));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,3,"type",mxType);
      }
  
      mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0));
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        mxSetField(mxData,4,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(3));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,4,"type",mxType);
      }
  
      mxSetField(mxData,4,"complexity",mxCreateDoubleScalar(0));
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        mxSetField(mxData,5,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(3));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,5,"type",mxType);
      }
  
      mxSetField(mxData,5,"complexity",mxCreateDoubleScalar(0));
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        mxSetField(mxData,6,"size",mxSize);
      }
  
      {
        const char *typeFields[] = { "base", "fixpt", "isFixedPointType" };
  
        mxArray *mxType = mxCreateStructMatrix(1,1,sizeof(typeFields)/sizeof
          (typeFields[0]),typeFields);
        mxSetField(mxType,0,"base",mxCreateDoubleScalar(3));
        mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
        mxSetField(mxType,0,"isFixedPointType",mxCreateDoubleScalar(0));
        mxSetField(mxData,6,"type",mxType);
      }
  
      mxSetField(mxData,6,"complexity",mxCreateDoubleScalar(0));
      mxSetField(mxAutoinheritanceInfo,0,"parameters",mxData);
    }
  
    {
      const char *dataFields[] = { "size", "type", "complexity" };
  
      mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
  
      {
        mxArray *mxSize = mxCreateDoubleMatrix(1,0,mxREAL);
        double *pr = mxGetPr(mxSize);
        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(8));
        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_MON_sl_after_replacement3_get_post_codegen_info();
      mxSetField(mxAutoinheritanceInfo,0,"postCodegenInfo",mxPostCodegenInfo);
    }
  
    return(mxAutoinheritanceInfo);
  }
  
  mxArray *sf_c1_MON_sl_after_replacement3_third_party_uses_info(void)
  {
    mxArray * mxcell3p = mxCreateCellMatrix(1,0);
    return(mxcell3p);
  }
  
  mxArray *sf_c1_MON_sl_after_replacement3_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("forceDebug");
    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_MON_sl_after_replacement3_updateBuildInfo_args_info(void)
  {
    mxArray *mxBIArgs = mxCreateCellMatrix(1,0);
    return mxBIArgs;
  }
  
  mxArray* sf_c1_MON_sl_after_replacement3_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_MON_sl_after_replacement3(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[1780],T\"r\",},{M[8],M[0],T\"is_active_c1_MON_sl_after_replacement3\",}}"
    };
  
    mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
    mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
    sf_c1_MON_sl_after_replacement3_get_check_sum(&mxChecksum);
    mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
    mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
    return mxInfo;
  }
  
  static const mxArray* sf_opaque_get_hover_data_for_msg(void* chartInstance,
    int32_T msgSSID)
  {
    return sf_get_hover_data_for_msg
      ( (SFc1_MON_sl_after_replacement3InstanceStruct *) chartInstance, msgSSID);
  }
  
  static void chart_debug_initialization(SimStruct *S, unsigned int
    fullDebuggerInitialization)
  {
    if (!sim_mode_is_rtw_gen(S)) {
      SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance =
        (SFc1_MON_sl_after_replacement3InstanceStruct *)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,
             _MON_sl_after_replacement3MachineNumber_,
             1,
             0,
             15,
             0,
             10,
             0,
             0,
             0,
             0,
             0,
             &chartInstance->chartNumber,
             &chartInstance->instanceNumber,
             (void *)S);
  
          /* Each instance must initialize its own list of scripts */
          init_script_number_translation(_MON_sl_after_replacement3MachineNumber_,
            chartInstance->chartNumber,chartInstance->instanceNumber);
          if (chartAlreadyPresent==0) {
            /* this is the first instance */
            sf_debug_set_chart_disable_implicit_casting
              (sfGlobalDebugInstanceStruct,
               _MON_sl_after_replacement3MachineNumber_,chartInstance->chartNumber,
               1);
            sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
              _MON_sl_after_replacement3MachineNumber_,
              chartInstance->chartNumber,
              0,
              0,
              0);
            _SFD_SET_DATA_PROPS(0,1,1,0,"mode");
            _SFD_SET_DATA_PROPS(1,1,1,0,"pedal");
            _SFD_SET_DATA_PROPS(2,2,0,1,"r");
            _SFD_SET_DATA_PROPS(3,10,0,0,"BRAKE_PRESSURE_LO");
            _SFD_SET_DATA_PROPS(4,10,0,0,"BRAKE_PRESSURE_MAX");
            _SFD_SET_DATA_PROPS(5,10,0,0,"BRAKE_PRESSURE_MED");
            _SFD_SET_DATA_PROPS(6,10,0,0,"LO");
            _SFD_SET_DATA_PROPS(7,10,0,0,"MANUAL");
            _SFD_SET_DATA_PROPS(8,10,0,0,"MAX");
            _SFD_SET_DATA_PROPS(9,10,0,0,"MED");
            _SFD_CH_SUBSTATE_COUNT(0);
            _SFD_CH_SUBSTATE_DECOMP(0);
          }
  
          _SFD_CV_INIT_CHART(0,0,0,0);
          _SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
  
          {
            static unsigned int sStartGuardMap[] = { 1 };
  
            static unsigned int sEndGuardMap[] = { 11 };
  
            static int sPostFixPredicateTree[] = { 0 };
  
            _SFD_CV_INIT_TRANS(1,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,
                               &(sPostFixPredicateTree[0]));
          }
  
          {
            static unsigned int sStartRelationalopMap[] = { 1 };
  
            static unsigned int sEndRelationalopMap[] = { 11 };
  
            static int sRelationalopEps[] = { 0 };
  
            static int sRelationalopType[] = { 0, 0 };
  
            _SFD_CV_INIT_TRANSITION_RELATIONALOP(1,1,&(sStartRelationalopMap[0]),
              &(sEndRelationalopMap[0]),&(sRelationalopEps[0]),
              &(sRelationalopType[0]));
          }
  
          _SFD_CV_INIT_TRANS(2,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(3,0,NULL,NULL,0,NULL);
  
          {
            static unsigned int sStartGuardMap[] = { 1 };
  
            static unsigned int sEndGuardMap[] = { 12 };
  
            static int sPostFixPredicateTree[] = { 0 };
  
            _SFD_CV_INIT_TRANS(4,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,
                               &(sPostFixPredicateTree[0]));
          }
  
          {
            static unsigned int sStartRelationalopMap[] = { 1 };
  
            static unsigned int sEndRelationalopMap[] = { 12 };
  
            static int sRelationalopEps[] = { 0 };
  
            static int sRelationalopType[] = { 0, 0 };
  
            _SFD_CV_INIT_TRANSITION_RELATIONALOP(4,1,&(sStartRelationalopMap[0]),
              &(sEndRelationalopMap[0]),&(sRelationalopEps[0]),
              &(sRelationalopType[0]));
          }
  
          _SFD_CV_INIT_TRANS(5,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(6,0,NULL,NULL,0,NULL);
  
          {
            static unsigned int sStartGuardMap[] = { 1 };
  
            static unsigned int sEndGuardMap[] = { 12 };
  
            static int sPostFixPredicateTree[] = { 0 };
  
            _SFD_CV_INIT_TRANS(7,1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),1,
                               &(sPostFixPredicateTree[0]));
          }
  
          {
            static unsigned int sStartRelationalopMap[] = { 1 };
  
            static unsigned int sEndRelationalopMap[] = { 12 };
  
            static int sRelationalopEps[] = { 0 };
  
            static int sRelationalopType[] = { 0, 0 };
  
            _SFD_CV_INIT_TRANSITION_RELATIONALOP(7,1,&(sStartRelationalopMap[0]),
              &(sEndRelationalopMap[0]),&(sRelationalopEps[0]),
              &(sRelationalopType[0]));
          }
  
          _SFD_CV_INIT_TRANS(13,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(9,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(8,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(14,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(10,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(11,0,NULL,NULL,0,NULL);
          _SFD_CV_INIT_TRANS(12,0,NULL,NULL,0,NULL);
          _SFD_SET_DATA_COMPILED_PROPS(0,SF_INT32,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_sf_marshallOut,(MexInFcnForType)NULL);
          _SFD_SET_DATA_COMPILED_PROPS(1,SF_INT32,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_sf_marshallOut,(MexInFcnForType)NULL);
          _SFD_SET_DATA_COMPILED_PROPS(2,SF_INT32,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_sf_marshallOut,(MexInFcnForType)c1_sf_marshallIn);
          _SFD_SET_DATA_COMPILED_PROPS(3,SF_INT32,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_sf_marshallOut,(MexInFcnForType)c1_sf_marshallIn);
          _SFD_SET_DATA_COMPILED_PROPS(4,SF_INT32,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_sf_marshallOut,(MexInFcnForType)c1_sf_marshallIn);
          _SFD_SET_DATA_COMPILED_PROPS(5,SF_INT32,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_sf_marshallOut,(MexInFcnForType)c1_sf_marshallIn);
          _SFD_SET_DATA_COMPILED_PROPS(6,SF_UINT8,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_b_sf_marshallOut,(MexInFcnForType)c1_b_sf_marshallIn);
          _SFD_SET_DATA_COMPILED_PROPS(7,SF_UINT8,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_b_sf_marshallOut,(MexInFcnForType)c1_b_sf_marshallIn);
          _SFD_SET_DATA_COMPILED_PROPS(8,SF_UINT8,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_b_sf_marshallOut,(MexInFcnForType)c1_b_sf_marshallIn);
          _SFD_SET_DATA_COMPILED_PROPS(9,SF_UINT8,0,NULL,0,0,0,0.0,1.0,0,0,
            (MexFcnForType)c1_b_sf_marshallOut,(MexInFcnForType)c1_b_sf_marshallIn);
        }
      } else {
        sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
          _MON_sl_after_replacement3MachineNumber_,chartInstance->chartNumber,
          chartInstance->instanceNumber);
      }
    }
  }
  
  static void chart_debug_initialize_data_addresses(SimStruct *S)
  {
    if (!sim_mode_is_rtw_gen(S)) {
      SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance =
        (SFc1_MON_sl_after_replacement3InstanceStruct *)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_mode);
          _SFD_SET_DATA_VALUE_PTR(1U, chartInstance->c1_pedal);
          _SFD_SET_DATA_VALUE_PTR(2U, chartInstance->c1_r);
          _SFD_SET_DATA_VALUE_PTR(7U, &chartInstance->c1_MANUAL);
          _SFD_SET_DATA_VALUE_PTR(6U, &chartInstance->c1_LO);
          _SFD_SET_DATA_VALUE_PTR(9U, &chartInstance->c1_MED);
          _SFD_SET_DATA_VALUE_PTR(8U, &chartInstance->c1_MAX);
          _SFD_SET_DATA_VALUE_PTR(3U, &chartInstance->c1_BRAKE_PRESSURE_LO);
          _SFD_SET_DATA_VALUE_PTR(4U, &chartInstance->c1_BRAKE_PRESSURE_MAX);
          _SFD_SET_DATA_VALUE_PTR(5U, &chartInstance->c1_BRAKE_PRESSURE_MED);
        }
      }
    }
  }
  
  static const char* sf_get_instance_specialization(void)
  {
    return "sOXeDqPNwwgjYlTYNRLp3C";
  }
  
  static void sf_opaque_initialize_c1_MON_sl_after_replacement3(void
    *chartInstanceVar)
  {
    chart_debug_initialization(((SFc1_MON_sl_after_replacement3InstanceStruct*)
      chartInstanceVar)->S,0);
    initialize_params_c1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct*) chartInstanceVar);
    initialize_c1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct*) chartInstanceVar);
  }
  
  static void sf_opaque_enable_c1_MON_sl_after_replacement3(void *chartInstanceVar)
  {
    enable_c1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct*) chartInstanceVar);
  }
  
  static void sf_opaque_disable_c1_MON_sl_after_replacement3(void
    *chartInstanceVar)
  {
    disable_c1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct*) chartInstanceVar);
  }
  
  static void sf_opaque_gateway_c1_MON_sl_after_replacement3(void
    *chartInstanceVar)
  {
    sf_gateway_c1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct*) chartInstanceVar);
  }
  
  static const mxArray* sf_opaque_get_sim_state_c1_MON_sl_after_replacement3
    (SimStruct* S)
  {
    return get_sim_state_c1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct *)sf_get_chart_instance_ptr(S));/* raw sim ctx */
  }
  
  static void sf_opaque_set_sim_state_c1_MON_sl_after_replacement3(SimStruct* S,
    const mxArray *st)
  {
    set_sim_state_c1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct*)sf_get_chart_instance_ptr(S),
       st);
  }
  
  static void sf_opaque_terminate_c1_MON_sl_after_replacement3(void
    *chartInstanceVar)
  {
    if (chartInstanceVar!=NULL) {
      SimStruct *S = ((SFc1_MON_sl_after_replacement3InstanceStruct*)
                      chartInstanceVar)->S;
      if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
        sf_clear_rtw_identifier(S);
        unload_MON_sl_after_replacement3_optimization_info();
      }
  
      finalize_c1_MON_sl_after_replacement3
        ((SFc1_MON_sl_after_replacement3InstanceStruct*) chartInstanceVar);
      utFree(chartInstanceVar);
      if (ssGetUserData(S)!= NULL) {
        sf_free_ChartRunTimeInfo(S);
      }
  
      ssSetUserData(S,NULL);
    }
  }
  
  static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
  {
    initSimStructsc1_MON_sl_after_replacement3
      ((SFc1_MON_sl_after_replacement3InstanceStruct*) chartInstanceVar);
  }
  
  extern unsigned int sf_machine_global_initializer_called(void);
  static void mdlProcessParameters_c1_MON_sl_after_replacement3(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_MON_sl_after_replacement3
        ((SFc1_MON_sl_after_replacement3InstanceStruct*)sf_get_chart_instance_ptr
         (S));
    }
  }
  
  static void mdlSetWorkWidths_c1_MON_sl_after_replacement3(SimStruct *S)
  {
    /* Actual parameters from chart:
       BRAKE_PRESSURE_LO BRAKE_PRESSURE_MAX BRAKE_PRESSURE_MED LO MANUAL MAX MED
     */
    const char_T *rtParamNames[] = { "BRAKE_PRESSURE_LO", "BRAKE_PRESSURE_MAX",
      "BRAKE_PRESSURE_MED", "LO", "MANUAL", "MAX", "MED" };
  
    ssSetNumRunTimeParams(S,ssGetSFcnParamsCount(S));
  
    /* registration for BRAKE_PRESSURE_LO*/
    ssRegDlgParamAsRunTimeParam(S, 0, 0, rtParamNames[0], SS_INT32);
  
    /* registration for BRAKE_PRESSURE_MAX*/
    ssRegDlgParamAsRunTimeParam(S, 1, 1, rtParamNames[1], SS_INT32);
  
    /* registration for BRAKE_PRESSURE_MED*/
    ssRegDlgParamAsRunTimeParam(S, 2, 2, rtParamNames[2], SS_INT32);
  
    /* registration for LO*/
    ssRegDlgParamAsRunTimeParam(S, 3, 3, rtParamNames[3], SS_UINT8);
  
    /* registration for MANUAL*/
    ssRegDlgParamAsRunTimeParam(S, 4, 4, rtParamNames[4], SS_UINT8);
  
    /* registration for MAX*/
    ssRegDlgParamAsRunTimeParam(S, 5, 5, rtParamNames[5], SS_UINT8);
  
    /* registration for MED*/
    ssRegDlgParamAsRunTimeParam(S, 6, 6, rtParamNames[6], SS_UINT8);
    ssMdlUpdateIsEmpty(S, 1);
    if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
      mxArray *infoStruct = load_MON_sl_after_replacement3_optimization_info
        (sim_mode_is_rtw_gen(S), sim_mode_is_modelref_sim(S), sim_mode_is_external
         (S));
      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(S, sf_get_instance_specialization(),infoStruct,1);
      if (chartIsInlinable) {
        ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
        ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
        sf_mark_chart_expressionable_inputs(S,sf_get_instance_specialization(),
          infoStruct,1,2);
        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 < 2; ++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,(626213442U));
    ssSetChecksum1(S,(1109451330U));
    ssSetChecksum2(S,(1601872295U));
    ssSetChecksum3(S,(3799355706U));
    ssSetmdlDerivatives(S, NULL);
    ssSetExplicitFCSSCtrl(S,1);
    ssSupportsMultipleExecInstances(S,1);
  }
  
  static void mdlRTW_c1_MON_sl_after_replacement3(SimStruct *S)
  {
    if (sim_mode_is_rtw_gen(S)) {
      ssWriteRTWStrParam(S, "StateflowChartType", "Stateflow");
    }
  }
  
  static void mdlStart_c1_MON_sl_after_replacement3(SimStruct *S)
  {
    SFc1_MON_sl_after_replacement3InstanceStruct *chartInstance;
    chartInstance = (SFc1_MON_sl_after_replacement3InstanceStruct *)utMalloc
      (sizeof(SFc1_MON_sl_after_replacement3InstanceStruct));
    if (chartInstance==NULL) {
      sf_mex_error_message("Could not allocate memory for chart instance.");
    }
  
    memset(chartInstance, 0, sizeof(SFc1_MON_sl_after_replacement3InstanceStruct));
    chartInstance->chartInfo.chartInstance = chartInstance;
    chartInstance->chartInfo.isEMLChart = 0;
    chartInstance->chartInfo.chartInitialized = 0;
    chartInstance->chartInfo.sFunctionGateway =
      sf_opaque_gateway_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.initializeChart =
      sf_opaque_initialize_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.terminateChart =
      sf_opaque_terminate_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.enableChart =
      sf_opaque_enable_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.disableChart =
      sf_opaque_disable_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.getSimState =
      sf_opaque_get_sim_state_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.setSimState =
      sf_opaque_set_sim_state_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.getSimStateInfo =
      sf_get_sim_state_info_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.zeroCrossings = NULL;
    chartInstance->chartInfo.outputs = NULL;
    chartInstance->chartInfo.derivatives = NULL;
    chartInstance->chartInfo.mdlRTW = mdlRTW_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.mdlStart = mdlStart_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.mdlSetWorkWidths =
      mdlSetWorkWidths_c1_MON_sl_after_replacement3;
    chartInstance->chartInfo.callGetHoverDataForMsg =
      sf_opaque_get_hover_data_for_msg;
    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_MON_sl_after_replacement3(chartInstance);
  }
  
  void c1_MON_sl_after_replacement3_method_dispatcher(SimStruct *S, int_T method,
    void *data)
  {
    switch (method) {
     case SS_CALL_MDL_START:
      mdlStart_c1_MON_sl_after_replacement3(S);
      break;
  
     case SS_CALL_MDL_SET_WORK_WIDTHS:
      mdlSetWorkWidths_c1_MON_sl_after_replacement3(S);
      break;
  
     case SS_CALL_MDL_PROCESS_PARAMETERS:
      mdlProcessParameters_c1_MON_sl_after_replacement3(S);
      break;
  
     default:
      /* Unhandled method */
      sf_mex_error_message("Stateflow Internal Error:\n"
                           "Error calling c1_MON_sl_after_replacement3_method_dispatcher.\n"
                           "Can't handle method %d.\n", method);
      break;
    }
  }
  