How to integrate $\int \frac{\cos x}{\sqrt{\sin2x}} \,dx$? 
How to integrate $$\int \frac{\cos x}{\sqrt{\sin2x}} \,dx$$ ?

I have:
$$\int \frac{\cos x}{\sqrt{\sin2x}} \,dx = \int \frac{\cos x}{\sqrt{2\sin x\cos x}} \,dx = \frac{1}{\sqrt2}\int \frac{\cos x}{\sqrt{\sin x}\sqrt{\cos x}} \,dx = \frac{1}{\sqrt2}\int \frac{\sqrt{\cos x}}{\sqrt{\sin x}} \,dx = \frac{1}{\sqrt2}\int \sqrt{\frac{\cos x}{\sin x}} \,dx = \frac{1}{\sqrt2}\int \sqrt{\cot x} \,dx \\
t = \sqrt{\cot x} \implies x = \cot^{-1} t^2 \implies \,dx = -\frac{2t\,dt}{1 + t^4}$$
so I have:
$$-\sqrt2 \int \frac{t^2 \,dt}{1 + t^4}$$
I tried partial integration on that but it just gets more complicated. I also tried the substitution $t = \tan \frac{x}{2}$ on this one: $\frac{1}{\sqrt2}\int \sqrt{\frac{\cos x}{\sin x}} \,dx$
$$= \frac{1}{\sqrt2}\int \sqrt{\frac{\frac{1 - t^2}{1 + t^2}}{\frac{2t}{1+t^2}}} \frac{2\,dt}{1+t^2} = \frac{1}{\sqrt2}\int \sqrt{\frac{1 - t^2}{2t}}  \frac{2\,dt}{1+t^2} = \int \sqrt{\frac{1 - t^2}{t}}  \frac{\,dt}{1+t^2}$$
... which doesn't look very promising.
Any hints are appreciated! 

Having it the form of one polynomial divided by another should suggest one method, ugly though it may be: partial fractions.  We have $1+t^4=1+2t^2+t^4-2t^2=(t^2+1-t\sqrt2)(t^2+1+t\sqrt2)$
