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


x86 assembly (clang, -O0):
<mp_mul_cmul>:
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   1030 <cdft@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    $0x1,%esi
call   1030 <cdft@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%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    1211 <mp_mul_cmul+0xf1>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
call   1040 <mp_mul_rcmul@plt>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%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    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    $0xffffffff,%esi
call   1030 <cdft@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_mul_cmul>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0x8(%rsi),%r12
mov    $0x1,%esi
mov    %r12,%rdx
call   1030 <cdft@plt>
lea    0x8(%rbx),%r15
mov    %ebp,%edi
mov    $0x1,%esi
mov    %r15,%rdx
call   1030 <cdft@plt>
movsd  (%r14),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%rbx)
movupd 0x8(%rbx),%xmm0
movsd  0x8(%r14),%xmm1
movsd  0x10(%r14),%xmm2
unpcklpd %xmm2,%xmm2
unpcklpd %xmm1,%xmm1
mulpd  %xmm0,%xmm1
shufpd $0x1,%xmm0,%xmm0
mulpd  %xmm2,%xmm0
addpd  %xmm0,%xmm1
movupd %xmm1,0x8(%rbx)
cmp    $0x3,%ebp
jl     11a2 <mp_mul_cmul+0x82>
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r15,%rdx
call   1040 <mp_mul_rcmul@plt>
movslq %ebp,%rax
movsd  0x8(%r14,%rax,8),%xmm0
mulsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rax,8)
mov    %ebp,%edi
mov    $0xffffffff,%esi
mov    %r15,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <cdft@plt>

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

LLVM IR (-O2):
define void @mp_mul_cmul(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 = getelementptr inbounds double, double* %2, i64 1
tail call void @cdft(i32 %0, i32 1, double* %5)
%6 = load double, double* %1
%7 = load double, double* %2
%8 = fadd double %6, %7
store double %8, double* %2
%9 = load double, double* %4
%10 = getelementptr inbounds double, double* %1, i64 2
%11 = load double, double* %10
%12 = bitcast double* %5 to <2 x double>*
%13 = load <2 x double>, <2 x double>* %12
%14 = insertelement <2 x double> poison, double %11, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = fmul <2 x double> %13, %15
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%18 = insertelement <2 x double> poison, double %9, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %19, <2 x double> %13, <2 x double> %17)
%21 = bitcast double* %5 to <2 x double>*
store <2 x double> %20, <2 x double>* %21
%22 = icmp sgt i32 %0, 2
br i1 %22, label %23, label %24
23: ; preds = %3
tail call void @mp_mul_rcmul(i32 %0, double* %4, double* %5)
br label %24
24: ; preds = %23, %3
%25 = add nsw i32 %0, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %1, i64 %26
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %2, i64 %26
%30 = load double, double* %29
%31 = fmul double %28, %30
store double %31, double* %29
tail call void @cdft(i32 %0, i32 -1, double* %5)
ret void
}