Used tmp in optimized program to avoid redundant loads/stores to matC