You have a 1st Amendment right to swear at a cop, but it's a stunningly stupid thing to do. They have badges and guns and color of authority, and can arrest you for disturbing the peace and any number of other offenses. If they fear for their lives, they can use a stun gun or baton or gun on you, and ask questions later. Find some other way to express yourself.
Disclaimer: Please note that this answer does not constitute legal advice, and should not be relied on, since each state has different laws, each situation is fact specific, and it is impossible to evaluate a legal problem without a comprehensive consultation and review of all the facts and documents at issue. This answer does not create an attorney-client relationship.
Incredible. Assuming some attorney were stupid enough to answer your question seriously, you'd be happy to sue him or her when it went wrong, wouldn't you? Cuz, after all, it wouldn't be YOUR fault, would it?