double quickselect_weight_double(double W0, int n, double *arr, double *weight,
                                 double Wl, double Wr) {
  int i, ir, j, m, mid;
  double a, temp;
  double wSumLeft = 0.0;
  double wLeft = Wl;
  double wRight = Wr;
  m = 0;
  ir = n - 1;
  for (;;) {
    if (ir <= m) {
      return arr[m];
    }
    if (ir == m + 1) {
      if (arr[m] > arr[ir]) {
        temp = (arr[m]);
        (arr[m]) = (arr[ir]);
        (arr[ir]) = temp;
        temp = (weight[m]);
        (weight[m]) = (weight[ir]);
        (weight[ir]) = temp;
      }
      if (wLeft + weight[m] >= W0) {
        return arr[m];
      } else {
        return arr[ir];
      }
    }
    mid = (m + ir) >> 1;
    if (arr[mid] > arr[ir]) {
      temp = (arr[mid]);
      (arr[mid]) = (arr[ir]);
      (arr[ir]) = temp;
      temp = (weight[mid]);
      (weight[mid]) = (weight[ir]);
      (weight[ir]) = temp;
    }
    if (arr[m] > arr[ir]) {
      temp = (arr[m]);
      (arr[m]) = (arr[ir]);
      (arr[ir]) = temp;
      temp = (weight[m]);
      (weight[m]) = (weight[ir]);
      (weight[ir]) = temp;
    }
    if (arr[mid] > arr[m]) {
      temp = (arr[mid]);
      (arr[mid]) = (arr[m]);
      (arr[m]) = temp;
      temp = (weight[mid]);
      (weight[mid]) = (weight[m]);
      (weight[m]) = temp;
    }
    temp = (arr[mid]);
    (arr[mid]) = (arr[m + 1]);
    (arr[m + 1]) = temp;
    temp = (weight[mid]);
    (weight[mid]) = (weight[m + 1]);
    (weight[m + 1]) = temp;
    a = arr[m];
    i = m + 1;
    j = ir;
    for (;;) {
      do {
        wSumLeft += weight[i];
        i++;
      } while (a > arr[i]);
      do {
        j--;
      } while (arr[j] > a);
      if (j < i)
        break;
      temp = (arr[i]);
      (arr[i]) = (arr[j]);
      (arr[j]) = temp;
      temp = (weight[i]);
      (weight[i]) = (weight[j]);
      (weight[j]) = temp;
    }
    temp = (arr[m]);
    (arr[m]) = (arr[j]);
    (arr[j]) = temp;
    temp = (weight[m]);
    (weight[m]) = (weight[j]);
    (weight[j]) = temp;
    while (i > j + 1) {
      i--;
      wSumLeft -= weight[i];
    }
    if ((wLeft + wSumLeft) <= W0) {
      if ((wLeft + wSumLeft + weight[j]) > W0) {
        return arr[j];
      }
      m = j + 1;
      wLeft += weight[j] + wSumLeft;
    } else {
      ir = j - 1;
      wRight = 2 * W0 - wSumLeft - wLeft;
    }
    wSumLeft = 0.0;
  }
}


x86 assembly (clang, -O0):
<quickselect_weight_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x48(%rbp),%eax
jg     116d <quickselect_weight_double+0x6d>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1766 <quickselect_weight_double+0x666>
mov    -0x40(%rbp),%eax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1265 <quickselect_weight_double+0x165>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    121a <quickselect_weight_double+0x11a>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     124e <quickselect_weight_double+0x14e>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1766 <quickselect_weight_double+0x666>
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1766 <quickselect_weight_double+0x666>
mov    -0x48(%rbp),%eax
add    -0x40(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    130d <quickselect_weight_double+0x20d>
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    13a9 <quickselect_weight_double+0x2a9>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1445 <quickselect_weight_double+0x345>
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    14fb <quickselect_weight_double+0x3fb>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
ja     14fb <quickselect_weight_double+0x3fb>
jmp    1538 <quickselect_weight_double+0x438>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x58(%rbp),%xmm0
ja     1538 <quickselect_weight_double+0x438>
mov    -0x44(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    156a <quickselect_weight_double+0x46a>
jmp    15eb <quickselect_weight_double+0x4eb>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    14f6 <quickselect_weight_double+0x3f6>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jle    16a1 <quickselect_weight_double+0x5a1>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1667 <quickselect_weight_double+0x567>
movsd  -0x70(%rbp),%xmm1
addsd  -0x68(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     171d <quickselect_weight_double+0x61d>
movsd  -0x70(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    16f3 <quickselect_weight_double+0x5f3>
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1766 <quickselect_weight_double+0x666>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x68(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1759 <quickselect_weight_double+0x659>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    114a <quickselect_weight_double+0x4a>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickselect_weight_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %r13d,%r13d
cmp    $0x2,%edi
jl     136c <quickselect_weight_double+0x26c>
movabs $0x100000000,%r14
add    $0xffffffff,%edi
xor    %r13d,%r13d
movabs $0xffffffff00000000,%r9
ff ff ff
jmp    1155 <quickselect_weight_double+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r11,%rax,1),%edi
add    $0xffffffff,%edi
mov    -0x8(%rsp),%r13
cmp    %r13d,%edi
jle    136c <quickselect_weight_double+0x26c>
lea    0x1(%r13),%r15d
cmp    %r15d,%edi
je     1375 <quickselect_weight_double+0x275>
lea    (%rdi,%r13,1),%eax
sar    %eax
cltq
movsd  (%rsi,%rax,8),%xmm3
movslq %edi,%rcx
movsd  (%rsi,%rcx,8),%xmm2
ucomisd %xmm2,%xmm3
jbe    11a0 <quickselect_weight_double+0xa0>
movsd  %xmm2,(%rsi,%rax,8)
movsd  %xmm3,(%rsi,%rcx,8)
movsd  (%rdx,%rax,8),%xmm2
movsd  (%rdx,%rcx,8),%xmm3
movsd  %xmm3,(%rdx,%rax,8)
movsd  %xmm2,(%rdx,%rcx,8)
movsd  (%rsi,%rcx,8),%xmm2
movslq %r13d,%r10
movsd  (%rsi,%r10,8),%xmm3
ucomisd %xmm2,%xmm3
jbe    11d6 <quickselect_weight_double+0xd6>
movsd  %xmm2,(%rsi,%r10,8)
movsd  %xmm3,(%rsi,%rcx,8)
movsd  (%rdx,%r10,8),%xmm2
movsd  (%rdx,%rcx,8),%xmm3
movsd  %xmm3,(%rdx,%r10,8)
movsd  %xmm2,(%rdx,%rcx,8)
movsd  (%rsi,%r10,8),%xmm3
movsd  (%rsi,%rax,8),%xmm2
ucomisd %xmm3,%xmm2
mov    %r13,-0x8(%rsp)
jbe    120c <quickselect_weight_double+0x10c>
movsd  %xmm3,(%rsi,%rax,8)
movsd  %xmm2,(%rsi,%r10,8)
movsd  (%rdx,%rax,8),%xmm2
movsd  (%rdx,%r10,8),%xmm3
movsd  %xmm3,(%rdx,%rax,8)
movsd  %xmm2,(%rdx,%r10,8)
movsd  (%rsi,%rax,8),%xmm2
movslq %r15d,%rcx
movsd  (%rsi,%rcx,8),%xmm3
movsd  %xmm3,(%rsi,%rax,8)
movsd  %xmm2,(%rsi,%rcx,8)
movsd  (%rdx,%rax,8),%xmm2
movsd  (%rdx,%rcx,8),%xmm3
movsd  %xmm3,(%rdx,%rax,8)
movsd  %xmm2,(%rdx,%rcx,8)
movsd  (%rsi,%r10,8),%xmm3
xorpd  %xmm2,%xmm2
mov    %edi,%r11d
nop
movslq %r15d,%r15
mov    %r15,%rcx
shl    $0x20,%rcx
nopw   0x0(%rax,%rax,1)
addsd  (%rdx,%r15,8),%xmm2
movsd  0x8(%rsi,%r15,8),%xmm4
add    $0x1,%r15
add    %r14,%rcx
ucomisd %xmm4,%xmm3
ja     1250 <quickselect_weight_double+0x150>
movslq %r11d,%r8
mov    %r8,%rbx
shl    $0x20,%rbx
add    %r14,%rbx
lea    (%rsi,%r8,8),%r13
mov    %r13,%r12
xor    %eax,%eax
add    %r9,%rbx
movsd  -0x8(%r13,%rax,8),%xmm5
add    $0xffffffffffffffff,%rax
add    $0xfffffffffffffff8,%r12
ucomisd %xmm3,%xmm5
ja     1280 <quickselect_weight_double+0x180>
lea    (%r11,%rax,1),%ebp
add    $0x1,%ebp
cmp    %r15d,%ebp
jle    12e0 <quickselect_weight_double+0x1e0>
add    %eax,%r11d
movsd  %xmm5,(%rsi,%r15,8)
movsd  %xmm4,0x0(%r13,%rax,8)
movsd  (%rdx,%r15,8),%xmm4
lea    (%rdx,%r8,8),%rcx
movsd  (%rcx,%rax,8),%xmm5
movsd  %xmm5,(%rdx,%r15,8)
movsd  %xmm4,(%rcx,%rax,8)
jmp    1240 <quickselect_weight_double+0x140>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r11d,%ebp
lea    (%rax,%rbp,1),%r13
add    $0x1,%r13
lea    -0x1(%r15),%r15d
movsd  (%rsi,%r10,8),%xmm3
movsd  %xmm5,(%rsi,%r10,8)
lea    (%rsi,%r8,8),%rbp
movsd  %xmm3,0x0(%rbp,%rax,8)
movsd  (%rdx,%r10,8),%xmm3
lea    (%rdx,%r8,8),%rbp
movsd  0x0(%rbp,%rax,8),%xmm4
movsd  %xmm4,(%rdx,%r10,8)
movsd  %xmm3,0x0(%rbp,%rax,8)
cmp    %r13d,%r15d
jl     133f <quickselect_weight_double+0x23f>
sar    $0x20,%rcx
sar    $0x20,%rbx
xchg   %ax,%ax
subsd  -0x8(%rdx,%rcx,8),%xmm2
add    $0xffffffffffffffff,%rcx
cmp    %rbx,%rcx
jg     1330 <quickselect_weight_double+0x230>
movapd %xmm1,%xmm4
addsd  %xmm2,%xmm4
ucomisd %xmm4,%xmm0
jb     1140 <quickselect_weight_double+0x40>
addsd  %xmm3,%xmm4
ucomisd %xmm0,%xmm4
ja     13be <quickselect_weight_double+0x2be>
addsd  %xmm2,%xmm3
addsd  %xmm3,%xmm1
cmp    %r13d,%edi
jg     1155 <quickselect_weight_double+0x55>
movslq %r13d,%rax
lea    (%rsi,%rax,8),%r12
jmp    13be <quickselect_weight_double+0x2be>
movslq %r13d,%rax
lea    (%rsi,%rax,8),%r12
movsd  (%rsi,%rax,8),%xmm2
movslq %edi,%rdi
lea    (%rsi,%rdi,8),%rcx
movsd  (%rsi,%rdi,8),%xmm3
ucomisd %xmm3,%xmm2
jbe    13b1 <quickselect_weight_double+0x2b1>
movsd  %xmm3,(%r12)
movsd  %xmm2,(%rcx)
movsd  (%rdx,%rax,8),%xmm2
movsd  (%rdx,%rdi,8),%xmm3
movsd  %xmm3,(%rdx,%rax,8)
movsd  %xmm2,(%rdx,%rdi,8)
addsd  (%rdx,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
cmovb  %rcx,%r12
movsd  (%r12),%xmm0
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @quickselect_weight_double(double %0, i32 %1, double* %2, double* %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double %0, double* %8
store i32 %1, i32* %9
store double* %2, double** %10
store double* %3, double** %11
store double %4, double* %12
store double %5, double* %13
store double 0.000000e+00, double* %21
%24 = load double, double* %12
store double %24, double* %22
%25 = load double, double* %13
store double %25, double* %23
store i32 0, i32* %17
%26 = load i32, i32* %9
%27 = sub nsw i32 %26, 1
store i32 %27, i32* %15
br label %28
28: ; preds = %498, %6
%29 = load i32, i32* %15
%30 = load i32, i32* %17
%31 = icmp sle i32 %29, %30
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = load double*, double** %10
%34 = load i32, i32* %17
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
store double %37, double* %7
br label %499
38: ; preds = %28
%39 = load i32, i32* %15
%40 = load i32, i32* %17
%41 = add nsw i32 %40, 1
%42 = icmp eq i32 %39, %41
br i1 %42, label %43, label %116
43: ; preds = %38
%44 = load double*, double** %10
%45 = load i32, i32* %17
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
%49 = load double*, double** %10
%50 = load i32, i32* %15
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
%53 = load double, double* %52
%54 = fcmp ogt double %48, %53
br i1 %54, label %55, label %94
55: ; preds = %43
%56 = load double*, double** %10
%57 = load i32, i32* %17
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
store double %60, double* %20
%61 = load double*, double** %10
%62 = load i32, i32* %15
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
%65 = load double, double* %64
%66 = load double*, double** %10
%67 = load i32, i32* %17
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
store double %65, double* %69
%70 = load double, double* %20
%71 = load double*, double** %10
%72 = load i32, i32* %15
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
store double %70, double* %74
%75 = load double*, double** %11
%76 = load i32, i32* %17
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
%79 = load double, double* %78
store double %79, double* %20
%80 = load double*, double** %11
%81 = load i32, i32* %15
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %80, i64 %82
%84 = load double, double* %83
%85 = load double*, double** %11
%86 = load i32, i32* %17
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
store double %84, double* %88
%89 = load double, double* %20
%90 = load double*, double** %11
%91 = load i32, i32* %15
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
store double %89, double* %93
br label %94
94: ; preds = %55, %43
%95 = load double, double* %22
%96 = load double*, double** %11
%97 = load i32, i32* %17
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %96, i64 %98
%100 = load double, double* %99
%101 = fadd double %95, %100
%102 = load double, double* %8
%103 = fcmp oge double %101, %102
br i1 %103, label %104, label %110
104: ; preds = %94
%105 = load double*, double** %10
%106 = load i32, i32* %17
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %105, i64 %107
%109 = load double, double* %108
store double %109, double* %7
br label %499
110: ; preds = %94
%111 = load double*, double** %10
%112 = load i32, i32* %15
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %111, i64 %113
%115 = load double, double* %114
store double %115, double* %7
br label %499
116: ; preds = %38
%117 = load i32, i32* %17
%118 = load i32, i32* %15
%119 = add nsw i32 %117, %118
%120 = ashr i32 %119, 1
store i32 %120, i32* %18
%121 = load double*, double** %10
%122 = load i32, i32* %18
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %121, i64 %123
%125 = load double, double* %124
%126 = load double*, double** %10
%127 = load i32, i32* %15
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double, double* %126, i64 %128
%130 = load double, double* %129
%131 = fcmp ogt double %125, %130
br i1 %131, label %132, label %171
132: ; preds = %116
%133 = load double*, double** %10
%134 = load i32, i32* %18
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
%137 = load double, double* %136
store double %137, double* %20
%138 = load double*, double** %10
%139 = load i32, i32* %15
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %138, i64 %140
%142 = load double, double* %141
%143 = load double*, double** %10
%144 = load i32, i32* %18
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double, double* %143, i64 %145
store double %142, double* %146
%147 = load double, double* %20
%148 = load double*, double** %10
%149 = load i32, i32* %15
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %148, i64 %150
store double %147, double* %151
%152 = load double*, double** %11
%153 = load i32, i32* %18
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds double, double* %152, i64 %154
%156 = load double, double* %155
store double %156, double* %20
%157 = load double*, double** %11
%158 = load i32, i32* %15
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds double, double* %157, i64 %159
%161 = load double, double* %160
%162 = load double*, double** %11
%163 = load i32, i32* %18
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds double, double* %162, i64 %164
store double %161, double* %165
%166 = load double, double* %20
%167 = load double*, double** %11
%168 = load i32, i32* %15
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %167, i64 %169
store double %166, double* %170
br label %171
171: ; preds = %132, %116
%172 = load double*, double** %10
%173 = load i32, i32* %17
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = load double*, double** %10
%178 = load i32, i32* %15
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %177, i64 %179
%181 = load double, double* %180
%182 = fcmp ogt double %176, %181
br i1 %182, label %183, label %222
183: ; preds = %171
%184 = load double*, double** %10
%185 = load i32, i32* %17
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %184, i64 %186
%188 = load double, double* %187
store double %188, double* %20
%189 = load double*, double** %10
%190 = load i32, i32* %15
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds double, double* %189, i64 %191
%193 = load double, double* %192
%194 = load double*, double** %10
%195 = load i32, i32* %17
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds double, double* %194, i64 %196
store double %193, double* %197
%198 = load double, double* %20
%199 = load double*, double** %10
%200 = load i32, i32* %15
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds double, double* %199, i64 %201
store double %198, double* %202
%203 = load double*, double** %11
%204 = load i32, i32* %17
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds double, double* %203, i64 %205
%207 = load double, double* %206
store double %207, double* %20
%208 = load double*, double** %11
%209 = load i32, i32* %15
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double, double* %208, i64 %210
%212 = load double, double* %211
%213 = load double*, double** %11
%214 = load i32, i32* %17
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double, double* %213, i64 %215
store double %212, double* %216
%217 = load double, double* %20
%218 = load double*, double** %11
%219 = load i32, i32* %15
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds double, double* %218, i64 %220
store double %217, double* %221
br label %222
222: ; preds = %183, %171
%223 = load double*, double** %10
%224 = load i32, i32* %18
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds double, double* %223, i64 %225
%227 = load double, double* %226
%228 = load double*, double** %10
%229 = load i32, i32* %17
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds double, double* %228, i64 %230
%232 = load double, double* %231
%233 = fcmp ogt double %227, %232
br i1 %233, label %234, label %273
234: ; preds = %222
%235 = load double*, double** %10
%236 = load i32, i32* %18
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds double, double* %235, i64 %237
%239 = load double, double* %238
store double %239, double* %20
%240 = load double*, double** %10
%241 = load i32, i32* %17
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds double, double* %240, i64 %242
%244 = load double, double* %243
%245 = load double*, double** %10
%246 = load i32, i32* %18
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds double, double* %245, i64 %247
store double %244, double* %248
%249 = load double, double* %20
%250 = load double*, double** %10
%251 = load i32, i32* %17
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds double, double* %250, i64 %252
store double %249, double* %253
%254 = load double*, double** %11
%255 = load i32, i32* %18
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds double, double* %254, i64 %256
%258 = load double, double* %257
store double %258, double* %20
%259 = load double*, double** %11
%260 = load i32, i32* %17
%261 = sext i32 %260 to i64
%262 = getelementptr inbounds double, double* %259, i64 %261
%263 = load double, double* %262
%264 = load double*, double** %11
%265 = load i32, i32* %18
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds double, double* %264, i64 %266
store double %263, double* %267
%268 = load double, double* %20
%269 = load double*, double** %11
%270 = load i32, i32* %17
%271 = sext i32 %270 to i64
%272 = getelementptr inbounds double, double* %269, i64 %271
store double %268, double* %272
br label %273
273: ; preds = %234, %222
%274 = load double*, double** %10
%275 = load i32, i32* %18
%276 = sext i32 %275 to i64
%277 = getelementptr inbounds double, double* %274, i64 %276
%278 = load double, double* %277
store double %278, double* %20
%279 = load double*, double** %10
%280 = load i32, i32* %17
%281 = add nsw i32 %280, 1
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds double, double* %279, i64 %282
%284 = load double, double* %283
%285 = load double*, double** %10
%286 = load i32, i32* %18
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds double, double* %285, i64 %287
store double %284, double* %288
%289 = load double, double* %20
%290 = load double*, double** %10
%291 = load i32, i32* %17
%292 = add nsw i32 %291, 1
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds double, double* %290, i64 %293
store double %289, double* %294
%295 = load double*, double** %11
%296 = load i32, i32* %18
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds double, double* %295, i64 %297
%299 = load double, double* %298
store double %299, double* %20
%300 = load double*, double** %11
%301 = load i32, i32* %17
%302 = add nsw i32 %301, 1
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds double, double* %300, i64 %303
%305 = load double, double* %304
%306 = load double*, double** %11
%307 = load i32, i32* %18
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds double, double* %306, i64 %308
store double %305, double* %309
%310 = load double, double* %20
%311 = load double*, double** %11
%312 = load i32, i32* %17
%313 = add nsw i32 %312, 1
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds double, double* %311, i64 %314
store double %310, double* %315
%316 = load double*, double** %10
%317 = load i32, i32* %17
%318 = sext i32 %317 to i64
%319 = getelementptr inbounds double, double* %316, i64 %318
%320 = load double, double* %319
store double %320, double* %19
%321 = load i32, i32* %17
%322 = add nsw i32 %321, 1
store i32 %322, i32* %14
%323 = load i32, i32* %15
store i32 %323, i32* %16
br label %324
324: ; preds = %360, %273
br label %325
325: ; preds = %335, %324
%326 = load double*, double** %11
%327 = load i32, i32* %14
%328 = sext i32 %327 to i64
%329 = getelementptr inbounds double, double* %326, i64 %328
%330 = load double, double* %329
%331 = load double, double* %21
%332 = fadd double %331, %330
store double %332, double* %21
%333 = load i32, i32* %14
%334 = add nsw i32 %333, 1
store i32 %334, i32* %14
br label %335
335: ; preds = %325
%336 = load double, double* %19
%337 = load double*, double** %10
%338 = load i32, i32* %14
%339 = sext i32 %338 to i64
%340 = getelementptr inbounds double, double* %337, i64 %339
%341 = load double, double* %340
%342 = fcmp ogt double %336, %341
br i1 %342, label %325, label %343
343: ; preds = %335
br label %344
344: ; preds = %347, %343
%345 = load i32, i32* %16
%346 = add nsw i32 %345, -1
store i32 %346, i32* %16
br label %347
347: ; preds = %344
%348 = load double*, double** %10
%349 = load i32, i32* %16
%350 = sext i32 %349 to i64
%351 = getelementptr inbounds double, double* %348, i64 %350
%352 = load double, double* %351
%353 = load double, double* %19
%354 = fcmp ogt double %352, %353
br i1 %354, label %344, label %355
355: ; preds = %347
%356 = load i32, i32* %16
%357 = load i32, i32* %14
%358 = icmp slt i32 %356, %357
br i1 %358, label %359, label %360
359: ; preds = %355
br label %399
360: ; preds = %355
%361 = load double*, double** %10
%362 = load i32, i32* %14
%363 = sext i32 %362 to i64
%364 = getelementptr inbounds double, double* %361, i64 %363
%365 = load double, double* %364
store double %365, double* %20
%366 = load double*, double** %10
%367 = load i32, i32* %16
%368 = sext i32 %367 to i64
%369 = getelementptr inbounds double, double* %366, i64 %368
%370 = load double, double* %369
%371 = load double*, double** %10
%372 = load i32, i32* %14
%373 = sext i32 %372 to i64
%374 = getelementptr inbounds double, double* %371, i64 %373
store double %370, double* %374
%375 = load double, double* %20
%376 = load double*, double** %10
%377 = load i32, i32* %16
%378 = sext i32 %377 to i64
%379 = getelementptr inbounds double, double* %376, i64 %378
store double %375, double* %379
%380 = load double*, double** %11
%381 = load i32, i32* %14
%382 = sext i32 %381 to i64
%383 = getelementptr inbounds double, double* %380, i64 %382
%384 = load double, double* %383
store double %384, double* %20
%385 = load double*, double** %11
%386 = load i32, i32* %16
%387 = sext i32 %386 to i64
%388 = getelementptr inbounds double, double* %385, i64 %387
%389 = load double, double* %388
%390 = load double*, double** %11
%391 = load i32, i32* %14
%392 = sext i32 %391 to i64
%393 = getelementptr inbounds double, double* %390, i64 %392
store double %389, double* %393
%394 = load double, double* %20
%395 = load double*, double** %11
%396 = load i32, i32* %16
%397 = sext i32 %396 to i64
%398 = getelementptr inbounds double, double* %395, i64 %397
store double %394, double* %398
br label %324
399: ; preds = %359
%400 = load double*, double** %10
%401 = load i32, i32* %17
%402 = sext i32 %401 to i64
%403 = getelementptr inbounds double, double* %400, i64 %402
%404 = load double, double* %403
store double %404, double* %20
%405 = load double*, double** %10
%406 = load i32, i32* %16
%407 = sext i32 %406 to i64
%408 = getelementptr inbounds double, double* %405, i64 %407
%409 = load double, double* %408
%410 = load double*, double** %10
%411 = load i32, i32* %17
%412 = sext i32 %411 to i64
%413 = getelementptr inbounds double, double* %410, i64 %412
store double %409, double* %413
%414 = load double, double* %20
%415 = load double*, double** %10
%416 = load i32, i32* %16
%417 = sext i32 %416 to i64
%418 = getelementptr inbounds double, double* %415, i64 %417
store double %414, double* %418
%419 = load double*, double** %11
%420 = load i32, i32* %17
%421 = sext i32 %420 to i64
%422 = getelementptr inbounds double, double* %419, i64 %421
%423 = load double, double* %422
store double %423, double* %20
%424 = load double*, double** %11
%425 = load i32, i32* %16
%426 = sext i32 %425 to i64
%427 = getelementptr inbounds double, double* %424, i64 %426
%428 = load double, double* %427
%429 = load double*, double** %11
%430 = load i32, i32* %17
%431 = sext i32 %430 to i64
%432 = getelementptr inbounds double, double* %429, i64 %431
store double %428, double* %432
%433 = load double, double* %20
%434 = load double*, double** %11
%435 = load i32, i32* %16
%436 = sext i32 %435 to i64
%437 = getelementptr inbounds double, double* %434, i64 %436
store double %433, double* %437
br label %438
438: ; preds = %443, %399
%439 = load i32, i32* %14
%440 = load i32, i32* %16
%441 = add nsw i32 %440, 1
%442 = icmp sgt i32 %439, %441
br i1 %442, label %443, label %453
443: ; preds = %438
%444 = load i32, i32* %14
%445 = add nsw i32 %444, -1
store i32 %445, i32* %14
%446 = load double*, double** %11
%447 = load i32, i32* %14
%448 = sext i32 %447 to i64
%449 = getelementptr inbounds double, double* %446, i64 %448
%450 = load double, double* %449
%451 = load double, double* %21
%452 = fsub double %451, %450
store double %452, double* %21
br label %438
453: ; preds = %438
%454 = load double, double* %22
%455 = load double, double* %21
%456 = fadd double %454, %455
%457 = load double, double* %8
%458 = fcmp ole double %456, %457
br i1 %458, label %459, label %489
459: ; preds = %453
%460 = load double, double* %22
%461 = load double, double* %21
%462 = fadd double %460, %461
%463 = load double*, double** %11
%464 = load i32, i32* %16
%465 = sext i32 %464 to i64
%466 = getelementptr inbounds double, double* %463, i64 %465
%467 = load double, double* %466
%468 = fadd double %462, %467
%469 = load double, double* %8
%470 = fcmp ogt double %468, %469
br i1 %470, label %471, label %477
471: ; preds = %459
%472 = load double*, double** %10
%473 = load i32, i32* %16
%474 = sext i32 %473 to i64
%475 = getelementptr inbounds double, double* %472, i64 %474
%476 = load double, double* %475
store double %476, double* %7
br label %499
477: ; preds = %459
%478 = load i32, i32* %16
%479 = add nsw i32 %478, 1
store i32 %479, i32* %17
%480 = load double*, double** %11
%481 = load i32, i32* %16
%482 = sext i32 %481 to i64
%483 = getelementptr inbounds double, double* %480, i64 %482
%484 = load double, double* %483
%485 = load double, double* %21
%486 = fadd double %484, %485
%487 = load double, double* %22
%488 = fadd double %487, %486
store double %488, double* %22
br label %498
489: ; preds = %453
%490 = load i32, i32* %16
%491 = sub nsw i32 %490, 1
store i32 %491, i32* %15
%492 = load double, double* %8
%493 = load double, double* %21
%494 = fneg double %493
%495 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %492, double %494)
%496 = load double, double* %22
%497 = fsub double %495, %496
store double %497, double* %23
br label %498
498: ; preds = %489, %477
store double 0.000000e+00, double* %21
br label %28
499: ; preds = %471, %110, %104, %32
%500 = load double, double* %7
ret double %500
}

LLVM IR (-O2):
define double @quickselect_weight_double(double %0, i32 %1, double* nocapture %2, double* nocapture %3, double %4, double %5) {
%7 = icmp sgt i32 %1, 1
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = add nsw i32 %1, -1
br label %14
10: ; preds = %156, %6
%11 = phi i32 [ 0, %6 ], [ %158, %156 ]
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds double, double* %2, i64 %12
br label %161
14: ; preds = %8, %156
%15 = phi double [ %159, %156 ], [ %4, %8 ]
%16 = phi i32 [ %158, %156 ], [ 0, %8 ]
%17 = phi i32 [ %157, %156 ], [ %9, %8 ]
%18 = add nsw i32 %16, 1
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %39
20: ; preds = %14
%21 = sext i32 %16 to i64
%22 = getelementptr inbounds double, double* %2, i64 %21
%23 = load double, double* %22
%24 = sext i32 %17 to i64
%25 = getelementptr inbounds double, double* %2, i64 %24
%26 = load double, double* %25
%27 = fcmp ogt double %23, %26
br i1 %27, label %28, label %33
28: ; preds = %20
store double %26, double* %22
store double %23, double* %25
%29 = getelementptr inbounds double, double* %3, i64 %21
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %3, i64 %24
%32 = load double, double* %31
store double %32, double* %29
store double %30, double* %31
br label %33
33: ; preds = %28, %20
%34 = getelementptr inbounds double, double* %3, i64 %21
%35 = load double, double* %34
%36 = fadd double %15, %35
%37 = fcmp ult double %36, %0
%38 = select i1 %37, double* %25, double* %22
br label %161
39: ; preds = %14
%40 = add nsw i32 %16, %17
%41 = ashr i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %2, i64 %42
%44 = load double, double* %43
%45 = sext i32 %17 to i64
%46 = getelementptr inbounds double, double* %2, i64 %45
%47 = load double, double* %46
%48 = fcmp ogt double %44, %47
br i1 %48, label %49, label %55
49: ; preds = %39
store double %47, double* %43
store double %44, double* %46
%50 = getelementptr inbounds double, double* %3, i64 %42
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %3, i64 %45
%53 = load double, double* %52
store double %53, double* %50
store double %51, double* %52
%54 = load double, double* %46
br label %55
55: ; preds = %49, %39
%56 = phi double [ %54, %49 ], [ %47, %39 ]
%57 = sext i32 %16 to i64
%58 = getelementptr inbounds double, double* %2, i64 %57
%59 = load double, double* %58
%60 = fcmp ogt double %59, %56
br i1 %60, label %61, label %67
61: ; preds = %55
store double %56, double* %58
store double %59, double* %46
%62 = getelementptr inbounds double, double* %3, i64 %57
%63 = load double, double* %62
%64 = getelementptr inbounds double, double* %3, i64 %45
%65 = load double, double* %64
store double %65, double* %62
store double %63, double* %64
%66 = load double, double* %58
br label %67
67: ; preds = %61, %55
%68 = phi double [ %66, %61 ], [ %59, %55 ]
%69 = load double, double* %43
%70 = fcmp ogt double %69, %68
br i1 %70, label %71, label %77
71: ; preds = %67
store double %68, double* %43
store double %69, double* %58
%72 = getelementptr inbounds double, double* %3, i64 %42
%73 = load double, double* %72
%74 = getelementptr inbounds double, double* %3, i64 %57
%75 = load double, double* %74
store double %75, double* %72
store double %73, double* %74
%76 = load double, double* %43
br label %77
77: ; preds = %71, %67
%78 = phi double [ %76, %71 ], [ %69, %67 ]
%79 = sext i32 %18 to i64
%80 = getelementptr inbounds double, double* %2, i64 %79
%81 = load double, double* %80
store double %81, double* %43
store double %78, double* %80
%82 = getelementptr inbounds double, double* %3, i64 %42
%83 = load double, double* %82
%84 = getelementptr inbounds double, double* %3, i64 %79
%85 = load double, double* %84
store double %85, double* %82
store double %83, double* %84
%86 = load double, double* %58
br label %87
87: ; preds = %116, %77
%88 = phi i32 [ %17, %77 ], [ %117, %116 ]
%89 = phi i32 [ %18, %77 ], [ %104, %116 ]
%90 = phi double [ 0.000000e+00, %77 ], [ %97, %116 ]
%91 = sext i32 %89 to i64
br label %92
92: ; preds = %92, %87
%93 = phi i64 [ %98, %92 ], [ %91, %87 ]
%94 = phi double [ %97, %92 ], [ %90, %87 ]
%95 = getelementptr inbounds double, double* %3, i64 %93
%96 = load double, double* %95
%97 = fadd double %94, %96
%98 = add nsw i64 %93, 1
%99 = getelementptr inbounds double, double* %2, i64 %98
%100 = load double, double* %99
%101 = fcmp ogt double %86, %100
br i1 %101, label %92, label %102
102: ; preds = %92
%103 = getelementptr inbounds double, double* %2, i64 %98
%104 = trunc i64 %98 to i32
%105 = sext i32 %88 to i64
br label %106
106: ; preds = %102, %106
%107 = phi i64 [ %105, %102 ], [ %108, %106 ]
%108 = add i64 %107, -1
%109 = getelementptr inbounds double, double* %2, i64 %108
%110 = load double, double* %109
%111 = fcmp ogt double %110, %86
br i1 %111, label %106, label %112
112: ; preds = %106
%113 = getelementptr inbounds double, double* %2, i64 %108
%114 = trunc i64 %107 to i32
%115 = icmp sgt i32 %114, %104
br i1 %115, label %116, label %122
116: ; preds = %112
%117 = trunc i64 %108 to i32
store double %110, double* %103
store double %100, double* %113
%118 = getelementptr inbounds double, double* %3, i64 %98
%119 = load double, double* %118
%120 = getelementptr inbounds double, double* %3, i64 %108
%121 = load double, double* %120
store double %121, double* %118
store double %119, double* %120
br label %87
122: ; preds = %112
%123 = trunc i64 %107 to i32
%124 = trunc i64 %93 to i32
%125 = load double, double* %58
store double %110, double* %58
store double %125, double* %113
%126 = getelementptr inbounds double, double* %3, i64 %57
%127 = load double, double* %126
%128 = getelementptr inbounds double, double* %3, i64 %108
%129 = load double, double* %128
store double %129, double* %126
store double %127, double* %128
%130 = icmp slt i32 %124, %123
br i1 %130, label %144, label %131
131: ; preds = %122
%132 = shl i64 %98, 32
%133 = ashr exact i64 %132, 32
%134 = shl i64 %107, 32
%135 = ashr exact i64 %134, 32
br label %136
136: ; preds = %131, %136
%137 = phi i64 [ %133, %131 ], [ %139, %136 ]
%138 = phi double [ %97, %131 ], [ %142, %136 ]
%139 = add nsw i64 %137, -1
%140 = getelementptr inbounds double, double* %3, i64 %139
%141 = load double, double* %140
%142 = fsub double %138, %141
%143 = icmp sgt i64 %139, %135
br i1 %143, label %136, label %144
144: ; preds = %136, %122
%145 = phi double [ %97, %122 ], [ %142, %136 ]
%146 = fadd double %15, %145
%147 = fcmp ugt double %146, %0
br i1 %147, label %154, label %148
148: ; preds = %144
%149 = fadd double %127, %146
%150 = fcmp ogt double %149, %0
br i1 %150, label %161, label %151
151: ; preds = %148
%152 = fadd double %127, %145
%153 = fadd double %15, %152
br label %156
154: ; preds = %144
%155 = add nsw i32 %123, -2
br label %156
156: ; preds = %154, %151
%157 = phi i32 [ %17, %151 ], [ %155, %154 ]
%158 = phi i32 [ %123, %151 ], [ %16, %154 ]
%159 = phi double [ %153, %151 ], [ %15, %154 ]
%160 = icmp sgt i32 %157, %158
br i1 %160, label %14, label %10
161: ; preds = %148, %33, %10
%162 = phi double* [ %13, %10 ], [ %38, %33 ], [ %113, %148 ]
%163 = load double, double* %162
ret double %163
}