void copyXZ(long copyto, long copyfrom, double *phi, double *mu) {
  long i, index_to, index_from;
  for (i = 0; i < 100; i++) {
    index_to = i * 50 + copyto;
    index_from = i * 50 + copyfrom;
    phi[index_to] = phi[index_from];
    mu[index_to] = mu[index_from];
  }
}


x86 assembly (clang, -O0):
<copyXZ>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x64,-0x28(%rbp)
jge    1186 <copyXZ+0x86>
imul   $0x32,-0x28(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
imul   $0x32,-0x28(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <copyXZ+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyXZ>:
lea    (%rcx,%rsi,8),%rax
lea    (%rdx,%rsi,8),%rsi
lea    (%rcx,%rdi,8),%rcx
lea    (%rdx,%rdi,8),%rdx
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rsi,%rdi,1),%xmm0
movsd  %xmm0,(%rdx,%rdi,1)
movsd  (%rax,%rdi,1),%xmm0
movsd  %xmm0,(%rcx,%rdi,1)
movsd  0x190(%rsi,%rdi,1),%xmm0
movsd  %xmm0,0x190(%rdx,%rdi,1)
movsd  0x190(%rax,%rdi,1),%xmm0
movsd  %xmm0,0x190(%rcx,%rdi,1)
add    $0x320,%rdi
cmp    $0x9c40,%rdi
jne    1120 <copyXZ+0x20>
ret

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

LLVM IR (-O2):
define void @copyXZ(i64 %0, i64 %1, double* nocapture %2, double* nocapture %3) {
br label %5
5: ; preds = %5, %4
%6 = phi i64 [ 0, %4 ], [ %26, %5 ]
%7 = mul nuw nsw i64 %6, 50
%8 = add nsw i64 %7, %0
%9 = add nsw i64 %7, %1
%10 = getelementptr inbounds double, double* %2, i64 %9
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %2, i64 %8
store double %11, double* %12
%13 = getelementptr inbounds double, double* %3, i64 %9
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %3, i64 %8
store double %14, double* %15
%16 = or i64 %6, 1
%17 = mul nuw nsw i64 %16, 50
%18 = add nsw i64 %17, %0
%19 = add nsw i64 %17, %1
%20 = getelementptr inbounds double, double* %2, i64 %19
%21 = load double, double* %20
%22 = getelementptr inbounds double, double* %2, i64 %18
store double %21, double* %22
%23 = getelementptr inbounds double, double* %3, i64 %19
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %3, i64 %18
store double %24, double* %25
%26 = add nuw nsw i64 %6, 2
%27 = icmp eq i64 %26, 100
br i1 %27, label %28, label %5
28: ; preds = %5
ret void
}