> do you have any links providing examples on how to do it in Nim?
I am not sure what you are asking. It is an optimization, and as such it should be invisible in frontend (i.e Nim) code. It is the task of a compiler backend to implement it, not something you do by hand. Or maybe I just misunderstood the question?