Flexibility transitions and looped adsorption of wormlike chains