diff --git a/files/mockup_prelude.cc b/files/mockup_prelude.cc
index c5f9e39bb142a15df8024c541b7ba0dd7838115b..2e668c0fd5c7dd91b129ba2e38f4a8c90e2f795b 100644
--- a/files/mockup_prelude.cc
+++ b/files/mockup_prelude.cc
@@ -1,6 +1,7 @@
 #include "os.h"
 #include "test/test.h"
 #include "machine.h"
+#include "arch/posix/irq.h"
 #include <stdio.h>
 
 extern "C" {
@@ -8,6 +9,11 @@ extern const uint32_t _sdata_os_canonical, _edata_os_canonical;
 extern const uint32_t _sdata_arch_canonical, _edata_arch_canonical;
 }
 
+void do_trigger_interrupt(uint8_t i) {
+	Machine::trigger_interrupt_from_user(i);
+	arch::irq.clear_interrupts();
+}
+
 // **********************************************************************
 // Murmur3 implementation
 //
@@ -99,6 +105,10 @@ uint32_t hash_os_state() {
     return first_hash ^ second_hash;
 }
 
+namespace arch {
+	extern void *OS_H5_ip;
+}
+
 void hex_os_state() {
     const uint8_t *start = (const uint8_t*)&_sdata_os_canonical;
     const uint8_t *end = (const uint8_t*)&_edata_os_canonical;
diff --git a/src/CFG/C.hs b/src/CFG/C.hs
index 0851f771b22cd273821c3b3898782f149251bca6..b7915fe31bc112597ae94dd8b3138bb46d046fe4 100644
--- a/src/CFG/C.hs
+++ b/src/CFG/C.hs
@@ -101,7 +101,7 @@ triggerInterrupts (Just ints) ident = do
           decision <- decisionNumber
           return $
             "  if (" <> decisionMaker decision <> ") {\n"
-            <> "    Machine::trigger_interrupt_from_user(" <> T.pack (show int) <> ");\n"
+            <> "    do_trigger_interrupt(" <> T.pack (show int) <> ");\n"
             <> "    _triggeredSomeInterrupt = 1;\n"
             <> "    " <> printOSState AtBasicBlockType ident "__func__" <> ";\n"
             <> "  }\n"