/*
 * _coder_test_call_api.cpp
 *
 * Code generation for function '_coder_test_call_api'
 *
 */

/* Include files */
#include "rt_nonfinite.h"
#include "test_call.h"
#include "_coder_test_call_api.h"
#include "test_call_data.h"

/* Function Declarations */
static void b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
  emlrtMsgIdentifier *parentId, real32_T y[54]);
static void c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
  emlrtMsgIdentifier *msgId, real32_T ret[54]);
static void emlrt_marshallIn(const emlrtStack *sp, const mxArray *x, const
  char_T *identifier, real32_T y[54]);
static const mxArray *emlrt_marshallOut(const real32_T u[54]);

/* Function Definitions */
static void b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
  emlrtMsgIdentifier *parentId, real32_T y[54])
{
  c_emlrt_marshallIn(sp, emlrtAlias(u), parentId, y);
  emlrtDestroyArray(&u);
}

static void c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
  emlrtMsgIdentifier *msgId, real32_T ret[54])
{
  static const int32_T dims[1] = { 54 };

  emlrtCheckBuiltInR2012b(sp, (const emlrtMsgIdentifier *)msgId, src,
    "single|double", false, 1U, *(int32_T (*)[1])&dims[0]);
  emlrtImportArrayR2015b(sp, src, ret, 4, false);
  emlrtDestroyArray(&src);
}

static void emlrt_marshallIn(const emlrtStack *sp, const mxArray *x, const
  char_T *identifier, real32_T y[54])
{
  emlrtMsgIdentifier thisId;
  thisId.fIdentifier = const_cast<const char *>(identifier);
  thisId.fParent = NULL;
  thisId.bParentIsCell = false;
  b_emlrt_marshallIn(sp, emlrtAlias(x), &thisId, y);
  emlrtDestroyArray(&x);
}

static const mxArray *emlrt_marshallOut(const real32_T u[54])
{
  const mxArray *y;
  const mxArray *m0;
  static const int32_T iv0[1] = { 54 };

  real32_T *pData;
  int32_T i0;
  int32_T i;
  y = NULL;
  m0 = emlrtCreateNumericArray(1, iv0, mxSINGLE_CLASS, mxREAL);
  pData = (real32_T *)emlrtMxGetData(m0);
  i0 = 0;
  for (i = 0; i < 54; i++) {
    pData[i0] = u[i];
    i0++;
  }

  emlrtAssign(&y, m0);
  return y;
}

void test_call_api(const mxArray * const prhs[1], int32_T, const mxArray *plhs[1])
{
  real32_T x[54];
  real32_T y[54];
  emlrtStack st = { NULL,              /* site */
    NULL,                              /* tls */
    NULL                               /* prev */
  };

  st.tls = emlrtRootTLSGlobal;

  /* Marshall function inputs */
  emlrt_marshallIn(&st, emlrtAliasP(prhs[0]), "x", x);

  /* Invoke the target function */
  test_call(&st, x, y);

  /* Marshall function outputs */
  plhs[0] = emlrt_marshallOut(y);
}

/* End of code generation (_coder_test_call_api.cpp) */
