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


x86 assembly (clang, -O0):
<mp_mul_csqu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
mov    $0x1,%esi
call   1040 <cdft@plt>
mov    -0x10(%rbp),%rax
movsd  0xeb0(%rip),%xmm0
mulsd  (%rax),%xmm0
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,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xe6b(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
cmpl   $0x2,-0x4(%rbp)
jle    11de <mp_mul_csqu+0xbe>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1030 <mp_mul_rcsqu@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
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
mov    $0xffffffff,%esi
call   1040 <cdft@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_mul_csqu>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x8(%rsi),%r14
mov    $0x1,%esi
mov    %r14,%rdx
call   1040 <cdft@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rbx)
movsd  0x10(%rbx),%xmm0
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rbx)
movsd  %xmm1,0x10(%rbx)
cmp    $0x3,%ebp
jl     1181 <mp_mul_csqu+0x61>
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <mp_mul_rcsqu@plt>
movslq %ebp,%rax
movsd  0x8(%rbx,%rax,8),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rbx,%rax,8)
mov    %ebp,%edi
mov    $0xffffffff,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <cdft@plt>

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

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