Add the debug_fprintf trick to alg.c

Signed-off-by: Andrew Tselischev <andrewtselischev@gmail.com>