In discussion of the meaning of the Second Amendment, much hinges on that first clause.
A well regulated militia being necessary to the security of a free state, the right of the people to keep and bear arms shall not be infringed.
So what does “a well regulated militia” mean? If only the Framers had explained.
I give you Article I, Section 8 of the United States Constitution:
The Congress shall have Power ....
To provide for calling forth the Militia to execute the Laws of the Union, suppress Insurrections and repel Invasions;
To provide for organizing, arming, and disciplining, the Militia, and for governing such Part of them as may be employed in the Service of the United States, reserving to the States respectively, the Appointment of the Officers, and the Authority of training the Militia according to the discipline prescribed by Congress;
I give you Article II, Section 2 of the United States Constitution:
The President shall be Commander in Chief of the Army and Navy of the United States, and of the Militia of the several States, when called into the actual Service of the United States;
That settles things decisively, does it not? Contra many gun regulation opponents' fantasies, the armed militia described in the Second Amendment is not meant to protect private gun ownership or to equip the populace to overthrow a tyrannical government. Indeed, let's look again at a key bit of I:8 —
The Congress shall have Power .... to provide for calling forth the Militia to ... suppress Insurrections
The militia of the Second Amendment is not meant to engage in an insurrection against the government, it is meant to fight such insurrections: the militia is an instrument of the Federal government.
The canard that the Second Amendment enables the American people to defend themselves against government tyranny is instructively half true. You can see in the quotes from the Constitution above that the Second Amendment was part of a coherent plan by the Founders to keep the United States from having a standing army which threatens the populace.
Here's another clause from Article I Section 8 which is relevant which grants Congress the power:
To raise and support Armies, but no Appropriation of Money to that Use shall be for a longer Term than two Years;
Short pursestrings to keep the Army in check.
Reading the Federalist Papers, one sees that many commentators at the time regarded the Constitution as too weak a safeguard against the threat of standing armies; Alexander Hamilton is eloquent in his argument that this anxiety was understandable, given what people had seen with the monarchies of Europe, but that the awesome new principle of liberal democracy enshrined in the Federal government as described in the Constitution was going to keep the army from being a problem.
A nation without a standing army seemed sensible to many people in late 18th century circumstances, but it just didn't work out that way. It quickly became apparent that it would be difficult for the US to operate without a standing army at all. In keeping with the principle, though, between wars the army was drawn down to a small size ... until the Cold War era, which ballooned the “peacetime” military, largely out of the recognition that in the era of mechanized warfare a well-prepared nation had a major advantage. (Plus there was the drive for American global hegemony, y'know.)
Since the no-standing-army policy proved impractical, the US has developed a range of other practices meant to counter the familiar dangers. Civilian control of the military is maintained through our institutions and our military culture. We keep a sharp distinction between police and military jurisdictions. We use volunteer citizen-soldiers. And so on.
There are reasons to worry, as the anti-Federalists did over two centuries ago, that these aren't safeguards enough ... but we should be comforted somewhat by the degree to which our society keeps its attention on these questions. We should watch out for how our military has the potential to become a threat to popular sovereignty and we should scrutinize our institutions to ensure that they protect against that. But opposing gun control is not an effective tool in that project. Access to handguns and semiautomatic rifles isn't going to do us much good in the implausible event that the weight of the US military were to be turned against the American people; instead, we should be working to ensure that the military is not used as an instrument of tyranny in the first place.
There are arguments to be made for the value of protecting access to private gun ownership. But saying that the Second Amendment guarantees it as a way of ensuring that the People can revolt against the Government is not one of them.