double quickselect_double(int k, int n, double *arr) {
  int i, ir, j, m, mid;
  double a, temp;
  k--;
  m = 0;
  ir = n - 1;
  for (;;) {
    if (ir <= m + 1) {
      if (ir == m + 1 && (arr)[ir] < (arr)[m]) {
        temp = ((arr)[m]);
        ((arr)[m]) = ((arr)[ir]);
        ((arr)[ir]) = temp;
      }
      return (arr)[k];
    } else {
      mid = (m + ir) >> 1;
      temp = ((arr)[mid]);
      ((arr)[mid]) = ((arr)[m + 1]);
      ((arr)[m + 1]) = temp;
      if ((arr)[m] > (arr)[ir]) {
        temp = ((arr)[m]);
        ((arr)[m]) = ((arr)[ir]);
        ((arr)[ir]) = temp;
      }
      if ((arr)[m + 1] > (arr)[ir]) {
        temp = ((arr)[m + 1]);
        ((arr)[m + 1]) = ((arr)[ir]);
        ((arr)[ir]) = temp;
      }
      if ((arr)[m] > (arr)[m + 1]) {
        temp = ((arr)[m]);
        ((arr)[m]) = ((arr)[m + 1]);
        ((arr)[m + 1]) = temp;
      }
      i = m + 1;
      j = ir;
      a = arr[m + 1];
      for (;;) {
        do
          i++;
        while ((arr)[i] < a);
        do
          j--;
        while ((arr)[j] > a);
        if (j < i)
          break;
        temp = ((arr)[i]);
        ((arr)[i]) = ((arr)[j]);
        ((arr)[j]) = temp;
      }
      (arr)[m + 1] = (arr)[j];
      (arr)[j] = a;
      if (j >= k)
        ir = j - 1;
      if (j <= k)
        m = i;
    }
  }
}


x86 assembly (clang, -O0):
<quickselect_double>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     11ba <quickselect_double+0xba>
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11ab <quickselect_double+0xab>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ab <quickselect_double+0xab>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
pop    %rbp
ret
mov    -0x20(%rbp),%eax
add    -0x18(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    126c <quickselect_double+0x16c>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    12d9 <quickselect_double+0x1d9>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1346 <quickselect_double+0x246>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1371 <quickselect_double+0x271>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     1371 <quickselect_double+0x271>
jmp    139b <quickselect_double+0x29b>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x30(%rbp),%xmm0
ja     139b <quickselect_double+0x29b>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13cd <quickselect_double+0x2cd>
jmp    1410 <quickselect_double+0x310>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    136c <quickselect_double+0x26c>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     1456 <quickselect_double+0x356>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1468 <quickselect_double+0x368>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    146d <quickselect_double+0x36d>
jmp    1127 <quickselect_double+0x27>

x86 assembly (clang, -O2):
<quickselect_double>:
push   %rbp
push   %rbx
lea    -0x1(%rsi),%r10d
xor    %r8d,%r8d
cmp    $0x3,%esi
jl     1248 <quickselect_double+0x148>
lea    0x8(%rdx),%r11
mov    $0x1,%esi
jmp    1144 <quickselect_double+0x44>
nopl   (%rax)
movsd  %xmm2,(%rdx,%r9,8)
movsd  %xmm0,(%rbx)
add    $0xffffffff,%ecx
cmp    %edi,%ebp
cmovge %ecx,%r10d
cmovle %esi,%r8d
lea    0x1(%r8),%esi
cmp    %esi,%r10d
jle    1254 <quickselect_double+0x154>
lea    (%r8,%r10,1),%eax
sar    %eax
cltq
movsd  (%rdx,%rax,8),%xmm1
movslq %esi,%r9
movsd  (%rdx,%r9,8),%xmm0
movsd  %xmm0,(%rdx,%rax,8)
movsd  %xmm1,(%rdx,%r9,8)
movslq %r8d,%rax
movsd  (%rdx,%rax,8),%xmm0
movslq %r10d,%rcx
movsd  (%rdx,%rcx,8),%xmm2
ucomisd %xmm2,%xmm0
jbe    11a0 <quickselect_double+0xa0>
movsd  %xmm2,(%rdx,%rax,8)
movsd  %xmm0,(%rdx,%rcx,8)
movsd  (%rdx,%r9,8),%xmm1
ucomisd %xmm0,%xmm1
ja     11aa <quickselect_double+0xaa>
jmp    11bb <quickselect_double+0xbb>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm2,%xmm0
ucomisd %xmm0,%xmm1
jbe    11bb <quickselect_double+0xbb>
movsd  %xmm0,(%rdx,%r9,8)
movsd  %xmm1,(%rdx,%rcx,8)
movsd  (%rdx,%r9,8),%xmm1
movsd  (%rdx,%rax,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e0 <quickselect_double+0xe0>
movsd  %xmm1,(%rdx,%rax,8)
movsd  %xmm0,(%rdx,%r9,8)
jmp    11e4 <quickselect_double+0xe4>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm1,%xmm0
mov    %r10d,%ecx
nopw   0x0(%rax,%rax,1)
movslq %esi,%rax
lea    (%r11,%rax,8),%rax
nopw   0x0(%rax,%rax,1)
movsd  (%rax),%xmm1
add    $0x1,%esi
add    $0x8,%rax
ucomisd %xmm1,%xmm0
ja     1200 <quickselect_double+0x100>
movslq %ecx,%rbx
lea    (%rdx,%rbx,8),%rbx
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rbx),%xmm2
add    $0xfffffffffffffff8,%rbx
add    $0xffffffff,%ecx
ucomisd %xmm0,%xmm2
ja     1220 <quickselect_double+0x120>
lea    0x1(%rcx),%ebp
cmp    %esi,%ebp
jle    1120 <quickselect_double+0x20>
movsd  %xmm2,-0x8(%rax)
movsd  %xmm1,(%rbx)
jmp    11f0 <quickselect_double+0xf0>
mov    $0x1,%esi
cmp    %esi,%r10d
je     125c <quickselect_double+0x15c>
jmp    127b <quickselect_double+0x17b>
movslq %r8d,%r8
cmp    %esi,%r10d
jne    127b <quickselect_double+0x17b>
movslq %r10d,%rax
movsd  (%rdx,%rax,8),%xmm0
movsd  (%rdx,%r8,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    127b <quickselect_double+0x17b>
movsd  %xmm0,(%rdx,%r8,8)
movsd  %xmm1,(%rdx,%rax,8)
movslq %edi,%rax
movsd  -0x8(%rdx,%rax,8),%xmm0
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define double @quickselect_double(i32 %0, i32 %1, double* nocapture %2) {
%4 = add nsw i32 %1, -1
%5 = icmp sgt i32 %1, 2
br i1 %5, label %26, label %8
6: ; preds = %86
%7 = sext i32 %93 to i64
br label %8
8: ; preds = %6, %3
%9 = phi i32 [ %4, %3 ], [ %91, %6 ]
%10 = phi i64 [ 0, %3 ], [ %7, %6 ]
%11 = phi i32 [ 1, %3 ], [ %94, %6 ]
%12 = icmp eq i32 %9, %11
br i1 %12, label %13, label %21
13: ; preds = %8
%14 = sext i32 %9 to i64
%15 = getelementptr inbounds double, double* %2, i64 %14
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %2, i64 %10
%18 = load double, double* %17
%19 = fcmp olt double %16, %18
br i1 %19, label %20, label %21
20: ; preds = %13
store double %16, double* %17
store double %18, double* %15
br label %21
21: ; preds = %20, %13, %8
%22 = add nsw i32 %0, -1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %2, i64 %23
%25 = load double, double* %24
ret double %25
26: ; preds = %3, %86
%27 = phi i32 [ %94, %86 ], [ 1, %3 ]
%28 = phi i32 [ %93, %86 ], [ 0, %3 ]
%29 = phi i32 [ %91, %86 ], [ %4, %3 ]
%30 = add nsw i32 %28, %29
%31 = ashr i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %2, i64 %32
%34 = load double, double* %33
%35 = sext i32 %27 to i64
%36 = getelementptr inbounds double, double* %2, i64 %35
%37 = load double, double* %36
store double %37, double* %33
store double %34, double* %36
%38 = sext i32 %28 to i64
%39 = getelementptr inbounds double, double* %2, i64 %38
%40 = load double, double* %39
%41 = sext i32 %29 to i64
%42 = getelementptr inbounds double, double* %2, i64 %41
%43 = load double, double* %42
%44 = fcmp ogt double %40, %43
br i1 %44, label %45, label %47
45: ; preds = %26
store double %43, double* %39
store double %40, double* %42
%46 = load double, double* %36
br label %47
47: ; preds = %45, %26
%48 = phi double [ %40, %45 ], [ %43, %26 ]
%49 = phi double [ %46, %45 ], [ %34, %26 ]
%50 = fcmp ogt double %49, %48
br i1 %50, label %51, label %53
51: ; preds = %47
store double %48, double* %36
store double %49, double* %42
%52 = load double, double* %36
br label %53
53: ; preds = %51, %47
%54 = phi double [ %52, %51 ], [ %49, %47 ]
%55 = load double, double* %39
%56 = fcmp ogt double %55, %54
br i1 %56, label %57, label %58
57: ; preds = %53
store double %54, double* %39
store double %55, double* %36
br label %58
58: ; preds = %57, %53
%59 = phi double [ %55, %57 ], [ %54, %53 ]
br label %60
60: ; preds = %84, %58
%61 = phi i32 [ %29, %58 ], [ %85, %84 ]
%62 = phi i32 [ %27, %58 ], [ %72, %84 ]
%63 = sext i32 %62 to i64
br label %64
64: ; preds = %64, %60
%65 = phi i64 [ %66, %64 ], [ %63, %60 ]
%66 = add nsw i64 %65, 1
%67 = getelementptr inbounds double, double* %2, i64 %66
%68 = load double, double* %67
%69 = fcmp olt double %68, %59
br i1 %69, label %64, label %70
70: ; preds = %64
%71 = getelementptr inbounds double, double* %2, i64 %66
%72 = trunc i64 %66 to i32
%73 = sext i32 %61 to i64
br label %74
74: ; preds = %70, %74
%75 = phi i64 [ %73, %70 ], [ %76, %74 ]
%76 = add i64 %75, -1
%77 = getelementptr inbounds double, double* %2, i64 %76
%78 = load double, double* %77
%79 = fcmp ogt double %78, %59
br i1 %79, label %74, label %80
80: ; preds = %74
%81 = getelementptr inbounds double, double* %2, i64 %76
%82 = trunc i64 %75 to i32
%83 = icmp sgt i32 %82, %72
br i1 %83, label %84, label %86
84: ; preds = %80
%85 = trunc i64 %76 to i32
store double %78, double* %71
store double %68, double* %81
br label %60
86: ; preds = %80
%87 = trunc i64 %66 to i32
%88 = trunc i64 %75 to i32
store double %78, double* %36
store double %59, double* %81
%89 = icmp slt i32 %88, %0
%90 = add nsw i32 %88, -2
%91 = select i1 %89, i32 %29, i32 %90
%92 = icmp sgt i32 %88, %0
%93 = select i1 %92, i32 %28, i32 %87
%94 = add nsw i32 %93, 1
%95 = icmp sgt i32 %91, %94
br i1 %95, label %26, label %6
}