void mp_squhf_use_infft(int n, int radix, double infft[], int in[], int out[],
                        int tmp[], int nfft, double tmpfft[]) {
  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[]);
  void mp_mul_csqu_nt_d1(int nfft, double d1[]);
  void mp_mul_d2i(int n, int radix, int nfft, double din[], int out[]);
  int n_h, shift;
  short int *indgt;
  indgt = (short int *)&in[2];
  shift = (nfft >> 1) + 1;
  while (n > shift) {
    if (indgt[shift] != 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);
  mp_mul_d2i(n_h, radix, nfft, tmpfft, tmp);
  mp_mul_csqu_nt_d1(nfft, infft);
  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    $0x40,%rsp
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    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
mov    0x10(%rbp),%eax
sar    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    11c1 <mp_squhf_use_infft+0x71>
mov    -0x38(%rbp),%rax
movslq -0x30(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
je     11b3 <mp_squhf_use_infft+0x63>
jmp    11c1 <mp_squhf_use_infft+0x71>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    118d <mp_squhf_use_infft+0x3d>
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    11ec <mp_squhf_use_infft+0x9c>
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
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
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     1271 <mp_squhf_use_infft+0x121>
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    $0x40,%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    $0x18,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,%r8
mov    %rdx,%rbp
mov    %esi,%r13d
mov    %edi,%r15d
mov    0x58(%rsp),%r14
mov    0x50(%rsp),%r12d
mov    %r12d,%ecx
sar    %ecx
movslq %ecx,%rax
movslq %edi,%rdx
lea    0x1(%rax),%esi
cmp    %esi,%edx
cmovg  %edi,%esi
add    $0x5,%rax
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x4(%rax),%rdi
cmp    %rdx,%rdi
jge    11ba <mp_squhf_use_infft+0x6a>
add    $0x1,%ecx
cmpw   $0x0,(%r8,%rax,2)
lea    0x1(%rax),%rax
je     11a0 <mp_squhf_use_infft+0x50>
jmp    11bc <mp_squhf_use_infft+0x6c>
mov    %esi,%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    %r13d,%esi
mov    %r12d,%edx
mov    %r14,%r9
call   1040 <mp_mul_i2d@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1030 <mp_mul_cmul_nt_d1@plt>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r14,%rcx
mov    %rbp,%rbx
mov    0x8(%rsp),%rbp
mov    %rbp,%r8
call   1070 <mp_mul_d2i@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
call   1060 <mp_mul_csqu_nt_d1@plt>
mov    %r15d,%edi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %rbx,%rcx
mov    0x10(%rsp),%rbx
mov    %rbx,%r8
call   1070 <mp_mul_d2i@plt>
cmpl   $0x0,0x0(%rbp)
je     125a <mp_squhf_use_infft+0x10a>
mov    %r15d,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %rbx,%r8
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <mp_add@plt>
add    $0x18,%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) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i16*
store i32 %0, i32* %9
store i32 %1, i32* %10
store double* %2, double** %11
store i32* %3, i32** %12
store i32* %4, i32** %13
store i32* %5, i32** %14
store i32 %6, i32* %15
store double* %7, double** %16
%20 = load i32*, i32** %12
%21 = getelementptr inbounds i32, i32* %20, i64 2
%22 = bitcast i32* %21 to i16*
store i16* %22, i16** %19
%23 = load i32, i32* %15
%24 = ashr i32 %23, 1
%25 = add nsw i32 %24, 1
store i32 %25, i32* %18
br label %26
26: ; preds = %39, %8
%27 = load i32, i32* %9
%28 = load i32, i32* %18
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %42
30: ; preds = %26
%31 = load i16*, i16** %19
%32 = load i32, i32* %18
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i16, i16* %31, i64 %33
%35 = load i16, i16* %34
%36 = sext i16 %35 to i32
%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* %18
%41 = add nsw i32 %40, 1
store i32 %41, i32* %18
br label %26
42: ; preds = %38, %26
%43 = load i32, i32* %9
%44 = sdiv i32 %43, 2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %17
%46 = load i32, i32* %17
%47 = load i32, i32* %9
%48 = load i32, i32* %18
%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* %9
%53 = load i32, i32* %18
%54 = sub nsw i32 %52, %53
store i32 %54, i32* %17
br label %55
55: ; preds = %51, %42
%56 = load i32, i32* %9
%57 = load i32, i32* %10
%58 = load i32, i32* %15
%59 = load i32, i32* %18
%60 = load i32*, i32** %12
%61 = load double*, double** %16
%62 = load i32, i32* %15
%63 = load double*, double** %11
%64 = load double*, double** %16
%65 = load i32, i32* %17
%66 = load i32, i32* %10
%67 = load i32, i32* %15
%68 = load double*, double** %16
%69 = load i32*, i32** %14
%70 = load i32, i32* %15
%71 = load double*, double** %11
%72 = load i32, i32* %9
%73 = load i32, i32* %10
%74 = load i32, i32* %15
%75 = load double*, double** %11
%76 = load i32*, i32** %13
%77 = load i32*, i32** %14
%78 = getelementptr inbounds i32, i32* %77, i64 0
%79 = load i32, i32* %78
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %87
81: ; preds = %55
%82 = load i32, i32* %9
%83 = load i32, i32* %10
%84 = load i32*, i32** %13
%85 = load i32*, i32** %14
%86 = load i32*, i32** %13
br label %87
87: ; preds = %81, %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) {
%9 = getelementptr inbounds i32, i32* %3, i64 2
%10 = bitcast i32* %9 to i16*
%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, %8
%17 = phi i64 [ %18, %20 ], [ %12, %8 ]
%18 = add nsw i64 %17, 1
%19 = icmp slt i64 %18, %13
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = getelementptr inbounds i16, i16* %10, i64 %18
%22 = load i16, i16* %21
%23 = icmp eq i16 %22, 0
br i1 %23, label %16, label %24
24: ; preds = %20
%25 = trunc i64 %18 to i32
br label %26
26: ; preds = %16, %24
%27 = phi i32 [ %25, %24 ], [ %15, %16 ]
%28 = sdiv i32 %0, 2
%29 = add nsw i32 %28, 1
%30 = sub nsw i32 %0, %27
%31 = icmp slt i32 %29, %30
%32 = select i1 %31, i32 %30, i32 %29
tail call void @mp_mul_i2d(i32 %0, i32 %1, i32 %6, i32 %27, i32* %3, double* %7)
tail call void @mp_mul_cmul_nt_d1(i32 %6, double* %2, double* %7)
tail call void @mp_mul_d2i(i32 %32, i32 %1, i32 %6, double* %7, i32* %5)
tail call void @mp_mul_csqu_nt_d1(i32 %6, double* %2)
tail call void @mp_mul_d2i(i32 %0, i32 %1, i32 %6, double* %2, i32* %4)
%33 = load i32, i32* %5
%34 = icmp eq i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %26
tail call void @mp_add(i32 %0, i32 %1, i32* %4, i32* %5, i32* %4)
br label %36
36: ; preds = %35, %26
ret void
}