user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<mp_mulhf>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebp
  mov    %esi,%r15d
  mov    %rcx,%r12
  mov    %r8,0x8(%rsp)
  mov    %r9,(%rsp)
  mov    0x50(%rsp),%r14d
  mov    %r14d,%ebx
  sar    %ebx
  add    $0x1,%ebx
  cmp    %edi,%ebx
  jge    L38
  movslq %ebx,%rax
L16:
  mov    %eax,%ebx
  cmpw   $0x0,0x8(%r12,%rax,2)
  jne    L38
  lea    0x1(%rax),%ebx
  add    $0x1,%rax
  cmp    %eax,%ebp
  jg     L16
L38:
  mov    %ebp,%r13d
  shr    $0x1f,%r13d
  add    %ebp,%r13d
  sar    %r13d
  add    $0x1,%r13d
  mov    %ebp,%eax
  sub    %ebx,%eax
  cmp    %eax,%r13d
  cmovl  %eax,%r13d
  mov    0x58(%rsp),%r9
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    %ebp,%edi
  call   <mp_mul_i2d@plt>
  mov    0x60(%rsp),%r9
  mov    %r12,%r8
  mov    $0x0,%ecx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    %ebp,%edi
  call   <mp_mul_i2d@plt>
  mov    0x60(%rsp),%rdx
  mov    0x58(%rsp),%rsi
  mov    %r14d,%edi
  call   <mp_mul_cmul@plt>
  mov    (%rsp),%r8
  mov    0x60(%rsp),%rcx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    %ebp,%edi
  call   <mp_mul_d2i@plt>
  mov    0x60(%rsp),%r9
  mov    %r12,%r8
  mov    %ebx,%ecx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    %ebp,%edi
  call   <mp_mul_i2d@plt>
  mov    0x60(%rsp),%rdx
  mov    0x58(%rsp),%rsi
  mov    %r14d,%edi
  call   <mp_mul_cmul_nt_d1@plt>
  mov    0x8(%rsp),%rbx
  mov    %rbx,%r8
  mov    0x60(%rsp),%rcx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    %r13d,%edi
  call   <mp_mul_d2i@plt>
  cmpl   $0x0,(%rbx)
  je     L22
  mov    %rbx,%r8
  mov    (%rsp),%rcx
  mov    %rbx,%rdx
  mov    %r15d,%esi
  mov    %ebp,%edi
  call   <mp_add@plt>
L46:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L22:
  mov    0x8(%rsp),%rcx
  mov    (%rsp),%rdx
  mov    %r15d,%esi
  mov    %ebp,%edi
  call   <mp_copy@plt>
  jmp    L46
```

assistant: ```c
void mp_mulhf(int n, int radix, int in1[], int in2[], int out[], int tmp[], int nfft, double in1fft[], 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(int nfft, double d1[], double d2[]);
  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, in1, in1fft);
  mp_mul_i2d(n, radix, nfft, 0, in2, tmpfft);
  mp_mul_cmul(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);
  }
}
```