Microsoft weighs TikTok purchase as ad business flattens out