#include<stdio.h>

void prod(float mat1[][3], float mat2[][6], float dest[][6], int m1, int n1, int n2) {
     printf("orders: %d, %d, %d\n", m1, n1, n2);
     int i, j, k; // kmax = n1, jmax = n2, imax = m1
     for (i = 0; i < m1; i++) {
         for (j = 0; j < n2; j++) {
             dest[i][j] = 0;
             for (k = 0; k < n1; k++) {
                 dest[i][j] += mat1[i][k]*mat2[k][j];
                 printf("iterals: %d, %d, %d\t", i, j, k);
                 printf("mat1[%d][%d] = %f\t", i, k, mat1[i][k]);
                 printf("mat2[%d][%d] = %f\t", k, j, mat2[k][j]);
                 printf("dest[%d][%d] = %f\n", i, j, dest[i][j]);
             }
         }
     }
 }


int main() {
    float res[6][6] = { 0 };

    float G[6][3] =  { {10,  0,  0},
                      { 0,  0,  0},
                      { 0, 20,  0},
                      { 0,  0,  0},
                      { 0,  0, 30},
                      { 0,  0,  0} };

    float H[3][6] =  { {1, 0, 0, 0, 0, 0},
                      {0, 0, 1, 0, 0, 0},
                      {0, 0, 0, 0, 1, 0} };

    prod(G, H, res, 6, 3, 6);
}