DineEquity posts 2Q profit despite falling sales