#include <stdio.h>
#include <iostream>
using namespace std;
                         float T, unsigned int N, unsigned int R, float mu, float kappa,
                         float vBar, float sigmaV, float rho, float x0, float v0)
{
    float deltaT = T / (float)(N - 1);
    float sqrtDeltaT = 
sqrt(deltaT);
 
    float sqrtOneMinusRhoSquare = 
sqrt(1 - rho*rho);
 
    float mArray[] = {rho, sqrtOneMinusRhoSquare};
    unsigned int tPrevious = 0, tCurrent = 0;
    for (unsigned int t = 1; t < N; t++) {
        tPrevious = (t+1) % 2;
        tCurrent = t % 2;
        x[tCurrent]= x[tPrevious] + (mu - 0.5 * v[tPrevious]) * deltaT + (sqrtVLag * dBt(
span, 0));
        af::array vTmp = v[tPrevious] + kappa * (vBar - v[tPrevious]) * deltaT + sigmaV * (sqrtVLag * 
matmul(dBt, m));
 
        v[tCurrent] = 
max(vTmp, zeroConstant);
    }
    xres = x[tCurrent];
    vres = v[tCurrent];
}
int main()
{
    float T = 1;
    unsigned int nT = 10 * T;
    unsigned int R_first_run = 1000;
    unsigned int R = 20000000;
    float x0 = 0; 
    float v0 = 
pow(0.087, 2); 
 
    float rho = -0.82; 
    float sigmaV = 0.14; 
    float kappa = 3.46; 
    float vBar = 0.008; 
    
    try {
        
        simulateHestonModel(x, v, T, nT, R_first_run, r, kappa, vBar, sigmaV, rho, x0, v0);
        timer::start();
        simulateHestonModel(x, v, T, nT, R, r, kappa, vBar, sigmaV, rho, x0, v0);
        cout << "Time in simulation: " << timer::stop() << endl;
        return 0;
        fprintf(stderr, 
"%s\n", e.
what());
        return 1;
    }
}