Complex sentence: Proletarian internationalism was replaced with a national, independent foreign policy; if a socialist and non-socialist country were at war, North Korea could (in theory) support the non-socialist country if it benefited North Korea.
Split into simpler sentences: Proletarian internationalism was replaced with a national, independent foreign policy. For instance, if a socialist and a non-socialist countries were at war, North Korea could in theory support the non-socialist alternative as long as it strengthens North Korea.