Code:
relay5_rev = p3_sw_aux1;
relay5_rev = p4_sw_aux1;
The first assignment sets the value based on the switch on port 3. The second assignment then sets the value based on the switch on port 4, regardless of what the first assignment did.
p3_sw_aux1 is completely irrelevant to the final result.
You need to set the value based on a combination of the two switches. The
| "or" operator will return a value of zero if both its operands are zero, and a value of one if either or both are one.
Code:
relay5_rev = p3_sw_aux1 | p4_sw_aux1;