#include <stdio.h>
#ifdef _CIVL
#include <civlc.cvh>
/* Dimensions of 2 matrices: a[N][L] * b[L][M] */
$input int NB=5, LB=5, MB=5, N, L, M;
$assume(0<N && N<=NB && 0<L && L<=LB && 0<M && M<=MB);
$input double a[N][L], b[L][M];
#else
#define N 2
#define L 2
#define M 2
double a[][L]={{1,2},{3,4}}, b[][M]={{5,6},{7,8}};
#endif
double c[N][M];

void printMatrix(int nrows, int ncols, double *m) {
  for (int i = 0; i < nrows; i++) {
    for (int j = 0; j < ncols; j++) 
      printf("%f ", m[i*ncols + j]);
    printf("\n");
  }
  printf("\n");
}

int main() {
  printMatrix(N, L, &a[0][0]);
  for (int i=0; i<N; i++)
    for (int j=0; j<M; j++) {
      c[i][j] = 0.0;
      for (int k=0; k<L; k++)
	c[i][j] += a[i][k]*b[k][j];
    }
  printMatrix(N, M, &c[0][0]);
}
