#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
double median_find(double *array, uint32_t n) {
  int32_t l, r, c, m, i, j;
  double tmp;
  l = 0;
  r = n - 1;
  m = (l + r) / 2;
  for (;;) {
    if (r <= l) {
      return array[m];
    }
    if ((r - l) == 1) {
      if (array[l] > array[r]) {
        tmp = array[l];
        array[l] = array[r];
        array[r] = tmp;
      }
      return array[m];
    }
    c = (l + r) / 2;
    if (array[c] > array[r]) {
      tmp = array[c];
      array[c] = array[r];
      array[r] = tmp;
    }
    if (array[l] > array[r]) {
      tmp = array[l];
      array[l] = array[r];
      array[r] = tmp;
    }
    if (array[c] > array[l]) {
      tmp = array[c];
      array[c] = array[l];
      array[l] = tmp;
    }
    i = l + 1;
    j = r;
    tmp = array[c];
    array[c] = array[i];
    array[i] = tmp;
    for (;;) {
      do {
        i++;
      } while (array[l] > array[i]);
      do {
        j--;
      } while (array[j] > array[l]);
      if (j < i) {
        break;
      }
      tmp = array[i];
      array[j] = array[i];
      array[j] = tmp;
    }
    tmp = array[l];
    array[l] = array[j];
    array[j] = tmp;
    if (j <= m) {
      l = i;
    }
    if (j >= m) {
      r = j - 1;
    }
  }
}


x86 assembly (clang, -O0):
<median_find>:
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,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     114f <median_find+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1465 <median_find+0x365>
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
cmp    $0x1,%eax
jne    11d3 <median_find+0xd3>
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    11bc <median_find+0xbc>
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 -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1465 <median_find+0x365>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1242 <median_find+0x142>
mov    -0x10(%rbp),%rax
movslq -0x20(%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 -0x20(%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 -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    12a0 <median_find+0x1a0>
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
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    12fe <median_find+0x1fe>
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    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%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 -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1350 <median_find+0x250>
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     1350 <median_find+0x250>
jmp    137e <median_find+0x27e>
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     137e <median_find+0x27e>
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13b8 <median_find+0x2b8>
jmp    13fb <median_find+0x2fb>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    134b <median_find+0x24b>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%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  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     144b <median_find+0x34b>
mov    -0x28(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jl     1460 <median_find+0x360>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112c <median_find+0x2c>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<median_find>:
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     125d <median_find+0x15d>
lea    0x8(%rdi),%r11
xor    %r9d,%r9d
jmp    1156 <median_find+0x56>
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,(%rdi,%rax,8)
movsd  %xmm0,(%rdx)
cmp    %ecx,%r8d
cmovl  %r9d,%esi
add    $0xffffffff,%ecx
cmp    %ebx,%r8d
cmovl  %ecx,%r10d
mov    %esi,%r9d
cmp    %esi,%r10d
jle    125d <median_find+0x15d>
mov    %r10d,%ecx
sub    %r9d,%ecx
movslq %r9d,%rax
movslq %r10d,%rsi
cmp    $0x1,%ecx
je     1243 <median_find+0x143>
lea    (%r9,%rsi,1),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
movslq %edx,%rcx
movsd  (%rdi,%rcx,8),%xmm0
movsd  (%rdi,%rsi,8),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a0 <median_find+0xa0>
movsd  %xmm1,(%rdi,%rcx,8)
movsd  %xmm0,(%rdi,%rsi,8)
jmp    11a4 <median_find+0xa4>
nopw   0x0(%rax,%rax,1)
movapd %xmm1,%xmm0
movsd  (%rdi,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    11be <median_find+0xbe>
movsd  %xmm0,(%rdi,%rax,8)
movsd  %xmm1,(%rdi,%rsi,8)
movsd  (%rdi,%rax,8),%xmm1
movsd  (%rdi,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d8 <median_find+0xd8>
movsd  %xmm1,(%rdi,%rcx,8)
movsd  %xmm0,(%rdi,%rax,8)
movsd  (%rdi,%rcx,8),%xmm0
lea    0x1(%rax),%esi
movsd  0x8(%rdi,%rax,8),%xmm1
movsd  %xmm1,(%rdi,%rcx,8)
movsd  %xmm0,0x8(%rdi,%rax,8)
mov    %r10d,%ecx
nop
movsd  (%rdi,%rax,8),%xmm0
movslq %esi,%rdx
lea    (%r11,%rdx,8),%rdx
nopl   0x0(%rax)
movsd  (%rdx),%xmm1
add    $0x1,%esi
add    $0x8,%rdx
ucomisd %xmm1,%xmm0
ja     1200 <median_find+0x100>
movslq %ecx,%rdx
lea    (%rdi,%rdx,8),%rdx
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rdx),%xmm2
add    $0xfffffffffffffff8,%rdx
add    $0xffffffff,%ecx
ucomisd %xmm0,%xmm2
ja     1220 <median_find+0x120>
lea    0x1(%rcx),%ebx
cmp    %esi,%ebx
jle    1130 <median_find+0x30>
movsd  %xmm1,(%rdx)
jmp    11f0 <median_find+0xf0>
movsd  (%rdi,%rax,8),%xmm0
movsd  (%rdi,%rsi,8),%xmm1
ucomisd %xmm1,%xmm0
jbe    125d <median_find+0x15d>
movsd  %xmm1,(%rdi,%rax,8)
movsd  %xmm0,(%rdi,%rsi,8)
movslq %r8d,%rax
movsd  (%rdi,%rax,8),%xmm0
pop    %rbx
ret

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

LLVM IR (-O2):
define double @median_find(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 = sub nsw i32 %8, %7
%10 = icmp eq i32 %9, 1
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 = add nsw i32 %7, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %0, i64 %48
%50 = load double, double* %49
store double %50, double* %24
store double %46, double* %49
br label %51
51: ; preds = %75, %45
%52 = phi i32 [ %47, %45 ], [ %72, %75 ]
%53 = phi i32 [ %8, %45 ], [ %76, %75 ]
%54 = load double, double* %34
%55 = sext i32 %52 to i64
br label %56
56: ; preds = %56, %51
%57 = phi i64 [ %58, %56 ], [ %55, %51 ]
%58 = add nsw i64 %57, 1
%59 = getelementptr inbounds double, double* %0, i64 %58
%60 = load double, double* %59
%61 = fcmp ogt double %54, %60
br i1 %61, label %56, label %62
62: ; preds = %56
%63 = sext i32 %53 to i64
br label %64
64: ; preds = %62, %64
%65 = phi i64 [ %63, %62 ], [ %66, %64 ]
%66 = add i64 %65, -1
%67 = getelementptr inbounds double, double* %0, i64 %66
%68 = load double, double* %67
%69 = fcmp ogt double %68, %54
br i1 %69, label %64, label %70
70: ; preds = %64
%71 = getelementptr inbounds double, double* %0, i64 %66
%72 = trunc i64 %58 to i32
%73 = trunc i64 %65 to i32
%74 = icmp sgt i32 %73, %72
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = trunc i64 %66 to i32
store double %60, double* %71
br label %51
77: ; preds = %70
%78 = trunc i64 %58 to i32
%79 = trunc i64 %65 to i32
%80 = trunc i64 %66 to i32
store double %68, double* %34
store double %54, double* %71
%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
}