Problem with performance when using Stored Routines i.c.w. ORDER BY or Temp Table

I already posted my question on Stackoverflow:
http://stackoverflow.com/questions/19638949/mysql-query-slow-because-of-order-by-with-stored-functions

The problem appears when I try to use the results of the Stored functions in the ORDER BY. I also tried to store the result (without the ORDER BY) in to a temporary table, but ended up with the same result. The query runs fast if I remove the ORDER BY.

Any directions are very welcome, thanks!