void *alloc(int count, int size) {}

int *make_matrix(int init, int dimx, int dimy) {
    int *ret;
    int i, j;

    ret = alloc(dimx * dimy, 4);

    for (i = 0; i < dimx; i += 1) {
        for (j = 0; j < dimy; j += 1) {
            ret[i*10 + j] = init;
        }
    }

    return ret;
}

void main(void) {
    int *a1, *a2, *a;
    int dim, row, col, i;

    dim = 200;

    a1 = make_matrix(3, dim, dim);
    a2 = make_matrix(4, dim, dim);
    a = alloc(dim * dim, 4);

    /* matrix multiplication, with several common subexpressions */
    for (row = 0; row < dim; row += 1) {
        for (col = 0; col < dim; col += 1) {
            a[row*dim + col] = 0;
            for (i = 0; i < dim; i += 1) {
                a[row*dim + col] += a1[row*dim + i] * a2[i*dim + col];
            }
        }
    }
}

