Magnetic flux ropes at the magnetopause and the associated cusp ion precipitation