I was an officer in a Singapore prison for a few years. As part of the job I witnessed a few canings, which are a legal punishment here for some serious crimes.
I remember my very first time serving as a witness, there was a rapist who had been sentenced to 24 strokes of the cane - the legal maximum.
I expected to feel some schadenfreude, and I did, but after 9 strokes or so I was more shocked. He was howling with anguish like a demon in hell, and his ass was so severely gashed open I didn't think it could ever heal. How could it not even be halfway done? Would they really continue?
Well, they did. By the end he couldn't speak or walk. His butt looked like someone had scraped it off down to the bone and then burned it.
Definitely a strong motivation not to commit crime...