void foo(double *output, double *input) {
  int i = 0;
  for (i = 0; i < 32; i++)
    output[i] = __builtin_nearbyint(input[i]);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    1165 <foo+0x55>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <nearbyint@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <foo+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x100(%rsi),%rax
cmp    %rdi,%rax
jbe    1199 <foo+0x89>
lea    0x100(%r14),%rax
cmp    %r15,%rax
jbe    1199 <foo+0x89>
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  (%r15,%rbx,8),%xmm0
call   1030 <nearbyint@plt>
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x8(%r15,%rbx,8),%xmm0
call   1030 <nearbyint@plt>
movsd  %xmm0,0x8(%r14,%rbx,8)
movsd  0x10(%r15,%rbx,8),%xmm0
call   1030 <nearbyint@plt>
movsd  %xmm0,0x10(%r14,%rbx,8)
movsd  0x18(%r15,%rbx,8),%xmm0
call   1030 <nearbyint@plt>
movsd  %xmm0,0x18(%r14,%rbx,8)
add    $0x4,%rbx
cmp    $0x20,%rbx
jne    1140 <foo+0x30>
jmp    1487 <foo+0x377>
movups (%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,(%r14)
movups 0x10(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x10(%r14)
movups 0x20(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x20(%r14)
movups 0x30(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x30(%r14)
movups 0x40(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x40(%r14)
movups 0x50(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x50(%r14)
movups 0x60(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x60(%r14)
movups 0x70(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x70(%r14)
movups 0x80(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x80(%r14)
movups 0x90(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x90(%r14)
movups 0xa0(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0xa0(%r14)
movups 0xb0(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0xb0(%r14)
movups 0xc0(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0xc0(%r14)
movups 0xd0(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0xd0(%r14)
movups 0xe0(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0xe0(%r14)
movups 0xf0(%r15),%xmm0
movaps %xmm0,(%rsp)
call   1030 <nearbyint@plt>
movaps %xmm0,0x10(%rsp)
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
call   1030 <nearbyint@plt>
movaps 0x10(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0xf0(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @foo(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
store i32 0, i32* %5
store i32 0, i32* %5
br label %6
6: ; preds = %20, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 32
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load double*, double** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds double, double* %10, i64 %12
%14 = load double, double* %13
%15 = call double @llvm.nearbyint.f64(double %14)
%16 = load double*, double** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
store double %15, double* %19
br label %20
20: ; preds = %9
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %6
23: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @foo(double* nocapture writeonly %0, double* nocapture %1) {
%3 = getelementptr double, double* %0, i64 32
%4 = getelementptr double, double* %1, i64 32
%5 = icmp ugt double* %4, %0
%6 = icmp ugt double* %3, %1
%7 = and i1 %5, %6
br i1 %7, label %103, label %8
8: ; preds = %2
%9 = bitcast double* %1 to <2 x double>*
%10 = load <2 x double>, <2 x double>* %9
%11 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %10)
%12 = bitcast double* %0 to <2 x double>*
store <2 x double> %11, <2 x double>* %12
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = bitcast double* %13 to <2 x double>*
%15 = load <2 x double>, <2 x double>* %14
%16 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %15)
%17 = getelementptr inbounds double, double* %0, i64 2
%18 = bitcast double* %17 to <2 x double>*
store <2 x double> %16, <2 x double>* %18
%19 = getelementptr inbounds double, double* %1, i64 4
%20 = bitcast double* %19 to <2 x double>*
%21 = load <2 x double>, <2 x double>* %20
%22 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %21)
%23 = getelementptr inbounds double, double* %0, i64 4
%24 = bitcast double* %23 to <2 x double>*
store <2 x double> %22, <2 x double>* %24
%25 = getelementptr inbounds double, double* %1, i64 6
%26 = bitcast double* %25 to <2 x double>*
%27 = load <2 x double>, <2 x double>* %26
%28 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %27)
%29 = getelementptr inbounds double, double* %0, i64 6
%30 = bitcast double* %29 to <2 x double>*
store <2 x double> %28, <2 x double>* %30
%31 = getelementptr inbounds double, double* %1, i64 8
%32 = bitcast double* %31 to <2 x double>*
%33 = load <2 x double>, <2 x double>* %32
%34 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %33)
%35 = getelementptr inbounds double, double* %0, i64 8
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> %34, <2 x double>* %36
%37 = getelementptr inbounds double, double* %1, i64 10
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %39)
%41 = getelementptr inbounds double, double* %0, i64 10
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> %40, <2 x double>* %42
%43 = getelementptr inbounds double, double* %1, i64 12
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %45)
%47 = getelementptr inbounds double, double* %0, i64 12
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %46, <2 x double>* %48
%49 = getelementptr inbounds double, double* %1, i64 14
%50 = bitcast double* %49 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %51)
%53 = getelementptr inbounds double, double* %0, i64 14
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %52, <2 x double>* %54
%55 = getelementptr inbounds double, double* %1, i64 16
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %57)
%59 = getelementptr inbounds double, double* %0, i64 16
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %58, <2 x double>* %60
%61 = getelementptr inbounds double, double* %1, i64 18
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %63)
%65 = getelementptr inbounds double, double* %0, i64 18
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> %64, <2 x double>* %66
%67 = getelementptr inbounds double, double* %1, i64 20
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %69)
%71 = getelementptr inbounds double, double* %0, i64 20
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %70, <2 x double>* %72
%73 = getelementptr inbounds double, double* %1, i64 22
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %75)
%77 = getelementptr inbounds double, double* %0, i64 22
%78 = bitcast double* %77 to <2 x double>*
store <2 x double> %76, <2 x double>* %78
%79 = getelementptr inbounds double, double* %1, i64 24
%80 = bitcast double* %79 to <2 x double>*
%81 = load <2 x double>, <2 x double>* %80
%82 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %81)
%83 = getelementptr inbounds double, double* %0, i64 24
%84 = bitcast double* %83 to <2 x double>*
store <2 x double> %82, <2 x double>* %84
%85 = getelementptr inbounds double, double* %1, i64 26
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %87)
%89 = getelementptr inbounds double, double* %0, i64 26
%90 = bitcast double* %89 to <2 x double>*
store <2 x double> %88, <2 x double>* %90
%91 = getelementptr inbounds double, double* %1, i64 28
%92 = bitcast double* %91 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %93)
%95 = getelementptr inbounds double, double* %0, i64 28
%96 = bitcast double* %95 to <2 x double>*
store <2 x double> %94, <2 x double>* %96
%97 = getelementptr inbounds double, double* %1, i64 30
%98 = bitcast double* %97 to <2 x double>*
%99 = load <2 x double>, <2 x double>* %98
%100 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %99)
%101 = getelementptr inbounds double, double* %0, i64 30
%102 = bitcast double* %101 to <2 x double>*
store <2 x double> %100, <2 x double>* %102
br label %126
103: ; preds = %2, %103
%104 = phi i64 [ %124, %103 ], [ 0, %2 ]
%105 = getelementptr inbounds double, double* %1, i64 %104
%106 = load double, double* %105
%107 = tail call double @llvm.nearbyint.f64(double %106)
%108 = getelementptr inbounds double, double* %0, i64 %104
store double %107, double* %108
%109 = or i64 %104, 1
%110 = getelementptr inbounds double, double* %1, i64 %109
%111 = load double, double* %110
%112 = tail call double @llvm.nearbyint.f64(double %111)
%113 = getelementptr inbounds double, double* %0, i64 %109
store double %112, double* %113
%114 = or i64 %104, 2
%115 = getelementptr inbounds double, double* %1, i64 %114
%116 = load double, double* %115
%117 = tail call double @llvm.nearbyint.f64(double %116)
%118 = getelementptr inbounds double, double* %0, i64 %114
store double %117, double* %118
%119 = or i64 %104, 3
%120 = getelementptr inbounds double, double* %1, i64 %119
%121 = load double, double* %120
%122 = tail call double @llvm.nearbyint.f64(double %121)
%123 = getelementptr inbounds double, double* %0, i64 %119
store double %122, double* %123
%124 = add nuw nsw i64 %104, 4
%125 = icmp eq i64 %124, 32
br i1 %125, label %126, label %103
126: ; preds = %103, %8
ret void
}