/*    TESTING OF THE SHADOW DIRECTIVE AND THE SHADOW_RENEW CLAUSE'.
     DISTRIBUTED ARRAY A(N,M,K,L) IS TO HAVE DIFFERENT SHADOW WIDTH
     ON BOTH SIDES */

#include <math.h>
#include <stdlib.h>
#include <stdio.h>

#define NL 1000

static void sh4101();
static void sh4102();
static void sh4103();
static void sh4104();
static void sh4105();
static void sh4106();
static void sh4107();
static void sh4108();
static void sh4109();
static void sh4110();
static void sh4111();

static void ansyes(const char tname[]);
static void ansno(const char tname[]);

int main(int an, char **as)
{
    printf("===START OF SH41========================\n");
    sh4101();
    sh4102();
    sh4103();
    sh4104();
    sh4105();
    sh4106();
    sh4107();
    sh4108();
    sh4109();
    sh4110();
    sh4111();

    printf("=== END OF SH41 ========================= \n");
    return 0;
}
/* ---------------------------------------------SH4101  */
void sh4101()
{
    #define N 16
    #define M 8
    #define K 8
    #define L 8

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4101";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;

    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[1:1][1:1][1:1][1:1]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;

    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A(corner))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            for (ii = 1; ii < K - 1; ii++)
                for (jj = 1; jj < L - 1; jj++)
                    B[i][j][ii][jj] = A[i+1][j+1][ii+1][jj+1]+A[i-1][j-1][ii-1][jj-1]+
                                   A[i+1][j-1][ii-1][jj-1]+A[i-1][j+1][ii-1][jj-1]+
                                   A[i-1][j-1][ii+1][jj-1]+A[i-1][j-1][ii-1][jj+1]+
                                   A[i+1][j+1][ii-1][jj-1]+A[i-1][j+1][ii+1][jj-1]+
                                   A[i-1][j-1][ii+1][jj+1]+A[i+1][j-1][ii-1][jj+1]+
                                   A[i+1][j-1][ii+1][jj-1]+A[i-1][j+1][ii-1][jj+1]+
                                   A[i+1][j+1][ii+1][jj-1]+A[i-1][j+1][ii+1][jj+1]+
                                   A[i+1][j-1][ii+1][jj+1]+A[i+1][j+1][ii-1][jj+1];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1; j++)
            for (ii = 1; ii < K - 1; ii++)
                for (jj = 1; jj < L - 1; jj++)
                    if (B[i][j][ii][jj]!=
                     C[i+1][j+1][ii+1][jj+1]+C[i-1][j-1][ii-1][jj-1]+
                     C[i+1][j-1][ii-1][jj-1]+C[i-1][j+1][ii-1][jj-1]+
                     C[i-1][j-1][ii+1][jj-1]+C[i-1][j-1][ii-1][jj+1]+
                     C[i+1][j+1][ii-1][jj-1]+C[i-1][j+1][ii+1][jj-1]+
                     C[i-1][j-1][ii+1][jj+1]+C[i+1][j-1][ii-1][jj+1]+
                     C[i+1][j-1][ii+1][jj-1]+C[i-1][j+1][ii-1][jj+1]+
                     C[i+1][j+1][ii+1][jj-1]+C[i-1][j+1][ii+1][jj+1]+
                     C[i+1][j-1][ii+1][jj+1]+C[i+1][j+1][ii-1][jj+1])
                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/*-----------------------------------------------------------SH4102  */
void sh4102()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4102";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[2:2][2:2][2:2][2:2]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;

    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

      #pragma dvm parallel ([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A (corner))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    B[i][j][ii][jj] =
                        A[i+2][j+2][ii+2][jj+2]+A[i-2][j-2][ii-2][jj-2]+
                        A[i+2][j-2][ii-2][jj-2]+A[i-2][j+2][ii-2][jj-2]+
                        A[i-2][j-2][ii+2][jj-2]+A[i-2][j-2][ii-2][jj+2]+
                        A[i+2][j+2][ii-2][jj-2]+A[i-2][j+2][ii+2][jj-2]+
                        A[i-2][j-2][ii+2][jj+2]+A[i+2][j-2][ii-2][jj+2]+
                        A[i+2][j-2][ii+2][jj-2]+A[i-2][j+2][ii-2][jj+2]+
                        A[i+2][j+2][ii+2][jj-2]+A[i-2][j+2][ii+2][jj+2]+
                        A[i+2][j-2][ii+2][jj+2]+A[i+2][j+2][ii-2][jj+2];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    if (B[i][j][ii][jj]!=
                       C[i+2][j+2][ii+2][jj+2]+C[i-2][j-2][ii-2][jj-2]+
                       C[i+2][j-2][ii-2][jj-2]+C[i-2][j+2][ii-2][jj-2]+
                       C[i-2][j-2][ii+2][jj-2]+C[i-2][j-2][ii-2][jj+2]+
                       C[i+2][j+2][ii-2][jj-2]+C[i-2][j+2][ii+2][jj-2]+
                       C[i-2][j-2][ii+2][jj+2]+C[i+2][j-2][ii-2][jj+2]+
                       C[i+2][j-2][ii+2][jj-2]+C[i-2][j+2][ii-2][jj+2]+
                       C[i+2][j+2][ii+2][jj-2]+C[i-2][j+2][ii+2][jj+2]+
                       C[i+2][j-2][ii+2][jj+2]+C[i+2][j+2][ii-2][jj+2])
                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4103  */
void sh4103()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4103";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[2:2][2:2][2:2][2:2]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;
    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A[2:0][2:2][2:0][2:0] (corner))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    B[i][j][ii][jj] =
                        A[i-2][j-2][ii-2][jj-2]+A[i][j-2][ii][jj]+
                        A[i-2][j-2][ii][jj]    +A[i][j-2][ii][jj]+
                        A[i][j-2][ii-2][jj]    +A[i-2][j-2][ii][jj]+
                        A[i][j-2][ii-2][jj-2]  +A[i][j-2][ii][jj-2]+
                        A[i-2][j-2][ii-2][jj]  +A[i][j-2][ii-2][jj-2];
    }/* end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    if (B[i][j][ii][jj]!=
                        C[i-2][j-2][ii-2][jj-2]+C[i][j-2][ii][jj]+
                        C[i-2][j-2][ii][jj]    +C[i][j-2][ii][jj]+
                        C[i][j-2][ii-2][jj]    +C[i-2][j-2][ii][jj]+
                        C[i][j-2][ii-2][jj-2]  +C[i][j-2][ii][jj-2]+
                        C[i-2][j-2][ii-2][jj]  +C[i][j-2][ii-2][jj-2])

                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4104  */
void sh4104()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4104";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[0:2][2:2][0:2][0:2]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;

   #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A(corner))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    B[i][j][ii][jj] = A[i+2][j+2][ii+2][jj+2]+A[i][j-2][ii][jj]+
                                          A[i+2][j-2][ii][jj]    +A[i][j-2][ii][jj]+
                                          A[i][j+2][ii][jj]      +A[i][j-2][ii+2][jj]+
                                          A[i+2][j+2][ii][jj]    +A[i][j-2][ii+2][jj+2]+
                                          A[i][j+2][ii][jj+2]    +A[i+2][j+2][ii+2][jj]+
                                          A[i][j+2][ii+2][jj+2]  +A[i+2][j-2][ii+2][jj+2];
    }/*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    if (B[i][j][ii][jj]!=
                        C[i+2][j+2][ii+2][jj+2]+C[i][j-2][ii][jj]+
                        C[i+2][j-2][ii][jj]    +C[i][j-2][ii][jj]+
                        C[i][j+2][ii][jj]      +C[i][j-2][ii+2][jj]+
                        C[i+2][j+2][ii][jj]    +C[i][j-2][ii+2][jj+2]+
                        C[i][j+2][ii][jj+2]    +C[i+2][j+2][ii+2][jj]+
                        C[i][j+2][ii+2][jj+2]  +C[i+2][j-2][ii+2][jj+2])

                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4105  */
void sh4105()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4105";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[2:2][2:0][0:2][2:2]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;

    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A[0:0][0:0][0:0][0:2] (corner))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    B[i][j][ii][jj] = A[i][j][ii][jj+2];
    }/*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    if (B[i][j][ii][jj]!=C[i][j][ii][jj+2])
                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4106  */
void sh4106()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4106";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[3:3][3:3][3:3][3:3]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;

    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

      #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A (corner))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    B[i][j][ii][jj] = A[i+3][j+3][ii+3][jj+3]+A[i-3][j-3][ii-3][jj-3]+
                                          A[i+3][j-3][ii-3][jj-3]+A[i-3][j+3][ii-3][jj-3]+
                                          A[i-3][j-3][ii+3][jj-3]+A[i-3][j-3][ii-3][jj+3]+
                                          A[i+3][j+3][ii-3][jj-3]+A[i-3][j+3][ii+3][jj-3]+
                                          A[i-3][j-3][ii+3][jj+3]+A[i+3][j-3][ii-3][jj+3]+
                                          A[i+3][j-3][ii+3][jj-3]+A[i-3][j+3][ii-3][jj+3]+
                                          A[i+3][j+3][ii+3][jj-3]+A[i-3][j+3][ii+3][jj+3]+
                                          A[i+3][j-3][ii+3][jj+3]+A[i+3][j+3][ii-3][jj+3];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    if (B[i][j][ii][jj]!=
                            C[i+3][j+3][ii+3][jj+3]+C[i-3][j-3][ii-3][jj-3]+
                            C[i+3][j-3][ii-3][jj-3]+C[i-3][j+3][ii-3][jj-3]+
                            C[i-3][j-3][ii+3][jj-3]+C[i-3][j-3][ii-3][jj+3]+
                            C[i+3][j+3][ii-3][jj-3]+C[i-3][j+3][ii+3][jj-3]+
                            C[i-3][j-3][ii+3][jj+3]+C[i+3][j-3][ii-3][jj+3]+
                            C[i+3][j-3][ii+3][jj-3]+C[i-3][j+3][ii-3][jj+3]+
                            C[i+3][j+3][ii+3][jj-3]+C[i-3][j+3][ii+3][jj+3]+
                            C[i+3][j-3][ii+3][jj+3]+C[i+3][j+3][ii-3][jj+3] )

                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4107  */
void sh4107()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4107";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[0:3][3:3][0:3][0:3]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;
    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

      #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A(corner))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    B[i][j][ii][jj] =
                        A[i+3][j+3][ii+3][jj+3]+A[i][j-3][ii][jj]+
                        A[i+3][j-3][ii][jj]+A[i][j+3][ii][jj]+
                        A[i][j-3][ii+3][jj]+A[i+3][j+3][ii][jj]+
                        A[i][j-3][ii+3][jj+3]+A[i][j+3][ii][jj+3]+
                        A[i+3][j+3][ii+3][jj]+A[i][j+3][ii+3][jj+3]+
                        A[i+3][j-3][ii+3][jj+3];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    if (B[i][j][ii][jj]!=
                             C[i+3][j+3][ii+3][jj+3]+C[i][j-3][ii][jj]+
                             C[i+3][j-3][ii][jj]+       C[i][j+3][ii][jj]+
                             C[i][j-3][ii+3][jj]+       C[i+3][j+3][ii][jj]+
                             C[i][j-3][ii+3][jj+3]+     C[i][j+3][ii][jj+3]+
                             C[i+3][j+3][ii+3][jj]+     C[i][j+3][ii+3][jj+3]+
                             C[i+3][j-3][ii+3][jj+3])

                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4108  */
void sh4108()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4108";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;

    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[0:3][3:3][0:3][0:3]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;
    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A[0:0][0:0][0:0][0:3] (corner))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    B[i][j][ii][jj] = A[i][j][ii][jj+3];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    if (B[i][j][ii][jj]!=C[i][j][ii][jj+3])
                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }
    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4109  */
void sh4109()
{
    #define N 48
    #define M 48
    #define K 24
    #define L 24

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4109";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array align([i][j][ii][jj] with B[i][j][ii][jj]), shadow[9:9][9:9][2:2][2:2]
    int A[N][M][K][L];


    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;

    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

      #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A[9:9][9:9][2:2][2:2] (corner))
    for (i = 9; i < N - 9; i++)
        for (j = 9; j < M - 9; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    B[i][j][ii][jj] = A[i+9][j+9][ii+2][jj+2]+A[i-9][j-9][ii-2][jj-2]+
                                          A[i+9][j-9][ii-2][jj-2]+A[i-9][j+9][ii-2][jj-2]+
                                          A[i-9][j-9][ii+2][jj-2]+A[i-9][j-9][ii-2][jj+2]+
                                          A[i+9][j+9][ii-2][jj-2]+A[i-9][j+9][ii+2][jj-2]+
                                          A[i-9][j-9][ii+2][jj+2]+A[i+9][j-9][ii-2][jj+2]+
                                          A[i+9][j-9][ii+2][jj-2]+A[i-9][j+9][ii-2][jj+2]+
                                          A[i+9][j+9][ii+2][jj-2]+A[i-9][j+9][ii+2][jj+2]+
                                          A[i+9][j-9][ii+2][jj+2]+A[i+9][j+9][ii-2][jj+2];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 9; i < N - 9; i++)
        for (j = 9; j < M - 9; j++)
            for (ii = 2; ii < K - 2; ii++)
                for (jj = 2; jj < L - 2; jj++)
                    if (B[i][j][ii][jj]!=
                            C[i+9][j+9][ii+2][jj+2]+C[i-9][j-9][ii-2][jj-2]+
                            C[i+9][j-9][ii-2][jj-2]+C[i-9][j+9][ii-2][jj-2]+
                            C[i-9][j-9][ii+2][jj-2]+C[i-9][j-9][ii-2][jj+2]+
                            C[i+9][j+9][ii-2][jj-2]+C[i-9][j+9][ii+2][jj-2]+
                            C[i-9][j-9][ii+2][jj+2]+C[i+9][j-9][ii-2][jj+2]+
                            C[i+9][j-9][ii+2][jj-2]+C[i-9][j+9][ii-2][jj+2]+
                            C[i+9][j+9][ii+2][jj-2]+C[i-9][j+9][ii+2][jj+2]+
                            C[i+9][j-9][ii+2][jj+2]+C[i+9][j+9][ii-2][jj+2] )

                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4110  */
void sh4110()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4110";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array distribute[block][block][block][block]
    int B[N][M][K][L];
    #pragma dvm array shadow[3:3][3:3][3:3][3:3]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;
    #pragma dvm realign(A[i][j][ii][jj] with B[i][j][ii][jj])
    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A (corner))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    B[i][j][ii][jj] = A[i+3][j+3][ii+3][jj+3]+A[i-3][j-3][ii-3][jj-3]+
                                          A[i+3][j-3][ii-3][jj-3]+A[i-3][j+3][ii-3][jj-3]+
                                          A[i-3][j-3][ii+3][jj-3]+A[i-3][j-3][ii-3][jj+3]+
                                          A[i+3][j+3][ii-3][jj-3]+A[i-3][j+3][ii+3][jj-3]+
                                          A[i-3][j-3][ii+3][jj+3]+A[i+3][j-3][ii-3][jj+3]+
                                          A[i+3][j-3][ii+3][jj-3]+A[i-3][j+3][ii-3][jj+3]+
                                          A[i+3][j+3][ii+3][jj-3]+A[i-3][j+3][ii+3][jj+3]+
                                          A[i+3][j-3][ii+3][jj+3]+A[i+3][j+3][ii-3][jj+3];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    if (B[i][j][ii][jj]!=
                            C[i+3][j+3][ii+3][jj+3]+C[i-3][j-3][ii-3][jj-3]+
                            C[i+3][j-3][ii-3][jj-3]+C[i-3][j+3][ii-3][jj-3]+
                            C[i-3][j-3][ii+3][jj-3]+C[i-3][j-3][ii-3][jj+3]+
                            C[i+3][j+3][ii-3][jj-3]+C[i-3][j+3][ii+3][jj-3]+
                            C[i-3][j-3][ii+3][jj+3]+C[i+3][j-3][ii-3][jj+3]+
                            C[i+3][j-3][ii+3][jj-3]+C[i-3][j+3][ii-3][jj+3]+
                            C[i+3][j+3][ii+3][jj-3]+C[i-3][j+3][ii+3][jj+3]+
                            C[i+3][j-3][ii+3][jj+3]+C[i+3][j+3][ii-3][jj+3] )

                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}
/* ---------------------------------------------SH4111  */
void sh4111()
{
    #define N 16
    #define M 16
    #define K 16
    #define L 16

    int C[N][M][K][L];
    int nloopi, nloopj, nloopii, nloopjj;
    char tname[] = "SH4111";
    int i, j, ii, jj, NN, NM, NK, NLL, NNL;
    #pragma dvm array
    int B[N][M][K][L];
    #pragma dvm array shadow[3:3][3:3][3:3][3:3]
    int A[N][M][K][L];

    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    C[i][j][ii][jj] = NL + i + j + ii + jj;
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    nloopjj = NL;

    #pragma dvm redistribute(B[block][block][block][block])
    #pragma dvm realign(A[i][j][ii][jj] with B[i][j][ii][jj])

    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii][jj] on A[i][j][ii][jj])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++)
                for (jj = 0; jj < L; jj++)
                    A[i][j][ii][jj] = NL + i + j + ii + jj;

     #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) shadow_renew(A (corner))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    B[i][j][ii][jj] = A[i+3][j+3][ii+3][jj+3]+A[i-3][j-3][ii-3][jj-3]+
                                          A[i+3][j-3][ii-3][jj-3]+A[i-3][j+3][ii-3][jj-3]+
                                          A[i-3][j-3][ii+3][jj-3]+A[i-3][j-3][ii-3][jj+3]+
                                          A[i+3][j+3][ii-3][jj-3]+A[i-3][j+3][ii+3][jj-3]+
                                          A[i-3][j-3][ii+3][jj+3]+A[i+3][j-3][ii-3][jj+3]+
                                          A[i+3][j-3][ii+3][jj-3]+A[i-3][j+3][ii-3][jj+3]+
                                          A[i+3][j+3][ii+3][jj-3]+A[i-3][j+3][ii+3][jj+3]+
                                          A[i+3][j-3][ii+3][jj+3]+A[i+3][j+3][ii-3][jj+3];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii][jj] on B[i][j][ii][jj]) reduction(min(nloopi), min(nloopj), min(nloopii), min(nloopjj))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                for (jj = 3; jj < L - 3; jj++)
                    if (B[i][j][ii][jj]!=
                            C[i+3][j+3][ii+3][jj+3]+C[i-3][j-3][ii-3][jj-3]+
                            C[i+3][j-3][ii-3][jj-3]+C[i-3][j+3][ii-3][jj-3]+
                            C[i-3][j-3][ii+3][jj-3]+C[i-3][j-3][ii-3][jj+3]+
                            C[i+3][j+3][ii-3][jj-3]+C[i-3][j+3][ii+3][jj-3]+
                            C[i-3][j-3][ii+3][jj+3]+C[i+3][j-3][ii-3][jj+3]+
                            C[i+3][j-3][ii+3][jj-3]+C[i-3][j+3][ii-3][jj+3]+
                            C[i+3][j+3][ii+3][jj-3]+C[i-3][j+3][ii+3][jj+3]+
                            C[i+3][j-3][ii+3][jj+3]+C[i+3][j+3][ii-3][jj+3] )

                    {
                        if (nloopi > i) nloopi = i;
                        if (nloopj > j) nloopj = j;
                        if (nloopii > ii) nloopii = ii;
                        if (nloopjj > jj) nloopjj = jj;
                    }

    if (nloopi == NL && nloopj == NL && nloopii == NL && nloopjj == NL)
        ansyes(tname);
    else
        ansno(tname);

    #undef N
    #undef M
    #undef K
    #undef L
}

void ansyes(const char name[])
{
    printf("%s  -  complete\n", name);
}

void ansno(const char name[])
{
    printf("%s  -  ***error\n", name);
}
