\[ \int (d+e x)^m (f+g x)^2 \left (a+b x+c x^2\right )^2 \, dx \]
Optimal antiderivative \[ \frac {\left (a \,e^{2}-b d e +c \,d^{2}\right )^{2} \left (-d g +e f \right )^{2} \left (e x +d \right )^{1+m}}{e^{7} \left (1+m \right )}-\frac {2 \left (a \,e^{2}-b d e +c \,d^{2}\right ) \left (-d g +e f \right ) \left (c d \left (-3 d g +2 e f \right )-e \left (a e g -2 b d g +b e f \right )\right ) \left (e x +d \right )^{2+m}}{e^{7} \left (2+m \right )}+\frac {\left (c^{2} d^{2} \left (15 d^{2} g^{2}-20 d e f g +6 e^{2} f^{2}\right )+e^{2} \left (a^{2} e^{2} g^{2}+2 a b e g \left (-3 d g +2 e f \right )+b^{2} \left (6 d^{2} g^{2}-6 d e f g +e^{2} f^{2}\right )\right )+2 c e \left (a e \left (6 d^{2} g^{2}-6 d e f g +e^{2} f^{2}\right )-b d \left (10 d^{2} g^{2}-12 d e f g +3 e^{2} f^{2}\right )\right )\right ) \left (e x +d \right )^{3+m}}{e^{7} \left (3+m \right )}+\frac {2 \left (b \,e^{2} g \left (a e g -2 b d g +b e f \right )-2 c^{2} d \left (5 d^{2} g^{2}-5 d e f g +e^{2} f^{2}\right )+c e \left (2 a e g \left (-2 d g +e f \right )+b \left (10 d^{2} g^{2}-8 d e f g +e^{2} f^{2}\right )\right )\right ) \left (e x +d \right )^{4+m}}{e^{7} \left (4+m \right )}+\frac {\left (b^{2} e^{2} g^{2}+2 c e g \left (a e g -5 b d g +2 b e f \right )+c^{2} \left (15 d^{2} g^{2}-10 d e f g +e^{2} f^{2}\right )\right ) \left (e x +d \right )^{5+m}}{e^{7} \left (5+m \right )}+\frac {2 c g \left (b e g -3 c d g +c e f \right ) \left (e x +d \right )^{6+m}}{e^{7} \left (6+m \right )}+\frac {c^{2} g^{2} \left (e x +d \right )^{7+m}}{e^{7} \left (7+m \right )} \]
command
integrate((e*x+d)**m*(g*x+f)**2*(c*x**2+b*x+a)**2,x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {output too large to display} \]
Sympy 1.8 under Python 3.8.8 output \[ \text {Timed out} \]_____________________________________________________