Solution (source code)

= Solution
{c}

Let $b=\pi/4$ and introduce
$$
J(x)=\int_0^b e^{ixt^2}\tan^2t\,dt,\qquad I(x)=\operatorname{Re}J(x).
$$
Deform the <contour> upward to the <steepest descent contour> $t=e^{i\pi/4}r$ from zero and the endpoint path $t=(b^2+is)^{1/2}$ from $b$. More precisely the original integral is the first path traversed forward minus the endpoint path traversed forward. Connect the truncated paths where $\operatorname{Im}(t^2)=R$ and let $R\to\infty$. That connector has exponentially small factor $e^{-xR}$, and no <pole> of $\tan t$ is crossed: all its <poles> are real and outside the original segment.

On the first path $\tan^2t=t^2+O(t^4)$, so its leading contribution is
$$
J_0(x)=e^{3i\pi/4}\int_0^\infty r^2e^{-xr^2}\,dr
+O(x^{-5/2})
=e^{3i\pi/4}\frac{\sqrt\pi}{4x^{3/2}}
+O(x^{-5/2}).
$$
The last equality follows by $u=xr^2$, $\Gamma(3/2)=\sqrt\pi/2$.

On the endpoint path $dt=i\,ds/(2\sqrt{b^2+is})$, and $\tan^2b=1$. Its negative orientation gives the leading endpoint term
$$
J_b(x)=-i e^{ixb^2}\int_0^\infty
e^{-xs}\frac{\tan^2\sqrt{b^2+is}}{2\sqrt{b^2+is}}\,ds
=-\frac{i e^{ixb^2}}{2bx}+O(x^{-2}).
$$
Taking real parts and inserting $b=\pi/4$ gives
$$
\boxed{I(x)=\frac2{\pi x}\sin\!\left(\frac{\pi^2x}{16}\right)
-\frac{\sqrt{2\pi}}{8x^{3/2}}+O(x^{-2}).}
$$
The oscillatory first coefficient can vanish at particular values of $x$; the stated remainder still holds as an additive <asymptotic expansion>.

\Image[/past-exam-of-the-perturbation-methods-and-applied-complex-variables-course-of-the-university-of-oxford/2008-quadratic-descent.png]
{title=The quadratic phase descends from the stationary endpoint and from the nonstationary upper endpoint}