Rewrite as function

Otherwise simplify_for_constant_input does not work
12 jobs for improve_simplify in 13 minutes and 43 seconds (queued for 1 second)