Cop, for whatever reason, decides to stop suspect and talk to him.
Cop asks a few 'cop questions' such as 'where are you coming from/going to'.
Cop, for whatever reason, isn't entirely satisfied. Maybe the suspect seems jittery or the suspect is a wiseass, or tells the cop he's going shoe shopping for his daughter, or to see a movie. Doesn't matter.
Cop decides he's going to get out of his patrol car, search suspect, get ID.
Cop SHOULD have told suspect not to move and to keep his hands where they can be seen.
Suspect knows once Cop finds his weapon he's going to be detained and possibly arrested.
Cop, as he is exiting his vehicle, doesn't keep constant attention on suspect allowing suspect to get the drop on him.
Cop gets no further than the front fender of his vehicle when suspect unloads on him from less than 10 feet away.
Poor dumb cop.