void __attribute__((no, noclone))
g3(double *__restrict a, double *__restrict b, double *__restrict c,
   double *__restrict d) {
  for (int i = 0; i < 1024; ++i) {
    d[i * 3] = a[i];
    d[i * 3 + 1] = b[i];
    d[i * 3 + 2] = c[i];
  }
}


x86 assembly (clang, -O0):
<g3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x400,-0x24(%rbp)
jge    1193 <g3+0x93>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
imul   $0x3,-0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111b <g3+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g3>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd (%rdi,%rax,8),%xmm0
movupd (%rsi,%rax,8),%xmm1
movupd (%rdx,%rax,8),%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm1,%xmm3
movsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm1
movupd %xmm1,0x20(%rcx)
movupd %xmm0,0x10(%rcx)
movupd %xmm3,(%rcx)
movupd 0x10(%rdi,%rax,8),%xmm0
movupd 0x10(%rsi,%rax,8),%xmm1
movupd 0x10(%rdx,%rax,8),%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm1,%xmm3
movsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm1
movupd %xmm1,0x50(%rcx)
movupd %xmm0,0x40(%rcx)
movupd %xmm3,0x30(%rcx)
add    $0x4,%rax
add    $0x60,%rcx
cmp    $0x400,%rax
jne    1110 <g3+0x10>
ret

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

LLVM IR (-O2):
define void @g3(double* noalias nocapture %0, double* noalias nocapture %1, double* noalias nocapture %2, double* noalias nocapture writeonly %3) {
br label %5
5: ; preds = %5, %4
%6 = phi i64 [ 0, %4 ], [ %38, %5 ]
%7 = getelementptr inbounds double, double* %0, i64 %6
%8 = bitcast double* %7 to <2 x double>*
%9 = load <2 x double>, <2 x double>* %8
%10 = mul nuw nsw i64 %6, 3
%11 = getelementptr inbounds double, double* %1, i64 %6
%12 = bitcast double* %11 to <2 x double>*
%13 = load <2 x double>, <2 x double>* %12
%14 = getelementptr inbounds double, double* %2, i64 %6
%15 = bitcast double* %14 to <2 x double>*
%16 = load <2 x double>, <2 x double>* %15
%17 = getelementptr inbounds double, double* %3, i64 %10
%18 = bitcast double* %17 to <6 x double>*
%19 = shufflevector <2 x double> %9, <2 x double> %13, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%20 = shufflevector <2 x double> %16, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%21 = shufflevector <4 x double> %19, <4 x double> %20, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %21, <6 x double>* %18
%22 = or i64 %6, 2
%23 = getelementptr inbounds double, double* %0, i64 %22
%24 = bitcast double* %23 to <2 x double>*
%25 = load <2 x double>, <2 x double>* %24
%26 = mul nuw nsw i64 %22, 3
%27 = getelementptr inbounds double, double* %1, i64 %22
%28 = bitcast double* %27 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = getelementptr inbounds double, double* %2, i64 %22
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = getelementptr inbounds double, double* %3, i64 %26
%34 = bitcast double* %33 to <6 x double>*
%35 = shufflevector <2 x double> %25, <2 x double> %29, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%36 = shufflevector <2 x double> %32, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%37 = shufflevector <4 x double> %35, <4 x double> %36, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %37, <6 x double>* %34
%38 = add nuw nsw i64 %6, 4
%39 = icmp eq i64 %38, 1024
br i1 %39, label %40, label %5
40: ; preds = %5
ret void
}