void mp_squhf_use_infft(int n, int radix, double infft[], int in[], int out[],
                        int tmp[], int nfft, double tmpfft[], int ip[],
                        double w[]) {
  void mp_add(int n, int radix, int in1[], int in2[], int out[]);
  void mp_mul_i2d(int n, int radix, int nfft, int shift, int in[],
                  double dout[]);
  void mp_mul_cmul_nt_d1(int nfft, double d1[], double d2[], int ip[],
                         double w[]);
  void mp_mul_csqu_nt_d1(int nfft, double d1[], int ip[], double w[]);
  void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]);
  int n_h, shift;
  shift = (nfft >> 1) + 1;
  while (n > shift) {
    if (in[shift + 2] != 0) {
      break;
    }
    shift++;
  }
  n_h = n / 2 + 1;
  if (n_h < n - shift) {
    n_h = n - shift;
  }
  mp_mul_i2d(n, radix, nfft, shift, in, tmpfft);
  mp_mul_cmul_nt_d1(nfft, infft, tmpfft, ip, w);
  mp_mul_d2i(n_h, radix, nfft, tmpfft, tmp);
  mp_mul_csqu_nt_d1(nfft, infft, ip, w);
  mp_mul_d2i(n, radix, nfft, infft, out);
  if (tmp[0] != 0) {
    mp_add(n, radix, out, tmp, out);
  }
}


x86 assembly (clang, -O0):
<mp_squhf_use_infft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    0x10(%rbp),%eax
sar    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    11bf <mp_squhf_use_infft+0x6f>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11b1 <mp_squhf_use_infft+0x61>
jmp    11bf <mp_squhf_use_infft+0x6f>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1189 <mp_squhf_use_infft+0x39>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x30(%rbp),%ecx
cmp    %ecx,%eax
jge    11ea <mp_squhf_use_infft+0x9a>
mov    -0x4(%rbp),%eax
sub    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x10(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    0x18(%rbp),%r9
call   1040 <mp_mul_i2d@plt>
mov    0x10(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x18(%rbp),%rdx
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
call   1030 <mp_mul_cmul_nt_d1@plt>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x10(%rbp),%edx
mov    0x18(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1070 <mp_mul_d2i@plt>
mov    0x10(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    0x28(%rbp),%rcx
call   1060 <mp_mul_csqu_nt_d1@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x10(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1070 <mp_mul_d2i@plt>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
je     127f <mp_squhf_use_infft+0x12f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1050 <mp_add@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_squhf_use_infft>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x28(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,%r8
mov    %rdx,0x20(%rsp)
mov    %edi,%r15d
mov    0x88(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x80(%rsp),%r13
mov    0x78(%rsp),%r12
mov    0x70(%rsp),%ebp
mov    %ebp,%ecx
sar    %ecx
movslq %ecx,%rdx
movslq %edi,%rax
lea    0x1(%rdx),%edi
cmp    %edi,%eax
cmovg  %r15d,%edi
add    $0x1,%rdx
nopl   0x0(%rax,%rax,1)
cmp    %rax,%rdx
jge    11c6 <mp_squhf_use_infft+0x76>
add    $0x1,%ecx
cmpl   $0x0,0x8(%r8,%rdx,4)
lea    0x1(%rdx),%rdx
je     11b0 <mp_squhf_use_infft+0x60>
jmp    11c8 <mp_squhf_use_infft+0x78>
mov    %edi,%ecx
mov    %r15d,%eax
shr    $0x1f,%eax
add    %r15d,%eax
sar    %eax
add    $0x1,%eax
mov    %r15d,%ebx
sub    %ecx,%ebx
cmp    %ebx,%eax
cmovge %eax,%ebx
mov    %r15d,%edi
mov    %ebp,%edx
mov    %esi,%r14d
mov    %r12,%r9
call   1040 <mp_mul_i2d@plt>
mov    %ebp,%edi
mov    %r15d,0xc(%rsp)
mov    0x20(%rsp),%r15
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,0x10(%rsp)
mov    %r13,%rcx
mov    0x18(%rsp),%r13
mov    %r13,%r8
call   1030 <mp_mul_cmul_nt_d1@plt>
mov    %ebx,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %r12,%rcx
mov    %r15,%rbx
mov    0xc(%rsp),%r15d
mov    0x28(%rsp),%r12
mov    %r12,%r8
call   1070 <mp_mul_d2i@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    0x10(%rsp),%rdx
mov    %r13,%rcx
call   1060 <mp_mul_csqu_nt_d1@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    0x30(%rsp),%rbx
mov    %rbx,%r8
call   1070 <mp_mul_d2i@plt>
cmpl   $0x0,(%r12)
je     1289 <mp_squhf_use_infft+0x139>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <mp_add@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @mp_squhf_use_infft(i32 %0, i32 %1, double* %2, i32* %3, i32* %4, i32* %5, i32 %6, double* %7, i32* %8, double* %9) {
%11 = ashr i32 %6, 1
%12 = sext i32 %11 to i64
%13 = sext i32 %0 to i64
%14 = add nsw i32 %11, 1
%15 = call i32 @llvm.smax.i32(i32 %0, i32 %14)
br label %16
16: ; preds = %20, %10
%17 = phi i64 [ %18, %20 ], [ %12, %10 ]
%18 = add nsw i64 %17, 1
%19 = icmp slt i64 %18, %13
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = add nsw i64 %17, 3
%22 = getelementptr inbounds i32, i32* %3, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %16, label %25
25: ; preds = %20
%26 = trunc i64 %18 to i32
br label %27
27: ; preds = %16, %25
%28 = phi i32 [ %26, %25 ], [ %15, %16 ]
%29 = sdiv i32 %0, 2
%30 = add nsw i32 %29, 1
%31 = sub nsw i32 %0, %28
%32 = icmp slt i32 %30, %31
%33 = select i1 %32, i32 %31, i32 %30
tail call void @mp_mul_i2d(i32 %0, i32 %1, i32 %6, i32 %28, i32* %3, double* %7)
tail call void @mp_mul_cmul_nt_d1(i32 %6, double* %2, double* %7, i32* %8, double* %9)
tail call void @mp_mul_d2i(i32 %33, i32 %1, i32 %6, double* %7, i32* %5)
tail call void @mp_mul_csqu_nt_d1(i32 %6, double* %2, i32* %8, double* %9)
tail call void @mp_mul_d2i(i32 %0, i32 %1, i32 %6, double* %2, i32* %4)
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %27
tail call void @mp_add(i32 %0, i32 %1, i32* %4, i32* %5, i32* %4)
br label %37
37: ; preds = %36, %27
ret void
}