The problem was two co-routines using the same temporary registers and
expecting those temporary registers to be preserved across a Yield.  The
solution is to ensure that every co-routine has its own set of temporary
registers that are not shared with the main thread or other co-routines.

In the demonstration query shown in the problem description, each SELECT
statement is evaluated by a separate co-routine that includes an ORDER BY.
The main thread handles the UNION by running each co-routine long enough
to generate a single row, then choosing the smaller of the two
rows to output and running the corresponding co-routine to generate the
next row for that SELECT.  Each co-routine evaluates its query as a nested
loop with t0 being the outer loop and t1 being the inner loop.  The t0.a
and t0.b values are stored in temporary registers in the outer loop, and
those value are expected to remain intact even though a Yield occurs after
each iteration of the inner loop.  Prior to the fix of
check-in [ca72be8618e5d466] both co-routines were using the same temporary
registers for their t0.a and t0.b values, which means that running one
co-routine would disrupt the other.  After check-in [ca72be8618e5d466] the
two co-routines use different temporary registers for holding t0.a and
t0.b so they no longer interfere with one another.