void mp_mulhf_use_in1fft(int n, int radix, double in1fft[], int in2[],
                         int out[], int tmp[], int nfft, double tmpfft[],
                         int ip[], double w[]) {
  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[], 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 (in2[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, 0, in2, tmpfft);
  mp_mul_cmul_nt_d1(nfft, in1fft, tmpfft, ip, w);
  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, ip, w);
  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    $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_mulhf_use_in1fft+0x6f>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11b1 <mp_mulhf_use_in1fft+0x61>
jmp    11bf <mp_mulhf_use_in1fft+0x6f>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1189 <mp_mulhf_use_in1fft+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_mulhf_use_in1fft+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    -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
mov    0x20(%rbp),%rcx
mov    0x28(%rbp),%r8
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
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    -0x20(%rbp),%r8
call   1070 <mp_mul_d2i@plt>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
je     12a0 <mp_mulhf_use_in1fft+0x150>
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    12b3 <mp_mulhf_use_in1fft+0x163>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1060 <mp_copy@plt>
add    $0x30,%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    $0x38,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,%r14
mov    %rdx,0x28(%rsp)
mov    0x88(%rsp),%rax
mov    %rax,0x20(%rsp)
mov    0x80(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x78(%rsp),%r15
mov    0x70(%rsp),%r12d
mov    %r12d,%ebp
sar    %ebp
movslq %ebp,%rcx
movslq %edi,%rax
lea    0x1(%rcx),%ebx
cmp    %ebx,%eax
cmovg  %edi,%ebx
add    $0x1,%rcx
nopl   0x0(%rax,%rax,1)
cmp    %rax,%rcx
jge    11c6 <mp_mulhf_use_in1fft+0x76>
add    $0x1,%ebp
cmpl   $0x0,0x8(%r14,%rcx,4)
lea    0x1(%rcx),%rcx
je     11b0 <mp_mulhf_use_in1fft+0x60>
jmp    11c8 <mp_mulhf_use_in1fft+0x78>
mov    %ebx,%ebp
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
add    $0x1,%eax
mov    %edi,%ebx
mov    %edi,%r13d
sub    %ebp,%r13d
cmp    %r13d,%eax
cmovge %eax,%r13d
mov    %esi,0xc(%rsp)
mov    %r12d,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    %r15,%r9
call   1040 <mp_mul_i2d@plt>
mov    %r12d,%edi
mov    0x28(%rsp),%rsi
mov    %r15,%rdx
mov    0x18(%rsp),%rcx
mov    0x20(%rsp),%r8
call   1030 <mp_mul_cmul_nt_d1@plt>
mov    %ebx,%edi
mov    0xc(%rsp),%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x10(%rsp),%r8
call   1070 <mp_mul_d2i@plt>
mov    %ebx,0x8(%rsp)
mov    %ebx,%edi
mov    0xc(%rsp),%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %esi,%ebp
mov    %r14,%r8
mov    %r15,%r9
call   1040 <mp_mul_i2d@plt>
mov    %r12d,%edi
mov    0x28(%rsp),%rsi
mov    %r15,%rdx
mov    0x18(%rsp),%rcx
mov    0x20(%rsp),%r8
call   1030 <mp_mul_cmul_nt_d1@plt>
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x30(%rsp),%rbx
mov    %rbx,%r8
call   1070 <mp_mul_d2i@plt>
cmpl   $0x0,(%rbx)
je     129e <mp_mulhf_use_in1fft+0x14e>
mov    0x8(%rsp),%edi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    0x10(%rsp),%rcx
mov    %rbx,%r8
add    $0x38,%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    $0x38,%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, 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** %14
%60 = load double*, double** %18
%61 = load i32, i32* %17
%62 = load double*, double** %13
%63 = load double*, double** %18
%64 = load i32*, i32** %19
%65 = load double*, double** %20
%66 = load i32, i32* %11
%67 = load i32, i32* %12
%68 = load i32, i32* %17
%69 = load double*, double** %18
%70 = load i32*, i32** %16
%71 = load i32, i32* %11
%72 = load i32, i32* %12
%73 = load i32, i32* %17
%74 = load i32, i32* %22
%75 = load i32*, i32** %14
%76 = load double*, double** %18
%77 = load i32, i32* %17
%78 = load double*, double** %13
%79 = load double*, double** %18
%80 = load i32*, i32** %19
%81 = load double*, double** %20
%82 = load i32, i32* %21
%83 = load i32, i32* %12
%84 = load i32, i32* %17
%85 = load double*, double** %18
%86 = load i32*, i32** %15
%87 = load i32*, i32** %15
%88 = getelementptr inbounds i32, i32* %87, i64 0
%89 = load i32, i32* %88
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %97
91: ; preds = %55
%92 = load i32, i32* %11
%93 = load i32, i32* %12
%94 = load i32*, i32** %15
%95 = load i32*, i32** %16
%96 = load i32*, i32** %15
br label %102
97: ; preds = %55
%98 = load i32, i32* %11
%99 = load i32, i32* %12
%100 = load i32*, i32** %16
%101 = load i32*, i32** %15
br label %102
102: ; preds = %97, %91
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, 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 0, 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 %0, i32 %1, i32 %6, double* %7, i32* %5)
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* %4)
%34 = load i32, i32* %4
%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 %38
37: ; preds = %27
tail call void @mp_copy(i32 %0, i32 %1, i32* %5, i32* %4)
br label %38
38: ; preds = %37, %36
ret void
}