Stability and instability of controlled motions of a two-mass pendulum of variable length