user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mp_sqrt_newton>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%r14d
  mov    %esi,%r12d
  mov    %rdx,0x18(%rsp)
  mov    %rcx,0x10(%rsp)
  mov    %r8,%r13
  mov    %r9,%rbx
  mov    0x60(%rsp),%r15d
  sar    %r15d
  lea    0x1(%r15),%ecx
  mov    %ecx,0xc(%rsp)
  mov    $0x2,%eax
  cmp    %eax,%r15d
  cmovl  %eax,%r15d
  mov    %edi,%ebp
  shr    $0x1f,%ebp
  add    %edi,%ebp
  sar    %ebp
  add    $0x1,%ebp
  mov    %edi,%eax
  sub    %ecx,%eax
  cmp    %eax,%ebp
  cmovl  %eax,%ebp
  mov    %r15d,%edx
  sar    %edx
  add    $0x1,%edx
  mov    %r8,%rcx
  mov    %ebp,%edi
  call   <mp_round@plt>
  mov    0x88(%rsp),%rax
  cmp    %r15d,(%rax)
  je     L2
  push   0x80(%rsp)
  push   0x80(%rsp)
  mov    0x78(%rsp),%r9
  mov    %r15d,%r8d
  mov    %rbx,%rcx
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_squh@plt>
  add    $0x10,%rsp
L28:
  mov    0x10(%rsp),%r15
  mov    %r15,%rcx
  mov    0xc(%rsp),%edx
  mov    %r12d,%esi
  mov    %r14d,%edi
  call   <mp_round@plt>
  push   0x80(%rsp)
  push   0x80(%rsp)
  push   0x80(%rsp)
  push   0x80(%rsp)
  mov    0x80(%rsp),%r9d
  mov    %rbx,%r8
  mov    %rbx,%rcx
  mov    %r15,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_mulh@plt>
  add    $0x20,%rsp
  mov    %rbx,%r8
  mov    %rbx,%rcx
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_sub@plt>
  mov    %r13,%r8
  mov    %rbx,%rcx
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_add@plt>
  sub    $0x8,%rsp
  push   0x88(%rsp)
  mov    0x88(%rsp),%r9
  mov    0x70(%rsp),%r8d
  mov    %rbx,%rcx
  mov    0x78(%rsp),%rdx
  mov    %r12d,%esi
  mov    %r14d,%edi
  call   <mp_squh_use_in1fft@plt>
  mov    %rbx,%r8
  mov    %rbx,%rcx
  mov    0x28(%rsp),%r15
  mov    %r15,%rdx
  mov    %r12d,%esi
  mov    %r14d,%edi
  call   <mp_sub@plt>
  mov    %r15,%rax
  mov    0x4(%r15),%r15d
  sub    0x4(%rbx),%r15d
  add    $0x10,%rsp
  mov    0x8(%rbx),%esi
  cmp    %esi,0x8(%rax)
  setg   %al
  movzbl %al,%eax
  add    %r15d,%eax
  mov    0x60(%rsp),%edi
  lea    0x1(%rdi),%r15d
  cmpl   $0x0,(%rbx)
  cmovne %eax,%r15d
  mov    %r13,%rcx
  mov    0xc(%rsp),%edx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_round@plt>
  push   0x80(%rsp)
  push   0x80(%rsp)
  push   0x80(%rsp)
  push   0x80(%rsp)
  mov    0x80(%rsp),%r9d
  mov    %rbx,%r8
  mov    %rbx,%rcx
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_mulh@plt>
  mov    0xa8(%rsp),%rax
  mov    0x80(%rsp),%esi
  mov    %esi,(%rax)
  add    $0x20,%rsp
  mov    %rbx,%rcx
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_idiv_2@plt>
  cmpl   $0x0,(%rbx)
  jne    L38
L37:
  mov    %r15d,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L2:
  sub    $0x8,%rsp
  push   0x88(%rsp)
  mov    0x88(%rsp),%r9
  mov    %r15d,%r8d
  mov    %rbx,%rcx
  mov    0x78(%rsp),%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_squh_use_in1fft@plt>
  add    $0x10,%rsp
  jmp    L28
L38:
  mov    0x10(%rsp),%rdx
  mov    %rdx,%r8
  mov    %rbx,%rcx
  mov    %r12d,%esi
  mov    %r14d,%edi
  call   <mp_add@plt>
  jmp    L37
```

assistant: ```c
int mp_sqrt_newton(int n, int radix, int in[], int inout[], int inout_rev[], int tmp[], int nfft, double tmp1fft[], double tmp2fft[], int ip[], double w[], int *n_tmp1fft) {
  void mp_round(int n, int radix, int m, int inout[]);
  void mp_add(int n, int radix, int in1[], int in2[], int out[]);
  void mp_sub(int n, int radix, int in1[], int in2[], int out[]);
  void mp_idiv_2(int n, int radix, int in[], int out[]);
  void mp_mulh(int n, int radix, int in1[], int in2[], int out[], int nfft, double in1fft[], double outfft[], int ip[], double w[]);
  void mp_squh(int n, int radix, int in[], int out[], int nfft, double inoutfft[], int ip[], double w[]);
  void mp_squh_use_in1fft(int n, int radix, double inoutfft[], int out[], int nfft, int ip[], double w[]);
  int n_h, nfft_h, shift, prc;
  nfft_h = nfft >> 1;
  shift = nfft_h + 1;
  if (nfft_h < 2) {
    nfft_h = 2;
  }
  n_h = n / 2 + 1;
  if (n_h < n - shift) {
    n_h = n - shift;
  }
  mp_round(n_h, radix, (nfft_h >> 1) + 1, inout_rev);
  if (*n_tmp1fft != nfft_h) {
    mp_squh(n_h, radix, inout_rev, tmp, nfft_h, tmp1fft, ip, w);
  } else {
    mp_squh_use_in1fft(n_h, radix, tmp1fft, tmp, nfft_h, ip, w);
  }
  mp_round(n, radix, shift, inout);
  mp_mulh(n_h, radix, inout, tmp, tmp, nfft, tmp1fft, tmp2fft, ip, w);
  mp_sub(n_h, radix, inout_rev, tmp, tmp);
  mp_add(n_h, radix, inout_rev, tmp, inout_rev);
  mp_squh_use_in1fft(n, radix, tmp1fft, tmp, nfft, ip, w);
  mp_sub(n, radix, in, tmp, tmp);
  prc = in[1] - tmp[1];
  if (in[2] > tmp[2]) {
    prc++;
  }
  if (tmp[0] == 0) {
    prc = nfft + 1;
  }
  mp_round(n_h, radix, shift, inout_rev);
  mp_mulh(n_h, radix, inout_rev, tmp, tmp, nfft, tmp1fft, tmp2fft, ip, w);
  *n_tmp1fft = nfft;
  mp_idiv_2(n_h, radix, tmp, tmp);
  if (tmp[0] != 0) {
    mp_add(n, radix, inout, tmp, inout);
  }
  return prc;
}
```