This could be an issue with your skeleton.
Basically what you see oj the right leg is a candy wrapper effect due to over rotation.
As if the bones are flipped 360deg plus whatever the IK is computing.
The other leg just looks like bad paint. Unrelated parts being pulled by the rotation?