Two switches and two LEDs using 8051
The code may incorrectly assume buttons being active low if they actually are active high. The code can't know that, it just looks at the bit value and it may be incorrect.
But that is how the code you wrote works - if either of the button bits are low, it sits in the corresponding button loop while it is low, or in other words, until it is high again without checking for the other button. If you want it to work differently, take paper and pen and design how it should work and then write it. Rarely any software is written first without thinking how it should work.