double __attribute__((no, noclone)) test_double(double *x, double *y) {
  double res = 0;
  for (int i = 0; i < 200; ++i) {
    x[i] = i;
    res += y[i];
  }
  return res;
}


x86 assembly (clang, -O0):
<test_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xc8,-0x1c(%rbp)
jge    115f <test_double+0x5f>
cvtsi2sdl -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111b <test_double+0x1b>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_double>:
xorpd  %xmm0,%xmm0
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
addsd  (%rsi,%rax,8),%xmm0
lea    0x1(%rax),%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movsd  %xmm1,0x8(%rdi,%rax,8)
addsd  0x8(%rsi,%rax,8),%xmm0
lea    0x2(%rax),%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movsd  %xmm1,0x10(%rdi,%rax,8)
addsd  0x10(%rsi,%rax,8),%xmm0
lea    0x3(%rax),%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movsd  %xmm1,0x18(%rdi,%rax,8)
addsd  0x18(%rsi,%rax,8),%xmm0
add    $0x4,%rax
cmp    $0xc8,%rax
jne    1110 <test_double+0x10>
ret

LLVM IR (-O0):
define double @test_double(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
store double 0.000000e+00, double* %5
store i32 0, i32* %6
br label %7
7: ; preds = %24, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 200
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load i32, i32* %6
%12 = sitofp i32 %11 to double
%13 = load double*, double** %3
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
store double %12, double* %16
%17 = load double*, double** %4
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = load double, double* %5
%23 = fadd double %22, %21
store double %23, double* %5
br label %24
24: ; preds = %10
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %7
27: ; preds = %7
%28 = load double, double* %5
ret double %28
}

LLVM IR (-O2):
define double @test_double(double* nocapture writeonly %0, double* nocapture %1) {
br label %4
3: ; preds = %4
ret double %33
4: ; preds = %4, %2
%5 = phi i64 [ 0, %2 ], [ %34, %4 ]
%6 = phi double [ 0.000000e+00, %2 ], [ %33, %4 ]
%7 = trunc i64 %5 to i32
%8 = sitofp i32 %7 to double
%9 = getelementptr inbounds double, double* %0, i64 %5
store double %8, double* %9
%10 = getelementptr inbounds double, double* %1, i64 %5
%11 = load double, double* %10
%12 = fadd double %6, %11
%13 = or i64 %5, 1
%14 = trunc i64 %13 to i32
%15 = sitofp i32 %14 to double
%16 = getelementptr inbounds double, double* %0, i64 %13
store double %15, double* %16
%17 = getelementptr inbounds double, double* %1, i64 %13
%18 = load double, double* %17
%19 = fadd double %12, %18
%20 = or i64 %5, 2
%21 = trunc i64 %20 to i32
%22 = sitofp i32 %21 to double
%23 = getelementptr inbounds double, double* %0, i64 %20
store double %22, double* %23
%24 = getelementptr inbounds double, double* %1, i64 %20
%25 = load double, double* %24
%26 = fadd double %19, %25
%27 = or i64 %5, 3
%28 = trunc i64 %27 to i32
%29 = sitofp i32 %28 to double
%30 = getelementptr inbounds double, double* %0, i64 %27
store double %29, double* %30
%31 = getelementptr inbounds double, double* %1, i64 %27
%32 = load double, double* %31
%33 = fadd double %26, %32
%34 = add nuw nsw i64 %5, 4
%35 = icmp eq i64 %34, 200
br i1 %35, label %3, label %4
}