FIRST AMENDED AND RESTATED REGISTRATION AND INVESTOR RIGHTS AGREEMENT