"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."
The first part, phrases 1 and 2, tell you why we have the second amendment. The second part, phrases 3 and 4 tell you how it is done.
If the government tells you that you can't buy a particular kind of arm, be it a sword, a crossbow, a knife, or any kind of gun, they are infringing on your right to keep arms. If the government tells you where you can or cannot carry any weapon you own, then they are infringing on your right to bear arms. There are NO legal gun laws in this country.