for loop optimization for temperature.c