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


x86 assembly (clang, -O0):
<g4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x400,-0x2c(%rbp)
jge    11bf <g4+0xbf>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    111f <g4+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g4>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups (%rdi,%rax,1),%xmm0
movups (%rsi,%rax,1),%xmm1
movups (%rdx,%rax,1),%xmm2
movups (%rcx,%rax,1),%xmm3
movaps %xmm0,%xmm4
movlhps %xmm1,%xmm4
movaps %xmm2,%xmm5
movlhps %xmm3,%xmm5
unpckhpd %xmm1,%xmm0
unpckhpd %xmm3,%xmm2
movups %xmm2,0x30(%r8,%rax,4)
movups %xmm0,0x20(%r8,%rax,4)
movups %xmm5,0x10(%r8,%rax,4)
movups %xmm4,(%r8,%rax,4)
movups 0x10(%rdi,%rax,1),%xmm0
movups 0x10(%rsi,%rax,1),%xmm1
movups 0x10(%rdx,%rax,1),%xmm2
movups 0x10(%rcx,%rax,1),%xmm3
movaps %xmm0,%xmm4
movlhps %xmm1,%xmm4
movaps %xmm2,%xmm5
movlhps %xmm3,%xmm5
unpckhpd %xmm1,%xmm0
unpckhpd %xmm3,%xmm2
movups %xmm2,0x70(%r8,%rax,4)
movups %xmm0,0x60(%r8,%rax,4)
movups %xmm5,0x50(%r8,%rax,4)
movups %xmm4,0x40(%r8,%rax,4)
add    $0x20,%rax
cmp    $0x2000,%rax
jne    1110 <g4+0x10>
ret

LLVM IR (-O0):
define void @g4(double* noalias %0, double* noalias %1, double* noalias %2, double* noalias %3, double* noalias %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 = %59, %5
%13 = load i32, i32* %11
%14 = icmp slt i32 %13, 1024
br i1 %14, label %15, label %62
15: ; preds = %12
%16 = load double*, double** %6
%17 = load i32, i32* %11
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = load double*, double** %10
%22 = load i32, i32* %11
%23 = mul nsw i32 %22, 4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %21, i64 %24
store double %20, double* %25
%26 = load double*, double** %7
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = load double*, double** %10
%32 = load i32, i32* %11
%33 = mul nsw i32 %32, 4
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %31, i64 %35
store double %30, double* %36
%37 = load double*, double** %8
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %10
%43 = load i32, i32* %11
%44 = mul nsw i32 %43, 4
%45 = add nsw i32 %44, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %42, i64 %46
store double %41, double* %47
%48 = load double*, double** %9
%49 = load i32, i32* %11
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %10
%54 = load i32, i32* %11
%55 = mul nsw i32 %54, 4
%56 = add nsw i32 %55, 3
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %53, i64 %57
store double %52, double* %58
br label %59
59: ; preds = %15
%60 = load i32, i32* %11
%61 = add nsw i32 %60, 1
store i32 %61, i32* %11
br label %12
62: ; preds = %12
ret void
}

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