Devon Energy posts quarterly profit versus year-ago loss