void mp_mulhf_use_in1fft(int n, int radix, double in1fft[], int in2[],
                         int out[], int tmp[], int nfft, double tmpfft[]) {
  void mp_copy(int n, int radix, int in[], int out[]);
  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_d2i(int n, int radix, int nfft, double din[], int out[]);
  int n_h, shift;
  short int *in2dgt;
  in2dgt = (short int *)&in2[2];
  shift = (nfft >> 1) + 1;
  while (n > shift) {
    if (in2dgt[shift] != 0) {
      break;
    }
    shift++;
  }
  n_h = n / 2 + 1;
  if (n_h < n - shift) {
    n_h = n - shift;
  }
  mp_mul_i2d(n, radix, nfft, 0, in2, tmpfft);
  mp_mul_cmul_nt_d1(nfft, in1fft, tmpfft);
  mp_mul_d2i(n, radix, nfft, tmpfft, tmp);
  mp_mul_i2d(n, radix, nfft, shift, in2, tmpfft);
  mp_mul_cmul_nt_d1(nfft, in1fft, tmpfft);
  mp_mul_d2i(n_h, radix, nfft, tmpfft, out);
  if (out[0] != 0) {
    mp_add(n, radix, out, tmp, out);
  } else {
    mp_copy(n, radix, tmp, out);
  }
}


x86 assembly (clang, -O0):
<mp_mulhf_use_in1fft>:
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_mulhf_use_in1fft+0x71>
mov    -0x38(%rbp),%rax
movslq -0x30(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
je     11b3 <mp_mulhf_use_in1fft+0x63>
jmp    11c1 <mp_mulhf_use_in1fft+0x71>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    118d <mp_mulhf_use_in1fft+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_mulhf_use_in1fft+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    -0x18(%rbp),%r8
mov    0x18(%rbp),%r9
xor    %ecx,%ecx
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    -0x4(%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    -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    -0x20(%rbp),%r8
call   1070 <mp_mul_d2i@plt>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
je     1292 <mp_mulhf_use_in1fft+0x142>
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>
jmp    12a5 <mp_mulhf_use_in1fft+0x155>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1060 <mp_copy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_mulhf_use_in1fft>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x20(%rsp)
mov    %rcx,%r14
mov    %rdx,0x18(%rsp)
mov    0x68(%rsp),%r13
mov    0x60(%rsp),%r12d
mov    %r12d,%ebp
sar    %ebp
movslq %ebp,%rax
movslq %edi,%rcx
lea    0x1(%rax),%r8d
cmp    %r8d,%ecx
cmovg  %edi,%r8d
add    $0x5,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x4(%rax),%rbx
cmp    %rcx,%rbx
jge    11ba <mp_mulhf_use_in1fft+0x6a>
add    $0x1,%ebp
cmpw   $0x0,(%r14,%rax,2)
lea    0x1(%rax),%rax
je     11a0 <mp_mulhf_use_in1fft+0x50>
jmp    11bd <mp_mulhf_use_in1fft+0x6d>
mov    %r8d,%ebp
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
add    $0x1,%eax
mov    %edi,%ebx
sub    %ebp,%ebx
cmp    %ebx,%eax
cmovge %eax,%ebx
mov    %r12d,%edx
xor    %ecx,%ecx
mov    %esi,0xc(%rsp)
mov    %edi,%r15d
mov    %r14,%r8
mov    %r13,%r9
call   1040 <mp_mul_i2d@plt>
mov    %r12d,%edi
mov    0x18(%rsp),%rsi
mov    %r13,%rdx
call   1030 <mp_mul_cmul_nt_d1@plt>
mov    %r15d,%edi
mov    0xc(%rsp),%esi
mov    %r12d,%edx
mov    %r13,%rcx
mov    0x10(%rsp),%r8
call   1070 <mp_mul_d2i@plt>
mov    %r15d,0x8(%rsp)
mov    %r15d,%edi
mov    0xc(%rsp),%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %esi,%ebp
mov    %r14,%r8
mov    %r13,%r9
call   1040 <mp_mul_i2d@plt>
mov    %r12d,%edi
mov    0x18(%rsp),%rsi
mov    %r13,%rdx
call   1030 <mp_mul_cmul_nt_d1@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r13,%rcx
mov    0x20(%rsp),%rbx
mov    %rbx,%r8
call   1070 <mp_mul_d2i@plt>
cmpl   $0x0,(%rbx)
je     127e <mp_mulhf_use_in1fft+0x12e>
mov    0x8(%rsp),%edi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    0x10(%rsp),%rcx
mov    %rbx,%r8
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <mp_add@plt>
mov    0x8(%rsp),%edi
mov    %ebp,%esi
mov    0x10(%rsp),%rdx
mov    %rbx,%rcx
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <mp_copy@plt>

LLVM IR (-O0):
define void @mp_mulhf_use_in1fft(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** %12
%60 = load double*, double** %16
%61 = load i32, i32* %15
%62 = load double*, double** %11
%63 = load double*, double** %16
%64 = load i32, i32* %9
%65 = load i32, i32* %10
%66 = load i32, i32* %15
%67 = load double*, double** %16
%68 = load i32*, i32** %14
%69 = load i32, i32* %9
%70 = load i32, i32* %10
%71 = load i32, i32* %15
%72 = load i32, i32* %18
%73 = load i32*, i32** %12
%74 = load double*, double** %16
%75 = load i32, i32* %15
%76 = load double*, double** %11
%77 = load double*, double** %16
%78 = load i32, i32* %17
%79 = load i32, i32* %10
%80 = load i32, i32* %15
%81 = load double*, double** %16
%82 = load i32*, i32** %13
%83 = load i32*, i32** %13
%84 = getelementptr inbounds i32, i32* %83, i64 0
%85 = load i32, i32* %84
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %93
87: ; preds = %55
%88 = load i32, i32* %9
%89 = load i32, i32* %10
%90 = load i32*, i32** %13
%91 = load i32*, i32** %14
%92 = load i32*, i32** %13
br label %98
93: ; preds = %55
%94 = load i32, i32* %9
%95 = load i32, i32* %10
%96 = load i32*, i32** %14
%97 = load i32*, i32** %13
br label %98
98: ; preds = %93, %87
ret void
}

LLVM IR (-O2):
define void @mp_mulhf_use_in1fft(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 0, 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 %0, i32 %1, i32 %6, double* %7, i32* %5)
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* %4)
%33 = load i32, i32* %4
%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 %37
36: ; preds = %26
tail call void @mp_copy(i32 %0, i32 %1, i32* %5, i32* %4)
br label %37
37: ; preds = %36, %35
ret void
}