void f(long long *r, const double *x, const double *y) {
  int i;
  for (i = 0; i < 1000000; i++) {
    double xi = x[i], yi = y[i];
    r[i] = ((xi) > (yi));
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xf4240,-0x1c(%rbp)
jge    1177 <f+0x77>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <f+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    $0x6,%eax
movapd 0xef3(%rip),%xmm0
nopl   (%rax)
movupd -0x30(%rsi,%rax,8),%xmm1
movupd -0x20(%rsi,%rax,8),%xmm2
movupd -0x30(%rdx,%rax,8),%xmm3
cmpltpd %xmm1,%xmm3
movupd -0x20(%rdx,%rax,8),%xmm1
cmpltpd %xmm2,%xmm1
andpd  %xmm0,%xmm3
andpd  %xmm0,%xmm1
movupd %xmm3,-0x30(%rdi,%rax,8)
movupd %xmm1,-0x20(%rdi,%rax,8)
movupd -0x10(%rsi,%rax,8),%xmm1
movupd (%rsi,%rax,8),%xmm2
movupd -0x10(%rdx,%rax,8),%xmm3
cmpltpd %xmm1,%xmm3
movupd (%rdx,%rax,8),%xmm1
cmpltpd %xmm2,%xmm1
andpd  %xmm0,%xmm3
andpd  %xmm0,%xmm1
movupd %xmm3,-0x10(%rdi,%rax,8)
movupd %xmm1,(%rdi,%rax,8)
add    $0x8,%rax
cmp    $0xf4246,%rax
jne    1110 <f+0x10>
ret

LLVM IR (-O0):
define void @f(i64* %0, double* %1, double* %2) {
%4 = alloca i64*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
store i64* %0, i64** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %10
10: ; preds = %33, %3
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 1000000
br i1 %12, label %13, label %36
13: ; preds = %10
%14 = load double*, double** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
store double %18, double* %8
%19 = load double*, double** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
store double %23, double* %9
%24 = load double, double* %8
%25 = load double, double* %9
%26 = fcmp ogt double %24, %25
%27 = zext i1 %26 to i32
%28 = sext i32 %27 to i64
%29 = load i64*, i64** %4
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i64, i64* %29, i64 %31
store i64 %28, i64* %32
br label %33
33: ; preds = %13
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %10
36: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @f(i64* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i64 [ 0, %3 ], [ %47, %4 ]
%6 = getelementptr inbounds double, double* %1, i64 %5
%7 = bitcast double* %6 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = getelementptr inbounds double, double* %6, i64 2
%10 = bitcast double* %9 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = getelementptr inbounds double, double* %2, i64 %5
%13 = bitcast double* %12 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = getelementptr inbounds double, double* %12, i64 2
%16 = bitcast double* %15 to <2 x double>*
%17 = load <2 x double>, <2 x double>* %16
%18 = fcmp ogt <2 x double> %8, %14
%19 = fcmp ogt <2 x double> %11, %17
%20 = zext <2 x i1> %18 to <2 x i64>
%21 = zext <2 x i1> %19 to <2 x i64>
%22 = getelementptr inbounds i64, i64* %0, i64 %5
%23 = bitcast i64* %22 to <2 x i64>*
store <2 x i64> %20, <2 x i64>* %23
%24 = getelementptr inbounds i64, i64* %22, i64 2
%25 = bitcast i64* %24 to <2 x i64>*
store <2 x i64> %21, <2 x i64>* %25
%26 = or i64 %5, 4
%27 = getelementptr inbounds double, double* %1, i64 %26
%28 = bitcast double* %27 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = getelementptr inbounds double, double* %27, i64 2
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = getelementptr inbounds double, double* %2, i64 %26
%34 = bitcast double* %33 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = getelementptr inbounds double, double* %33, i64 2
%37 = bitcast double* %36 to <2 x double>*
%38 = load <2 x double>, <2 x double>* %37
%39 = fcmp ogt <2 x double> %29, %35
%40 = fcmp ogt <2 x double> %32, %38
%41 = zext <2 x i1> %39 to <2 x i64>
%42 = zext <2 x i1> %40 to <2 x i64>
%43 = getelementptr inbounds i64, i64* %0, i64 %26
%44 = bitcast i64* %43 to <2 x i64>*
store <2 x i64> %41, <2 x i64>* %44
%45 = getelementptr inbounds i64, i64* %43, i64 2
%46 = bitcast i64* %45 to <2 x i64>*
store <2 x i64> %42, <2 x i64>* %46
%47 = add nuw nsw i64 %5, 8
%48 = icmp eq i64 %47, 1000000
br i1 %48, label %49, label %4
49: ; preds = %4
ret void
}