compiler: optimize applies