After its near-death experience, the tech behemoth is profitable once more