Why does LLVM keep some loads in the loops even after applying the O3 optimization?

It probably thinks that the call to fprintf can clobber memory.