main()

{

	// All variables should be defined as 'int'.

	register int LR,low,high; // The variables of 'spawn' & 'ps' must be held in registers

	int a[8] = {1,2,3,4,5,6,7,8}; // This is how an array is initiated

	int c[8] = {0,1,0,1,0,1,0,1};

	int d[8];

	global register GR; // The global register of 'ps' is defined here

	GR = 0;

	low=0;

	high=7;

	spawn low,high;

	if ( c[$] == 1) // '$' represents the virtual thread ID.

	{
		LR = 1;

		ps LR , GR; // The left parameter of 'ps' is local and the right parameter is global

		d[LR]= a[$];

	}

	join;


	// For now it is better to print inside main().

	// You are supposed to print in serial mode only.


	printf("%d %d %d\n",a[0],a[1],a[2]); // At most 3 parameters can be passed to 'printf'
	printf("%d %d %d\n",a[3],a[4],a[5]); // Do not use " inside a string.
	printf("%d %d\n",a[6],a[7]);
	printf("%d %d %d\n",c[0],c[1],c[2]);
	printf("%d %d %d\n",c[3],c[4],c[5]);
	printf("%d %d\n",c[6],c[7]);
	printf("%d %d %d\n",d[0],d[1],d[2]);
	printf("%d\n",d[3]);

}