A quantum entangled C++ program?
...run it and see whether or not history changes as a result.
Is this a situation akin to the Story of Mel, or just poorly written code?
Then you have my sympathies.
...my first step when dealing with poorly written C code is to run it through some sort of autoindenter. Makes it _way_ easier to figure out what's up.
Second step generally involves cautious use of text output statements (printf or cout, either will do) to check on values of the variables mid-run.
...do you know which variables need to be changed to do X?
Then a text search for that variable name might reveal the function that does X.
And a text search for that function's name through the signal handling bit might reveal which signal triggers it.
...maybe?
all the control flow is done through signals, except... when it's not.
I can't even figure out how this fucking loop runs aaaaaaaaaaaaaaa