It should have ended with Prime becoming evil.
Ancient Prime Spirits: Unite the matrix of power with the spark in his chest but....
Sam: but what?
Ancient Prime Spirits: but we can't gaurantee that it will actually work.
Sam: You can't gaurantee that it will actually work?
Ancient Prime Spirits: No, it was never properly tested so we don't actually know what will happen. The Optimus that you loved may not be the same Optimus that returns from the dead after he absorbs the raw power, plus your taking advice from dead guys during a near death experience, so enter the matrix of power into his chest at your own risk.
Sam: Inserts the matrix of power into Optimus's chest, Optimus your alive & see's Optimus' blue eyes turn red & yells "Oh ****" & runs away.
Optimus: Stands up & says, call me Prime Evil & begins upgrading his own self with dead decepticon parts & flys to the Pyramid.
The Fallen: Optimus, Your alive!
Optimus: Call me Prime Evil & there can be only one.
The Fallen: There can be only one what?
Optimus: There can be only one Evil Prime. Prime Evil & The Fallen start fighting & later Prime Evil decapitates The Fallen & absorbs all of his power.
The movie ends with a cliffhanger where Prime Evil is fighting with the remaining decepticons & autobots.