void __attribute__((no, noclone))
test_double(double *__restrict r, double *__restrict a, double *__restrict b,
            double *__restrict c, int n) {
  for (int i = 0; i < n; ++i)
    r[i] = a[i] < 20 ? __builtin_fabs(b[i] - c[i]) : c[i];
}


x86 assembly (clang, -O0):
<test_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11a7 <test_double+0xa7>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  0xec5(%rip),%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    1175 <test_double+0x75>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xea9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1187 <test_double+0x87>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    111f <test_double+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_double>:
test   %r8d,%r8d
jle    114a <test_double+0x4a>
mov    %r8d,%r8d
xor    %eax,%eax
movsd  0xeee(%rip),%xmm0
movapd 0xef6(%rip),%xmm1
jmp    1133 <test_double+0x33>
nopl   0x0(%rax)
movsd  (%rcx,%rax,8),%xmm2
movsd  %xmm2,(%rdi,%rax,8)
add    $0x1,%rax
cmp    %rax,%r8
je     114a <test_double+0x4a>
ucomisd (%rsi,%rax,8),%xmm0
jbe    1120 <test_double+0x20>
movsd  (%rdx,%rax,8),%xmm2
subsd  (%rcx,%rax,8),%xmm2
andpd  %xmm1,%xmm2
jmp    1125 <test_double+0x25>
ret

LLVM IR (-O0):
define void @test_double(double* noalias %0, double* noalias %1, double* noalias %2, double* noalias %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %12
12: ; preds = %48, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %10
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %51
16: ; preds = %12
%17 = load double*, double** %7
%18 = load i32, i32* %11
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fcmp olt double %21, 2.000000e+01
br i1 %22, label %23, label %36
23: ; preds = %16
%24 = load double*, double** %8
%25 = load i32, i32* %11
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %9
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = fsub double %28, %33
%35 = call double @llvm.fabs.f64(double %34)
br label %42
36: ; preds = %16
%37 = load double*, double** %9
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
br label %42
42: ; preds = %36, %23
%43 = phi double [ %35, %23 ], [ %41, %36 ]
%44 = load double*, double** %6
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %43, double* %47
br label %48
48: ; preds = %42
%49 = load i32, i32* %11
%50 = add nsw i32 %49, 1
store i32 %50, i32* %11
br label %12
51: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @test_double(double* noalias nocapture writeonly %0, double* noalias nocapture %1, double* noalias nocapture %2, double* noalias nocapture %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = zext i32 %4 to i64
br label %10
9: ; preds = %25, %5
ret void
10: ; preds = %7, %25
%11 = phi i64 [ 0, %7 ], [ %28, %25 ]
%12 = getelementptr inbounds double, double* %1, i64 %11
%13 = load double, double* %12
%14 = fcmp olt double %13, 2.000000e+01
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = getelementptr inbounds double, double* %2, i64 %11
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %3, i64 %11
%19 = load double, double* %18
%20 = fsub double %17, %19
%21 = tail call double @llvm.fabs.f64(double %20)
br label %25
22: ; preds = %10
%23 = getelementptr inbounds double, double* %3, i64 %11
%24 = load double, double* %23
br label %25
25: ; preds = %22, %15
%26 = phi double [ %21, %15 ], [ %24, %22 ]
%27 = getelementptr inbounds double, double* %0, i64 %11
store double %26, double* %27
%28 = add nuw nsw i64 %11, 1
%29 = icmp eq i64 %28, %8
br i1 %29, label %9, label %10
}