  We completely classify the KMS states for the gauge action on a $C^*$-algebra
associated with a rational function $R$ introduced in our previous work. The
gauge action has a phase transition at $\beta = \log \deg R$. We can recover
the degree of $R$, the number of branched points, the number of exceptional
points and the orbits of exceptional points from the structure of the KMS
states. We also classify the KMS states for $C^*$-algebras associated with some
self-similar sets, including the full tent map and the Sierpinski gasket by a
similar method.
