How to derive the total potential energy of the atmosphere?
First, let's acknowledge this fact: $$c_p=R+c_v \tag{1}$$,
where $R$ is the specific gas constant.
This means that $x=R/c_p$.
Rearranging the equation, we can see that $$P+I=\int{c_p\left(\frac{P}{P_{00}}\right)^{R/c_p}\Theta dM}\tag{2}$$
Notice that $\left(\frac{P}{P_{00}}\right)^{R/c_p}$ is the Exner function. By extension,$$P+I=\int{c_p T dM}\tag{3}$$ If we rearrange (1) we can get
$$P+I=\int{c_v T+RT dM}\tag{4}$$.
You observed correctly that $I=\int{c_v T}dM$. This leaves $$P=\int{RT dM}\tag{5}$$.
Using the ideal gas law,$$P=\int{P\alpha dM}$$, where $\alpha$ is specific volume. This makes (4) look like $$P+I=\int{c_v T+P\alpha dM}\tag{4}$$ which is just a restatement of the first law of thermodynamics: $\delta q = c_v dT + p d\alpha$