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

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

#define N 60
#define M 60
#define K 60
#define NL 1000

static void sh3101();
static void sh3102();
static void sh3103();
static void sh3104();
static void sh3105();
static void sh3106();
static void sh3107();
static void sh3108();
static void sh3109();
static void sh3110();
static void sh3111();
static void serial3(int AR[N][M][K], int NN, int NM, int NK, int NNL);
static void ansyes(const char tname[]);
static void ansno(const char tname[]);

int main(int argc, char *argv[])
{
    printf("===START OF SH31========================\n");
    sh3101();
    sh3102();
    sh3103();
    sh3104();
    sh3105();
    sh3106();
    sh3107();
    sh3108();
    sh3109();
    sh3110();
    sh3111();

    printf("=== END OF SH31 ========================= \n");
    return 0;
}
/* ---------------------------------------------SH3101  */
void sh3101()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3101";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii])
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) 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++)
                B[i][j][ii] = A[i+1][j][ii]+A[i][j+1][ii]+A[i][j][ii+1]+A[i-1][j][ii]+
                     A[i][j-1][ii]+A[i][j][ii-1]+A[i-1][j-1][ii-1]+
                     A[i+1][j+1][ii+1]+A[i-1][j+1][ii]+A[i+1][j-1][ii]+
                     A[i-1][j+1][ii-1]+A[i-1][j+1][ii+1]+A[i+1][j-1][ii-1]+
                     A[i+1][j-1][ii+1];

    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) reduction(min(nloopi), min(nloopj), min(nloopii))
    for (i = 1; i < N - 1; i++)
        for (j = 1; j < M - 1;j++)
            for (ii = 1; ii < K - 1; ii++)
                if (B[i][j][ii]!=C[i+1][j][ii]+C[i][j+1][ii]+C[i][j][ii+1]+
                      C[i-1][j][ii]+C[i][j-1][ii]+C[i][j][ii-1]+
                      C[i-1][j-1][ii-1]+C[i+1][j+1][ii+1]+C[i-1][j+1][ii]+
                      C[i+1][j-1][ii]+C[i-1][j+1][ii-1]+C[i-1][j+1][ii+1]+
                      C[i+1][j-1][ii-1]+C[i+1][j-1][ii+1])
                {
                    if (nloopi > i) nloopi = i;
                    if (nloopj > j) nloopj = j;
                    if (nloopii > ii) nloopii = ii;
                }
    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3102  */
void sh3102()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3102";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[2:2][2:2][2:2]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

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

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3103  */
void sh3103()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3103";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[2:2][2:2][2:2]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

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

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3104  */
void sh3104()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3104";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[2:2][2:2][2:2]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) shadow_renew(A[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++)
                B[i][j][ii] =  A[i+2][j][ii]+A[i-2][j-2][ii-2]
                  +   A[i+2][j-2][ii-2]+A[i-2][j][ii-2]+ A[i-2][j-2][ii]+
                     A[i-2][j][ii]+A[i+2][j-2][ii]+A[i+2][j][ii-2];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) reduction(min(nloopi), min(nloopj), min(nloopii))
    for (i = 2; i < N - 2; i++)
        for (j = 2; j < M - 2; j++)
            for (ii = 2; ii < K - 2; ii++)
                if (B[i][j][ii]!=C[i+2][j][ii]+C[i-2][j-2][ii-2]
                  +   C[i+2][j-2][ii-2]+C[i-2][j][ii-2]+ C[i-2][j-2][ii]+
                     C[i-2][j][ii]+C[i+2][j-2][ii]+C[i+2][j][ii-2])
                {
                    if (nloopi > i) nloopi = i;
                    if (nloopj > j) nloopj = j;
                    if (nloopii > ii) nloopii = ii;
                }
/*    printf ("%i,%i,%i\n",nloopi,nloopj,nloopii);*/
    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3105  */
void sh3105()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3105";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[0:2][2:2][0:2]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

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

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3106  */
void sh3106()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3106";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[3:3][3:3][3:3]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) 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++)
                B[i][j][ii] = A[i-3][j-3][ii+3]+A[i+3][j+3][ii-3]+A[i+3][j-3][ii+3]+
                     A[i-3][j+3][ii+3]+A[i-3][j+3][ii-3]+A[i+3][j-3][ii-3]+
                     A[i+3][j+3][ii+3]+A[i-3][j-3][ii-3];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) reduction(min(nloopi), min(nloopj), min(nloopii))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                if (B[i][j][ii]!= C[i-3][j-3][ii+3]+C[i+3][j+3][ii-3]+C[i+3][j-3][ii+3]+
                     C[i-3][j+3][ii+3]+C[i-3][j+3][ii-3]+C[i+3][j-3][ii-3]+
                     C[i+3][j+3][ii+3]+C[i-3][j-3][ii-3])
                {
                    if (nloopi > i) nloopi = i;
                    if (nloopj > j) nloopj = j;
                    if (nloopii > ii) nloopii = ii;
                }

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3107  */
void sh3107()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3107";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[3:3][0:3][3:0]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) 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++)
                B[i][j][ii] = A[i+3][j+3][ii]+A[i-3][j][ii-3]+A[i+3][j][ii-3]+
                     A[i-3][j+3][ii-3]+A[i-3][j][ii]+A[i-3][j+3][ii]+
                     A[i+3][j][ii]+A[i+3][j+3][ii-3];
    } /*end region*/
    #pragma dvm get_actual(B)
    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) reduction(min(nloopi), min(nloopj), min(nloopii))
    for (i = 3; i < N - 3; i++)
        for (j = 3; j < M - 3; j++)
            for (ii = 3; ii < K - 3; ii++)
                if (B[i][j][ii]!= C[i-3][j-3][ii+3]+C[i+3][j+3][ii-3]+C[i+3][j-3][ii+3]+
                     C[i-3][j+3][ii+3]+C[i-3][j+3][ii-3]+C[i+3][j-3][ii-3]+
                     C[i+3][j+3][ii+3]+C[i-3][j-3][ii-3])
                {
                    if (nloopi > i) nloopi = i;
                    if (nloopj > j) nloopj = j;
                    if (nloopii > ii) nloopii = ii;
                }

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3108  */
void sh3108()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3108";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[0:3][0:3][0:3]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

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

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

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3109  */
void sh3109()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3109";
    int i, j, ii, NN, NM, NK, NNL;
    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];
    #pragma dvm array align([i][j][ii] with B[i][j][ii]), shadow[9:9][9:9][9:9]
    int A[N][M][K];
    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;

    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii] on A[i][j][ii])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++) {
                A[i][j][ii] = NL + i + j + ii;
                B[i][j][ii] = 0;
            }
    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) shadow_renew(A[9:9][9:9][9:9] (corner))
    for (i = 9; i < N - 9; i++)
        for (j = 9; j < M - 9; j++)
            for (ii = 9; ii < K - 9; ii++)
                B[i][j][ii]=A[i+9][j+9][ii+9]+A[i-9][j-9][ii-9]+A[i+9][j-9][ii-9]+
                      A[i-9][j+9][ii-9]+A[i-9][j-9][ii+9]+A[i-9][j+9][ii+9]+
                      A[i+9][j-9][ii+9]+A[i+9][j+9][ii-9];


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

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3110  */
void sh3110()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3110";
    int i, j, ii, NN, NM, NK, NNL;

    #pragma dvm array distribute[block][block][block]
    int B[N][M][K];

    #pragma dvm array shadow[9:9][9:9][9:9]
    int A[N][M][K];

    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    #pragma dvm realign(A[i][j][ii] with B[i][j][ii])
    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii] on A[i][j][ii])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++) {
                A[i][j][ii] = NL + i + j + ii;
                B[i][j][ii] = 0;
            }
    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) shadow_renew(A[9:9][9:9][9:9] (corner))
    for (i = 9; i < N - 9; i++)
        for (j = 9; j < M - 9; j++)
            for (ii = 9; ii < K - 9; ii++)
                B[i][j][ii]=A[i+9][j+9][ii+9]+A[i-9][j-9][ii-9]+A[i+9][j-9][ii-9]+
                      A[i-9][j+9][ii-9]+A[i-9][j-9][ii+9]+A[i-9][j+9][ii+9]+
                      A[i+9][j-9][ii+9]+A[i+9][j+9][ii-9];


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

    if (nloopi == NL && nloopj == NL && nloopii == NL)
        ansyes(tname);
    else
        ansno(tname);
}
/* ---------------------------------------------SH3111  */
void sh3111()
{
    int C[N][M][K];
    int nloopi, nloopj, nloopii;
    char tname[] = "SH3111";
    int i, j, ii, NN, NM, NK, NNL;

    #pragma dvm array
    int B[N][M][K];

    #pragma dvm array shadow[9:9][9:9][9:9]
    int A[N][M][K];

    NN = N;
    NM = M;
    NK = K;
    NNL = NL;
    serial3(C, NN, NM, NK, NNL);
    nloopi = NL;
    nloopj = NL;
    nloopii = NL;
    #pragma dvm redistribute(B[block][block][block])
    #pragma dvm realign(A[i][j][ii] with B[i][j][ii])
    #pragma dvm region local(A), out(B)
    {
    #pragma dvm parallel([i][j][ii] on A[i][j][ii])
    for (i = 0; i < N; i++)
        for (j = 0; j < M; j++)
            for (ii = 0; ii < K; ii++) {
                A[i][j][ii] = NL + i + j + ii;
                B[i][j][ii] = 0;
            }
    #pragma dvm parallel([i][j][ii] on B[i][j][ii]) shadow_renew(A[9:9][9:9][9:9] (corner))
    for (i = 9; i < N - 9; i++)
        for (j = 9; j < M - 9; j++)
            for (ii = 9; ii < K - 9; ii++)
                B[i][j][ii]=A[i+9][j+9][ii+9]+A[i-9][j-9][ii-9]+A[i+9][j-9][ii-9]+
                      A[i-9][j+9][ii-9]+A[i-9][j-9][ii+9]+A[i-9][j+9][ii+9]+
                      A[i+9][j-9][ii+9]+A[i+9][j+9][ii-9];


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

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

void serial3(int AR[N][M][K], int NN, int NM, int NK, int NNL)
{
    int i, j, ii;
    for (i = 0; i < NN; i++)
        for (j = 0; j < NM; j++)
            for (ii = 0; ii < NK; ii++)
                AR[i][j][ii] = NNL + i + j + ii;
}

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

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