Yates (Mark Ruffalo) goes to the Warden and tells him that Irwin is planning a coup that day. While the men are in the yard, Irwin summons all his men to toss the cells, but has fallen into a trap -
Irwin has hidden weapons and gas canisters (!) and other unbelievable stuff under the wall they have been rebuilding in the yard. They lock the doors, and then start to take out the towers, using dinner trays as shields. The water cannon is brought in, but they manage to turn off the water.
Next, Irwin somehow has a trebuchet at his disposal, and launches large rocks at Winter's office. The attack chopper shows up and starts taking out men, but the felons manage to take it out using the water cannon they've commandeered.
Winter gets the upper hand though when his men finally get out to the walls, and take aim with live rounds. General Wheeler is on his way, and if Irwin can hold out then Winter will be relieved of his command.
The men stand strong, but Irwin would massacre them so Irwin takes it on himself to take the flag, which Yates stole earlier, and approach the flagpole. Irwin commands his men to shoot, but they lower their weapons.
Winter thinks Irwin will raise the flag upside down, apparently a sign of distress (doesn't work too well on most European flags!), so takes out his gun and shoots him. Irwin hangs on to the ropes and pulls up the flag to unveil the flag the right way up. People salute him as a hero as he dies needlessly, but at least Winter (who wasn't that bad really) will be replaced by someone else (who is probably worse).
Later, when rebuilding the wall, his name is engraved onto one of the bricks.