working c version of matrix multiply