Convert irq.cpp to C