class Program
{
  int x,y;

  int m1(int x)
  {
	//shadows global x as formal
        int ret;
	ret=x;
	x=100;
	return ret-1;
  }

  int m2(int n)
  {
	//shadow global by local
        int x;
	x=n+1000;
	return x;
  }

  int m3(int n)
  {
	//write to global in proc and main
        x=4;
	y=n; 
	return y-100;
  }  

  void main()
  {
     int res;

        x=2;
	res = m1(x);
	if (x==2 && res==1) 
	{ 
		callout("printf","shadow by formal OK\n"); 
	}
	else 
	{
		callout("printf","FAIL: shadow by formal: %d %d\n",x,y);
	}

        x=2;
	res = m2(x);
	if (x==2 && res==1002) 
	{
		callout("printf","shadow by local OK\n");
	}
	else 
	{ 
		callout("printf","FAIL: shadow by local: %d %d\n",x,y);
	}
         
	x=2;
	y=3;
        y = m3(y+100) + (y-50);
	if (x==4 && y==56) 
	{
		callout("printf","proc sideeffect OK\n");
	}
	else 
	{
		callout("printf","FAIL: proc sideeffect in first operand: %d %d\n",x,y);
	}

  }
}
