"could" and "should" are doing some very theoretical heavy lifting here.
Sure, at the limit, I agree with you, but in reality, relying on the compiler to do any optimization that you care about (such as inlining an indirect function call in a hot loop) is incredibly unwise. Invariably, in some cases it will fail, and it will fail silently. If you're writing performance critical code in any language, you give the compiler no choice in the matter, and do the optimization yourself.
I do generally agree that in the case of qsort, it's an API design flaw
> qsort, it's an API design flaw
It's just a generic sorting function. If you need more you're supposed to write it yourself. The C standard library exists for convenience not performance.