US bakery firm Flowers Foods posted a decline in second quarter profit, hit by higher commodity costs.