Solution (source code)

= Solution

Condition on $S$ and use the characteristic function of a <standard normal distribution>:
$$
\mathbb E_Z[S^{iZ}\mid S]
=\mathbb E_Z[e^{iZ\log S}]
=e^{-(\log S)^2/2}
=G(S).
$$
The integrand has modulus one, so <Fubini's theorem> is immediate. Taking expectation over $S$ yields
$$
\boxed{\mathbb E[G(S)]=\mathbb E[M(iZ)].}
$$