The immediate reason that "memset" is being called in your assembly is that the MSVC compiler noticed your loop is functionally identical to a standard memory-set operation and replaced it to save space under /O1.