text: #include <math.h>
  #define ceild(n,d)  ceil(((double)(n))/((double)(d)))
  #define floord(n,d) floor(((double)(n))/((double)(d)))
  #define max(x,y)    ((x) > (y)? (x) : (y))
  #define min(x,y)    ((x) < (y)? (x) : (y))
  
  /**
   * This version is stamped on May 10, 2016
   *
   * Contact:
   *   Louis-Noel Pouchet <pouchet.ohio-state.edu>
   *   Tomofumi Yuki <tomofumi.yuki.fr>
   *
   * Web address: http://polybench.sourceforge.net
   */
  /* gemver.c: this file is part of PolyBench/C */
  
  #include <stdio.h>
  #include <unistd.h>
  #include <string.h>
  #include <math.h>
  
  /* Include polybench common header. */
  #include <polybench.h>
  
  /* Include benchmark-specific header. */
  #include "gemver.h"
  
  
  /* Array initialization. */
  static
  void init_array (int n,
  		 DATA_TYPE *alpha,
  		 DATA_TYPE *beta,
  		 DATA_TYPE POLYBENCH_2D(A,N,N,n,n),
  		 DATA_TYPE POLYBENCH_1D(u1,N,n),
  		 DATA_TYPE POLYBENCH_1D(v1,N,n),
  		 DATA_TYPE POLYBENCH_1D(u2,N,n),
  		 DATA_TYPE POLYBENCH_1D(v2,N,n),
  		 DATA_TYPE POLYBENCH_1D(w,N,n),
  		 DATA_TYPE POLYBENCH_1D(x,N,n),
  		 DATA_TYPE POLYBENCH_1D(y,N,n),
  		 DATA_TYPE POLYBENCH_1D(z,N,n))
  {
    int i, j;
  
    *alpha = 1.5;
    *beta = 1.2;
  
    DATA_TYPE fn = (DATA_TYPE)n;
  
    for (i = 0; i < n; i++)
      {
        u1[i] = i;
        u2[i] = ((i+1)/fn)/2.0;
        v1[i] = ((i+1)/fn)/4.0;
        v2[i] = ((i+1)/fn)/6.0;
        y[i] = ((i+1)/fn)/8.0;
        z[i] = ((i+1)/fn)/9.0;
        x[i] = 0.0;
        w[i] = 0.0;
        for (j = 0; j < n; j++)
          A[i][j] = (DATA_TYPE) (i*j % n) / n;
      }
  }
  
  
  /* DCE code. Must scan the entire live-out data.
     Can be used also to check the correctness of the output. */
  static
  void print_array(int n,
  		 DATA_TYPE POLYBENCH_1D(w,N,n))
  {
    int i;
  
    POLYBENCH_DUMP_START;
    POLYBENCH_DUMP_BEGIN("w");
    for (i = 0; i < n; i++) {
      if (i % 20 == 0) fprintf (POLYBENCH_DUMP_TARGET, "\n");
      fprintf (POLYBENCH_DUMP_TARGET, DATA_PRINTF_MODIFIER, w[i]);
    }
    POLYBENCH_DUMP_END("w");
    POLYBENCH_DUMP_FINISH;
  }
  
  
  /* Main computational kernel. The whole function will be timed,
     including the call and return. */
  static
  void kernel_gemver(int n,
  		   DATA_TYPE alpha,
  		   DATA_TYPE beta,
  		   DATA_TYPE POLYBENCH_2D(A,N,N,n,n),
  		   DATA_TYPE POLYBENCH_1D(u1,N,n),
  		   DATA_TYPE POLYBENCH_1D(v1,N,n),
  		   DATA_TYPE POLYBENCH_1D(u2,N,n),
  		   DATA_TYPE POLYBENCH_1D(v2,N,n),
  		   DATA_TYPE POLYBENCH_1D(w,N,n),
  		   DATA_TYPE POLYBENCH_1D(x,N,n),
  		   DATA_TYPE POLYBENCH_1D(y,N,n),
  		   DATA_TYPE POLYBENCH_1D(z,N,n))
  {
    int i, j;
  
  /* Copyright (C) 1991-2016 Free Software Foundation, Inc.
     This file is part of the GNU C Library.
  
     The GNU C Library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     License as published by the Free Software Foundation; either
     version 2.1 of the License, or (at your option) any later version.
  
     The GNU C Library is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     Lesser General Public License for more details.
  
     You should have received a copy of the GNU Lesser General Public
     License along with the GNU C Library; if not, see
     <http://www.gnu.org/licenses/>.  */
  /* This header is separate from features.h so that the compiler can
     include it implicitly at the start of every compilation.  It must
     not itself include <features.h> or any other header that includes
     <features.h> because the implicit include comes before any feature
     test macros that may be defined in a source file before it first
     explicitly includes a system header.  GCC knows the name of this
     header in order to preinclude it.  */
  /* glibc's intent is to support the IEC 559 math functionality, real
     and complex.  If the GCC (4.9 and later) predefined macros
     specifying compiler intent are available, use them to determine
     whether the overall intent is to support these features; otherwise,
     presume an older compiler has intent to support these features and
     define these macros by default.  */
  /* wchar_t uses Unicode 8.0.0.  Version 8.0 of the Unicode Standard is
     synchronized with ISO/IEC 10646:2014, plus Amendment 1 (published
     2015-05-15).  */
  /* We do not support C11 <threads.h>.  */
    int t1, t2, t3, t4, t5, t6;
   register int lbv, ubv;
  /* Start of CLooG code */
  if (_PB_N >= 1) {
    for (t2=0;t2<=floord(_PB_N-1,32);t2++) {
      for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
        for (t4=32*t3;t4<=min(_PB_N-1,32*t3+31);t4++) {
          lbv=32*t2;
          ubv=min(_PB_N-1,32*t2+31);
  #pragma ivdep
  #pragma vector always
          for (t5=lbv;t5<=ubv;t5++) {
            A[t4][t5] = A[t4][t5] + u1[t4] * v1[t5] + u2[t4] * v2[t5];;
            x[t5] = x[t5] + beta * A[t4][t5] * y[t4];;
          }
        }
      }
    }
    for (t2=0;t2<=floord(_PB_N-1,32);t2++) {
      lbv=32*t2;
      ubv=min(_PB_N-1,32*t2+31);
  #pragma ivdep
  #pragma vector always
      for (t3=lbv;t3<=ubv;t3++) {
        x[t3] = x[t3] + z[t3];;
      }
    }
    for (t2=0;t2<=floord(_PB_N-1,32);t2++) {
      for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
        for (t4=32*t2;t4<=min(_PB_N-1,32*t2+31);t4++) {
          for (t5=32*t3;t5<=min(_PB_N-1,32*t3+31);t5++) {
            w[t4] = w[t4] + alpha * A[t4][t5] * x[t5];;
          }
        }
      }
    }
  }
  /* End of CLooG code */
  }
  
  
  int main(int argc, char** argv)
  {
    /* Retrieve problem size. */
    int n = N;
  
    /* Variable declaration/allocation. */
    DATA_TYPE alpha;
    DATA_TYPE beta;
    POLYBENCH_2D_ARRAY_DECL(A, DATA_TYPE, N, N, n, n);
    POLYBENCH_1D_ARRAY_DECL(u1, DATA_TYPE, N, n);
    POLYBENCH_1D_ARRAY_DECL(v1, DATA_TYPE, N, n);
    POLYBENCH_1D_ARRAY_DECL(u2, DATA_TYPE, N, n);
    POLYBENCH_1D_ARRAY_DECL(v2, DATA_TYPE, N, n);
    POLYBENCH_1D_ARRAY_DECL(w, DATA_TYPE, N, n);
    POLYBENCH_1D_ARRAY_DECL(x, DATA_TYPE, N, n);
    POLYBENCH_1D_ARRAY_DECL(y, DATA_TYPE, N, n);
    POLYBENCH_1D_ARRAY_DECL(z, DATA_TYPE, N, n);
  
  
    /* Initialize array(s). */
    init_array (n, &alpha, &beta,
  	      POLYBENCH_ARRAY(A),
  	      POLYBENCH_ARRAY(u1),
  	      POLYBENCH_ARRAY(v1),
  	      POLYBENCH_ARRAY(u2),
  	      POLYBENCH_ARRAY(v2),
  	      POLYBENCH_ARRAY(w),
  	      POLYBENCH_ARRAY(x),
  	      POLYBENCH_ARRAY(y),
  	      POLYBENCH_ARRAY(z));
  
    /* Start timer. */
    polybench_start_instruments;
  
    /* Run kernel. */
    kernel_gemver (n, alpha, beta,
  		 POLYBENCH_ARRAY(A),
  		 POLYBENCH_ARRAY(u1),
  		 POLYBENCH_ARRAY(v1),
  		 POLYBENCH_ARRAY(u2),
  		 POLYBENCH_ARRAY(v2),
  		 POLYBENCH_ARRAY(w),
  		 POLYBENCH_ARRAY(x),
  		 POLYBENCH_ARRAY(y),
  		 POLYBENCH_ARRAY(z));
  
    /* Stop and print timer. */
    polybench_stop_instruments;
    polybench_print_instruments;
  
    /* Prevent dead-code elimination. All live-out data must be printed
       by the function call in argument. */
    polybench_prevent_dce(print_array(n, POLYBENCH_ARRAY(w)));
  
    /* Be clean. */
    POLYBENCH_FREE_ARRAY(A);
    POLYBENCH_FREE_ARRAY(u1);
    POLYBENCH_FREE_ARRAY(v1);
    POLYBENCH_FREE_ARRAY(u2);
    POLYBENCH_FREE_ARRAY(v2);
    POLYBENCH_FREE_ARRAY(w);
    POLYBENCH_FREE_ARRAY(x);
    POLYBENCH_FREE_ARRAY(y);
    POLYBENCH_FREE_ARRAY(z);
  
    return 0;
  }
  