void dft_4(double aRe[], double aIm[]) {
  double t1_re, t1_im, t2_re, t2_im;
  double m2_re, m2_im, m3_re, m3_im;
  {
    double ax, ay;
    ax = aRe[0];
    ay = aRe[2];
    t1_re = ax + ay;
    m2_re = ax - ay;
    ax = aIm[0];
    ay = aIm[2];
    t1_im = ax + ay;
    m2_im = ax - ay;
    ax = aRe[1];
    ay = aRe[3];
    t2_re = ax + ay;
    m3_im = ay - ax;
    ax = aIm[1];
    ay = aIm[3];
    t2_im = ax + ay;
    m3_re = ax - ay;
  }
  aRe[0] = t1_re + t2_re;
  aRe[1] = m2_re + m3_re;
  aRe[2] = t1_re - t2_re;
  aRe[3] = m2_re - m3_re;
  aIm[0] = t1_im + t2_im;
  aIm[1] = m2_im + m3_im;
  aIm[2] = t1_im - t2_im;
  aIm[3] = m2_im - m3_im;
}


x86 assembly (clang, -O0):
<dft_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x38(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x20(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x40(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dft_4>:
movsd  0x10(%rdi),%xmm0
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm4
movapd %xmm1,%xmm3
addsd  %xmm0,%xmm3
subsd  %xmm0,%xmm1
movsd  0x10(%rsi),%xmm5
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm6
movapd %xmm0,%xmm2
addsd  %xmm5,%xmm2
subsd  %xmm5,%xmm0
movsd  0x18(%rdi),%xmm5
movapd %xmm4,%xmm7
addsd  %xmm5,%xmm7
subsd  %xmm4,%xmm5
movsd  0x18(%rsi),%xmm8
movapd %xmm6,%xmm9
addsd  %xmm8,%xmm9
subsd  %xmm8,%xmm6
movapd %xmm3,%xmm4
addsd  %xmm7,%xmm4
movsd  %xmm4,(%rdi)
movapd %xmm1,%xmm4
addsd  %xmm6,%xmm4
movsd  %xmm4,0x8(%rdi)
subsd  %xmm7,%xmm3
movsd  %xmm3,0x10(%rdi)
subsd  %xmm6,%xmm1
movsd  %xmm1,0x18(%rdi)
movapd %xmm2,%xmm1
addsd  %xmm9,%xmm1
movsd  %xmm1,(%rsi)
movapd %xmm0,%xmm1
addsd  %xmm5,%xmm1
movsd  %xmm1,0x8(%rsi)
subsd  %xmm9,%xmm2
movsd  %xmm2,0x10(%rsi)
subsd  %xmm5,%xmm0
movsd  %xmm0,0x18(%rsi)
ret

LLVM IR (-O0):
define void @dft_4(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
store double %17, double* %13
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 2
%20 = load double, double* %19
store double %20, double* %14
%21 = load double, double* %13
%22 = load double, double* %14
%23 = fadd double %21, %22
store double %23, double* %5
%24 = load double, double* %13
%25 = load double, double* %14
%26 = fsub double %24, %25
store double %26, double* %9
%27 = load double*, double** %4
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
store double %29, double* %13
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 2
%32 = load double, double* %31
store double %32, double* %14
%33 = load double, double* %13
%34 = load double, double* %14
%35 = fadd double %33, %34
store double %35, double* %6
%36 = load double, double* %13
%37 = load double, double* %14
%38 = fsub double %36, %37
store double %38, double* %10
%39 = load double*, double** %3
%40 = getelementptr inbounds double, double* %39, i64 1
%41 = load double, double* %40
store double %41, double* %13
%42 = load double*, double** %3
%43 = getelementptr inbounds double, double* %42, i64 3
%44 = load double, double* %43
store double %44, double* %14
%45 = load double, double* %13
%46 = load double, double* %14
%47 = fadd double %45, %46
store double %47, double* %7
%48 = load double, double* %14
%49 = load double, double* %13
%50 = fsub double %48, %49
store double %50, double* %12
%51 = load double*, double** %4
%52 = getelementptr inbounds double, double* %51, i64 1
%53 = load double, double* %52
store double %53, double* %13
%54 = load double*, double** %4
%55 = getelementptr inbounds double, double* %54, i64 3
%56 = load double, double* %55
store double %56, double* %14
%57 = load double, double* %13
%58 = load double, double* %14
%59 = fadd double %57, %58
store double %59, double* %8
%60 = load double, double* %13
%61 = load double, double* %14
%62 = fsub double %60, %61
store double %62, double* %11
%63 = load double, double* %5
%64 = load double, double* %7
%65 = fadd double %63, %64
%66 = load double*, double** %3
%67 = getelementptr inbounds double, double* %66, i64 0
store double %65, double* %67
%68 = load double, double* %9
%69 = load double, double* %11
%70 = fadd double %68, %69
%71 = load double*, double** %3
%72 = getelementptr inbounds double, double* %71, i64 1
store double %70, double* %72
%73 = load double, double* %5
%74 = load double, double* %7
%75 = fsub double %73, %74
%76 = load double*, double** %3
%77 = getelementptr inbounds double, double* %76, i64 2
store double %75, double* %77
%78 = load double, double* %9
%79 = load double, double* %11
%80 = fsub double %78, %79
%81 = load double*, double** %3
%82 = getelementptr inbounds double, double* %81, i64 3
store double %80, double* %82
%83 = load double, double* %6
%84 = load double, double* %8
%85 = fadd double %83, %84
%86 = load double*, double** %4
%87 = getelementptr inbounds double, double* %86, i64 0
store double %85, double* %87
%88 = load double, double* %10
%89 = load double, double* %12
%90 = fadd double %88, %89
%91 = load double*, double** %4
%92 = getelementptr inbounds double, double* %91, i64 1
store double %90, double* %92
%93 = load double, double* %6
%94 = load double, double* %8
%95 = fsub double %93, %94
%96 = load double*, double** %4
%97 = getelementptr inbounds double, double* %96, i64 2
store double %95, double* %97
%98 = load double, double* %10
%99 = load double, double* %12
%100 = fsub double %98, %99
%101 = load double*, double** %4
%102 = getelementptr inbounds double, double* %101, i64 3
store double %100, double* %102
ret void
}

LLVM IR (-O2):
define void @dft_4(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 2
%5 = load double, double* %4
%6 = fadd double %3, %5
%7 = fsub double %3, %5
%8 = load double, double* %1
%9 = getelementptr inbounds double, double* %1, i64 2
%10 = load double, double* %9
%11 = fadd double %8, %10
%12 = fsub double %8, %10
%13 = getelementptr inbounds double, double* %0, i64 1
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %0, i64 3
%16 = load double, double* %15
%17 = fadd double %14, %16
%18 = fsub double %16, %14
%19 = getelementptr inbounds double, double* %1, i64 1
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %1, i64 3
%22 = load double, double* %21
%23 = fadd double %20, %22
%24 = fsub double %20, %22
%25 = fadd double %6, %17
store double %25, double* %0
%26 = fadd double %7, %24
store double %26, double* %13
%27 = fsub double %6, %17
store double %27, double* %4
%28 = fsub double %7, %24
store double %28, double* %15
%29 = fadd double %11, %23
store double %29, double* %1
%30 = fadd double %12, %18
store double %30, double* %19
%31 = fsub double %11, %23
store double %31, double* %9
%32 = fsub double %12, %18
store double %32, double* %21
ret void
}