void tml_dr_vSub2(const double *src, double *dst, int n) {
  int i;
  for (i = 0; i < n; i++)
    dst[i] -= src[i];
}


x86 assembly (clang, -O0):
<tml_dr_vSub2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <tml_dr_vSub2+0x53>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1116 <tml_dr_vSub2+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tml_dr_vSub2>:
test   %edx,%edx
jle    1287 <tml_dr_vSub2+0x187>
mov    %edx,%r9d
cmp    $0x4,%edx
jb     112a <tml_dr_vSub2+0x2a>
lea    (%rdi,%r9,8),%rax
cmp    %rsi,%rax
jbe    11c3 <tml_dr_vSub2+0xc3>
lea    (%rsi,%r9,8),%rax
cmp    %rdi,%rax
jbe    11c3 <tml_dr_vSub2+0xc3>
xor    %ecx,%ecx
mov    %rcx,%rax
not    %rax
add    %r9,%rax
mov    %r9,%rdx
and    $0x3,%rdx
je     1159 <tml_dr_vSub2+0x59>
xchg   %ax,%ax
movsd  (%rsi,%rcx,8),%xmm0
subsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdx
jne    1140 <tml_dr_vSub2+0x40>
cmp    $0x3,%rax
jb     1287 <tml_dr_vSub2+0x187>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rsi,%rcx,8),%xmm0
subsd  (%rdi,%rcx,8),%xmm0
movsd  0x8(%rsi,%rcx,8),%xmm1
movsd  %xmm0,(%rsi,%rcx,8)
subsd  0x8(%rdi,%rcx,8),%xmm1
movsd  %xmm1,0x8(%rsi,%rcx,8)
movsd  0x10(%rsi,%rcx,8),%xmm0
subsd  0x10(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rsi,%rcx,8)
movsd  0x18(%rsi,%rcx,8),%xmm0
subsd  0x18(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rsi,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%r9
jne    1170 <tml_dr_vSub2+0x70>
jmp    1287 <tml_dr_vSub2+0x187>
mov    %r9d,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rax
mov    %rax,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rax,%rax
je     1288 <tml_dr_vSub2+0x188>
mov    %r8,%rax
and    $0xfffffffffffffffe,%rax
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movupd (%rdi,%rdx,8),%xmm0
movupd 0x10(%rdi,%rdx,8),%xmm1
movupd (%rsi,%rdx,8),%xmm2
subpd  %xmm0,%xmm2
movupd 0x10(%rsi,%rdx,8),%xmm0
subpd  %xmm1,%xmm0
movupd 0x20(%rsi,%rdx,8),%xmm1
movupd 0x30(%rsi,%rdx,8),%xmm3
movupd %xmm2,(%rsi,%rdx,8)
movupd %xmm0,0x10(%rsi,%rdx,8)
movupd 0x20(%rdi,%rdx,8),%xmm0
subpd  %xmm0,%xmm1
movupd 0x30(%rdi,%rdx,8),%xmm0
subpd  %xmm0,%xmm3
movupd %xmm1,0x20(%rsi,%rdx,8)
movupd %xmm3,0x30(%rsi,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rax
jne    11f0 <tml_dr_vSub2+0xf0>
test   $0x1,%r8b
je     127e <tml_dr_vSub2+0x17e>
movupd (%rdi,%rdx,8),%xmm0
movupd 0x10(%rdi,%rdx,8),%xmm1
movupd (%rsi,%rdx,8),%xmm2
subpd  %xmm0,%xmm2
movupd 0x10(%rsi,%rdx,8),%xmm0
subpd  %xmm1,%xmm0
movupd %xmm2,(%rsi,%rdx,8)
movupd %xmm0,0x10(%rsi,%rdx,8)
cmp    %r9,%rcx
jne    112c <tml_dr_vSub2+0x2c>
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    1255 <tml_dr_vSub2+0x155>
jmp    127e <tml_dr_vSub2+0x17e>

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

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