
! ***** This is level 2 program *****

! This program requires both shift and remap 

      PROGRAM MAIN 
      REAL X(-41:197), Y(-126:555) 
!HPF$ PROCESSORS P(8) 
!HPF$ TEMPLATE TX(-522:2444),TY(-590:2221) 
!HPF$ DISTRIBUTE TX(CYCLIC) ONTO P 
!HPF$ DISTRIBUTE TY(CYCLIC) ONTO P 
!HPF$ ALIGN X(i) WITH TX(12*i-8) 
!HPF$ ALIGN Y(i) WITH TY(4*i-9) 
      FORALL (i=-41:197) X(i) = 0 
      FORALL (i=-126:555) Y(i) = i 
      FORALL (i=-8:183:3) X(i) = Y(3*i-2) + Y(2*i-6) 

      CALL FOO(X(-41:190:3),Y(-123:547:2)) 
      CALL FOO(X(-41:190:3),Y(-126:209:1)) 

      PRINT 111, (X(i),i=-41,197) 
111   FORMAT(1x,f17.2) 
      END 

      SUBROUTINE FOO(X,Y) 
      REAL X(:), Y(:) 
!HPF$ INHERIT X,Y 
      FORALL (i=1:77) X(i)=X(i)-Y(i)-Y(i+1) 
      END 
!          p,lx,ly,ux,uy,l,u,s,d1,d2,ax,ay,a1,a2, 
!          ltx,utx,lty,uty,bx,by,b1,b2, 
!          lxs1,uxs1, sxs1, lys1, uys1, sys1, 
!          lxs2,uxs2, sxs2, lys2, uys2, sys2 
!          8 -41 -126 197 555 -8 183 3 2 2 12 4 3 2 
!          -522 2444 -590 2221 -8 -9 -2 -6  
!          -41 190 3 -123 547 2 
!          -41 190 3 -126 209 1 
