I'm working on a problem in computer vision and I've ended up trying to minimize the functional $$\int \left[\lambda(S''(x))^2 + (f(x) - S(x))^2 \sum_k \delta (x - x_k)\right]dx$$
where $\lambda$ is a constant and, if it is relevant to you, $f(x)$ is the image plane. As an intermediary step it would be of great help if I could find the Euler-Lagrange equation for this optimization problem.
Your expression is equal to
$$ \int \lambda S\frac{d^4}{dx^4}S + (f-S)^2\sum_k \delta(x-x_k) dx $$
which gives the E-L equation
$$ \lambda\frac{d^4}{dx^4}S = (f-S)\sum_k \delta(x-x_k). $$
Also, integrating around some $x_k$ one gets
$$ \lambda \left( \frac{d^3S}{dx^3}(x_k^+)-\frac{d^3S}{dx^3}(x_k^-)\right)=f(x_k)-S(x_k) $$ which shows that the third derivative of $S$ is discontinuous.