#include <stdio.h>
#include <stdlib.h>
#include "liss_bool.h"
#include "liss_list.h"
#include "liss_set.h"

int factorial(int n)
{
	int res = 1, r = 0;

	while (n > 0)
	{
		res = res * n;
		--n;
	}

	return res;
}

int * calculate(int m[4], int *r)
{
	int * liss0 = malloc(sizeof(int) * 4);
	int fac = 6;
	int res = -16;
	int liss1 = 0;

	for((*r)=0; (*r)<=3; (*r)+=1)
	{
		m[(*r)] = factorial(fac + (*r));
	//m[4]=4444;
	}

	for(liss1=0; liss1<4; liss1++)
		liss0[liss1] = m[liss1];
	return liss0;
}

void main()
{
	int a = 4, b = 5, c = 5, r = 0;
	int array1[4] = {10,20,30,40}, array2[4] = {}, array3[4] = {};
	int liss0 = 0;
	int liss1 = 0;
	int liss2 = 0;

	for(a=0; a<=3; a+=1)
	{
		array3[a] = factorial(a + 1);
	}

	printf("[");
	for(liss0=0; liss0<4; liss0++)
	{
		if (liss0==3)
			printf("%d", array3[liss0]);
		else
			printf("%d,", array3[liss0]);
	}
	printf("]");
	printf("\n");

	for(liss1=0; liss1<4; liss1++)
		array2[liss1] = calculate(array1, &r)[liss1];

	printf("[");
	for(liss2=0; liss2<4; liss2++)
	{
		if (liss2==3)
			printf("%d", array2[liss2]);
		else
			printf("%d,", array2[liss2]);
	}
	printf("]");
	printf("\n");

}
