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


x86 assembly (clang, -O0):
<mp_sqrt_newton>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
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    0x18(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x2,-0x30(%rbp)
jge    11f4 <mp_sqrt_newton+0x54>
movl   $0x2,-0x30(%rbp)
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    -0x34(%rbp),%ecx
cmp    %ecx,%eax
jge    121f <mp_sqrt_newton+0x7f>
mov    -0x4(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x30(%rbp),%edx
sar    $0x1,%edx
add    $0x1,%edx
mov    -0x20(%rbp),%rcx
call   1030 <mp_round@plt>
mov    -0x30(%rbp),%eax
sar    $0x1,%eax
add    $0x1,%eax
cltq
shl    $0x1,%rax
add    $0x8,%rax
mov    %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <f_swap_out@plt>
mov    0x30(%rbp),%rax
mov    (%rax),%eax
cmp    -0x30(%rbp),%eax
je     1288 <mp_sqrt_newton+0xe8>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%r8d
mov    0x20(%rbp),%r9
call   1080 <mp_squh@plt>
jmp    12ba <mp_sqrt_newton+0x11a>
mov    -0x30(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
mov    0x28(%rbp),%rsi
mov    0x20(%rbp),%rdx
call   1070 <f_swap_in@plt>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%r8d
call   10c0 <mp_squh_use_in1fft@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <mp_round@plt>
movslq -0x34(%rbp),%rax
shl    $0x1,%rax
add    $0x8,%rax
mov    %eax,%edi
mov    0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <f_swap_out@plt>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    0x18(%rbp),%r9d
mov    0x28(%rbp),%r10
mov    0x20(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <mp_mulh_f@plt>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   10b0 <mp_load_0@plt>
mov    -0x30(%rbp),%eax
sar    $0x1,%eax
add    $0x1,%eax
cltq
shl    $0x1,%rax
add    $0x8,%rax
mov    %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <f_swap_in@plt>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   1090 <mp_sub@plt>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1050 <mp_add@plt>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1030 <mp_round@plt>
movslq -0x2c(%rbp),%rax
shl    $0x1,%rax
add    $0x8,%rax
mov    %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <f_swap_out@plt>
mov    0x18(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
mov    0x28(%rbp),%rsi
mov    0x20(%rbp),%rdx
call   1070 <f_swap_in@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    0x18(%rbp),%r8d
call   10c0 <mp_squh_use_in1fft@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   1090 <mp_sub@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x18(%rbp),%rcx
sub    0x4(%rcx),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movswl 0x8(%rax),%eax
mov    -0x18(%rbp),%rcx
movswl 0x8(%rcx),%ecx
cmp    %ecx,%eax
jle    141a <mp_sqrt_newton+0x27a>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1430 <mp_sqrt_newton+0x290>
mov    0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    0x18(%rbp),%r9d
mov    0x28(%rbp),%r10
mov    0x20(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <mp_mulh_f@plt>
mov    0x18(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   10a0 <mp_idiv_2@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   10b0 <mp_load_0@plt>
movslq -0x34(%rbp),%rax
shl    $0x1,%rax
add    $0x8,%rax
mov    %eax,%edi
mov    0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1070 <f_swap_in@plt>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
je     14c6 <mp_sqrt_newton+0x326>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   1050 <mp_add@plt>
movslq -0x2c(%rbp),%rax
shl    $0x1,%rax
add    $0x8,%rax
mov    %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <f_swap_in@plt>
mov    -0x38(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_sqrt_newton>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,%r12
mov    %rcx,%rbx
mov    %rdx,0x18(%rsp)
mov    %esi,%ebp
mov    0x78(%rsp),%eax
sar    %eax
lea    0x1(%rax),%ecx
cmp    $0x3,%eax
mov    $0x2,%r15d
cmovge %eax,%r15d
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
add    $0x1,%eax
mov    %edi,0x8(%rsp)
mov    %edi,%r14d
mov    %rcx,0x10(%rsp)
sub    %ecx,%r14d
cmp    %r14d,%eax
cmovge %eax,%r14d
mov    %r15d,%r13d
shr    %r13d
lea    0x1(%r13),%edx
mov    %r14d,%edi
mov    %r8,%rcx
call   1030 <mp_round@plt>
add    %r13d,%r13d
add    $0xa,%r13d
mov    %r13d,%edi
mov    0x20(%rsp),%rsi
mov    %r12,%rdx
call   1040 <f_swap_out@plt>
mov    0x90(%rsp),%rax
cmp    %r15d,(%rax)
jne    1270 <mp_sqrt_newton+0xd0>
lea    0x10(,%r15,8),%edi
mov    0x88(%rsp),%rsi
mov    %r13d,0x4(%rsp)
mov    0x80(%rsp),%r13
mov    %r13,%rdx
call   1070 <f_swap_in@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r13,%rdx
mov    0x4(%rsp),%r13d
mov    %r12,%rcx
mov    %r15d,%r8d
call   10c0 <mp_squh_use_in1fft@plt>
jmp    128b <mp_sqrt_newton+0xeb>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r12,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    0x80(%rsp),%r9
call   1080 <mp_squh@plt>
mov    0x8(%rsp),%edi
mov    %ebp,%esi
mov    0x10(%rsp),%r15
mov    %r15d,%edx
mov    %rbx,%rcx
call   1030 <mp_round@plt>
lea    (%r15,%r15,1),%edi
add    $0x8,%edi
mov    %edi,0x4(%rsp)
mov    0x70(%rsp),%rsi
mov    %rbx,%rdx
call   1040 <f_swap_out@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
mov    0x78(%rsp),%eax
mov    %rax,%r9
mov    0x80(%rsp),%rax
push   %rax
mov    0x90(%rsp),%rax
push   %rax
call   1060 <mp_mulh_f@plt>
add    $0x10,%rsp
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r12,%rdx
call   10b0 <mp_load_0@plt>
mov    %r13d,%edi
mov    0x20(%rsp),%r13
mov    %r13,%rsi
mov    %r12,%rdx
call   1070 <f_swap_in@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
call   1090 <mp_sub@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %r12,%r8
call   1050 <mp_add@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %r12,%rcx
call   1030 <mp_round@plt>
lea    (%r14,%r14,1),%edi
add    $0x8,%edi
mov    %edi,0x10(%rsp)
mov    %r13,%rsi
mov    %ebp,%r13d
mov    %r12,%rdx
call   1040 <f_swap_out@plt>
mov    0x78(%rsp),%eax
lea    0x10(,%rax,8),%edi
mov    0x88(%rsp),%rsi
mov    0x80(%rsp),%r15
mov    %r15,%rdx
call   1070 <f_swap_in@plt>
mov    0x8(%rsp),%ebp
mov    %ebp,%edi
mov    %r13d,%esi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    0x78(%rsp),%r8d
call   10c0 <mp_squh_use_in1fft@plt>
mov    %ebp,%edi
mov    %r13d,%esi
mov    0x18(%rsp),%r15
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
call   1090 <mp_sub@plt>
mov    0x4(%r15),%eax
mov    %eax,0x2c(%rsp)
mov    (%rbx),%eax
mov    %eax,0x34(%rsp)
mov    0x4(%rbx),%eax
mov    %eax,0x30(%rsp)
movzwl 0x8(%r15),%eax
mov    %ax,0x18(%rsp)
movzwl 0x8(%rbx),%eax
mov    %ax,0xe(%rsp)
mov    %r14d,%edi
mov    %r13d,%esi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %r12,%r8
mov    0x78(%rsp),%ebp
mov    %ebp,%r9d
push   0x80(%rsp)
push   0x90(%rsp)
call   1060 <mp_mulh_f@plt>
add    $0x10,%rsp
mov    0x90(%rsp),%rax
mov    %ebp,(%rax)
mov    %r14d,%edi
mov    0x8(%rsp),%r15d
mov    %r13d,%esi
mov    %r12,%rdx
mov    %r12,%rcx
call   10a0 <mp_idiv_2@plt>
mov    %r15d,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
call   10b0 <mp_load_0@plt>
mov    0x4(%rsp),%edi
mov    0x70(%rsp),%rsi
mov    %rbx,%rdx
call   1070 <f_swap_in@plt>
cmpl   $0x0,(%r12)
je     145b <mp_sqrt_newton+0x2bb>
mov    %r15d,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
call   1050 <mp_add@plt>
mov    0x78(%rsp),%eax
add    $0x1,%eax
mov    0x2c(%rsp),%edx
sub    0x30(%rsp),%edx
xor    %ebx,%ebx
movzwl 0xe(%rsp),%ecx
cmp    %cx,0x18(%rsp)
setg   %bl
add    %edx,%ebx
cmpl   $0x0,0x34(%rsp)
cmove  %eax,%ebx
mov    0x10(%rsp),%edi
mov    0x20(%rsp),%rsi
mov    %r12,%rdx
call   1070 <f_swap_in@plt>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mp_sqrt_newton(i32 %0, i32 %1, i32* %2, i32* %3, i32* %4, i8* %5, i8* %6, i32 %7, double* %8, i8* %9, i32* %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i32
%20 = alloca double*
%21 = alloca i8*
%22 = alloca i32*
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32 %0, i32* %12
store i32 %1, i32* %13
store i32* %2, i32** %14
store i32* %3, i32** %15
store i32* %4, i32** %16
store i8* %5, i8** %17
store i8* %6, i8** %18
store i32 %7, i32* %19
store double* %8, double** %20
store i8* %9, i8** %21
store i32* %10, i32** %22
%27 = load i32, i32* %19
%28 = ashr i32 %27, 1
store i32 %28, i32* %24
%29 = load i32, i32* %24
%30 = add nsw i32 %29, 1
store i32 %30, i32* %25
%31 = load i32, i32* %24
%32 = icmp slt i32 %31, 2
br i1 %32, label %33, label %34
33: ; preds = %11
store i32 2, i32* %24
br label %34
34: ; preds = %33, %11
%35 = load i32, i32* %12
%36 = sdiv i32 %35, 2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %23
%38 = load i32, i32* %23
%39 = load i32, i32* %12
%40 = load i32, i32* %25
%41 = sub nsw i32 %39, %40
%42 = icmp slt i32 %38, %41
br i1 %42, label %43, label %47
43: ; preds = %34
%44 = load i32, i32* %12
%45 = load i32, i32* %25
%46 = sub nsw i32 %44, %45
store i32 %46, i32* %23
br label %47
47: ; preds = %43, %34
%48 = load i32, i32* %23
%49 = load i32, i32* %13
%50 = load i32, i32* %24
%51 = ashr i32 %50, 1
%52 = add nsw i32 %51, 1
%53 = load i32*, i32** %16
%54 = load i32, i32* %24
%55 = ashr i32 %54, 1
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = mul i64 %57, 2
%59 = add i64 8, %58
%60 = trunc i64 %59 to i32
%61 = load i8*, i8** %17
%62 = load i32*, i32** %16
%63 = bitcast i32* %62 to i8*
%64 = load i32*, i32** %22
%65 = load i32, i32* %64
%66 = load i32, i32* %24
%67 = icmp ne i32 %65, %66
br i1 %67, label %68, label %75
68: ; preds = %47
%69 = load i32, i32* %23
%70 = load i32, i32* %13
%71 = load i32*, i32** %16
%72 = load i32*, i32** %16
%73 = load i32, i32* %24
%74 = load double*, double** %20
br label %89
75: ; preds = %47
%76 = load i32, i32* %24
%77 = add nsw i32 %76, 2
%78 = sext i32 %77 to i64
%79 = mul i64 %78, 8
%80 = trunc i64 %79 to i32
%81 = load i8*, i8** %21
%82 = load double*, double** %20
%83 = bitcast double* %82 to i8*
%84 = load i32, i32* %23
%85 = load i32, i32* %13
%86 = load double*, double** %20
%87 = load i32*, i32** %16
%88 = load i32, i32* %24
br label %89
89: ; preds = %75, %68
%90 = load i32, i32* %12
%91 = load i32, i32* %13
%92 = load i32, i32* %25
%93 = load i32*, i32** %15
%94 = load i32, i32* %25
%95 = sext i32 %94 to i64
%96 = mul i64 %95, 2
%97 = add i64 8, %96
%98 = trunc i64 %97 to i32
%99 = load i8*, i8** %18
%100 = load i32*, i32** %15
%101 = bitcast i32* %100 to i8*
%102 = load i32, i32* %23
%103 = load i32, i32* %13
%104 = load i32*, i32** %15
%105 = load i32*, i32** %16
%106 = load i32*, i32** %15
%107 = load i32, i32* %19
%108 = load i8*, i8** %21
%109 = load double*, double** %20
%110 = load i32, i32* %23
%111 = load i32, i32* %13
%112 = load i32*, i32** %16
%113 = load i32, i32* %24
%114 = ashr i32 %113, 1
%115 = add nsw i32 %114, 1
%116 = sext i32 %115 to i64
%117 = mul i64 %116, 2
%118 = add i64 8, %117
%119 = trunc i64 %118 to i32
%120 = load i8*, i8** %17
%121 = load i32*, i32** %16
%122 = bitcast i32* %121 to i8*
%123 = load i32, i32* %23
%124 = load i32, i32* %13
%125 = load i32*, i32** %16
%126 = load i32*, i32** %15
%127 = load i32*, i32** %15
%128 = load i32, i32* %23
%129 = load i32, i32* %13
%130 = load i32*, i32** %16
%131 = load i32*, i32** %15
%132 = load i32*, i32** %16
%133 = load i32, i32* %23
%134 = load i32, i32* %13
%135 = load i32, i32* %25
%136 = load i32*, i32** %16
%137 = load i32, i32* %23
%138 = sext i32 %137 to i64
%139 = mul i64 %138, 2
%140 = add i64 8, %139
%141 = trunc i64 %140 to i32
%142 = load i8*, i8** %17
%143 = load i32*, i32** %16
%144 = bitcast i32* %143 to i8*
%145 = load i32, i32* %19
%146 = add nsw i32 %145, 2
%147 = sext i32 %146 to i64
%148 = mul i64 %147, 8
%149 = trunc i64 %148 to i32
%150 = load i8*, i8** %21
%151 = load double*, double** %20
%152 = bitcast double* %151 to i8*
%153 = load i32, i32* %12
%154 = load i32, i32* %13
%155 = load double*, double** %20
%156 = load i32*, i32** %15
%157 = load i32, i32* %19
%158 = load i32, i32* %12
%159 = load i32, i32* %13
%160 = load i32*, i32** %14
%161 = load i32*, i32** %15
%162 = load i32*, i32** %15
%163 = load i32*, i32** %14
%164 = getelementptr inbounds i32, i32* %163, i64 1
%165 = load i32, i32* %164
%166 = load i32*, i32** %15
%167 = getelementptr inbounds i32, i32* %166, i64 1
%168 = load i32, i32* %167
%169 = sub nsw i32 %165, %168
store i32 %169, i32* %26
%170 = load i32*, i32** %14
%171 = getelementptr inbounds i32, i32* %170, i64 2
%172 = bitcast i32* %171 to i16*
%173 = getelementptr inbounds i16, i16* %172, i64 0
%174 = load i16, i16* %173
%175 = sext i16 %174 to i32
%176 = load i32*, i32** %15
%177 = getelementptr inbounds i32, i32* %176, i64 2
%178 = bitcast i32* %177 to i16*
%179 = getelementptr inbounds i16, i16* %178, i64 0
%180 = load i16, i16* %179
%181 = sext i16 %180 to i32
%182 = icmp sgt i32 %175, %181
br i1 %182, label %183, label %186
183: ; preds = %89
%184 = load i32, i32* %26
%185 = add nsw i32 %184, 1
store i32 %185, i32* %26
br label %186
186: ; preds = %183, %89
%187 = load i32*, i32** %15
%188 = getelementptr inbounds i32, i32* %187, i64 0
%189 = load i32, i32* %188
%190 = icmp eq i32 %189, 0
br i1 %190, label %191, label %194
191: ; preds = %186
%192 = load i32, i32* %19
%193 = add nsw i32 %192, 1
store i32 %193, i32* %26
br label %194
194: ; preds = %191, %186
%195 = load i32, i32* %23
%196 = load i32, i32* %13
%197 = load i32*, i32** %16
%198 = load i32*, i32** %15
%199 = load i32*, i32** %16
%200 = load i32, i32* %19
%201 = load i8*, i8** %21
%202 = load double*, double** %20
%203 = load i32, i32* %19
%204 = load i32*, i32** %22
store i32 %203, i32* %204
%205 = load i32, i32* %23
%206 = load i32, i32* %13
%207 = load i32*, i32** %16
%208 = load i32*, i32** %16
%209 = load i32, i32* %12
%210 = load i32, i32* %13
%211 = load i32*, i32** %15
%212 = load i32, i32* %25
%213 = sext i32 %212 to i64
%214 = mul i64 %213, 2
%215 = add i64 8, %214
%216 = trunc i64 %215 to i32
%217 = load i8*, i8** %18
%218 = load i32*, i32** %15
%219 = bitcast i32* %218 to i8*
%220 = load i32*, i32** %16
%221 = getelementptr inbounds i32, i32* %220, i64 0
%222 = load i32, i32* %221
%223 = icmp ne i32 %222, 0
br i1 %223, label %224, label %230
224: ; preds = %194
%225 = load i32, i32* %12
%226 = load i32, i32* %13
%227 = load i32*, i32** %15
%228 = load i32*, i32** %16
%229 = load i32*, i32** %15
br label %230
230: ; preds = %224, %194
%231 = load i32, i32* %23
%232 = sext i32 %231 to i64
%233 = mul i64 %232, 2
%234 = add i64 8, %233
%235 = trunc i64 %234 to i32
%236 = load i8*, i8** %17
%237 = load i32*, i32** %16
%238 = bitcast i32* %237 to i8*
%239 = load i32, i32* %26
ret i32 %239
}

LLVM IR (-O2):
define i32 @mp_sqrt_newton(i32 %0, i32 %1, i32* %2, i32* %3, i32* %4, i8* %5, i8* %6, i32 %7, double* %8, i8* %9, i32* nocapture %10) {
%12 = ashr i32 %7, 1
%13 = add nsw i32 %12, 1
%14 = icmp sgt i32 %12, 2
%15 = select i1 %14, i32 %12, i32 2
%16 = sdiv i32 %0, 2
%17 = add nsw i32 %16, 1
%18 = sub nsw i32 %0, %13
%19 = icmp slt i32 %17, %18
%20 = select i1 %19, i32 %18, i32 %17
%21 = lshr i32 %15, 1
%22 = add nuw nsw i32 %21, 1
tail call void @mp_round(i32 %20, i32 %1, i32 %22, i32* %4)
%23 = shl nuw nsw i32 %22, 1
%24 = add nuw nsw i32 %23, 8
%25 = bitcast i32* %4 to i8*
tail call void @f_swap_out(i32 %24, i8* %5, i8* %25)
%26 = load i32, i32* %10
%27 = icmp eq i32 %26, %15
br i1 %27, label %29, label %28
28: ; preds = %11
tail call void @mp_squh(i32 %20, i32 %1, i32* %4, i32* %4, i32 %15, double* %8)
br label %33
29: ; preds = %11
%30 = shl i32 %15, 3
%31 = add i32 %30, 16
%32 = bitcast double* %8 to i8*
tail call void @f_swap_in(i32 %31, i8* %9, i8* %32)
tail call void @mp_squh_use_in1fft(i32 %20, i32 %1, double* %8, i32* %4, i32 %15)
br label %33
33: ; preds = %29, %28
%34 = bitcast double* %8 to i8*
tail call void @mp_round(i32 %0, i32 %1, i32 %13, i32* %3)
%35 = shl i32 %13, 1
%36 = add i32 %35, 8
%37 = bitcast i32* %3 to i8*
tail call void @f_swap_out(i32 %36, i8* %6, i8* %37)
tail call void @mp_mulh_f(i32 %20, i32 %1, i32* %3, i32* %4, i32* %3, i32 %7, i8* %9, double* %8)
tail call void @mp_load_0(i32 %20, i32 %1, i32* %4)
tail call void @f_swap_in(i32 %24, i8* %5, i8* %25)
tail call void @mp_sub(i32 %20, i32 %1, i32* %4, i32* %3, i32* %3)
tail call void @mp_add(i32 %20, i32 %1, i32* %4, i32* %3, i32* %4)
tail call void @mp_round(i32 %20, i32 %1, i32 %13, i32* %4)
%38 = shl i32 %20, 1
%39 = add i32 %38, 8
tail call void @f_swap_out(i32 %39, i8* %5, i8* %25)
%40 = shl i32 %7, 3
%41 = add i32 %40, 16
tail call void @f_swap_in(i32 %41, i8* %9, i8* %34)
tail call void @mp_squh_use_in1fft(i32 %0, i32 %1, double* %8, i32* %3, i32 %7)
tail call void @mp_sub(i32 %0, i32 %1, i32* %2, i32* %3, i32* %3)
%42 = getelementptr inbounds i32, i32* %2, i64 1
%43 = load i32, i32* %42
%44 = getelementptr inbounds i32, i32* %3, i64 1
%45 = load i32, i32* %44
%46 = getelementptr inbounds i32, i32* %2, i64 2
%47 = bitcast i32* %46 to i16*
%48 = load i16, i16* %47
%49 = getelementptr inbounds i32, i32* %3, i64 2
%50 = bitcast i32* %49 to i16*
%51 = load i16, i16* %50
%52 = load i32, i32* %3
tail call void @mp_mulh_f(i32 %20, i32 %1, i32* %4, i32* %3, i32* %4, i32 %7, i8* %9, double* %8)
store i32 %7, i32* %10
tail call void @mp_idiv_2(i32 %20, i32 %1, i32* %4, i32* %4)
tail call void @mp_load_0(i32 %0, i32 %1, i32* %3)
tail call void @f_swap_in(i32 %36, i8* %6, i8* %37)
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 0
br i1 %54, label %56, label %55
55: ; preds = %33
tail call void @mp_add(i32 %0, i32 %1, i32* %3, i32* %4, i32* %3)
br label %56
56: ; preds = %55, %33
%57 = icmp eq i32 %52, 0
%58 = add nsw i32 %7, 1
%59 = sub i32 %43, %45
%60 = icmp sgt i16 %48, %51
%61 = zext i1 %60 to i32
%62 = add nsw i32 %59, %61
%63 = select i1 %57, i32 %58, i32 %62
tail call void @f_swap_in(i32 %39, i8* %5, i8* %25)
ret i32 %63
}