Dinosaurs were declining before the asteroid impact, according to a new study