How the energy giants tried to transform their businesses — but ended up dramatically scaling back those plans and writing off billions of dollars