Translated IRK example to C++