Is $\int_0^a\frac{f(x)^2}{\int_0^x f(t)\,dt}\,dx\geq\int_0^a \frac{g(x)^2}{\int_{0}^{x}{g(t)}\,dt}\,dx.$? Suppose $f(x)\geq g(x)>0$ and that $f,g$ are suitably defined so that the integrals below make sense. I want to know if  
$$\int_0^a\frac{f(x)^2}{\int_0^x f(t)\,dt}\,dx\geq\int_0^a \frac{g(x)^2}{\int_{0}^{x}{g(t)}\,dt}\,dx.$$
I guess I'll need some assumption to take care of fact that the integrals are improper, as the denominators are zero when $x=0$. If needed, I can also assume that $f$ and $g$ are decreasing functions. 
I'm actually more interested in the discrete counterpart to this problem but was hoping that the continuous version might give some insights. Does this integral inequality resemble some other problem? What techniques are helpful for such problems. 

This is equivalent to write
\begin{align}
\int_0^a\frac{f(x)^2}{\int_0^x f(t)\,dt}\,dx-\int_0^a \frac{g(x)^2}{\int_{0}^{x}{g(t)}\,dt}\,dx \ge0
\end{align}
So,
\begin{align}
0 &\le\int_0^a\left[{\frac{f(x)^2}{\int_0^x f(t)\,dt} -\frac{g(x)^2}{\int_{0}^{x}{g(t)}\,dt} }\right]dx 
\\
&=\int_0^a\left[{\frac{f(x)^2\int_{0}^{x}{g(t)}\,dt-g(x)^2\int_{0}^{x}{f(t)}\,dt}{\int_0^x f(t)\int_{0}^{x}{g(t)}\,dt}} \right]dx \tag{1}
\end{align}
Setting $A:=\int_{0}^{x}{f(t)}\,dt$ and $B=\int_{0}^{x}{g(t)}\,dt$
thus (1) becomes
\begin{align}
0 &\le
 \int_0^a\left[{\frac{Bf(x)^2 -Ag(x)^2}{AB }} \right]dx \tag{2}
\end{align}
which holds if and only if $ Bf(x)^2 -Ag(x)^2 >0$ and $AB>0$ or
$ Bf(x)^2 -Ag(x)^2 <0$ and $AB<0$.
Obliviously, we can conclude that the primary assumptions are the both quantities are positive (negative) and $f,g$ continuous.
Thus, from (2)
\begin{align}
0 &\le
 \int_0^a\left[{\frac{Bf(x)^2 -Ag(x)^2}{AB }} \right]dx
\\
&=\int_0^a\left[{\frac{\left(\sqrt{B}f(x) -\sqrt{A}g(x)\right)\left(\sqrt{B}f(x)+\sqrt{A}g(x)\right)}{AB }} \right]dx
\end{align}
Without loss of generality assume $A,B>0$ thus 
\begin{align}
\left(\sqrt{B}f(x) -\sqrt{A}g(x)\right)\left(\sqrt{B}f(x)+\sqrt{A}g(x)\right) >0
\end{align}
which means that $\sqrt{B}f(x) -\sqrt{A}g(x)>0$ or we write $\sqrt{B}f(x) >\sqrt{A}g(x)$ i.e., it is enough to assume  $f>g$ for all $x$.
The summary of assumptions is that $f,g$ non-zero, positive, continuous functions on $[0,\infty)$  (or integrable, so far is enough) and $f>g$. To guarantee the imroper integrals, $f,g$ must be bounded as $x\to \infty$.
Let me know if i missed something. 
