We can start from the given
#f(x)=int(x*sin x-cos 4x)*dx# also if when #f(pi)=-2#
Integrating by Parts
#int u*dv=uv-int v*du#
#color(red)(int(x*sin x)dx)#
let #u=x#
let #dv=sin x *dx#
let #v=-cos x#
let #du=dx#
#int u*dv=uv-int v*du#
#int(x)(sin x*dx)=x*(-cos x)-int(-cos x)*dx#
#int(x*sin x)dx=-x cos x+sin x#
Integrating the #int cos 4x dx#
#color(red)(int cos 4x dx)#
#int cos 4x dx=1/4 int cos 4x*4*dx=1/4*sin 4x#
Let us have now the complete integration
#f(x)=int(x*sin x-cos 4x)*dx#
#f(x)=-x cos x+sin x-1/4*sin 4x+C#
But #f(pi)=-2#
#f(x)=-x cos x+sin x-1/4*sin 4x+C#
#f(pi)=-(pi) cos (pi)+sin (pi)-1/4*sin 4(pi)+C#
#-2=-(pi) (-1)+(0)-1/4*(0)+C#
#-2=pi+0-0+C#
#C=-pi-2#
Final answer
#color(red)(f(x)=-x cos x+sin x-1/4*sin 4x-pi-2)#
God bless....I hope the explanation is useful.