You are free to talk shit to anyone you want in a bar; you are also free to get your ass kicked.
Antagonizing a cop just to be a dick will probably result in those minor charges he would have ignored if you were nice, getting written up with a smile on his face. That's 100% your fault in that case.
Differential punishment based on protected speech is not professional or in line with the Constitution.
That it may be difficult for a court to unambiguously distinguish this abuse of power from legitimate application of discretion doesn't mean that it is legitimate.
Reread what I said above...If you are being a dick because you want to "stick it to the man", well expect the man to stick it back to you and write you up for those petty offenses he would have otherwise ignored.
Problem there is often times people have recieved BS citations for "disturbing the peace" or other nonsense citations which plainly don't apply (i.e. because contempt of cop isn't a crime), but still result in court time and hassle for the accused.
Antagonizing a cop just to be a dick will probably result in those minor charges he would have ignored if you were nice, getting written up with a smile on his face. That's 100% your fault in that case.