Evaluating $\int e^{x\sin x+\cos x}\left(\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2 x}\right)dx$ Evaluate 

$$\displaystyle \int e^{x\sin x+\cos x}\left(\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2 x}\right)dx$$

$\bf{My\; Try::}$ 
Let $$\begin{align}I &= \int e^{x\sin x+\cos x}\left(\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2 x}\right)dx\\
&=\int e^{x\sin x+\cos x}\left(x^2\cos x+\frac{\cos x-x\sin x}{x^2\cos^2 x}\right)dx\\
&= \int x\cdot e^{x\sin x+\cos x}\left(x\cos x\right)dx+\int e^{x\sin x+\cos x}\left(\frac{\cos x-x\sin x}{x^2\cos^2 x}\right)dx\\
\end{align}$$
Now Let $x\sin x+\cos x = t\;,$ Then $x\cos x\,dx = dt$ and Integration by parts for $\bf{1^{st}}$ Integral
So $$\displaystyle I = x\cdot e^{x\sin x+\cos x}-\int e^{x\sin x+\cos x}dx+\int e^{x\sin x+\cos x}\left(\frac{\cos x-x\sin x}{x^2\cos^2 x}\right)dx$$
Now I do not understand how to solve after that.

Let $$\begin{align}I&= \int e^{x\sin x+\cos x}\left[\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2 x}\right]\mathrm d x\\
&= \int e^{x\sin x+\cos x}\left[\frac{\cos x - x \sin x + x^4 \cos^3 x}{x^2\cos^2x}\right]\mathrm d x\tag{1}\\
&=\int e^{x\sin x+\cos x} \left[ \frac{1}{x^2 \cos x} -\frac{\sin x}{x\cos ^2x}+x^2\cos x\right]\mathrm d x\tag{2}\\
&=\int e^{x\sin x+\cos x} \left[ \frac{1}{x^2 \cos x} -\frac{\sin x}{x\cos ^2x}+1+x^2\cos x-1\right]\mathrm dx\tag{3}\\
&=\int e^{x\sin x+\cos x} \left[ \left(\frac{1}{x^2 \cos x} -\frac{\sin x}{x\cos^2x}+1\right) +(x\cos x)\left(x-\frac{1}{x\cos x}\right)\right] \mathrm dx \tag{4} \\
\end{align}$$
Notice that
$$\frac{ \mathrm d }{ \mathrm d x }\left[x-
\frac{1}{x\cos x}\right]=\frac{1} { x^2\cos x } -\frac{\sin x}{x\cos^2x}+1$$
$$\frac{\mathrm d}{\mathrm dx}(x\sin x+\cos x)=x\cos x$$
Now use

$$\int e^t[ f ( t ) + f ' ( t ) ] \mathrm d t = e^t\cdot f(t ) +C$$

to get 

$$\int e^{x\sin x+\cos x}\left(\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2 x}\right)\mathrm d x=e^{x\sin x+\cos x}\left(x-\frac{1}{x\cos x}\right)+C$$

$\text{ Explanations }\\
1 .\text{ Rearranging terms}\\
2 .\text{ Seperating out terms}\\
3 .\text{ Adding zero}\\
4 .\text{ Grouping terms and factor }$
