Asymptotic analysis of chattering oscillations for an impacting inverted pendulum