If we don't flush the counters before fork, the counters of the execution up to the fork call will be added twice (by both processes).
This fixes https://bugs.llvm.org/show_bug.cgi?id=38180.
There's also another problem that probably should be fixed on the Clang/LLVM side but is not directly related to this patch (even though you can see its effects in the test): after fork there should be a separate block (right now everything in main in the test is in the same block).
func1 is executed once not twice.