The Baltimore Orioles have signed Yovani Gallardo to a restructured two-year contract.

The deal is worth $22 million, according to a league source, and could end up being worth $33 million over three years.

The Orioles can buy out Gallardo for $2 million after two years, or pick up a club option for 2018 worth $13 million.

Gallardo and Baltimore had reportedly agreed to terms on a three-year contract worth $35 million on Saturday, but the deal stalled after the Orioles reviewed the right-hander's pre-signing physical.