Cops are in a fairly high risk occupation--for our benefit. I do not understand the need to treat them with anything but consideration and politeness. In my dozen or so encounters through the years I have carried, I have never had one that was aggressive or rude in return.
Put yourself in his place. He's seen the videos of cops getting shot in traffic stops, and maybe it has happened to someone he actually knows. Help him feel at ease.
1. Get off the cell phone and don't answer it if it rings. Turn off your car (and radio!). Put the keys on the dash. Have your driver's license, car registration, handgun permit (required to hand over in Utah), and insurance info (if required) where they are easily accessible so you don't have to jump around the interior of the car while he is calling in your plate or approaching your car. A lot of movement will make an officer suspicious as to what you are doing. I keep my permit behind my driver's license in my wallet, and the other papers stored right close to me (not over in the glove compartment).
2. Before he approaches, if you have electric windows, and especially if they are tinted, roll them all down, on all sides, even if it is cold. Turn on your interior lights if it is night time. This lets him see what is going on in the car with good lighting, which helps him to assess the situation as less of a personal threat. It also lets him know you are trying to cooperate, which goes a long way toward forming a good attitude toward you.
3. Stay in the car. Do not get out. Keep your hands where he can see them; on the steering wheel is best. Keep them there, with your paperwork in your left hand with your permit on top of your DL so it is the first thing he will see. Let him initiate the conversation. You don't need to volunteer any information, including about how fast you were going or what you may have done wrong. "I don't know," is always an acceptable response. Just be polite and follow his instructions. When he asks for your license and registration, slowly hand it to him, and put your hand back on the wheel.
4. He will next most likely ask you if you have your gun with you. Keeping your hands on the wheel, say, "Yes, sir," and tell him where it is. At this point, I have found it helpful to ask him, "What would you like me to do?"
5. Follow his instructions. He will most likely say, "That's fine. I'll be right back." You have given him a series of significant signals that should say you are not a threat; just a good guy going a little too fast. If he wants you to retrieve the gun, get out of the car, or make any other moves under his direction, do so deliberately and carefully and keep your hands where he can see them. (I have never had this happen).
If in any way you "cop an attitude", he may become a cop with an attitude, and he is likely to prevail, at least in the short term. He does have authority, which you have given him, and he wants to go home at the end of his shift. It isn't worth the hassle. Such stops can actually be rather pleasant encounters for both parties. At least that has been my experience as I have been let off with a warning more times than not, and he has thanked me for being cooperative and helpful.