Do building codes allow smaller nails when using gun instead of manually hammering?
Fastening schedules are quite straight forward. You look up what you're connecting together, and it tells you what size fastener to use, how many to use, the spacing between fasteners, and where the fastener should go.  There are no exceptions based on how the fastener is driven.

For example:

According to International Residential Code 2012, if you're going to end nail a top or sole plate to a stud, you'll use 2 16d (3 1/2″ × 0.135″) nails.