\[ \int (g \cos (e+f x))^p (a-a \sin (e+f x))^m (A m+A (1+m+p) \sin (e+f x)) \, dx \]
Optimal antiderivative \[ -\frac {A \left (g \cos \left (f x +e \right )\right )^{1+p} \left (a -a \sin \left (f x +e \right )\right )^{m}}{f g} \]
command
integrate((g*cos(f*x+e))^p*(a-a*sin(f*x+e))^m*(A*m+A*(1+m+p)*sin(f*x+e)),x, algorithm="giac")
Giac 1.9.0-11 via sagemath 9.6 output
\[ \text {output too large to display} \]
Giac 1.7.0 via sagemath 9.3 output \[ \text {Exception raised: NotImplementedError} \]_______________________________________________________