  We investigate general semilinear (obstacle-like) problems of the form
$\Delta u = f(u)$, where $f(u)$ has a singularity/jump at $\{u=0\}$ giving rise
to a free boundary. Unlike many works on such equations where $f$ is
approximately homogeneous near $u = 0$, we work under assumptions allowing for
highly oscillatory behavior.
  We establish the $C^\infty$ regularity of the free boundary $\partial
\{u>0\}$ at flat points. Our approach is to first establish that flat free
boundaries are Lipschitz, using a comparison argument with the Kelvin
transform. For higher regularity, we study the highly degenerate PDE satisfied
by ratios of derivatives of $u$, using changes of variable and then the
hodograph transform. Along the way, we prove and make use of new
Caffarelli-Peral type $W^{1, p}$ estimates for such degenerate equations. Much
of our approach appears new even in the case of Alt-Phillips and classical
obstacle problems.
