(d) This Section does not apply to or affect any of the following:
(1) Peace officers as defined in Section 2-13 of this Code and retired peace officers not otherwise prohibited from receiving a firearm, in possession of a semi-automatic assault weapon, assault weapon attachment, or .50 caliber rifle transferred to the retired peace officer by his or her law enforcement agency upon retirement.
(2) Wardens, superintendents, and keepers of prisons, penitentiaries, jails, and other institutions for the detention of persons accused or convicted of an offense.
(3) Members of the Armed Services or Reserve Forces of the United State or the Illinois National Guard, while in the performance of their official duties or while traveling to or from their place of duty.
(4) Manufacture, transportation, or sale of weapons, attachments, or ammunition to persons authorized under subdivisions (1) through (3) of this subsection to possess those item