Stock market today: Stocks end higher as investors claw back most losses after big rout