void init_prev_with_curr(int Dim, double *G, double *V1, double *V2,
                         double *G_prev, double *V1_prev, double *V2_prev) {
  int i;
  for (i = 0; i < Dim; i++) {
    G_prev[i] = G[i];
    V1_prev[i] = V1[i];
    V2_prev[i] = V2[i];
  }
  return;
}


x86 assembly (clang, -O0):
<init_prev_with_curr>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118e <init_prev_with_curr+0x8e>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1126 <init_prev_with_curr+0x26>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_prev_with_curr>:
test   %edi,%edi
jle    11a8 <init_prev_with_curr+0xa8>
mov    0x8(%rsp),%r11
mov    %edi,%r10d
cmp    $0x1,%edi
jne    1119 <init_prev_with_curr+0x19>
xor    %edi,%edi
jmp    1181 <init_prev_with_curr+0x81>
mov    %r10d,%eax
and    $0xfffffffe,%eax
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rsi,%rdi,8),%xmm0
movsd  %xmm0,(%r8,%rdi,8)
movsd  (%rdx,%rdi,8),%xmm0
movsd  %xmm0,(%r9,%rdi,8)
movsd  (%rcx,%rdi,8),%xmm0
movsd  %xmm0,(%r11,%rdi,8)
movsd  0x8(%rsi,%rdi,8),%xmm0
movsd  %xmm0,0x8(%r8,%rdi,8)
movsd  0x8(%rdx,%rdi,8),%xmm0
movsd  %xmm0,0x8(%r9,%rdi,8)
movsd  0x8(%rcx,%rdi,8),%xmm0
movsd  %xmm0,0x8(%r11,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%rax
jne    1130 <init_prev_with_curr+0x30>
test   $0x1,%r10b
je     11a8 <init_prev_with_curr+0xa8>
movsd  (%rsi,%rdi,8),%xmm0
movsd  %xmm0,(%r8,%rdi,8)
movsd  (%rdx,%rdi,8),%xmm0
movsd  %xmm0,(%r9,%rdi,8)
movsd  (%rcx,%rdi,8),%xmm0
movsd  %xmm0,(%r11,%rdi,8)
ret

LLVM IR (-O0):
define void @init_prev_with_curr(i32 %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6) {
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
store i32 %0, i32* %8
store double* %1, double** %9
store double* %2, double** %10
store double* %3, double** %11
store double* %4, double** %12
store double* %5, double** %13
store double* %6, double** %14
store i32 0, i32* %15
br label %16
16: ; preds = %48, %7
%17 = load i32, i32* %15
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %51
20: ; preds = %16
%21 = load double*, double** %9
%22 = load i32, i32* %15
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double*, double** %12
%27 = load i32, i32* %15
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
store double %25, double* %29
%30 = load double*, double** %10
%31 = load i32, i32* %15
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load double*, double** %13
%36 = load i32, i32* %15
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
store double %34, double* %38
%39 = load double*, double** %11
%40 = load i32, i32* %15
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = load double*, double** %14
%45 = load i32, i32* %15
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %43, double* %47
br label %48
48: ; preds = %20
%49 = load i32, i32* %15
%50 = add nsw i32 %49, 1
store i32 %50, i32* %15
br label %16
51: ; preds = %16
ret void
}

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