void COPY(double *u_init, double *u_past, double *u_present, double *u_future,
          double n_points) {
  int i;
  for (i = 0; i < n_points; i++) {
    u_past[i] = u_present[i];
    u_present[i] = u_future[i];
  }
}


x86 assembly (clang, -O0):
<COPY>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1176 <COPY+0x76>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1120 <COPY+0x20>
pop    %rbp
ret

x86 assembly (clang, -O2):
<COPY>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1135 <COPY+0x35>
xor    %eax,%eax
nopl   0x0(%rax)
movsd  (%rdx,%rax,8),%xmm1
movsd  %xmm1,(%rsi,%rax,8)
movsd  (%rcx,%rax,8),%xmm1
movsd  %xmm1,(%rdx,%rax,8)
add    $0x1,%rax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
ja     1110 <COPY+0x10>
ret

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

LLVM IR (-O2):
define void @COPY(double* nocapture readnone %0, double* nocapture writeonly %1, double* nocapture %2, double* nocapture %3, double %4) {
%6 = fcmp ogt double %4, 0.000000e+00
br i1 %6, label %7, label %18
7: ; preds = %5, %7
%8 = phi i64 [ %14, %7 ], [ 0, %5 ]
%9 = getelementptr inbounds double, double* %2, i64 %8
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 %8
store double %10, double* %11
%12 = getelementptr inbounds double, double* %3, i64 %8
%13 = load double, double* %12
store double %13, double* %9
%14 = add nuw i64 %8, 1
%15 = trunc i64 %14 to i32
%16 = sitofp i32 %15 to double
%17 = fcmp olt double %16, %4
br i1 %17, label %7, label %18
18: ; preds = %7, %5
ret void
}