[X86] Make sure startproc/endproc are paired
We used different conditions to determine if we should emit startproc vs
endproc. Use the same condition to ensure that they will always be
This fixes PR24374.
We should merge this to 3.7.1 if there's still time. It's been reported multiple times:
Is this OK to merge to the 3.7 branch?
Yes, we should merge this. LGTM!