void mp_mul_csqu_save_d1(int nfft, double d1[], double d2[]) {
  void cdft(int n, int isgn, double *a);
  void mp_mul_rcsqu_save(int n, double *a, double *b);
  double xr, xi;
  cdft(nfft, 1, &d1[1]);
  d2[0] = 2 * d1[0];
  xr = d1[1] * d1[1] + d1[2] * d1[2];
  xi = 2 * d1[1] * d1[2];
  d2[1] = xr;
  d2[2] = xi;
  if (nfft > 2) {
    mp_mul_rcsqu_save(nfft, &d1[1], &d2[1]);
  }
  d2[nfft + 1] = d1[nfft + 1] * d1[nfft + 1];
  cdft(nfft, -1, &d2[1]);
}


x86 assembly (clang, -O0):
<mp_mul_csqu_save_d1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
mov    $0x1,%esi
call   1040 <cdft@plt>
mov    -0x10(%rbp),%rax
movsd  0xeac(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xe63(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
cmpl   $0x2,-0x4(%rbp)
jle    11ee <mp_mul_csqu_save_d1+0xce>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
call   1030 <mp_mul_rcsqu_save@plt>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    $0xffffffff,%esi
call   1040 <cdft@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_mul_csqu_save_d1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %edi,%r14d
lea    0x8(%rsi),%r15
mov    $0x1,%esi
mov    %r15,%rdx
call   1040 <cdft@plt>
movsd  0x0(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rbx)
movsd  0x8(%rbp),%xmm0
movsd  0x10(%rbp),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm1
mulsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
lea    0x8(%rbx),%r12
movsd  %xmm2,0x8(%rbx)
movsd  %xmm0,0x10(%rbx)
cmp    $0x3,%r14d
jl     1193 <mp_mul_csqu_save_d1+0x73>
mov    %r14d,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <mp_mul_rcsqu_save@plt>
movslq %r14d,%rax
movsd  0x8(%rbp,%rax,8),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rbx,%rax,8)
mov    %r14d,%edi
mov    $0xffffffff,%esi
mov    %r12,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cdft@plt>

LLVM IR (-O0):
define void @mp_mul_csqu_save_d1(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%9 = load i32, i32* %4
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = fmul double 2.000000e+00, %14
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 0
store double %15, double* %17
%18 = load double*, double** %5
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = load double*, double** %5
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 2
%26 = load double, double* %25
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 2
%29 = load double, double* %28
%30 = fmul double %26, %29
%31 = call double @llvm.fmuladd.f64(double %20, double %23, double %30)
store double %31, double* %7
%32 = load double*, double** %5
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
%35 = fmul double 2.000000e+00, %34
%36 = load double*, double** %5
%37 = getelementptr inbounds double, double* %36, i64 2
%38 = load double, double* %37
%39 = fmul double %35, %38
store double %39, double* %8
%40 = load double, double* %7
%41 = load double*, double** %6
%42 = getelementptr inbounds double, double* %41, i64 1
store double %40, double* %42
%43 = load double, double* %8
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 2
store double %43, double* %45
%46 = load i32, i32* %4
%47 = icmp sgt i32 %46, 2
br i1 %47, label %48, label %54
48: ; preds = %3
%49 = load i32, i32* %4
%50 = load double*, double** %5
%51 = getelementptr inbounds double, double* %50, i64 1
%52 = load double*, double** %6
%53 = getelementptr inbounds double, double* %52, i64 1
br label %54
54: ; preds = %48, %3
%55 = load double*, double** %5
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %55, i64 %58
%60 = load double, double* %59
%61 = load double*, double** %5
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %61, i64 %64
%66 = load double, double* %65
%67 = fmul double %60, %66
%68 = load double*, double** %6
%69 = load i32, i32* %4
%70 = add nsw i32 %69, 1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %68, i64 %71
store double %67, double* %72
%73 = load i32, i32* %4
%74 = load double*, double** %6
%75 = getelementptr inbounds double, double* %74, i64 1
ret void
}

LLVM IR (-O2):
define void @mp_mul_csqu_save_d1(i32 %0, double* %1, double* %2) {
%4 = getelementptr inbounds double, double* %1, i64 1
tail call void @cdft(i32 %0, i32 1, double* %4)
%5 = load double, double* %1
%6 = fmul double %5, 2.000000e+00
store double %6, double* %2
%7 = load double, double* %4
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = fmul double %9, %9
%11 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %10)
%12 = fmul double %7, 2.000000e+00
%13 = fmul double %12, %9
%14 = getelementptr inbounds double, double* %2, i64 1
store double %11, double* %14
%15 = getelementptr inbounds double, double* %2, i64 2
store double %13, double* %15
%16 = icmp sgt i32 %0, 2
br i1 %16, label %17, label %18
17: ; preds = %3
tail call void @mp_mul_rcsqu_save(i32 %0, double* %4, double* %14)
br label %18
18: ; preds = %17, %3
%19 = add nsw i32 %0, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %1, i64 %20
%22 = load double, double* %21
%23 = fmul double %22, %22
%24 = getelementptr inbounds double, double* %2, i64 %20
store double %23, double* %24
tail call void @cdft(i32 %0, i32 -1, double* %14)
ret void
}