user: Converte this assembly snippet into its equivalent C code:

```asm
<mp_sqrt_newton>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,0x8(%rsp)
  mov    %esi,%r12d
  mov    %rdx,0x10(%rsp)
  mov    %rcx,%rbp
  mov    %r8,%rbx
  mov    %r9,(%rsp)
  mov    0x68(%rsp),%r14d
  sar    %r14d
  lea    0x1(%r14),%ecx
  mov    %ecx,0xc(%rsp)
  mov    $0x2,%r13d
  cmp    %r13d,%r14d
  cmovge %r14d,%r13d
  mov    %edi,%eax
  shr    $0x1f,%eax
  add    %edi,%eax
  sar    %eax
  add    $0x1,%eax
  sub    %ecx,%edi
  mov    %edi,%edx
  cmp    %edi,%eax
  cmovge %eax,%edx
  mov    %edx,%r15d
  mov    %r13d,%eax
  sar    %eax
  mov    %eax,0x18(%rsp)
  lea    0x1(%rax),%edx
  mov    %r8,%rcx
  mov    %r15d,%edi
  call   <mp_round@plt>
  mov    0x18(%rsp),%eax
  lea    0xa(%rax,%rax,1),%eax
  mov    %eax,0x18(%rsp)
  mov    %rbx,%rdx
  mov    (%rsp),%rsi
  mov    %eax,%edi
  call   <f_swap_out@plt>
  mov    0x80(%rsp),%rax
  cmp    %r13d,(%rax)
  je     L33
  mov    0x70(%rsp),%r9
  mov    %r13d,%r8d
  mov    %rbx,%rcx
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_squh@plt>
L7:
  mov    %rbp,%rcx
  mov    0xc(%rsp),%edx
  mov    %r12d,%esi
  mov    0x8(%rsp),%r13d
  mov    %r13d,%edi
  call   <mp_round@plt>
  lea    0xa(%r14,%r14,1),%eax
  mov    %rbp,%rdx
  mov    0x60(%rsp),%rsi
  mov    %eax,0x1c(%rsp)
  mov    %eax,%edi
  call   <f_swap_out@plt>
  push   0x70(%rsp)
  push   0x80(%rsp)
  mov    0x78(%rsp),%r9d
  mov    %rbp,%r8
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_mulh_f@plt>
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_load_0@plt>
  mov    %rbx,%rdx
  mov    0x10(%rsp),%rsi
  mov    0x28(%rsp),%edi
  call   <f_swap_in@plt>
  mov    %rbp,%r8
  mov    %rbp,%rcx
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_sub@plt>
  mov    %rbx,%r8
  mov    %rbp,%rcx
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_add@plt>
  mov    %rbx,%rcx
  mov    0x1c(%rsp),%edx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_round@plt>
  lea    0x8(%r15,%r15,1),%r14d
  mov    %rbx,%rdx
  mov    0x10(%rsp),%rsi
  mov    %r14d,%edi
  call   <f_swap_out@plt>
  mov    0x78(%rsp),%ecx
  lea    0x10(,%rcx,8),%edi
  mov    0x80(%rsp),%rdx
  mov    0x88(%rsp),%rsi
  call   <f_swap_in@plt>
  mov    0x78(%rsp),%r8d
  mov    %rbp,%rcx
  mov    0x80(%rsp),%rdx
  mov    %r12d,%esi
  mov    %r13d,%edi
  call   <mp_squh_use_in1fft@plt>
  mov    %rbp,%r8
  mov    %rbp,%rcx
  mov    0x20(%rsp),%rdx
  mov    %r12d,%esi
  mov    %r13d,0x18(%rsp)
  mov    %r13d,%edi
  call   <mp_sub@plt>
  mov    0x20(%rsp),%rax
  mov    0x4(%rax),%r13d
  sub    0x4(%rbp),%r13d
  add    $0x10,%rsp
  movzwl 0x8(%rbp),%ecx
  cmp    %cx,0x8(%rax)
  setg   %al
  movzbl %al,%eax
  add    %r13d,%eax
  mov    0x68(%rsp),%ecx
  lea    0x1(%rcx),%r13d
  cmpl   $0x0,0x0(%rbp)
  cmovne %eax,%r13d
  push   0x70(%rsp)
  push   0x80(%rsp)
  mov    0x78(%rsp),%r9d
  mov    %rbx,%r8
  mov    %rbp,%rcx
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_mulh_f@plt>
  mov    0x90(%rsp),%rsi
  mov    0x78(%rsp),%ecx
  mov    %ecx,(%rsi)
  mov    %rbx,%rcx
  mov    %rbx,%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_idiv_2@plt>
  mov    %rbp,%rdx
  mov    %r12d,%esi
  mov    0x18(%rsp),%edi
  call   <mp_load_0@plt>
  mov    %rbp,%rdx
  mov    0x70(%rsp),%rsi
  mov    0x2c(%rsp),%edi
  call   <f_swap_in@plt>
  add    $0x10,%rsp
  cmpl   $0x0,(%rbx)
  jne    L5
L3:
  mov    %rbx,%rdx
  mov    (%rsp),%rsi
  mov    %r14d,%edi
  call   <f_swap_in@plt>
  mov    %r13d,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L33:
  lea    0x10(,%r13,8),%edi
  mov    0x70(%rsp),%rdx
  mov    0x78(%rsp),%rsi
  call   <f_swap_in@plt>
  mov    %r13d,%r8d
  mov    %rbx,%rcx
  mov    0x70(%rsp),%rdx
  mov    %r12d,%esi
  mov    %r15d,%edi
  call   <mp_squh_use_in1fft@plt>
  jmp    L7
L5:
  mov    %rbp,%r8
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  mov    %r12d,%esi
  mov    0x8(%rsp),%edi
  call   <mp_add@plt>
  jmp    L3
```

assistant: ```c
int mp_sqrt_newton(int n, int radix, int in[], int inout[], int inout_rev[], char *f_name_tmp1, char *f_name_tmp2, int nfft, double tmpfft[], char *f_name_tmp1fft, int *n_tmp1fft) {
  void f_swap_in(int bytesize, char *f_name, char *in);
  void f_swap_out(int bytesize, char *f_name, char *out);
  void mp_load_0(int n, int radix, int out[]);
  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_f(int n, int radix, int in1[], int in2[], int out[], int nfft, char *f_name_in1fft, double outfft[]);
  void mp_squh(int n, int radix, int in[], int out[], int nfft, double inoutfft[]);
  void mp_squh_use_in1fft(int n, int radix, double inoutfft[], int out[], int nfft);
  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);
  f_swap_out(2 * sizeof(int) + ((nfft_h >> 1) + 1) * sizeof(short int), f_name_tmp1, (char *)inout_rev);
  if (*n_tmp1fft != nfft_h) {
    mp_squh(n_h, radix, inout_rev, inout_rev, nfft_h, tmpfft);
  } else {
    f_swap_in((nfft_h + 2) * sizeof(double), f_name_tmp1fft, (char *)tmpfft);
    mp_squh_use_in1fft(n_h, radix, tmpfft, inout_rev, nfft_h);
  }
  mp_round(n, radix, shift, inout);
  f_swap_out(2 * sizeof(int) + shift * sizeof(short int), f_name_tmp2, (char *)inout);
  mp_mulh_f(n_h, radix, inout, inout_rev, inout, nfft, f_name_tmp1fft, tmpfft);
  mp_load_0(n_h, radix, inout_rev);
  f_swap_in(2 * sizeof(int) + ((nfft_h >> 1) + 1) * sizeof(short int), f_name_tmp1, (char *)inout_rev);
  mp_sub(n_h, radix, inout_rev, inout, inout);
  mp_add(n_h, radix, inout_rev, inout, inout_rev);
  mp_round(n_h, radix, shift, inout_rev);
  f_swap_out(2 * sizeof(int) + n_h * sizeof(short int), f_name_tmp1, (char *)inout_rev);
  f_swap_in((nfft + 2) * sizeof(double), f_name_tmp1fft, (char *)tmpfft);
  mp_squh_use_in1fft(n, radix, tmpfft, inout, nfft);
  mp_sub(n, radix, in, inout, inout);
  prc = in[1] - inout[1];
  if (((short int *)&in[2])[0] > ((short int *)&inout[2])[0]) {
    prc++;
  }
  if (inout[0] == 0) {
    prc = nfft + 1;
  }
  mp_mulh_f(n_h, radix, inout_rev, inout, inout_rev, nfft, f_name_tmp1fft, tmpfft);
  *n_tmp1fft = nfft;
  mp_idiv_2(n_h, radix, inout_rev, inout_rev);
  mp_load_0(n, radix, inout);
  f_swap_in(2 * sizeof(int) + shift * sizeof(short int), f_name_tmp2, (char *)inout);
  if (inout_rev[0] != 0) {
    mp_add(n, radix, inout, inout_rev, inout);
  }
  f_swap_in(2 * sizeof(int) + n_h * sizeof(short int), f_name_tmp1, (char *)inout_rev);
  return prc;
}
```