/*
 * _coder_MLS_applyDeform_mex.c
 *
 * Code generation for function '_coder_MLS_applyDeform_mex'
 *
 */

/* Include files */
#include "MLS_applyDeform.h"
#include "_coder_MLS_applyDeform_mex.h"
#include "MLS_applyDeform_terminate.h"
#include "_coder_MLS_applyDeform_api.h"
#include "MLS_applyDeform_initialize.h"
#include "MLS_applyDeform_data.h"

/* Function Declarations */
static void MLS_applyDeform_mexFunction(int32_T nlhs, mxArray *plhs[2], int32_T
  nrhs, const mxArray *prhs[4]);

/* Function Definitions */
static void MLS_applyDeform_mexFunction(int32_T nlhs, mxArray *plhs[2], int32_T
  nrhs, const mxArray *prhs[4])
{
  int32_T n;
  const mxArray *inputs[4];
  const mxArray *outputs[2];
  int32_T b_nlhs;
  emlrtStack st = { NULL,              /* site */
    NULL,                              /* tls */
    NULL                               /* prev */
  };

  st.tls = emlrtRootTLSGlobal;

  /* Check for proper number of arguments. */
  if (nrhs != 4) {
    emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:WrongNumberOfInputs", 5, 12, 4, 4,
                        15, "MLS_applyDeform");
  }

  if (nlhs > 2) {
    emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:TooManyOutputArguments", 3, 4, 15,
                        "MLS_applyDeform");
  }

  /* Temporary copy for mex inputs. */
  for (n = 0; n < nrhs; n++) {
    inputs[n] = prhs[n];
    if (*emlrtBreakCheckR2012bFlagVar != 0) {
      emlrtBreakCheckR2012b(&st);
    }
  }

  /* Call the function. */
  MLS_applyDeform_api(inputs, outputs);

  /* Copy over outputs to the caller. */
  if (nlhs < 1) {
    b_nlhs = 1;
  } else {
    b_nlhs = nlhs;
  }

  emlrtReturnArrays(b_nlhs, plhs, outputs);

  /* Module termination. */
  MLS_applyDeform_terminate();
}

void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  mexAtExit(MLS_applyDeform_atexit);

  /* Initialize the memory manager. */
  /* Module initialization. */
  MLS_applyDeform_initialize();

  /* Dispatch the entry-point. */
  MLS_applyDeform_mexFunction(nlhs, plhs, nrhs, prhs);
}

emlrtCTX mexFunctionCreateRootTLS(void)
{
  emlrtCreateRootTLS(&emlrtRootTLSGlobal, &emlrtContextGlobal, NULL, 1);
  return emlrtRootTLSGlobal;
}

/* End of code generation (_coder_MLS_applyDeform_mex.c) */
