#ifdef MATLAB_MEX_FILE
#include <stdexcept>
#include <cmath>
#include<math.h>

inline double Power(double x, double y) { return pow(x, y); }
inline double Sqrt(double x) { return sqrt(x); }

inline double Abs(double x) { return fabs(x); }

inline double Exp(double x) { return exp(x); }
inline double Log(double x) { return log(x); }

inline double Sin(double x) { return sin(x); }
inline double Cos(double x) { return cos(x); }
inline double Tan(double x) { return tan(x); }

inline double ArcSin(double x) { return asin(x); }
inline double ArcCos(double x) { return acos(x); }
inline double ArcTan(double x) { return atan(x); }

inline double ArcTan(double x, double y) { return atan2(y,x); }

inline double Sinh(double x) { return sinh(x); }
inline double Cosh(double x) { return cosh(x); }
inline double Tanh(double x) { return tanh(x); }

const double E	= 2.71828182845904523536029;
const double Pi = 3.14159265358979323846264;
const double Degree = 0.01745329251994329576924;

inline double Sec(double x) { return 1/cos(x); }
inline double Csc(double x) { return 1/sin(x); }

#endif

static void output1(double *p_output1,const double *var1)
{
  double t18;
  double t1091;
  double t1227;
  double t1993;
  double t2140;
  double t161;
  double t447;
  double t2565;
  double t2762;
  double t2349;
  double t2916;
  double t2932;
  double t2937;
  double t2968;
  double t2969;
  double t2974;
  double t3014;
  double t3045;
  double t3081;
  double t3123;
  double t3385;
  double t3409;
  double t3474;
  double t3652;
  double t3709;
  double t3716;
  double t3810;
  double t4104;
  double t4438;
  double t4522;
  double t4614;
  double t4681;
  double t4688;
  double t4753;
  double t4777;
  double t4786;
  double t4813;
  double t4864;
  double t4872;
  double t4873;
  double t5025;
  double t5117;
  double t5150;
  double t5154;
  double t5183;
  double t5204;
  double t5316;
  double t5364;
  double t5403;
  double t5413;
  double t5481;
  double t5501;
  double t5504;
  double t5515;
  double t5527;
  double t5532;
  double t5557;
  double t5587;
  double t5599;
  double t5607;
  double t5635;
  double t5646;
  double t5648;
  double t2013;
  double t2147;
  double t2318;
  double t564;
  double t776;
  double t5787;
  double t2615;
  double t2618;
  double t2637;
  double t2650;
  double t5810;
  double t2807;
  double t2851;
  double t2885;
  double t5793;
  double t5820;
  double t5836;
  double t5843;
  double t5845;
  double t5852;
  double t2992;
  double t3027;
  double t3028;
  double t5906;
  double t5912;
  double t5933;
  double t3276;
  double t3279;
  double t3362;
  double t3784;
  double t4061;
  double t4077;
  double t5939;
  double t5940;
  double t5956;
  double t5996;
  double t5997;
  double t6000;
  double t4578;
  double t4602;
  double t4609;
  double t4810;
  double t4817;
  double t4844;
  double t6018;
  double t6020;
  double t6022;
  double t6036;
  double t6037;
  double t6054;
  double t4948;
  double t4952;
  double t5015;
  double t5276;
  double t5325;
  double t5363;
  double t6061;
  double t6062;
  double t6066;
  double t6090;
  double t6091;
  double t6096;
  double t5457;
  double t5459;
  double t5480;
  double t5554;
  double t5569;
  double t5585;
  double t6108;
  double t6115;
  double t6117;
  double t6136;
  double t6137;
  double t6142;
  double t5627;
  double t5630;
  double t5634;
  double t6147;
  double t6154;
  double t6169;
  double t6183;
  double t6187;
  double t6190;
  double t6330;
  double t6331;
  double t6333;
  double t6337;
  double t6361;
  double t6409;
  double t6414;
  double t6418;
  double t6436;
  double t6443;
  double t6457;
  double t6461;
  double t6544;
  double t6554;
  double t6564;
  double t6583;
  double t6594;
  double t6595;
  double t6630;
  double t6651;
  double t6664;
  double t6677;
  double t6699;
  double t6713;
  double t6737;
  double t6743;
  double t6750;
  double t6762;
  double t6767;
  double t6780;
  double t6788;
  double t6790;
  double t6832;
  double t6890;
  double t6891;
  double t6895;
  double t6908;
  double t6910;
  double t6915;
  t18 = Cos(var1[4]);
  t1091 = Cos(var1[14]);
  t1227 = -1.*t1091;
  t1993 = 1. + t1227;
  t2140 = Sin(var1[14]);
  t161 = Cos(var1[5]);
  t447 = Sin(var1[13]);
  t2565 = Cos(var1[13]);
  t2762 = Sin(var1[5]);
  t2349 = Sin(var1[4]);
  t2916 = t18*t161*t447;
  t2932 = t2565*t18*t2762;
  t2937 = t2916 + t2932;
  t2968 = Cos(var1[15]);
  t2969 = -1.*t2968;
  t2974 = 1. + t2969;
  t3014 = Sin(var1[15]);
  t3045 = t2565*t18*t161;
  t3081 = -1.*t18*t447*t2762;
  t3123 = t3045 + t3081;
  t3385 = -1.*t1091*t2349;
  t3409 = t2140*t2937;
  t3474 = t3385 + t3409;
  t3652 = Cos(var1[16]);
  t3709 = -1.*t3652;
  t3716 = 1. + t3709;
  t3810 = Sin(var1[16]);
  t4104 = t3014*t3123;
  t4438 = t2968*t3474;
  t4522 = t4104 + t4438;
  t4614 = t2968*t3123;
  t4681 = -1.*t3014*t3474;
  t4688 = t4614 + t4681;
  t4753 = Cos(var1[17]);
  t4777 = -1.*t4753;
  t4786 = 1. + t4777;
  t4813 = Sin(var1[17]);
  t4864 = -1.*t3810*t4522;
  t4872 = t3652*t4688;
  t4873 = t4864 + t4872;
  t5025 = t3652*t4522;
  t5117 = t3810*t4688;
  t5150 = t5025 + t5117;
  t5154 = Cos(var1[18]);
  t5183 = -1.*t5154;
  t5204 = 1. + t5183;
  t5316 = Sin(var1[18]);
  t5364 = t4813*t4873;
  t5403 = t4753*t5150;
  t5413 = t5364 + t5403;
  t5481 = t4753*t4873;
  t5501 = -1.*t4813*t5150;
  t5504 = t5481 + t5501;
  t5515 = Cos(var1[19]);
  t5527 = -1.*t5515;
  t5532 = 1. + t5527;
  t5557 = Sin(var1[19]);
  t5587 = -1.*t5316*t5413;
  t5599 = t5154*t5504;
  t5607 = t5587 + t5599;
  t5635 = t5154*t5413;
  t5646 = t5316*t5504;
  t5648 = t5635 + t5646;
  t2013 = -0.049*t1993;
  t2147 = -0.135*t2140;
  t2318 = 0. + t2013 + t2147;
  t564 = 0.135*t447;
  t776 = 0. + t564;
  t5787 = Cos(var1[3]);
  t2615 = -1.*t2565;
  t2618 = 1. + t2615;
  t2637 = -0.135*t2618;
  t2650 = 0. + t2637;
  t5810 = Sin(var1[3]);
  t2807 = -0.135*t1993;
  t2851 = 0.049*t2140;
  t2885 = 0. + t2807 + t2851;
  t5793 = t5787*t161*t2349;
  t5820 = t5810*t2762;
  t5836 = t5793 + t5820;
  t5843 = -1.*t161*t5810;
  t5845 = t5787*t2349*t2762;
  t5852 = t5843 + t5845;
  t2992 = -0.09*t2974;
  t3027 = 0.049*t3014;
  t3028 = 0. + t2992 + t3027;
  t5906 = t447*t5836;
  t5912 = t2565*t5852;
  t5933 = t5906 + t5912;
  t3276 = -0.049*t2974;
  t3279 = -0.09*t3014;
  t3362 = 0. + t3276 + t3279;
  t3784 = -0.049*t3716;
  t4061 = -0.21*t3810;
  t4077 = 0. + t3784 + t4061;
  t5939 = t2565*t5836;
  t5940 = -1.*t447*t5852;
  t5956 = t5939 + t5940;
  t5996 = t1091*t5787*t18;
  t5997 = t2140*t5933;
  t6000 = t5996 + t5997;
  t4578 = -0.21*t3716;
  t4602 = 0.049*t3810;
  t4609 = 0. + t4578 + t4602;
  t4810 = -0.2707*t4786;
  t4817 = 0.0016*t4813;
  t4844 = 0. + t4810 + t4817;
  t6018 = t3014*t5956;
  t6020 = t2968*t6000;
  t6022 = t6018 + t6020;
  t6036 = t2968*t5956;
  t6037 = -1.*t3014*t6000;
  t6054 = t6036 + t6037;
  t4948 = -0.0016*t4786;
  t4952 = -0.2707*t4813;
  t5015 = 0. + t4948 + t4952;
  t5276 = 0.0184*t5204;
  t5325 = -0.7055*t5316;
  t5363 = 0. + t5276 + t5325;
  t6061 = -1.*t3810*t6022;
  t6062 = t3652*t6054;
  t6066 = t6061 + t6062;
  t6090 = t3652*t6022;
  t6091 = t3810*t6054;
  t6096 = t6090 + t6091;
  t5457 = -0.7055*t5204;
  t5459 = -0.0184*t5316;
  t5480 = 0. + t5457 + t5459;
  t5554 = -1.1135*t5532;
  t5569 = 0.0216*t5557;
  t5585 = 0. + t5554 + t5569;
  t6108 = t4813*t6066;
  t6115 = t4753*t6096;
  t6117 = t6108 + t6115;
  t6136 = t4753*t6066;
  t6137 = -1.*t4813*t6096;
  t6142 = t6136 + t6137;
  t5627 = -0.0216*t5532;
  t5630 = -1.1135*t5557;
  t5634 = 0. + t5627 + t5630;
  t6147 = -1.*t5316*t6117;
  t6154 = t5154*t6142;
  t6169 = t6147 + t6154;
  t6183 = t5154*t6117;
  t6187 = t5316*t6142;
  t6190 = t6183 + t6187;
  t6330 = t161*t5810*t2349;
  t6331 = -1.*t5787*t2762;
  t6333 = t6330 + t6331;
  t6337 = t5787*t161;
  t6361 = t5810*t2349*t2762;
  t6409 = t6337 + t6361;
  t6414 = t447*t6333;
  t6418 = t2565*t6409;
  t6436 = t6414 + t6418;
  t6443 = t2565*t6333;
  t6457 = -1.*t447*t6409;
  t6461 = t6443 + t6457;
  t6544 = t1091*t18*t5810;
  t6554 = t2140*t6436;
  t6564 = t6544 + t6554;
  t6583 = t3014*t6461;
  t6594 = t2968*t6564;
  t6595 = t6583 + t6594;
  t6630 = t2968*t6461;
  t6651 = -1.*t3014*t6564;
  t6664 = t6630 + t6651;
  t6677 = -1.*t3810*t6595;
  t6699 = t3652*t6664;
  t6713 = t6677 + t6699;
  t6737 = t3652*t6595;
  t6743 = t3810*t6664;
  t6750 = t6737 + t6743;
  t6762 = t4813*t6713;
  t6767 = t4753*t6750;
  t6780 = t6762 + t6767;
  t6788 = t4753*t6713;
  t6790 = -1.*t4813*t6750;
  t6832 = t6788 + t6790;
  t6890 = -1.*t5316*t6780;
  t6891 = t5154*t6832;
  t6895 = t6890 + t6891;
  t6908 = t5154*t6780;
  t6910 = t5316*t6832;
  t6915 = t6908 + t6910;
  p_output1[0]=Sqrt(Power(0. + t2318*t2349 - 1.*t18*t2650*t2762 - 1.*t2885*t2937 + 0.1305*(t2140*t2349 + t1091*t2937) - 1.*t3028*t3123 - 1.*t3362*t3474 - 1.*t4077*t4522 - 1.*t4609*t4688 - 1.*t4844*t4873 - 1.*t5015*t5150 - 1.*t5363*t5413 - 1.*t5480*t5504 - 1.*t5585*t5607 - 1.*t5634*t5648 - 0.0306*(t5557*t5607 + t5515*t5648) + 1.1312*(t5515*t5607 - 1.*t5557*t5648) - 1.*t161*t18*t776,2) + Power(0. - 1.*t18*t2318*t5787 - 1.*t2650*t5852 - 1.*t2885*t5933 + 0.1305*(-1.*t18*t2140*t5787 + t1091*t5933) - 1.*t3028*t5956 - 1.*t3362*t6000 - 1.*t4077*t6022 - 1.*t4609*t6054 - 1.*t4844*t6066 - 1.*t5015*t6096 - 1.*t5363*t6117 - 1.*t5480*t6142 - 1.*t5585*t6169 - 1.*t5634*t6190 - 0.0306*(t5557*t6169 + t5515*t6190) + 1.1312*(t5515*t6169 - 1.*t5557*t6190) - 1.*t5836*t776,2) + Power(0. - 1.*t18*t2318*t5810 - 1.*t2650*t6409 - 1.*t2885*t6436 + 0.1305*(-1.*t18*t2140*t5810 + t1091*t6436) - 1.*t3028*t6461 - 1.*t3362*t6564 - 1.*t4077*t6595 - 1.*t4609*t6664 - 1.*t4844*t6713 - 1.*t5015*t6750 - 1.*t5363*t6780 - 1.*t5480*t6832 - 1.*t5585*t6895 - 1.*t5634*t6915 - 0.0306*(t5557*t6895 + t5515*t6915) + 1.1312*(t5515*t6895 - 1.*t5557*t6915) - 1.*t6333*t776,2));
}

#ifdef MATLAB_MEX_FILE

#include "mex.h"

void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  size_t mrows, ncols;

  double *var1;
  double *p_output1;

  if( nrhs != 1)
    {
      mexErrMsgIdAndTxt("MATLAB:MShaped:invalidNumInputs", "One input(s) required (var1).");
    }
  else if( nlhs > 1)
    {
      mexErrMsgIdAndTxt("MATLAB:MShaped:maxlhs", "Too many output arguments.");
    }

  mrows = mxGetM(prhs[0]);
  ncols = mxGetN(prhs[0]);
  if( !mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) ||
    ( !(mrows == 20 && ncols == 1) && 
      !(mrows == 1 && ncols == 20))) 
    {
      mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var1 is wrong.");
    }

  var1 = mxGetPr(prhs[0]);

  plhs[0] = mxCreateDoubleMatrix((mwSize) 1, (mwSize) 1, mxREAL);
  p_output1 = mxGetPr(plhs[0]);

  output1(p_output1,var1);

}

#else 

#include "distance_pelvis_to_stance_toe_RightStance.hh"

namespace RightStance
{

void distance_pelvis_to_stance_toe_RightStance_raw(double *p_output1, const double *var1)
{

  output1(p_output1, var1);

}

}

#endif
/*
 * Automatically Generated from Mathematica.
 * Thu 14 Oct 2021 09:54:23 GMT-04:00
 */

#ifdef MATLAB_MEX_FILE
#include <stdexcept>
#include <cmath>
#include<math.h>
/**
 * Copied from Wolfram Mathematica C Definitions file mdefs.hpp
 * Changed marcos to inline functions (Eric Cousineau)
 */
inline double Power(double x, double y) { return pow(x, y); }
inline double Sqrt(double x) { return sqrt(x); }

inline double Abs(double x) { return fabs(x); }

inline double Exp(double x) { return exp(x); }
inline double Log(double x) { return log(x); }

inline double Sin(double x) { return sin(x); }
inline double Cos(double x) { return cos(x); }
inline double Tan(double x) { return tan(x); }

inline double ArcSin(double x) { return asin(x); }
inline double ArcCos(double x) { return acos(x); }
inline double ArcTan(double x) { return atan(x); }

/* update ArcTan function to use atan2 instead. */
inline double ArcTan(double x, double y) { return atan2(y,x); }

inline double Sinh(double x) { return sinh(x); }
inline double Cosh(double x) { return cosh(x); }
inline double Tanh(double x) { return tanh(x); }

const double E	= 2.71828182845904523536029;
const double Pi = 3.14159265358979323846264;
const double Degree = 0.01745329251994329576924;

inline double Sec(double x) { return 1/cos(x); }
inline double Csc(double x) { return 1/sin(x); }

#endif

/*
 * Sub functions
 */
static void output1(double *p_output1,const double *var1)
{
  double t18;
  double t1091;
  double t1227;
  double t1993;
  double t2140;
  double t161;
  double t447;
  double t2565;
  double t2762;
  double t2349;
  double t2916;
  double t2932;
  double t2937;
  double t2968;
  double t2969;
  double t2974;
  double t3014;
  double t3045;
  double t3081;
  double t3123;
  double t3385;
  double t3409;
  double t3474;
  double t3652;
  double t3709;
  double t3716;
  double t3810;
  double t4104;
  double t4438;
  double t4522;
  double t4614;
  double t4681;
  double t4688;
  double t4753;
  double t4777;
  double t4786;
  double t4813;
  double t4864;
  double t4872;
  double t4873;
  double t5025;
  double t5117;
  double t5150;
  double t5154;
  double t5183;
  double t5204;
  double t5316;
  double t5364;
  double t5403;
  double t5413;
  double t5481;
  double t5501;
  double t5504;
  double t5515;
  double t5527;
  double t5532;
  double t5557;
  double t5587;
  double t5599;
  double t5607;
  double t5635;
  double t5646;
  double t5648;
  double t2013;
  double t2147;
  double t2318;
  double t564;
  double t776;
  double t5787;
  double t2615;
  double t2618;
  double t2637;
  double t2650;
  double t5810;
  double t2807;
  double t2851;
  double t2885;
  double t5793;
  double t5820;
  double t5836;
  double t5843;
  double t5845;
  double t5852;
  double t2992;
  double t3027;
  double t3028;
  double t5906;
  double t5912;
  double t5933;
  double t3276;
  double t3279;
  double t3362;
  double t3784;
  double t4061;
  double t4077;
  double t5939;
  double t5940;
  double t5956;
  double t5996;
  double t5997;
  double t6000;
  double t4578;
  double t4602;
  double t4609;
  double t4810;
  double t4817;
  double t4844;
  double t6018;
  double t6020;
  double t6022;
  double t6036;
  double t6037;
  double t6054;
  double t4948;
  double t4952;
  double t5015;
  double t5276;
  double t5325;
  double t5363;
  double t6061;
  double t6062;
  double t6066;
  double t6090;
  double t6091;
  double t6096;
  double t5457;
  double t5459;
  double t5480;
  double t5554;
  double t5569;
  double t5585;
  double t6108;
  double t6115;
  double t6117;
  double t6136;
  double t6137;
  double t6142;
  double t5627;
  double t5630;
  double t5634;
  double t6147;
  double t6154;
  double t6169;
  double t6183;
  double t6187;
  double t6190;
  double t6330;
  double t6331;
  double t6333;
  double t6337;
  double t6361;
  double t6409;
  double t6414;
  double t6418;
  double t6436;
  double t6443;
  double t6457;
  double t6461;
  double t6544;
  double t6554;
  double t6564;
  double t6583;
  double t6594;
  double t6595;
  double t6630;
  double t6651;
  double t6664;
  double t6677;
  double t6699;
  double t6713;
  double t6737;
  double t6743;
  double t6750;
  double t6762;
  double t6767;
  double t6780;
  double t6788;
  double t6790;
  double t6832;
  double t6890;
  double t6891;
  double t6895;
  double t6908;
  double t6910;
  double t6915;
  t18 = Cos(var1[4]);
  t1091 = Cos(var1[14]);
  t1227 = -1.*t1091;
  t1993 = 1. + t1227;
  t2140 = Sin(var1[14]);
  t161 = Cos(var1[5]);
  t447 = Sin(var1[13]);
  t2565 = Cos(var1[13]);
  t2762 = Sin(var1[5]);
  t2349 = Sin(var1[4]);
  t2916 = t18*t161*t447;
  t2932 = t2565*t18*t2762;
  t2937 = t2916 + t2932;
  t2968 = Cos(var1[15]);
  t2969 = -1.*t2968;
  t2974 = 1. + t2969;
  t3014 = Sin(var1[15]);
  t3045 = t2565*t18*t161;
  t3081 = -1.*t18*t447*t2762;
  t3123 = t3045 + t3081;
  t3385 = -1.*t1091*t2349;
  t3409 = t2140*t2937;
  t3474 = t3385 + t3409;
  t3652 = Cos(var1[16]);
  t3709 = -1.*t3652;
  t3716 = 1. + t3709;
  t3810 = Sin(var1[16]);
  t4104 = t3014*t3123;
  t4438 = t2968*t3474;
  t4522 = t4104 + t4438;
  t4614 = t2968*t3123;
  t4681 = -1.*t3014*t3474;
  t4688 = t4614 + t4681;
  t4753 = Cos(var1[17]);
  t4777 = -1.*t4753;
  t4786 = 1. + t4777;
  t4813 = Sin(var1[17]);
  t4864 = -1.*t3810*t4522;
  t4872 = t3652*t4688;
  t4873 = t4864 + t4872;
  t5025 = t3652*t4522;
  t5117 = t3810*t4688;
  t5150 = t5025 + t5117;
  t5154 = Cos(var1[18]);
  t5183 = -1.*t5154;
  t5204 = 1. + t5183;
  t5316 = Sin(var1[18]);
  t5364 = t4813*t4873;
  t5403 = t4753*t5150;
  t5413 = t5364 + t5403;
  t5481 = t4753*t4873;
  t5501 = -1.*t4813*t5150;
  t5504 = t5481 + t5501;
  t5515 = Cos(var1[19]);
  t5527 = -1.*t5515;
  t5532 = 1. + t5527;
  t5557 = Sin(var1[19]);
  t5587 = -1.*t5316*t5413;
  t5599 = t5154*t5504;
  t5607 = t5587 + t5599;
  t5635 = t5154*t5413;
  t5646 = t5316*t5504;
  t5648 = t5635 + t5646;
  t2013 = -0.049*t1993;
  t2147 = -0.135*t2140;
  t2318 = 0. + t2013 + t2147;
  t564 = 0.135*t447;
  t776 = 0. + t564;
  t5787 = Cos(var1[3]);
  t2615 = -1.*t2565;
  t2618 = 1. + t2615;
  t2637 = -0.135*t2618;
  t2650 = 0. + t2637;
  t5810 = Sin(var1[3]);
  t2807 = -0.135*t1993;
  t2851 = 0.049*t2140;
  t2885 = 0. + t2807 + t2851;
  t5793 = t5787*t161*t2349;
  t5820 = t5810*t2762;
  t5836 = t5793 + t5820;
  t5843 = -1.*t161*t5810;
  t5845 = t5787*t2349*t2762;
  t5852 = t5843 + t5845;
  t2992 = -0.09*t2974;
  t3027 = 0.049*t3014;
  t3028 = 0. + t2992 + t3027;
  t5906 = t447*t5836;
  t5912 = t2565*t5852;
  t5933 = t5906 + t5912;
  t3276 = -0.049*t2974;
  t3279 = -0.09*t3014;
  t3362 = 0. + t3276 + t3279;
  t3784 = -0.049*t3716;
  t4061 = -0.21*t3810;
  t4077 = 0. + t3784 + t4061;
  t5939 = t2565*t5836;
  t5940 = -1.*t447*t5852;
  t5956 = t5939 + t5940;
  t5996 = t1091*t5787*t18;
  t5997 = t2140*t5933;
  t6000 = t5996 + t5997;
  t4578 = -0.21*t3716;
  t4602 = 0.049*t3810;
  t4609 = 0. + t4578 + t4602;
  t4810 = -0.2707*t4786;
  t4817 = 0.0016*t4813;
  t4844 = 0. + t4810 + t4817;
  t6018 = t3014*t5956;
  t6020 = t2968*t6000;
  t6022 = t6018 + t6020;
  t6036 = t2968*t5956;
  t6037 = -1.*t3014*t6000;
  t6054 = t6036 + t6037;
  t4948 = -0.0016*t4786;
  t4952 = -0.2707*t4813;
  t5015 = 0. + t4948 + t4952;
  t5276 = 0.0184*t5204;
  t5325 = -0.7055*t5316;
  t5363 = 0. + t5276 + t5325;
  t6061 = -1.*t3810*t6022;
  t6062 = t3652*t6054;
  t6066 = t6061 + t6062;
  t6090 = t3652*t6022;
  t6091 = t3810*t6054;
  t6096 = t6090 + t6091;
  t5457 = -0.7055*t5204;
  t5459 = -0.0184*t5316;
  t5480 = 0. + t5457 + t5459;
  t5554 = -1.1135*t5532;
  t5569 = 0.0216*t5557;
  t5585 = 0. + t5554 + t5569;
  t6108 = t4813*t6066;
  t6115 = t4753*t6096;
  t6117 = t6108 + t6115;
  t6136 = t4753*t6066;
  t6137 = -1.*t4813*t6096;
  t6142 = t6136 + t6137;
  t5627 = -0.0216*t5532;
  t5630 = -1.1135*t5557;
  t5634 = 0. + t5627 + t5630;
  t6147 = -1.*t5316*t6117;
  t6154 = t5154*t6142;
  t6169 = t6147 + t6154;
  t6183 = t5154*t6117;
  t6187 = t5316*t6142;
  t6190 = t6183 + t6187;
  t6330 = t161*t5810*t2349;
  t6331 = -1.*t5787*t2762;
  t6333 = t6330 + t6331;
  t6337 = t5787*t161;
  t6361 = t5810*t2349*t2762;
  t6409 = t6337 + t6361;
  t6414 = t447*t6333;
  t6418 = t2565*t6409;
  t6436 = t6414 + t6418;
  t6443 = t2565*t6333;
  t6457 = -1.*t447*t6409;
  t6461 = t6443 + t6457;
  t6544 = t1091*t18*t5810;
  t6554 = t2140*t6436;
  t6564 = t6544 + t6554;
  t6583 = t3014*t6461;
  t6594 = t2968*t6564;
  t6595 = t6583 + t6594;
  t6630 = t2968*t6461;
  t6651 = -1.*t3014*t6564;
  t6664 = t6630 + t6651;
  t6677 = -1.*t3810*t6595;
  t6699 = t3652*t6664;
  t6713 = t6677 + t6699;
  t6737 = t3652*t6595;
  t6743 = t3810*t6664;
  t6750 = t6737 + t6743;
  t6762 = t4813*t6713;
  t6767 = t4753*t6750;
  t6780 = t6762 + t6767;
  t6788 = t4753*t6713;
  t6790 = -1.*t4813*t6750;
  t6832 = t6788 + t6790;
  t6890 = -1.*t5316*t6780;
  t6891 = t5154*t6832;
  t6895 = t6890 + t6891;
  t6908 = t5154*t6780;
  t6910 = t5316*t6832;
  t6915 = t6908 + t6910;
  p_output1[0]=Sqrt(Power(0. + t2318*t2349 - 1.*t18*t2650*t2762 - 1.*t2885*t2937 + 0.1305*(t2140*t2349 + t1091*t2937) - 1.*t3028*t3123 - 1.*t3362*t3474 - 1.*t4077*t4522 - 1.*t4609*t4688 - 1.*t4844*t4873 - 1.*t5015*t5150 - 1.*t5363*t5413 - 1.*t5480*t5504 - 1.*t5585*t5607 - 1.*t5634*t5648 - 0.0306*(t5557*t5607 + t5515*t5648) + 1.1312*(t5515*t5607 - 1.*t5557*t5648) - 1.*t161*t18*t776,2) + Power(0. - 1.*t18*t2318*t5787 - 1.*t2650*t5852 - 1.*t2885*t5933 + 0.1305*(-1.*t18*t2140*t5787 + t1091*t5933) - 1.*t3028*t5956 - 1.*t3362*t6000 - 1.*t4077*t6022 - 1.*t4609*t6054 - 1.*t4844*t6066 - 1.*t5015*t6096 - 1.*t5363*t6117 - 1.*t5480*t6142 - 1.*t5585*t6169 - 1.*t5634*t6190 - 0.0306*(t5557*t6169 + t5515*t6190) + 1.1312*(t5515*t6169 - 1.*t5557*t6190) - 1.*t5836*t776,2) + Power(0. - 1.*t18*t2318*t5810 - 1.*t2650*t6409 - 1.*t2885*t6436 + 0.1305*(-1.*t18*t2140*t5810 + t1091*t6436) - 1.*t3028*t6461 - 1.*t3362*t6564 - 1.*t4077*t6595 - 1.*t4609*t6664 - 1.*t4844*t6713 - 1.*t5015*t6750 - 1.*t5363*t6780 - 1.*t5480*t6832 - 1.*t5585*t6895 - 1.*t5634*t6915 - 0.0306*(t5557*t6895 + t5515*t6915) + 1.1312*(t5515*t6895 - 1.*t5557*t6915) - 1.*t6333*t776,2));
}



#ifdef MATLAB_MEX_FILE

#include "mex.h"
/*
 * Main function
 */
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  size_t mrows, ncols;

  double *var1;
  double *p_output1;

  /*  Check for proper number of arguments.  */ 
  if( nrhs != 1)
    {
      mexErrMsgIdAndTxt("MATLAB:MShaped:invalidNumInputs", "One input(s) required (var1).");
    }
  else if( nlhs > 1)
    {
      mexErrMsgIdAndTxt("MATLAB:MShaped:maxlhs", "Too many output arguments.");
    }

  /*  The input must be a noncomplex double vector or scaler.  */
  mrows = mxGetM(prhs[0]);
  ncols = mxGetN(prhs[0]);
  if( !mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) ||
    ( !(mrows == 20 && ncols == 1) && 
      !(mrows == 1 && ncols == 20))) 
    {
      mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var1 is wrong.");
    }

  /*  Assign pointers to each input.  */
  var1 = mxGetPr(prhs[0]);
   


   
  /*  Create matrices for return arguments.  */
  plhs[0] = mxCreateDoubleMatrix((mwSize) 1, (mwSize) 1, mxREAL);
  p_output1 = mxGetPr(plhs[0]);


  /* Call the calculation subroutine. */
  output1(p_output1,var1);


}

#else // MATLAB_MEX_FILE

#include "distance_pelvis_to_stance_toe_RightStance.hh"

namespace RightStance
{

void distance_pelvis_to_stance_toe_RightStance_raw(double *p_output1, const double *var1)
{
  // Call Subroutines
  output1(p_output1, var1);

}

}

#endif // MATLAB_MEX_FILE
