<s>[INST] integrate $\int \frac{x^4-16}{x^3+4x^2+8x}dx$ 
$$\int \frac{x^4-16}{x^3+4x^2+8x}dx$$

So I first started with be dividing $p(x)$ with $q(x)$ and got:
$$\int x-4+\frac{8x^2+32x-16}{x^3+4x^2+8x}dx=\frac{x^2}{2}-4x+\int \frac{8x^2+32x-16}{x^3+4x^2+8x}dx$$ 
Using partial sum I have received:
$$\int \frac{8x^2+32x-16}{x^3+4x^2+8x}dx=8\int -\frac{1}{4x}+\frac{5x}{4(x^2+4x+8)}+\frac{5}{x^2+4x+8} dx=-2ln|x|+8(\frac{5}{4}\int\frac{x}{(x^2+4x+8)} +5\int \frac{1}{x^2+4x+8})=-2ln|x| +10\int\frac{x}{(x^2+4x+8)}dx +40\int \frac{1}{x^2+4x+8}dx$$ 
How do I continue from here?
 [/INST] 
$\displaystyle \int \dfrac{1}{x^2+4x+8}dx$
How do I continue from here?

Observe that by writing
$$
x^2+4x+8=(x+2)^2+4
$$ and by making the change of variable
$$
t=2(x+2), \quad dx=\frac12dt, \quad x^2+4x+8=4(t^2+1)
$$ you are led to evaluate
$$
\int \dfrac{1}{x^2+4x+8}dx=\frac18\int\frac1{t^2+1}dt
$$ which is classic.

$\displaystyle \int \dfrac{x}{x^2+4x+8}dx$
How do I continue from here?

One may write
$$
 \int \dfrac{x}{x^2+4x+8}dx= \frac12\int \dfrac{2x+4}{x^2+4x+8}dx-2\int \dfrac{1}{x^2+4x+8}dx
$$that is $$
 \int \dfrac{x}{x^2+4x+8}dx=\frac12 \int \dfrac{(x^2+4x+8)'}{x^2+4x+8}dx-2\int \dfrac{1}{x^2+4x+8}dx
$$ then conclude with the first part.
</s>