/* Include files */

#include "double_new_moment_sfun.h"
#include "double_new_moment_sfun_debug_macros.h"
#include "c2_double_new_moment.h"
#include "c3_double_new_moment.h"
#include "c4_double_new_moment.h"

/* Type Definitions */

/* Named Constants */

/* Variable Declarations */

/* Variable Definitions */
uint32_T _double_new_momentMachineNumber_;

/* Function Declarations */

/* Function Definitions */
void double_new_moment_initializer(void)
{
}

void double_new_moment_terminator(void)
{
}

/* SFunction Glue Code */
unsigned int sf_double_new_moment_method_dispatcher(SimStruct *simstructPtr,
  unsigned int chartFileNumber, const char* specsCksum, int_T method, void *data)
{
  if (chartFileNumber==2) {
    c2_double_new_moment_method_dispatcher(simstructPtr, method, data);
    return 1;
  }

  if (chartFileNumber==3) {
    c3_double_new_moment_method_dispatcher(simstructPtr, method, data);
    return 1;
  }

  if (chartFileNumber==4) {
    c4_double_new_moment_method_dispatcher(simstructPtr, method, data);
    return 1;
  }

  return 0;
}

extern void sf_double_new_moment_uses_exported_functions(int nlhs, mxArray *
  plhs[], int nrhs, const mxArray * prhs[])
{
  plhs[0] = mxCreateLogicalScalar(0);
}

unsigned int sf_double_new_moment_process_testpoint_info_call( int nlhs, mxArray
  * plhs[], int nrhs, const mxArray * prhs[] )
{

#ifdef MATLAB_MEX_FILE

  char commandName[32];
  char machineName[128];
  if (nrhs < 3 || !mxIsChar(prhs[0]) || !mxIsChar(prhs[1]))
    return 0;

  /* Possible call to get testpoint info. */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  if (strcmp(commandName,"get_testpoint_info"))
    return 0;
  mxGetString(prhs[1], machineName, sizeof(machineName)/sizeof(char));
  machineName[(sizeof(machineName)/sizeof(char)-1)] = '\0';
  if (!strcmp(machineName, "double_new_moment")) {
    unsigned int chartFileNumber;
    chartFileNumber = (unsigned int)mxGetScalar(prhs[2]);
    switch (chartFileNumber) {
     case 2:
      {
        extern mxArray *sf_c2_double_new_moment_get_testpoint_info(void);
        plhs[0] = sf_c2_double_new_moment_get_testpoint_info();
        break;
      }

     case 3:
      {
        extern mxArray *sf_c3_double_new_moment_get_testpoint_info(void);
        plhs[0] = sf_c3_double_new_moment_get_testpoint_info();
        break;
      }

     case 4:
      {
        extern mxArray *sf_c4_double_new_moment_get_testpoint_info(void);
        plhs[0] = sf_c4_double_new_moment_get_testpoint_info();
        break;
      }

     default:
      plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
    }

    return 1;
  }

  return 0;

#else

  return 0;

#endif

}

unsigned int sf_double_new_moment_process_check_sum_call( int nlhs, mxArray *
  plhs[], int nrhs, const mxArray * prhs[] )
{

#ifdef MATLAB_MEX_FILE

  char commandName[20];
  if (nrhs<1 || !mxIsChar(prhs[0]) )
    return 0;

  /* Possible call to get the checksum */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  if (strcmp(commandName,"sf_get_check_sum"))
    return 0;
  plhs[0] = mxCreateDoubleMatrix( 1,4,mxREAL);
  if (nrhs>1 && mxIsChar(prhs[1])) {
    mxGetString(prhs[1], commandName,sizeof(commandName)/sizeof(char));
    commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
    if (!strcmp(commandName,"machine")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(1545062690U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(786428483U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(3617629116U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(2433674952U);
    } else if (!strcmp(commandName,"exportedFcn")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0U);
    } else if (nrhs==3 && !strcmp(commandName,"chart")) {
      unsigned int chartFileNumber;
      chartFileNumber = (unsigned int)mxGetScalar(prhs[2]);
      switch (chartFileNumber) {
       case 2:
        {
          extern void sf_c2_double_new_moment_get_check_sum(mxArray *plhs[]);
          sf_c2_double_new_moment_get_check_sum(plhs);
          break;
        }

       case 3:
        {
          extern void sf_c3_double_new_moment_get_check_sum(mxArray *plhs[]);
          sf_c3_double_new_moment_get_check_sum(plhs);
          break;
        }

       case 4:
        {
          extern void sf_c4_double_new_moment_get_check_sum(mxArray *plhs[]);
          sf_c4_double_new_moment_get_check_sum(plhs);
          break;
        }

       default:
        ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(0.0);
        ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(0.0);
        ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(0.0);
        ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(0.0);
      }
    } else if (!strcmp(commandName,"target")) {
      ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(3753949129U);
      ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1992807360U);
      ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(3452263806U);
      ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1297880015U);
    } else {
      return 0;
    }
  } else {
    ((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2896159050U);
    ((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(1161163824U);
    ((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1652575175U);
    ((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(1213343013U);
  }

  return 1;

#else

  return 0;

#endif

}

unsigned int sf_double_new_moment_autoinheritance_info( int nlhs, mxArray *
  plhs[], int nrhs, const mxArray * prhs[] )
{

#ifdef MATLAB_MEX_FILE

  char commandName[32];
  char aiChksum[64];
  if (nrhs<3 || !mxIsChar(prhs[0]) )
    return 0;

  /* Possible call to get the autoinheritance_info */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  if (strcmp(commandName,"get_autoinheritance_info"))
    return 0;
  mxGetString(prhs[2], aiChksum,sizeof(aiChksum)/sizeof(char));
  aiChksum[(sizeof(aiChksum)/sizeof(char)-1)] = '\0';

  {
    unsigned int chartFileNumber;
    chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
    switch (chartFileNumber) {
     case 2:
      {
        if (strcmp(aiChksum, "SH5zaDL2pGTKEknTYCn2IE") == 0) {
          extern mxArray *sf_c2_double_new_moment_get_autoinheritance_info(void);
          plhs[0] = sf_c2_double_new_moment_get_autoinheritance_info();
          break;
        }

        plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
        break;
      }

     case 3:
      {
        if (strcmp(aiChksum, "SSQ1o8wQ0RgpWkc8fBIOHE") == 0) {
          extern mxArray *sf_c3_double_new_moment_get_autoinheritance_info(void);
          plhs[0] = sf_c3_double_new_moment_get_autoinheritance_info();
          break;
        }

        plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
        break;
      }

     case 4:
      {
        if (strcmp(aiChksum, "nRBnSZaStvqswMhXxRm7KH") == 0) {
          extern mxArray *sf_c4_double_new_moment_get_autoinheritance_info(void);
          plhs[0] = sf_c4_double_new_moment_get_autoinheritance_info();
          break;
        }

        plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
        break;
      }

     default:
      plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
    }
  }

  return 1;

#else

  return 0;

#endif

}

unsigned int sf_double_new_moment_get_eml_resolved_functions_info( int nlhs,
  mxArray * plhs[], int nrhs, const mxArray * prhs[] )
{

#ifdef MATLAB_MEX_FILE

  char commandName[64];
  if (nrhs<2 || !mxIsChar(prhs[0]))
    return 0;

  /* Possible call to get the get_eml_resolved_functions_info */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  if (strcmp(commandName,"get_eml_resolved_functions_info"))
    return 0;

  {
    unsigned int chartFileNumber;
    chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
    switch (chartFileNumber) {
     case 2:
      {
        extern const mxArray
          *sf_c2_double_new_moment_get_eml_resolved_functions_info(void);
        mxArray *persistentMxArray = (mxArray *)
          sf_c2_double_new_moment_get_eml_resolved_functions_info();
        plhs[0] = mxDuplicateArray(persistentMxArray);
        mxDestroyArray(persistentMxArray);
        break;
      }

     case 3:
      {
        extern const mxArray
          *sf_c3_double_new_moment_get_eml_resolved_functions_info(void);
        mxArray *persistentMxArray = (mxArray *)
          sf_c3_double_new_moment_get_eml_resolved_functions_info();
        plhs[0] = mxDuplicateArray(persistentMxArray);
        mxDestroyArray(persistentMxArray);
        break;
      }

     case 4:
      {
        extern const mxArray
          *sf_c4_double_new_moment_get_eml_resolved_functions_info(void);
        mxArray *persistentMxArray = (mxArray *)
          sf_c4_double_new_moment_get_eml_resolved_functions_info();
        plhs[0] = mxDuplicateArray(persistentMxArray);
        mxDestroyArray(persistentMxArray);
        break;
      }

     default:
      plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
    }
  }

  return 1;

#else

  return 0;

#endif

}

unsigned int sf_double_new_moment_third_party_uses_info( int nlhs, mxArray *
  plhs[], int nrhs, const mxArray * prhs[] )
{
  char commandName[64];
  char tpChksum[64];
  if (nrhs<3 || !mxIsChar(prhs[0]))
    return 0;

  /* Possible call to get the third_party_uses_info */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  mxGetString(prhs[2], tpChksum,sizeof(tpChksum)/sizeof(char));
  tpChksum[(sizeof(tpChksum)/sizeof(char)-1)] = '\0';
  if (strcmp(commandName,"get_third_party_uses_info"))
    return 0;

  {
    unsigned int chartFileNumber;
    chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
    switch (chartFileNumber) {
     case 2:
      {
        if (strcmp(tpChksum, "svGXYZWIykKBgAsj7KpxAOD") == 0) {
          extern mxArray *sf_c2_double_new_moment_third_party_uses_info(void);
          plhs[0] = sf_c2_double_new_moment_third_party_uses_info();
          break;
        }
      }

     case 3:
      {
        if (strcmp(tpChksum, "sJZHHFEdkgRoBVmgO3V3x8G") == 0) {
          extern mxArray *sf_c3_double_new_moment_third_party_uses_info(void);
          plhs[0] = sf_c3_double_new_moment_third_party_uses_info();
          break;
        }
      }

     case 4:
      {
        if (strcmp(tpChksum, "shO87WLLl4eX9XpZzqd6xRD") == 0) {
          extern mxArray *sf_c4_double_new_moment_third_party_uses_info(void);
          plhs[0] = sf_c4_double_new_moment_third_party_uses_info();
          break;
        }
      }

     default:
      plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
    }
  }

  return 1;
}

unsigned int sf_double_new_moment_jit_fallback_info( int nlhs, mxArray * plhs[],
  int nrhs, const mxArray * prhs[] )
{
  char commandName[64];
  char tpChksum[64];
  if (nrhs<3 || !mxIsChar(prhs[0]))
    return 0;

  /* Possible call to get the jit_fallback_info */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  mxGetString(prhs[2], tpChksum,sizeof(tpChksum)/sizeof(char));
  tpChksum[(sizeof(tpChksum)/sizeof(char)-1)] = '\0';
  if (strcmp(commandName,"get_jit_fallback_info"))
    return 0;

  {
    unsigned int chartFileNumber;
    chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
    switch (chartFileNumber) {
     case 2:
      {
        if (strcmp(tpChksum, "svGXYZWIykKBgAsj7KpxAOD") == 0) {
          extern mxArray *sf_c2_double_new_moment_jit_fallback_info(void);
          plhs[0] = sf_c2_double_new_moment_jit_fallback_info();
          break;
        }
      }

     case 3:
      {
        if (strcmp(tpChksum, "sJZHHFEdkgRoBVmgO3V3x8G") == 0) {
          extern mxArray *sf_c3_double_new_moment_jit_fallback_info(void);
          plhs[0] = sf_c3_double_new_moment_jit_fallback_info();
          break;
        }
      }

     case 4:
      {
        if (strcmp(tpChksum, "shO87WLLl4eX9XpZzqd6xRD") == 0) {
          extern mxArray *sf_c4_double_new_moment_jit_fallback_info(void);
          plhs[0] = sf_c4_double_new_moment_jit_fallback_info();
          break;
        }
      }

     default:
      plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
    }
  }

  return 1;
}

unsigned int sf_double_new_moment_updateBuildInfo_args_info( int nlhs, mxArray *
  plhs[], int nrhs, const mxArray * prhs[] )
{
  char commandName[64];
  char tpChksum[64];
  if (nrhs<3 || !mxIsChar(prhs[0]))
    return 0;

  /* Possible call to get the updateBuildInfo_args_info */
  mxGetString(prhs[0], commandName,sizeof(commandName)/sizeof(char));
  commandName[(sizeof(commandName)/sizeof(char)-1)] = '\0';
  mxGetString(prhs[2], tpChksum,sizeof(tpChksum)/sizeof(char));
  tpChksum[(sizeof(tpChksum)/sizeof(char)-1)] = '\0';
  if (strcmp(commandName,"get_updateBuildInfo_args_info"))
    return 0;

  {
    unsigned int chartFileNumber;
    chartFileNumber = (unsigned int)mxGetScalar(prhs[1]);
    switch (chartFileNumber) {
     case 2:
      {
        if (strcmp(tpChksum, "svGXYZWIykKBgAsj7KpxAOD") == 0) {
          extern mxArray *sf_c2_double_new_moment_updateBuildInfo_args_info(void);
          plhs[0] = sf_c2_double_new_moment_updateBuildInfo_args_info();
          break;
        }
      }

     case 3:
      {
        if (strcmp(tpChksum, "sJZHHFEdkgRoBVmgO3V3x8G") == 0) {
          extern mxArray *sf_c3_double_new_moment_updateBuildInfo_args_info(void);
          plhs[0] = sf_c3_double_new_moment_updateBuildInfo_args_info();
          break;
        }
      }

     case 4:
      {
        if (strcmp(tpChksum, "shO87WLLl4eX9XpZzqd6xRD") == 0) {
          extern mxArray *sf_c4_double_new_moment_updateBuildInfo_args_info(void);
          plhs[0] = sf_c4_double_new_moment_updateBuildInfo_args_info();
          break;
        }
      }

     default:
      plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
    }
  }

  return 1;
}

void sf_double_new_moment_get_post_codegen_info( int nlhs, mxArray * plhs[], int
  nrhs, const mxArray * prhs[] )
{
  unsigned int chartFileNumber = (unsigned int) mxGetScalar(prhs[0]);
  char tpChksum[64];
  mxGetString(prhs[1], tpChksum,sizeof(tpChksum)/sizeof(char));
  tpChksum[(sizeof(tpChksum)/sizeof(char)-1)] = '\0';
  switch (chartFileNumber) {
   case 2:
    {
      if (strcmp(tpChksum, "svGXYZWIykKBgAsj7KpxAOD") == 0) {
        extern mxArray *sf_c2_double_new_moment_get_post_codegen_info(void);
        plhs[0] = sf_c2_double_new_moment_get_post_codegen_info();
        return;
      }
    }
    break;

   case 3:
    {
      if (strcmp(tpChksum, "sJZHHFEdkgRoBVmgO3V3x8G") == 0) {
        extern mxArray *sf_c3_double_new_moment_get_post_codegen_info(void);
        plhs[0] = sf_c3_double_new_moment_get_post_codegen_info();
        return;
      }
    }
    break;

   case 4:
    {
      if (strcmp(tpChksum, "shO87WLLl4eX9XpZzqd6xRD") == 0) {
        extern mxArray *sf_c4_double_new_moment_get_post_codegen_info(void);
        plhs[0] = sf_c4_double_new_moment_get_post_codegen_info();
        return;
      }
    }
    break;

   default:
    break;
  }

  plhs[0] = mxCreateDoubleMatrix(0,0,mxREAL);
}

void double_new_moment_debug_initialize(struct SfDebugInstanceStruct*
  debugInstance)
{
  _double_new_momentMachineNumber_ = sf_debug_initialize_machine(debugInstance,
    "double_new_moment","sfun",0,8,0,0,0);
  sf_debug_set_machine_event_thresholds(debugInstance,
    _double_new_momentMachineNumber_,0,0);
  sf_debug_set_machine_data_thresholds(debugInstance,
    _double_new_momentMachineNumber_,0);
}

void double_new_moment_register_exported_symbols(SimStruct* S)
{
}

static mxArray* sRtwOptimizationInfoStruct= NULL;
mxArray* load_double_new_moment_optimization_info(void)
{
  if (sRtwOptimizationInfoStruct==NULL) {
    sRtwOptimizationInfoStruct = sf_load_rtw_optimization_info(
      "double_new_moment", "double_new_moment");
    mexMakeArrayPersistent(sRtwOptimizationInfoStruct);
  }

  return(sRtwOptimizationInfoStruct);
}

void unload_double_new_moment_optimization_info(void)
{
  if (sRtwOptimizationInfoStruct!=NULL) {
    mxDestroyArray(sRtwOptimizationInfoStruct);
    sRtwOptimizationInfoStruct = NULL;
  }
}
