Nonlinear geometric optics for contact discontinuities and shock waves in one-dimensional Euler system for gas dynamics