Consider 2 bodies of mass $m_1$ and $m_2$ at infinite separation. As these bodies approach each other, their gravitational potential energy is converted to kinetic energy and we let the bodies collide, the kinetic energy may be released in the form of heat. Let the bodies settle down and reach a stable state after colliding with each other. Let the system have lost energy equal to $E$ in the collision process. Let the mass of the combined system after the collision be $M$.
My question is, Does $m_1+m_2=M$? If not, does $m_1+m_2=M+\dfrac{E}{c^2}$? In other words, where does the energy $E$ show up from? Is it initially a part of $m_1$ and $m_2$? If we weigh the objects before and after the collision, will we see a difference in mass between the two states?