单项选择题

He quickly stepped on the brakes, and his car came to a stop just in time ()an accident.

A. to avoid
B.to be avoiding
C.to have avoided
D.to have been avoided