Decomposition of rational functions