nested loops in atmel studio 7