Firstly, the article doesn't mention speculative execution - it refers to a programming technique which is effectively (assume f,g,h are arithmetic functions, not 'program' functions):
compute f
while f is in the pipeline, compute g
while g is in the pipeline, compute h
let bits = 111111..111 if h is true or 00000...000 if h is false
let result = (f & bits) | (g & ~bits)
In your example, if they're function calls, and not inlined, then they won't execute speculatively
at all: speculative execution usually only applies to straight-line instructions and in any case only applies to letting the instruction go off into an "execution" unit. Only one branch should ever make it into the "commit" phase of the pipeline (think like a database commit), and only one should ever have effects that are visible off the processor die.
Also things like system calls, interrupts, context switches, and so on tend to flush the pipeline and insert a "barrier", at which point all the instructions before the barrier have committed and none of the ones after the barrier have committed.