#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <time.h>

#define TIME_CST 330000

int cpt = 0;

void do_work(unsigned int duration) /* duration en millisecondes */
{
    int i;

    for(i=0;i<TIME_CST *duration;i++) asm volatile ("nop");
}

void handler()
{
    t2();
    t3();
    t4a();
    t3();
    t4b();
    t3();
    t2();
    t4b();
    t2();
    t4a();
    t3();
    t2();
    t4b();
    t3();
    t2();
    t4a();
}

void t2()
{
    printf("t2\n");
    do_work(333);
}

void t3()
{
    printf("t3\n");
    do_work(1000);
}

void t4a()
{
    printf("t4a\n");
    do_work(1667);
}

void t4b()
{
    printf("t4b\n");
    do_work(333);
}

int main()
{
    //while(1)
        handler();

    pause();
    return 0;
}
