keep all four loops; optimize loop ordering; pad matrix