Here is the code I get from compiling your example with optimizations enabled:
(__TEXT,__text) section _main: 0000000100000f20 pushq %rbp 0000000100000f21 movq %rsp, %rbp 0000000100000f24 leaq 61(%rip), %rdi
Note that the loop does not even start - the compiler has completely optimized it, as it can say that the only destination c that matters is the last.
Unlike re-setting the commented line, the loop should execute, and the output code looks like this:
(__TEXT,__text) section _main: 0000000100000ea0 pushq %rbp 0000000100000ea1 movq %rsp, %rbp 0000000100000ea4 movss 148(%rip), %xmm5 0000000100000eac movl $100000000, %eax 0000000100000eb1 movsd 143(%rip), %xmm1 0000000100000eb9 movsd 143(%rip), %xmm2 0000000100000ec1 movsd 143(%rip), %xmm3 0000000100000ec9 movsd 143(%rip), %xmm4 0000000100000ed1 nopw %cs:(%rax,%rax) 0000000100000ee0 xorps %xmm0, %xmm0 0000000100000ee3 cvtss2sd %xmm5, %xmm0 0000000100000ee7 mulsd %xmm1, %xmm0 0000000100000eeb addsd %xmm2, %xmm0 0000000100000eef cvtsd2ss %xmm0, %xmm0 0000000100000ef3 cvtss2sd %xmm0, %xmm0 0000000100000ef7 movaps %xmm0, %xmm5 0000000100000efa mulsd %xmm3, %xmm5 0000000100000efe addsd %xmm4, %xmm5 0000000100000f02 decl %eax 0000000100000f04 cvtsd2ss %xmm5, %xmm5 0000000100000f08 jne 0x100000ee0 0000000100000f0a leaq 87(%rip), %rdi
Quite another, as you can see.
source share