finished ir code