Finding f such that f(f(x))=g(x) given g
Suppose $g(x)$ is a smooth increasing function defined for $x \ge 0$ such that $g(x) \ge x$ for all $x$. Does there exist a function $f$ with similar properties such that $f(f(x))=g(x)$ for all $x \ge 0$? (You can interpret "similar" as widely as you'd like - smoothness would be great, but even continuity would be nice)
I asked the question given these conditions on $g$ since it seems reasonable that they would produce a positive answer. However, I'm just as interested in the same question for more general classes of $g$. For example, suppose we only assume $g$ is continuous, or even measurable - can we find an $f$ with the same properties? And let's suppose we relax the requirement $g(x) \ge x$, etc (I included that because it helps ensure the existence of a set-theoretic $f$).
Under the given conditions, how many such $f$ exist?
I'm not entirely what the tag should be, so please feel free to edit it.