A mathematical theory of global program optimization