split main.c, add irq function