Several thousand years ago, the planet Cybertron was consumed by a civil war by the two Transformer factions, the Autobots led by Optimus Prime and the Decepticons led by Megatron. Optimus jettisoned the AllSpark, a mystical artifact that brings life to the planet, into space, but Megatron pursued it. Megatron crashed in the Arctic Circle and froze, and was discovered in 1895 by explorer Archibald Witwicky. Witwicky activated Megatron s navigational system, which scanned the AllSpark s coordinates into his glasses. The glasses end up in the possession of his great-great-grandson Sam Witwicky. In the present, Sam buys his first car, a rusting Chevrolet Camaro, but discovers it has a life of its own.
In modern Qatar, Blackout attacks and destroys a United States military base in a failed attempt to hack the military network to find information on Megatron and the AllSpark. A team of soldiers led by Captain William Lennox escape across the desert, pursued by Blackout s drone Scorponok. They fight Scorponok off, aided by aerial reinforcements and travel home with Scorponok s stinger, discovering sabot rounds damaged the armor. At the Pentagon, Secretary of Defense John Keller leads the investigation into the attack. Sound analyst Maggie Madsen catches another Decepticon, Frenzy, hacking into the network while onboard Air Force One. While the hack is thwarted, Frenzy downloads files on Archibald s glasses, tracking down Sam with Barricade, disguised as a police car.
Sam and his high school crush Mikaela Banes are rescued by the Camaro who turns out to be Autobot scout Bumblebee, but he is mute and has to communicate through his car radio. Previously sending a beacon to his fellow Autobots, Bumblebee takes Sam and Mikaela to meet the new arrivals   Optimus, Jazz, Ironhide, and Ratchet. Optimus explains the details of their situation, revealing if Megatron gained the AllSpark he would transform Earth s machinery into a new army and exterminate mankind. Sam, Mikaela, and the Autobots travel to Sam s house to retrieve the glasses, but the teenagers are captured by agents of Sector Seven, a top secret government branch led by Seymour Simmons. The Autobots stop the agents, but Simmons calls for backup, who take Sam, Mikaela, and Bumblebee into custody with Optimus obtaining the glasses.
The respective groups connected to the Transformers are gathered together at Hoover Dam by Sector Seven s director Tom Banachek. Inside, the group discover the frozen Megatron and the AllSpark, but Frenzy, who smuggled away in Mikaela s bag, summons the other Decepticons to attack. Bumblebee is released to protect the AllSpark, shrinking it down to a handheld size so it can be transported to safety. Megatron escapes the dam after thawing out. A lengthy battle occurs in Mission City (but was clearly filmed in Los Angeles), with most of the Decepticons being killed, but Megatron murders Jazz. He prevents Sam s attempted escape with the AllSpark, and begins to fight Optimus. After a long brawl Megatron seems to get the upper hand. Optimus then tells Sam to push the cube into his chest, but Sam rams it into Megatron's chest instead, extinguishing his spark. Starscream is the only Decepticon to escape, but Barricade remains on Earth.
Optimus salvages a shard of the AllSpark from Megatron s body. The United States government shuts down Sector Seven, disposing of the dead Decepticons in the Laurentian Abyss. Sam and Mikaela then start a relationship while the Autobots secretly hide out on Earth, Optimus sends a transmission into space inviting any surviving Autobots to join them.
Output: Who led the Decepticons during the civil war that consumed the planet Cybertron several thousand years ago?