Since $I=\lim\limits_{x\to\infty}\int_0^x f(t)\,dt$ exists finite, you have $\limsup\limits_{x\to\infty} f(x)\ge0$ and $\liminf\limits_{x\to\infty} f(x)\le 0$.
Assume as a contradiction that $\limsup\limits_{x\to\infty} f(x)>0$. Since $\liminf\limits_{x\to\infty} f(x)\le 0$, you have that $f'(x)$ is negative in at least one point (actually, it must be frequently negative as $x\to\infty$). Therefore, $$A=\inf_{x> 0} f'(x)<0$$
Again, since $\liminf\limits_{x\to\infty} f(x)\le 0<\limsup\limits_{x\to\infty} f(x)$ and $f$ is continuous, there is a positive real number $M$ such that $f(x)=M$ frequently often as $x\to\infty$. Id est, there is a sequence $x_n\to\infty$ such that $f(x_n)=M$.
By Lagrange theorem, $$\begin{align}&f(x)\ge A(x-x_n)+M&\text{if }x>x_n\\\end{align}$$
A fortiori, this holds for $x_n< x
Hence, $$\int_{x_n}^{x_n-\frac MA}f(t)\,dt\ge \left[\frac A2t^2+(M-Ax_n)t\right]^{x_n-\frac MA}_{x_n}=-\frac{M^2}{2A}$$
But $x_n-\frac MA\stackrel{n\to\infty}\longrightarrow \infty$ and $$\liminf\limits_{n\to\infty}\int_0^{x_n-\frac MA}f(t)\,dt=\liminf\limits_{n\to\infty}\left(\int_0^{x_n}f(t)\,dt+\int_{x_n}^{x_n-\frac MA}f(t)\,dt\right)=\\=\lim\limits_{n\to\infty}\int_0^{x_n}f(t)\,dt+\liminf\limits_{n\to\infty}\int_{x_n}^{x_n-\frac MA}f(t)\,dt\ge I-\frac{M^2}{2A}>I$$
Which contradicts $\lim\limits_{x\to\infty} \int_0^x f(t)\,dt=I$. Therefore it must hold $\limsup\limits_{x\to \infty}f(x)\le0$ and, hence, $=0$.
Now, by using the previous result on $g=-f$ (which satisfies the hypothesis of the theorem), we obtain that $$0\ge\limsup\limits_{x\to\infty} g(x)=-\liminf\limits_{x\to\infty} f(x)$$
So $\liminf\limits_{x\to\infty}f(x)\ge 0$ as well. Hence $\liminf\limits_{x\to\infty} f(x)=0$.
This proves that $\lim\limits_{x\to\infty} f(x)=0$.