double quick_select_double(double arr[], int n) {
  int low, high;
  int median;
  int middle, ll, hh;
  low = 0;
  high = n - 1;
  median = (low + high) / 2;
  for (;;) {
    if (high <= low)
      return arr[median];
    if (high == low + 1) {
      if (arr[low] > arr[high]) {
        double temp = (arr[low]);
        (arr[low]) = (arr[high]);
        (arr[high]) = temp;
      };
      return arr[median];
    }
    middle = (low + high) / 2;
    if (arr[middle] > arr[high]) {
      double temp = (arr[middle]);
      (arr[middle]) = (arr[high]);
      (arr[high]) = temp;
    };
    if (arr[low] > arr[high]) {
      double temp = (arr[low]);
      (arr[low]) = (arr[high]);
      (arr[high]) = temp;
    };
    if (arr[middle] > arr[low]) {
      double temp = (arr[middle]);
      (arr[middle]) = (arr[low]);
      (arr[low]) = temp;
    };
    {
      double temp = (arr[middle]);
      (arr[middle]) = (arr[low + 1]);
      (arr[low + 1]) = temp;
    };
    ll = low + 1;
    hh = high;
    for (;;) {
      do
        ll++;
      while (arr[low] > arr[ll]);
      do
        hh--;
      while (arr[hh] > arr[low]);
      if (hh < ll)
        break;
      {
        double temp = (arr[ll]);
        (arr[ll]) = (arr[hh]);
        (arr[hh]) = temp;
      };
    }
    {
      double temp = (arr[low]);
      (arr[low]) = (arr[hh]);
      (arr[hh]) = temp;
    };
    if (hh <= median)
      low = ll;
    if (hh >= median)
      high = hh - 1;
  }
}


x86 assembly (clang, -O0):
<quick_select_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     114f <quick_select_double+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1471 <quick_select_double+0x371>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11d5 <quick_select_double+0xd5>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    11be <quick_select_double+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x18(%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 -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1471 <quick_select_double+0x371>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1244 <quick_select_double+0x144>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    12a2 <quick_select_double+0x1a2>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1300 <quick_select_double+0x200>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%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  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    135c <quick_select_double+0x25c>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
ja     135c <quick_select_double+0x25c>
jmp    138a <quick_select_double+0x28a>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
ja     138a <quick_select_double+0x28a>
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13c4 <quick_select_double+0x2c4>
jmp    1407 <quick_select_double+0x307>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1357 <quick_select_double+0x257>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x68(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1457 <quick_select_double+0x357>
mov    -0x28(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     146c <quick_select_double+0x36c>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112c <quick_select_double+0x2c>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_select_double>:
push   %r15
push   %r14
push   %rbx
lea    -0x1(%rsi),%r10d
mov    %r10d,%eax
shr    $0x1f,%eax
lea    (%rsi,%rax,1),%r8d
add    $0xffffffff,%r8d
sar    %r8d
cmp    $0x2,%esi
jl     1274 <quick_select_double+0x174>
lea    0x8(%rdi),%r14
xor    %r9d,%r9d
jmp    1157 <quick_select_double+0x57>
nopl   0x0(%rax)
movsd  %xmm2,(%rdi,%r15,8)
movsd  %xmm0,(%rbx)
cmp    %ecx,%r8d
cmovl  %r9d,%eax
add    $0xffffffff,%ecx
cmp    %esi,%r8d
cmovl  %ecx,%r10d
mov    %eax,%r9d
cmp    %eax,%r10d
jle    1274 <quick_select_double+0x174>
lea    0x1(%r9),%eax
movslq %r9d,%r15
movslq %r10d,%rcx
cmp    %eax,%r10d
je     1258 <quick_select_double+0x158>
lea    (%r9,%rcx,1),%edx
mov    %edx,%esi
shr    $0x1f,%esi
add    %edx,%esi
sar    %esi
movslq %esi,%r11
movsd  (%rdi,%r11,8),%xmm1
movsd  (%rdi,%rcx,8),%xmm0
ucomisd %xmm0,%xmm1
jbe    11a0 <quick_select_double+0xa0>
movsd  %xmm0,(%rdi,%r11,8)
movsd  %xmm1,(%rdi,%rcx,8)
jmp    11a4 <quick_select_double+0xa4>
nopl   0x0(%rax,%rax,1)
movapd %xmm0,%xmm1
movsd  (%rdi,%r15,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c1 <quick_select_double+0xc1>
movsd  %xmm1,(%rdi,%r15,8)
movsd  %xmm0,(%rdi,%rcx,8)
movsd  (%rdi,%r15,8),%xmm0
movsd  (%rdi,%r11,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    11df <quick_select_double+0xdf>
movsd  %xmm0,(%rdi,%r11,8)
movsd  %xmm1,(%rdi,%r15,8)
movsd  (%rdi,%r11,8),%xmm1
movslq %eax,%rcx
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,(%rdi,%r11,8)
movsd  %xmm1,(%rdi,%rcx,8)
mov    %r10d,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rdi,%r15,8),%xmm0
movslq %eax,%rdx
lea    (%r14,%rdx,8),%rdx
nopl   (%rax)
movsd  (%rdx),%xmm1
add    $0x1,%eax
add    $0x8,%rdx
ucomisd %xmm1,%xmm0
ja     1210 <quick_select_double+0x110>
movslq %ecx,%rsi
lea    (%rdi,%rsi,8),%rbx
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rbx),%xmm2
add    $0xfffffffffffffff8,%rbx
add    $0xffffffff,%ecx
ucomisd %xmm0,%xmm2
ja     1230 <quick_select_double+0x130>
lea    0x1(%rcx),%esi
cmp    %eax,%esi
jle    1130 <quick_select_double+0x30>
movsd  %xmm2,-0x8(%rdx)
movsd  %xmm1,(%rbx)
jmp    1200 <quick_select_double+0x100>
movsd  (%rdi,%r15,8),%xmm0
movsd  (%rdi,%rcx,8),%xmm1
ucomisd %xmm1,%xmm0
jbe    1274 <quick_select_double+0x174>
movsd  %xmm1,(%rdi,%r15,8)
movsd  %xmm0,(%rdi,%rcx,8)
movslq %r8d,%rax
movsd  (%rdi,%rax,8),%xmm0
pop    %rbx
pop    %r14
pop    %r15
ret

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

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