(Filters) Rewrite dark.c so that it can be compiled by MSVC