void dcopy_(int n, double *dx, double *dy) {
  int i, m;
  if (n <= 0) {
    return;
  }
  m = n % 7;
  if (m != 0) {
    for (i = 0; i < m; ++i) {
      dy[i] = dx[i];
    }
    if (n < 7) {
      return;
    }
  }
  for (i = m; i < n; i += 7) {
    dy[i] = dx[i];
    dy[i + 1] = dx[i + 1];
    dy[i + 2] = dx[i + 2];
    dy[i + 3] = dx[i + 3];
    dy[i + 4] = dx[i + 4];
    dy[i + 5] = dx[i + 5];
    dy[i + 6] = dx[i + 6];
  }
}


x86 assembly (clang, -O0):
<dcopy_>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     111e <dcopy_+0x1e>
jmp    1297 <dcopy_+0x197>
mov    -0x4(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1185 <dcopy_+0x85>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1171 <dcopy_+0x71>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <dcopy_+0x3d>
cmpl   $0x7,-0x4(%rbp)
jge    1180 <dcopy_+0x80>
jmp    1297 <dcopy_+0x197>
jmp    1185 <dcopy_+0x85>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1297 <dcopy_+0x197>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x1c(%rbp)
jmp    118b <dcopy_+0x8b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcopy_>:
push   %r14
push   %rbx
test   %edi,%edi
jle    131d <dcopy_+0x21d>
mov    %edi,%eax
imul   $0x24924925,%rax,%rcx
shr    $0x20,%rcx
mov    %edi,%r8d
sub    %ecx,%r8d
shr    %r8d
add    %ecx,%r8d
shr    $0x2,%r8d
lea    0x0(,%r8,8),%ecx
sub    %ecx,%r8d
add    %edi,%r8d
je     1275 <dcopy_+0x175>
mov    %r8d,%r9d
cmp    $0x4,%r8d
jae    114c <dcopy_+0x4c>
xor    %ecx,%ecx
jmp    1250 <dcopy_+0x150>
lea    (%rsi,%r9,8),%rcx
cmp    %rdx,%rcx
jbe    1165 <dcopy_+0x65>
lea    (%rdx,%r9,8),%rcx
cmp    %rsi,%rcx
jbe    1165 <dcopy_+0x65>
xor    %ecx,%ecx
jmp    1250 <dcopy_+0x150>
mov    %r9d,%ecx
and    $0x4,%ecx
lea    -0x4(%rcx),%rbx
mov    %rbx,%r11
shr    $0x2,%r11
add    $0x1,%r11
mov    %r11d,%r10d
and    $0x3,%r10d
cmp    $0xc,%rbx
jae    118b <dcopy_+0x8b>
xor    %ebx,%ebx
jmp    11f8 <dcopy_+0xf8>
and    $0xfffffffffffffffc,%r11
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movups (%rsi,%rbx,8),%xmm0
movups 0x10(%rsi,%rbx,8),%xmm1
movups %xmm0,(%rdx,%rbx,8)
movups %xmm1,0x10(%rdx,%rbx,8)
movups 0x20(%rsi,%rbx,8),%xmm0
movups 0x30(%rsi,%rbx,8),%xmm1
movups %xmm0,0x20(%rdx,%rbx,8)
movups %xmm1,0x30(%rdx,%rbx,8)
movups 0x40(%rsi,%rbx,8),%xmm0
movups 0x50(%rsi,%rbx,8),%xmm1
movups %xmm0,0x40(%rdx,%rbx,8)
movups %xmm1,0x50(%rdx,%rbx,8)
movups 0x60(%rsi,%rbx,8),%xmm0
movups 0x70(%rsi,%rbx,8),%xmm1
movups %xmm0,0x60(%rdx,%rbx,8)
movups %xmm1,0x70(%rdx,%rbx,8)
add    $0x10,%rbx
add    $0xfffffffffffffffc,%r11
jne    11a0 <dcopy_+0xa0>
test   %r10,%r10
je     123f <dcopy_+0x13f>
lea    (%rdx,%rbx,8),%r11
add    $0x10,%r11
lea    (%rsi,%rbx,8),%r14
add    $0x10,%r14
shl    $0x5,%r10
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%r14,%rbx,1),%xmm0
movups (%r14,%rbx,1),%xmm1
movups %xmm0,-0x10(%r11,%rbx,1)
movups %xmm1,(%r11,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%r10
jne    1220 <dcopy_+0x120>
cmp    %r9,%rcx
je     1263 <dcopy_+0x163>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rsi,%rcx,8),%xmm0
movsd  %xmm0,(%rdx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%r9
jne    1250 <dcopy_+0x150>
cmp    $0x7,%edi
jl     131d <dcopy_+0x21d>
cmp    %edi,%r8d
jge    131d <dcopy_+0x21d>
imul   $0x24924925,%rax,%rbx
shr    $0x20,%rbx
mov    %edi,%ecx
sub    %ebx,%ecx
shr    %ecx
add    %ebx,%ecx
shr    $0x2,%ecx
lea    0x0(,%rcx,8),%r8
mov    %rcx,%rbx
sub    %r8,%rbx
lea    (%rdx,%rbx,8),%rdx
add    $0x30,%rdx
lea    (%rsi,%rbx,8),%rsi
add    $0x30,%rsi
lea    0x0(,%rcx,8),%ebx
sub    %ebx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  -0x30(%rsi,%rax,8),%xmm0
movsd  %xmm0,-0x30(%rdx,%rax,8)
movsd  -0x28(%rsi,%rax,8),%xmm0
movsd  %xmm0,-0x28(%rdx,%rax,8)
movsd  -0x20(%rsi,%rax,8),%xmm0
movsd  %xmm0,-0x20(%rdx,%rax,8)
movsd  -0x18(%rsi,%rax,8),%xmm0
movsd  %xmm0,-0x18(%rdx,%rax,8)
movsd  -0x10(%rsi,%rax,8),%xmm0
movsd  %xmm0,-0x10(%rdx,%rax,8)
movsd  -0x8(%rsi,%rax,8),%xmm0
movsd  %xmm0,-0x8(%rdx,%rax,8)
movsd  (%rsi,%rax,8),%xmm0
movsd  %xmm0,(%rdx,%rax,8)
add    $0x7,%rax
lea    (%rcx,%rax,1),%ebx
cmp    %edi,%ebx
jl     12c0 <dcopy_+0x1c0>
pop    %rbx
pop    %r14
ret

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

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