The largest U.S. energy companies reported their lowest second-quarter profits in years, as tariffs have weighed on oil prices.