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

```asm
<mp_sqrt_newton>:
  endbr64
  push   %r15
  mov    $0x2,%eax
  mov    %r9,%r15
  push   %r14
  mov    %r8,%r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    0x60(%rsp),%ebx
  mov    %rdx,0x10(%rsp)
  mov    %rcx,0x8(%rsp)
  mov    %r14,%rcx
  mov    %ebx,%r8d
  sar    %r8d
  cmp    %eax,%r8d
  lea    0x1(%r8),%esi
  cmovl  %eax,%r8d
  shr    $0x1f,%ebp
  mov    %edi,%eax
  mov    %esi,0x18(%rsp)
  add    %edi,%ebp
  sub    %esi,%eax
  mov    %r12d,%esi
  sar    %ebp
  mov    %r8d,%edx
  mov    %r8d,0x1c(%rsp)
  add    $0x1,%ebp
  cmp    %eax,%ebp
  cmovl  %eax,%ebp
  sar    %edx
  add    $0x1,%edx
  mov    %ebp,%edi
  call   <mp_round@plt>
  mov    0x88(%rsp),%rax
  mov    0x1c(%rsp),%r8d
  cmp    %r8d,(%rax)
  je     L7
  push   0x80(%rsp)
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12d,%esi
  push   0x80(%rsp)
  mov    %ebp,%edi
  mov    0x78(%rsp),%r9
  call   <mp_squh@plt>
  pop    %r11
  pop    %rax
L13:
  mov    0x8(%rsp),%rcx
  mov    0x18(%rsp),%edx
  mov    %r12d,%esi
  mov    %r13d,%edi
  call   <mp_round@plt>
  mov    %ebx,%r9d
  mov    %r15,%r8
  mov    %r15,%rcx
  push   0x80(%rsp)
  mov    %r12d,%esi
  mov    %ebp,%edi
  push   0x80(%rsp)
  push   0x80(%rsp)
  push   0x80(%rsp)
  mov    0x28(%rsp),%rdx
  call   <mp_mulh@plt>
  add    $0x20,%rsp
  mov    %r15,%r8
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_sub@plt>
  mov    %r14,%r8
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <mp_add@plt>
  sub    $0x8,%rsp
  mov    %ebx,%r8d
  mov    %r15,%rcx
  push   0x88(%rsp)
  mov    0x78(%rsp),%rdx
  mov    %r12d,%esi
  mov    %r13d,%edi
  mov    0x88(%rsp),%r9
  call   <mp_squh_use_in1fft@plt>
  mov    0x20(%rsp),%rdx
  mov    %r15,%r8
  mov    %r15,%rcx
  mov    %r12d,%esi
  mov    %r13d,%edi
  call   <mp_sub@plt>
  mov    0x20(%rsp),%rcx
  mov    0x8(%r15),%edi
  pop    %rdx
  xor    %edx,%edx
  pop    %rsi
  mov    %r12d,%esi
  mov    0x4(%rcx),%eax
  sub    0x4(%r15),%eax
  cmp    %edi,0x8(%rcx)
  mov    (%r15),%edi
  mov    %r14,%rcx
  setg   %dl
  add    %edx,%eax
  test   %edi,%edi
  lea    0x1(%rbx),%edx
  mov    %ebp,%edi
  cmove  %edx,%eax
  mov    0x18(%rsp),%edx
  mov    %eax,0x10(%rsp)
  call   <mp_round@plt>
  mov    %r15,%r8
  mov    %ebx,%r9d
  mov    %r15,%rcx
  push   0x80(%rsp)
  mov    %r14,%rdx
  mov    %r12d,%esi
  mov    %ebp,%edi
  push   0x80(%rsp)
  push   0x80(%rsp)
  push   0x80(%rsp)
  call   <mp_mulh@plt>
  mov    %r15,%rcx
  mov    %r15,%rdx
  mov    %r12d,%esi
  mov    0xa8(%rsp),%rax
  mov    %ebp,%edi
  add    $0x20,%rsp
  mov    %ebx,(%rax)
  call   <mp_idiv_2@plt>
  mov    (%r15),%r8d
  mov    0x10(%rsp),%eax
  test   %r8d,%r8d
  jne    L24
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L7:
  sub    $0x8,%rsp
  mov    %r15,%rcx
  mov    %r12d,%esi
  mov    %ebp,%edi
  push   0x88(%rsp)
  mov    0x88(%rsp),%r9
  mov    0x78(%rsp),%rdx
  call   <mp_squh_use_in1fft@plt>
  pop    %r9
  pop    %r10
  jmp    L13
  xchg   %ax,%ax
L24:
  mov    0x8(%rsp),%rdx
  mov    %r15,%rcx
  mov    %r12d,%esi
  mov    %r13d,%edi
  mov    %eax,0x18(%rsp)
  mov    %rdx,%r8
  call   <mp_add@plt>
  mov    0x18(%rsp),%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

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;
}
```