Touch each pair combination in the right side cable with a multimeter set on Ohms - you will hear a definite "click" when you touch the earpiece wires.
The other two will 99% be the mic. The button generally just shorts out the mic, so the same two wires - the device it's plugged in to detects the button by monitoring the voltage across the mic, which has a voltage feed through a resistor in the device.
edit - The mic and earpiece grounds are separate in properly designed stuff, so any voltage drop on the earpiece ground is not added in to the mic audio.