How do I get the result of an instruction?

Thanks Eli!
But I still have a question. What you have written is in IR. When I am writing the pass, I donot have access to the result of the instruction (%resulttoprint in your example). All I have is a Instruction* right? So, how do I get the result of the instruction? Am I missing something here?

Thanks,
Bhavani