proof of the second generalized mean value theorem for integrals

Let $f,g,g´$ be continous on $[a,b]$ and $g$ monotone on $[a,b]$; then there exist $c\in (a,b)$ so that $$\int_{a}^{b}f(x)g(x)dx=g(a)\int_{a}^{c}f(x)dx+g(b)\int_{c}^{b}f(x)dx$$

Ineed to apply the first generalized mean value theorem for integrals i.e. $$\int_{a}^{b}f(x)g(x)dx=f(c)\int_{a}^{b}g(x)dx$$ to $g´$and $\int_{a}^{x}f(x)dx$ but I don´t know how please I would appreciate your help

Let $\alpha=\int_0^x f$. Then you have $$\int_a^b g d\alpha=\alpha(b) g(b)-\alpha(a)g(b)-\int_a^b \alpha dg$$
By the generalized MVT, $$\int_a^b\alpha fg=\alpha(c)\int_a^b dg=\alpha(c) (g(b)-g(a))$$
Finally, grouping up we get $$\int_a^b gf=\int_a^b gd\alpha=(\alpha(b)-\alpha(c))g(b)+(\alpha(c)-\alpha(a))g(a)$$ which is what you want.