void mp_mul_csqu(int nfft, double d1[], int ip[], double w[]) {
  void makect(int nc, int *ip, double *c);
  void cdft(int n, int isgn, double *a, int *ip, double *w);
  void mp_mul_rcsqu(int n, double *a, int nc, double *c);
  double xr, xi;
  cdft(nfft, 1, &d1[1], ip, w);
  if (nfft > (ip[1] << 2)) {
    makect(nfft >> 2, ip, &w[ip[0]]);
  }
  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], ip[1], &w[ip[0]]);
  }
  d1[nfft + 1] *= d1[nfft + 1];
  cdft(nfft, -1, &d1[1], ip, w);
}


x86 assembly (clang, -O0):
<mp_mul_csqu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0x1,%esi
call   1040 <cdft@plt>
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jle    119a <mp_mul_csqu+0x6a>
mov    -0x4(%rbp),%edi
sar    $0x2,%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x3,%rax
add    %rax,%rdx
call   1050 <makect@plt>
mov    -0x10(%rbp),%rax
movsd  0xe5a(%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,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xe15(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
cmpl   $0x2,-0x4(%rbp)
jle    124d <mp_mul_csqu+0x11d>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x3,%rax
add    %rax,%rcx
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    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0xffffffff,%esi
call   1040 <cdft@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_mul_csqu>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x8(%rsi),%r15
mov    $0x1,%esi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r14,%r8
call   1040 <cdft@plt>
mov    0x4(%r12),%eax
shl    $0x2,%eax
cmp    %ebp,%eax
jge    117b <mp_mul_csqu+0x4b>
mov    %ebp,%edi
sar    $0x2,%edi
movslq (%r12),%rax
lea    (%r14,%rax,8),%rdx
mov    %r12,%rsi
call   1050 <makect@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     11cf <mp_mul_csqu+0x9f>
mov    0x4(%r12),%edx
movslq (%r12),%rax
lea    (%r14,%rax,8),%rcx
mov    %ebp,%edi
mov    %r15,%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    %r15,%rdx
mov    %r12,%rcx
mov    %r14,%r8
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cdft@plt>

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

LLVM IR (-O2):
define void @mp_mul_csqu(i32 %0, double* %1, i32* %2, double* %3) {
%5 = getelementptr inbounds double, double* %1, i64 1
tail call void @cdft(i32 %0, i32 1, double* %5, i32* %2, double* %3)
%6 = getelementptr inbounds i32, i32* %2, i64 1
%7 = load i32, i32* %6
%8 = shl i32 %7, 2
%9 = icmp slt i32 %8, %0
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = ashr i32 %0, 2
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %3, i64 %13
tail call void @makect(i32 %11, i32* %2, double* %14)
br label %15
15: ; preds = %10, %4
%16 = load double, double* %1
%17 = fmul double %16, 2.000000e+00
store double %17, double* %1
%18 = load double, double* %5
%19 = getelementptr inbounds double, double* %1, i64 2
%20 = load double, double* %19
%21 = fmul double %20, %20
%22 = tail call double @llvm.fmuladd.f64(double %18, double %18, double %21)
%23 = fmul double %18, 2.000000e+00
%24 = fmul double %23, %20
store double %22, double* %5
store double %24, double* %19
%25 = icmp sgt i32 %0, 2
br i1 %25, label %26, label %31
26: ; preds = %15
%27 = load i32, i32* %6
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %3, i64 %29
tail call void @mp_mul_rcsqu(i32 %0, double* %5, i32 %27, double* %30)
br label %31
31: ; preds = %26, %15
%32 = add nsw i32 %0, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %1, i64 %33
%35 = load double, double* %34
%36 = fmul double %35, %35
store double %36, double* %34
tail call void @cdft(i32 %0, i32 -1, double* %5, i32* %2, double* %3)
ret void
}