Add gandalf.c (source: http://pastebin.com/raw.php?i=8BPCDc4i)