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


x86 assembly (clang, -O0):
<mp_sqrt_newton>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x58,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x10(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x2,-0x38(%rbp)
jge    11c9 <mp_sqrt_newton+0x59>
movl   $0x2,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x3c(%rbp),%ecx
cmp    %ecx,%eax
jge    11f4 <mp_sqrt_newton+0x84>
mov    -0xc(%rbp),%eax
sub    -0x3c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x38(%rbp),%edx
sar    $0x1,%edx
add    $0x1,%edx
mov    -0x28(%rbp),%rcx
call   1040 <mp_round@plt>
mov    0x38(%rbp),%rax
mov    (%rax),%eax
cmp    -0x38(%rbp),%eax
je     124c <mp_sqrt_newton+0xdc>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8d
mov    0x18(%rbp),%r9
mov    0x28(%rbp),%r10
mov    0x30(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <mp_squh@plt>
jmp    126f <mp_sqrt_newton+0xff>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x18(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8d
mov    0x28(%rbp),%r9
mov    0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1090 <mp_squh_use_in1fft@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1040 <mp_round@plt>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%rbx
mov    0x20(%rbp),%r11
mov    0x28(%rbp),%r10
mov    0x30(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <mp_mulh@plt>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1070 <mp_sub@plt>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1050 <mp_add@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x18(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%r8d
mov    0x28(%rbp),%r9
mov    0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1090 <mp_squh_use_in1fft@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1070 <mp_sub@plt>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x30(%rbp),%rcx
sub    0x4(%rcx),%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x30(%rbp),%rcx
cmp    0x8(%rcx),%eax
jle    1355 <mp_sqrt_newton+0x1e5>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
jne    136b <mp_sqrt_newton+0x1fb>
mov    0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1040 <mp_round@plt>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%rbx
mov    0x20(%rbp),%r11
mov    0x28(%rbp),%r10
mov    0x30(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <mp_mulh@plt>
mov    0x10(%rbp),%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1080 <mp_idiv_2@plt>
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
je     13fb <mp_sqrt_newton+0x28b>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1050 <mp_add@plt>
mov    -0x40(%rbp),%eax
add    $0x58,%rsp
pop    %rbx
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,%rbx
mov    %rcx,0x30(%rsp)
mov    %rdx,0x10(%rsp)
mov    %esi,%r13d
mov    %edi,%r12d
mov    0x98(%rsp),%rbp
mov    0x70(%rsp),%eax
sar    %eax
lea    0x1(%rax),%ecx
cmp    $0x3,%eax
mov    $0x2,%r14d
cmovge %eax,%r14d
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
add    $0x1,%eax
mov    %edi,0xc(%rsp)
mov    %ecx,%r15d
sub    %ecx,%r12d
cmp    %r12d,%eax
cmovge %eax,%r12d
mov    %r14d,%edx
shr    %edx
add    $0x1,%edx
mov    %r12d,%edi
mov    %r8,0x28(%rsp)
mov    %r8,%rcx
call   1040 <mp_round@plt>
cmp    %r14d,0x0(%rbp)
jne    1218 <mp_sqrt_newton+0xa8>
sub    $0x8,%rsp
mov    %r12d,%edi
mov    %r13d,%esi
mov    0x80(%rsp),%rdx
mov    %rbx,%rcx
mov    %r14d,%r8d
mov    0x90(%rsp),%r9
push   0x98(%rsp)
call   1090 <mp_squh_use_in1fft@plt>
jmp    1241 <mp_sqrt_newton+0xd1>
mov    %r12d,%edi
mov    %r13d,%esi
mov    0x28(%rsp),%rdx
mov    %rbx,%rcx
mov    %r14d,%r8d
mov    0x78(%rsp),%r9
push   0x90(%rsp)
push   0x90(%rsp)
call   1060 <mp_squh@plt>
add    $0x10,%rsp
mov    0xc(%rsp),%edi
mov    %r13d,%esi
mov    %r15d,0x24(%rsp)
mov    %r15d,%edx
mov    0x30(%rsp),%rbp
mov    %rbp,%rcx
call   1040 <mp_round@plt>
mov    %r12d,%edi
mov    %r13d,%esi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    0x70(%rsp),%r9d
mov    0x90(%rsp),%rax
push   %rax
mov    0x90(%rsp),%rax
push   %rax
mov    0x90(%rsp),%rax
push   %rax
mov    0x90(%rsp),%rbp
push   %rbp
call   1030 <mp_mulh@plt>
add    $0x20,%rsp
mov    %r12d,%edi
mov    %r13d,%esi
mov    0x28(%rsp),%r14
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
call   1070 <mp_sub@plt>
mov    %r12d,%edi
mov    %r13d,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
call   1050 <mp_add@plt>
sub    $0x8,%rsp
mov    0x14(%rsp),%r15d
mov    %r15d,%edi
mov    %r13d,%esi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    0x78(%rsp),%r8d
mov    0x90(%rsp),%r9
push   0x98(%rsp)
call   1090 <mp_squh_use_in1fft@plt>
add    $0x10,%rsp
mov    %r15d,%edi
mov    %r13d,%esi
mov    0x70(%rsp),%ebp
mov    0x10(%rsp),%r15
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
call   1070 <mp_sub@plt>
mov    0x4(%r15),%eax
mov    %eax,0x20(%rsp)
mov    0x8(%r15),%eax
mov    %eax,0x10(%rsp)
mov    (%rbx),%r15d
mov    0x4(%rbx),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rbx),%eax
mov    %eax,0x1c(%rsp)
mov    %r12d,%edi
mov    %r13d,%esi
mov    0x24(%rsp),%edx
mov    %r14,%rcx
call   1040 <mp_round@plt>
mov    %r12d,%edi
mov    %r13d,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %ebp,%r9d
push   0x90(%rsp)
push   0x90(%rsp)
push   0x90(%rsp)
push   0x90(%rsp)
call   1030 <mp_mulh@plt>
add    $0x20,%rsp
mov    0x98(%rsp),%rax
mov    %ebp,(%rax)
mov    %r12d,%edi
mov    %r13d,%r14d
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %rbx,%rcx
call   1080 <mp_idiv_2@plt>
cmpl   $0x0,(%rbx)
je     13c2 <mp_sqrt_newton+0x252>
mov    0xc(%rsp),%edi
mov    %r14d,%esi
mov    0x30(%rsp),%rdx
mov    %rbx,%rcx
mov    %rdx,%r8
call   1050 <mp_add@plt>
add    $0x1,%ebp
mov    0x20(%rsp),%ecx
sub    0x18(%rsp),%ecx
xor    %eax,%eax
mov    0x1c(%rsp),%edx
cmp    %edx,0x10(%rsp)
setg   %al
add    %ecx,%eax
test   %r15d,%r15d
cmove  %ebp,%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, i32* %5, i32 %6, double* %7, double* %8, i32* %9, double* %10, i32* %11) {
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32
%20 = alloca double*
%21 = alloca double*
%22 = alloca i32*
%23 = alloca double*
%24 = alloca i32*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
store i32 %0, i32* %13
store i32 %1, i32* %14
store i32* %2, i32** %15
store i32* %3, i32** %16
store i32* %4, i32** %17
store i32* %5, i32** %18
store i32 %6, i32* %19
store double* %7, double** %20
store double* %8, double** %21
store i32* %9, i32** %22
store double* %10, double** %23
store i32* %11, i32** %24
%29 = load i32, i32* %19
%30 = ashr i32 %29, 1
store i32 %30, i32* %26
%31 = load i32, i32* %26
%32 = add nsw i32 %31, 1
store i32 %32, i32* %27
%33 = load i32, i32* %26
%34 = icmp slt i32 %33, 2
br i1 %34, label %35, label %36
35: ; preds = %12
store i32 2, i32* %26
br label %36
36: ; preds = %35, %12
%37 = load i32, i32* %13
%38 = sdiv i32 %37, 2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %25
%40 = load i32, i32* %25
%41 = load i32, i32* %13
%42 = load i32, i32* %27
%43 = sub nsw i32 %41, %42
%44 = icmp slt i32 %40, %43
br i1 %44, label %45, label %49
45: ; preds = %36
%46 = load i32, i32* %13
%47 = load i32, i32* %27
%48 = sub nsw i32 %46, %47
store i32 %48, i32* %25
br label %49
49: ; preds = %45, %36
%50 = load i32, i32* %25
%51 = load i32, i32* %14
%52 = load i32, i32* %26
%53 = ashr i32 %52, 1
%54 = add nsw i32 %53, 1
%55 = load i32*, i32** %17
%56 = load i32*, i32** %24
%57 = load i32, i32* %56
%58 = load i32, i32* %26
%59 = icmp ne i32 %57, %58
br i1 %59, label %60, label %69
60: ; preds = %49
%61 = load i32, i32* %25
%62 = load i32, i32* %14
%63 = load i32*, i32** %17
%64 = load i32*, i32** %18
%65 = load i32, i32* %26
%66 = load double*, double** %20
%67 = load i32*, i32** %22
%68 = load double*, double** %23
br label %77
69: ; preds = %49
%70 = load i32, i32* %25
%71 = load i32, i32* %14
%72 = load double*, double** %20
%73 = load i32*, i32** %18
%74 = load i32, i32* %26
%75 = load i32*, i32** %22
%76 = load double*, double** %23
br label %77
77: ; preds = %69, %60
%78 = load i32, i32* %13
%79 = load i32, i32* %14
%80 = load i32, i32* %27
%81 = load i32*, i32** %16
%82 = load i32, i32* %25
%83 = load i32, i32* %14
%84 = load i32*, i32** %16
%85 = load i32*, i32** %18
%86 = load i32*, i32** %18
%87 = load i32, i32* %19
%88 = load double*, double** %20
%89 = load double*, double** %21
%90 = load i32*, i32** %22
%91 = load double*, double** %23
%92 = load i32, i32* %25
%93 = load i32, i32* %14
%94 = load i32*, i32** %17
%95 = load i32*, i32** %18
%96 = load i32*, i32** %18
%97 = load i32, i32* %25
%98 = load i32, i32* %14
%99 = load i32*, i32** %17
%100 = load i32*, i32** %18
%101 = load i32*, i32** %17
%102 = load i32, i32* %13
%103 = load i32, i32* %14
%104 = load double*, double** %20
%105 = load i32*, i32** %18
%106 = load i32, i32* %19
%107 = load i32*, i32** %22
%108 = load double*, double** %23
%109 = load i32, i32* %13
%110 = load i32, i32* %14
%111 = load i32*, i32** %15
%112 = load i32*, i32** %18
%113 = load i32*, i32** %18
%114 = load i32*, i32** %15
%115 = getelementptr inbounds i32, i32* %114, i64 1
%116 = load i32, i32* %115
%117 = load i32*, i32** %18
%118 = getelementptr inbounds i32, i32* %117, i64 1
%119 = load i32, i32* %118
%120 = sub nsw i32 %116, %119
store i32 %120, i32* %28
%121 = load i32*, i32** %15
%122 = getelementptr inbounds i32, i32* %121, i64 2
%123 = load i32, i32* %122
%124 = load i32*, i32** %18
%125 = getelementptr inbounds i32, i32* %124, i64 2
%126 = load i32, i32* %125
%127 = icmp sgt i32 %123, %126
br i1 %127, label %128, label %131
128: ; preds = %77
%129 = load i32, i32* %28
%130 = add nsw i32 %129, 1
store i32 %130, i32* %28
br label %131
131: ; preds = %128, %77
%132 = load i32*, i32** %18
%133 = getelementptr inbounds i32, i32* %132, i64 0
%134 = load i32, i32* %133
%135 = icmp eq i32 %134, 0
br i1 %135, label %136, label %139
136: ; preds = %131
%137 = load i32, i32* %19
%138 = add nsw i32 %137, 1
store i32 %138, i32* %28
br label %139
139: ; preds = %136, %131
%140 = load i32, i32* %25
%141 = load i32, i32* %14
%142 = load i32, i32* %27
%143 = load i32*, i32** %17
%144 = load i32, i32* %25
%145 = load i32, i32* %14
%146 = load i32*, i32** %17
%147 = load i32*, i32** %18
%148 = load i32*, i32** %18
%149 = load i32, i32* %19
%150 = load double*, double** %20
%151 = load double*, double** %21
%152 = load i32*, i32** %22
%153 = load double*, double** %23
%154 = load i32, i32* %19
%155 = load i32*, i32** %24
store i32 %154, i32* %155
%156 = load i32, i32* %25
%157 = load i32, i32* %14
%158 = load i32*, i32** %18
%159 = load i32*, i32** %18
%160 = load i32*, i32** %18
%161 = getelementptr inbounds i32, i32* %160, i64 0
%162 = load i32, i32* %161
%163 = icmp ne i32 %162, 0
br i1 %163, label %164, label %170
164: ; preds = %139
%165 = load i32, i32* %13
%166 = load i32, i32* %14
%167 = load i32*, i32** %16
%168 = load i32*, i32** %18
%169 = load i32*, i32** %16
br label %170
170: ; preds = %164, %139
%171 = load i32, i32* %28
ret i32 %171
}

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