I used to have the same problems and constipation will still haunt me if I do not watch my diet. Beans and broccoli would bloat me like a blimp so severely that I was in excruciating pain and I had to lay down and pass gas, huge amounts of gas.
After flushing my liver/gall bladder several times I can now eat both of them without any gas at all. I also take liver support herbs. There are many. Google for herbs that match your symptoms and make a list. But several and rotate.
You can say anything you want to say about me, but I am not FOS (full of shit) because I will wash it out with an enema before I will walk around all day in misery. Do not let it build up. Get the shit out.