This code is part of a note about binary instrumentation and PIN tools. You can check the note here: Binary Instrumentation Using PIN