Fix range checks for valid CTT regions

Also workaround inlining issue with GCC. The change to
setinstancevariable is ugly, but effective.
Finally, collapse adjacent inline assembly into single blocks (gcc does
not guarantee their proximity), add dependencies on th and rsp to keep
the variables alive, and use __builtin_unreachable as a compiler hint.