double opt_med9_double(double *p, int n) {
  {
    if ((p[1]) > (p[2])) {
      double temp = ((p[1]));
      ((p[1])) = ((p[2]));
      ((p[2])) = temp;
    };
  };
  {
    if ((p[4]) > (p[5])) {
      double temp = ((p[4]));
      ((p[4])) = ((p[5]));
      ((p[5])) = temp;
    };
  };
  {
    if ((p[7]) > (p[8])) {
      double temp = ((p[7]));
      ((p[7])) = ((p[8]));
      ((p[8])) = temp;
    };
  };
  {
    if ((p[0]) > (p[1])) {
      double temp = ((p[0]));
      ((p[0])) = ((p[1]));
      ((p[1])) = temp;
    };
  };
  {
    if ((p[3]) > (p[4])) {
      double temp = ((p[3]));
      ((p[3])) = ((p[4]));
      ((p[4])) = temp;
    };
  };
  {
    if ((p[6]) > (p[7])) {
      double temp = ((p[6]));
      ((p[6])) = ((p[7]));
      ((p[7])) = temp;
    };
  };
  {
    if ((p[1]) > (p[2])) {
      double temp = ((p[1]));
      ((p[1])) = ((p[2]));
      ((p[2])) = temp;
    };
  };
  {
    if ((p[4]) > (p[5])) {
      double temp = ((p[4]));
      ((p[4])) = ((p[5]));
      ((p[5])) = temp;
    };
  };
  {
    if ((p[7]) > (p[8])) {
      double temp = ((p[7]));
      ((p[7])) = ((p[8]));
      ((p[8])) = temp;
    };
  };
  {
    if ((p[0]) > (p[3])) {
      double temp = ((p[0]));
      ((p[0])) = ((p[3]));
      ((p[3])) = temp;
    };
  };
  {
    if ((p[5]) > (p[8])) {
      double temp = ((p[5]));
      ((p[5])) = ((p[8]));
      ((p[8])) = temp;
    };
  };
  {
    if ((p[4]) > (p[7])) {
      double temp = ((p[4]));
      ((p[4])) = ((p[7]));
      ((p[7])) = temp;
    };
  };
  {
    if ((p[3]) > (p[6])) {
      double temp = ((p[3]));
      ((p[3])) = ((p[6]));
      ((p[6])) = temp;
    };
  };
  {
    if ((p[1]) > (p[4])) {
      double temp = ((p[1]));
      ((p[1])) = ((p[4]));
      ((p[4])) = temp;
    };
  };
  {
    if ((p[2]) > (p[5])) {
      double temp = ((p[2]));
      ((p[2])) = ((p[5]));
      ((p[5])) = temp;
    };
  };
  {
    if ((p[4]) > (p[7])) {
      double temp = ((p[4]));
      ((p[4])) = ((p[7]));
      ((p[7])) = temp;
    };
  };
  {
    if ((p[4]) > (p[2])) {
      double temp = ((p[4]));
      ((p[4])) = ((p[2]));
      ((p[2])) = temp;
    };
  };
  {
    if ((p[6]) > (p[4])) {
      double temp = ((p[6]));
      ((p[6])) = ((p[4]));
      ((p[4])) = temp;
    };
  };
  {
    if ((p[4]) > (p[2])) {
      double temp = ((p[4]));
      ((p[4])) = ((p[2]));
      ((p[2])) = temp;
    };
  };
  return (p[4]);
}


x86 assembly (clang, -O0):
<opt_med9_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x28,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    1155 <opt_med9_double+0x55>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x28(%rax),%xmm0
jbe    119b <opt_med9_double+0x9b>
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x40(%rax),%xmm0
jbe    11e1 <opt_med9_double+0xe1>
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x40(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    1224 <opt_med9_double+0x124>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x20(%rax),%xmm0
jbe    126a <opt_med9_double+0x16a>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x38(%rax),%xmm0
jbe    12b0 <opt_med9_double+0x1b0>
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    12f6 <opt_med9_double+0x1f6>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x28(%rax),%xmm0
jbe    133c <opt_med9_double+0x23c>
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x40(%rax),%xmm0
jbe    1382 <opt_med9_double+0x282>
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x40(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x18(%rax),%xmm0
jbe    13c5 <opt_med9_double+0x2c5>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x40(%rax),%xmm0
jbe    140b <opt_med9_double+0x30b>
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x68(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x40(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x38(%rax),%xmm0
jbe    1451 <opt_med9_double+0x351>
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x30(%rax),%xmm0
jbe    1497 <opt_med9_double+0x397>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x78(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x20(%rax),%xmm0
jbe    14dd <opt_med9_double+0x3dd>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x80(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x28(%rax),%xmm0
jbe    1529 <opt_med9_double+0x429>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x38(%rax),%xmm0
jbe    1575 <opt_med9_double+0x475>
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    15c1 <opt_med9_double+0x4c1>
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x20(%rax),%xmm0
jbe    160d <opt_med9_double+0x50d>
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    1659 <opt_med9_double+0x559>
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
add    $0x28,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_med9_double>:
movsd  0x8(%rdi),%xmm0
movsd  0x10(%rdi),%xmm2
ucomisd %xmm2,%xmm0
jbe    1121 <opt_med9_double+0x21>
movsd  %xmm2,0x8(%rdi)
movsd  %xmm0,0x10(%rdi)
movapd %xmm0,%xmm10
jmp    112a <opt_med9_double+0x2a>
movapd %xmm2,%xmm10
movapd %xmm0,%xmm2
movsd  0x20(%rdi),%xmm0
movsd  0x28(%rdi),%xmm5
ucomisd %xmm5,%xmm0
jbe    114a <opt_med9_double+0x4a>
movsd  %xmm5,0x20(%rdi)
movsd  %xmm0,0x28(%rdi)
movapd %xmm0,%xmm4
jmp    1152 <opt_med9_double+0x52>
movapd %xmm5,%xmm4
movapd %xmm0,%xmm5
movsd  0x38(%rdi),%xmm0
movsd  0x40(%rdi),%xmm6
ucomisd %xmm6,%xmm0
jbe    1173 <opt_med9_double+0x73>
movsd  %xmm6,0x38(%rdi)
movsd  %xmm0,0x40(%rdi)
movapd %xmm0,%xmm9
jmp    117c <opt_med9_double+0x7c>
movapd %xmm6,%xmm9
movapd %xmm0,%xmm6
movsd  (%rdi),%xmm0
ucomisd %xmm2,%xmm0
jbe    1195 <opt_med9_double+0x95>
movsd  %xmm2,(%rdi)
movsd  %xmm0,0x8(%rdi)
movapd %xmm2,%xmm1
jmp    119d <opt_med9_double+0x9d>
movapd %xmm0,%xmm1
movapd %xmm2,%xmm0
movsd  0x18(%rdi),%xmm7
ucomisd %xmm5,%xmm7
jbe    11b8 <opt_med9_double+0xb8>
movsd  %xmm5,0x18(%rdi)
movsd  %xmm7,0x20(%rdi)
movapd %xmm5,%xmm3
jmp    11c0 <opt_med9_double+0xc0>
movapd %xmm7,%xmm3
movapd %xmm5,%xmm7
movsd  0x30(%rdi),%xmm2
ucomisd %xmm6,%xmm2
jbe    12b3 <opt_med9_double+0x1b3>
movsd  %xmm6,0x30(%rdi)
movsd  %xmm2,0x38(%rdi)
movapd %xmm6,%xmm5
ucomisd %xmm10,%xmm0
ja     12c6 <opt_med9_double+0x1c6>
movapd %xmm10,%xmm8
movapd %xmm0,%xmm10
ucomisd %xmm4,%xmm7
ja     12e0 <opt_med9_double+0x1e0>
movapd %xmm7,%xmm0
movapd %xmm4,%xmm7
ucomisd %xmm9,%xmm2
ja     12f9 <opt_med9_double+0x1f9>
movapd %xmm2,%xmm4
movapd %xmm9,%xmm2
ucomisd %xmm3,%xmm1
ja     1313 <opt_med9_double+0x213>
movapd %xmm3,%xmm1
ucomisd %xmm2,%xmm7
ja     1326 <opt_med9_double+0x226>
movapd %xmm7,%xmm2
ucomisd %xmm4,%xmm0
ja     133a <opt_med9_double+0x23a>
movapd %xmm4,%xmm3
movapd %xmm0,%xmm4
ucomisd %xmm5,%xmm1
ja     1352 <opt_med9_double+0x252>
movapd %xmm5,%xmm1
ucomisd %xmm4,%xmm10
ja     1367 <opt_med9_double+0x267>
movapd %xmm4,%xmm10
ucomisd %xmm2,%xmm8
ja     137d <opt_med9_double+0x27d>
movapd %xmm8,%xmm2
ucomisd %xmm3,%xmm10
ja     1393 <opt_med9_double+0x293>
movapd %xmm10,%xmm3
ucomisd %xmm2,%xmm3
ja     13a8 <opt_med9_double+0x2a8>
movapd %xmm2,%xmm0
movapd %xmm3,%xmm2
ucomisd %xmm2,%xmm1
ja     13c0 <opt_med9_double+0x2c0>
movapd %xmm2,%xmm1
ucomisd %xmm0,%xmm1
ja     13d4 <opt_med9_double+0x2d4>
movapd %xmm1,%xmm0
ret
movapd %xmm2,%xmm5
movapd %xmm6,%xmm2
ucomisd %xmm10,%xmm0
jbe    11e8 <opt_med9_double+0xe8>
movsd  %xmm10,0x8(%rdi)
movsd  %xmm0,0x10(%rdi)
movapd %xmm0,%xmm8
ucomisd %xmm4,%xmm7
jbe    11fc <opt_med9_double+0xfc>
movsd  %xmm4,0x20(%rdi)
movsd  %xmm7,0x28(%rdi)
movapd %xmm4,%xmm0
ucomisd %xmm9,%xmm2
jbe    120f <opt_med9_double+0x10f>
movsd  %xmm9,0x38(%rdi)
movsd  %xmm2,0x40(%rdi)
movapd %xmm9,%xmm4
ucomisd %xmm3,%xmm1
jbe    1222 <opt_med9_double+0x122>
movsd  %xmm3,(%rdi)
movsd  %xmm1,0x18(%rdi)
ucomisd %xmm2,%xmm7
jbe    1230 <opt_med9_double+0x130>
movsd  %xmm2,0x28(%rdi)
movsd  %xmm7,0x40(%rdi)
ucomisd %xmm4,%xmm0
jbe    123e <opt_med9_double+0x13e>
movsd  %xmm4,0x20(%rdi)
movsd  %xmm0,0x38(%rdi)
movapd %xmm0,%xmm3
ucomisd %xmm5,%xmm1
jbe    1250 <opt_med9_double+0x150>
movsd  %xmm5,0x18(%rdi)
movsd  %xmm1,0x30(%rdi)
ucomisd %xmm4,%xmm10
jbe    125f <opt_med9_double+0x15f>
movsd  %xmm4,0x8(%rdi)
movsd  %xmm10,0x20(%rdi)
ucomisd %xmm2,%xmm8
jbe    126f <opt_med9_double+0x16f>
movsd  %xmm2,0x10(%rdi)
movsd  %xmm8,0x28(%rdi)
ucomisd %xmm3,%xmm10
jbe    127f <opt_med9_double+0x17f>
movsd  %xmm3,0x20(%rdi)
movsd  %xmm10,0x38(%rdi)
ucomisd %xmm2,%xmm3
jbe    128e <opt_med9_double+0x18e>
movsd  %xmm2,0x20(%rdi)
movsd  %xmm3,0x10(%rdi)
movapd %xmm3,%xmm0
ucomisd %xmm2,%xmm1
jbe    12a0 <opt_med9_double+0x1a0>
movsd  %xmm2,0x30(%rdi)
movsd  %xmm1,0x20(%rdi)
ucomisd %xmm0,%xmm1
jbe    12ae <opt_med9_double+0x1ae>
movsd  %xmm0,0x20(%rdi)
movsd  %xmm1,0x10(%rdi)
ret

LLVM IR (-O0):
define double @opt_med9_double(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
%24 = load double*, double** %3
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = load double*, double** %3
%28 = getelementptr inbounds double, double* %27, i64 2
%29 = load double, double* %28
%30 = fcmp ogt double %26, %29
br i1 %30, label %31, label %43
31: ; preds = %2
%32 = load double*, double** %3
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
store double %34, double* %5
%35 = load double*, double** %3
%36 = getelementptr inbounds double, double* %35, i64 2
%37 = load double, double* %36
%38 = load double*, double** %3
%39 = getelementptr inbounds double, double* %38, i64 1
store double %37, double* %39
%40 = load double, double* %5
%41 = load double*, double** %3
%42 = getelementptr inbounds double, double* %41, i64 2
store double %40, double* %42
br label %43
43: ; preds = %31, %2
%44 = load double*, double** %3
%45 = getelementptr inbounds double, double* %44, i64 4
%46 = load double, double* %45
%47 = load double*, double** %3
%48 = getelementptr inbounds double, double* %47, i64 5
%49 = load double, double* %48
%50 = fcmp ogt double %46, %49
br i1 %50, label %51, label %63
51: ; preds = %43
%52 = load double*, double** %3
%53 = getelementptr inbounds double, double* %52, i64 4
%54 = load double, double* %53
store double %54, double* %6
%55 = load double*, double** %3
%56 = getelementptr inbounds double, double* %55, i64 5
%57 = load double, double* %56
%58 = load double*, double** %3
%59 = getelementptr inbounds double, double* %58, i64 4
store double %57, double* %59
%60 = load double, double* %6
%61 = load double*, double** %3
%62 = getelementptr inbounds double, double* %61, i64 5
store double %60, double* %62
br label %63
63: ; preds = %51, %43
%64 = load double*, double** %3
%65 = getelementptr inbounds double, double* %64, i64 7
%66 = load double, double* %65
%67 = load double*, double** %3
%68 = getelementptr inbounds double, double* %67, i64 8
%69 = load double, double* %68
%70 = fcmp ogt double %66, %69
br i1 %70, label %71, label %83
71: ; preds = %63
%72 = load double*, double** %3
%73 = getelementptr inbounds double, double* %72, i64 7
%74 = load double, double* %73
store double %74, double* %7
%75 = load double*, double** %3
%76 = getelementptr inbounds double, double* %75, i64 8
%77 = load double, double* %76
%78 = load double*, double** %3
%79 = getelementptr inbounds double, double* %78, i64 7
store double %77, double* %79
%80 = load double, double* %7
%81 = load double*, double** %3
%82 = getelementptr inbounds double, double* %81, i64 8
store double %80, double* %82
br label %83
83: ; preds = %71, %63
%84 = load double*, double** %3
%85 = getelementptr inbounds double, double* %84, i64 0
%86 = load double, double* %85
%87 = load double*, double** %3
%88 = getelementptr inbounds double, double* %87, i64 1
%89 = load double, double* %88
%90 = fcmp ogt double %86, %89
br i1 %90, label %91, label %103
91: ; preds = %83
%92 = load double*, double** %3
%93 = getelementptr inbounds double, double* %92, i64 0
%94 = load double, double* %93
store double %94, double* %8
%95 = load double*, double** %3
%96 = getelementptr inbounds double, double* %95, i64 1
%97 = load double, double* %96
%98 = load double*, double** %3
%99 = getelementptr inbounds double, double* %98, i64 0
store double %97, double* %99
%100 = load double, double* %8
%101 = load double*, double** %3
%102 = getelementptr inbounds double, double* %101, i64 1
store double %100, double* %102
br label %103
103: ; preds = %91, %83
%104 = load double*, double** %3
%105 = getelementptr inbounds double, double* %104, i64 3
%106 = load double, double* %105
%107 = load double*, double** %3
%108 = getelementptr inbounds double, double* %107, i64 4
%109 = load double, double* %108
%110 = fcmp ogt double %106, %109
br i1 %110, label %111, label %123
111: ; preds = %103
%112 = load double*, double** %3
%113 = getelementptr inbounds double, double* %112, i64 3
%114 = load double, double* %113
store double %114, double* %9
%115 = load double*, double** %3
%116 = getelementptr inbounds double, double* %115, i64 4
%117 = load double, double* %116
%118 = load double*, double** %3
%119 = getelementptr inbounds double, double* %118, i64 3
store double %117, double* %119
%120 = load double, double* %9
%121 = load double*, double** %3
%122 = getelementptr inbounds double, double* %121, i64 4
store double %120, double* %122
br label %123
123: ; preds = %111, %103
%124 = load double*, double** %3
%125 = getelementptr inbounds double, double* %124, i64 6
%126 = load double, double* %125
%127 = load double*, double** %3
%128 = getelementptr inbounds double, double* %127, i64 7
%129 = load double, double* %128
%130 = fcmp ogt double %126, %129
br i1 %130, label %131, label %143
131: ; preds = %123
%132 = load double*, double** %3
%133 = getelementptr inbounds double, double* %132, i64 6
%134 = load double, double* %133
store double %134, double* %10
%135 = load double*, double** %3
%136 = getelementptr inbounds double, double* %135, i64 7
%137 = load double, double* %136
%138 = load double*, double** %3
%139 = getelementptr inbounds double, double* %138, i64 6
store double %137, double* %139
%140 = load double, double* %10
%141 = load double*, double** %3
%142 = getelementptr inbounds double, double* %141, i64 7
store double %140, double* %142
br label %143
143: ; preds = %131, %123
%144 = load double*, double** %3
%145 = getelementptr inbounds double, double* %144, i64 1
%146 = load double, double* %145
%147 = load double*, double** %3
%148 = getelementptr inbounds double, double* %147, i64 2
%149 = load double, double* %148
%150 = fcmp ogt double %146, %149
br i1 %150, label %151, label %163
151: ; preds = %143
%152 = load double*, double** %3
%153 = getelementptr inbounds double, double* %152, i64 1
%154 = load double, double* %153
store double %154, double* %11
%155 = load double*, double** %3
%156 = getelementptr inbounds double, double* %155, i64 2
%157 = load double, double* %156
%158 = load double*, double** %3
%159 = getelementptr inbounds double, double* %158, i64 1
store double %157, double* %159
%160 = load double, double* %11
%161 = load double*, double** %3
%162 = getelementptr inbounds double, double* %161, i64 2
store double %160, double* %162
br label %163
163: ; preds = %151, %143
%164 = load double*, double** %3
%165 = getelementptr inbounds double, double* %164, i64 4
%166 = load double, double* %165
%167 = load double*, double** %3
%168 = getelementptr inbounds double, double* %167, i64 5
%169 = load double, double* %168
%170 = fcmp ogt double %166, %169
br i1 %170, label %171, label %183
171: ; preds = %163
%172 = load double*, double** %3
%173 = getelementptr inbounds double, double* %172, i64 4
%174 = load double, double* %173
store double %174, double* %12
%175 = load double*, double** %3
%176 = getelementptr inbounds double, double* %175, i64 5
%177 = load double, double* %176
%178 = load double*, double** %3
%179 = getelementptr inbounds double, double* %178, i64 4
store double %177, double* %179
%180 = load double, double* %12
%181 = load double*, double** %3
%182 = getelementptr inbounds double, double* %181, i64 5
store double %180, double* %182
br label %183
183: ; preds = %171, %163
%184 = load double*, double** %3
%185 = getelementptr inbounds double, double* %184, i64 7
%186 = load double, double* %185
%187 = load double*, double** %3
%188 = getelementptr inbounds double, double* %187, i64 8
%189 = load double, double* %188
%190 = fcmp ogt double %186, %189
br i1 %190, label %191, label %203
191: ; preds = %183
%192 = load double*, double** %3
%193 = getelementptr inbounds double, double* %192, i64 7
%194 = load double, double* %193
store double %194, double* %13
%195 = load double*, double** %3
%196 = getelementptr inbounds double, double* %195, i64 8
%197 = load double, double* %196
%198 = load double*, double** %3
%199 = getelementptr inbounds double, double* %198, i64 7
store double %197, double* %199
%200 = load double, double* %13
%201 = load double*, double** %3
%202 = getelementptr inbounds double, double* %201, i64 8
store double %200, double* %202
br label %203
203: ; preds = %191, %183
%204 = load double*, double** %3
%205 = getelementptr inbounds double, double* %204, i64 0
%206 = load double, double* %205
%207 = load double*, double** %3
%208 = getelementptr inbounds double, double* %207, i64 3
%209 = load double, double* %208
%210 = fcmp ogt double %206, %209
br i1 %210, label %211, label %223
211: ; preds = %203
%212 = load double*, double** %3
%213 = getelementptr inbounds double, double* %212, i64 0
%214 = load double, double* %213
store double %214, double* %14
%215 = load double*, double** %3
%216 = getelementptr inbounds double, double* %215, i64 3
%217 = load double, double* %216
%218 = load double*, double** %3
%219 = getelementptr inbounds double, double* %218, i64 0
store double %217, double* %219
%220 = load double, double* %14
%221 = load double*, double** %3
%222 = getelementptr inbounds double, double* %221, i64 3
store double %220, double* %222
br label %223
223: ; preds = %211, %203
%224 = load double*, double** %3
%225 = getelementptr inbounds double, double* %224, i64 5
%226 = load double, double* %225
%227 = load double*, double** %3
%228 = getelementptr inbounds double, double* %227, i64 8
%229 = load double, double* %228
%230 = fcmp ogt double %226, %229
br i1 %230, label %231, label %243
231: ; preds = %223
%232 = load double*, double** %3
%233 = getelementptr inbounds double, double* %232, i64 5
%234 = load double, double* %233
store double %234, double* %15
%235 = load double*, double** %3
%236 = getelementptr inbounds double, double* %235, i64 8
%237 = load double, double* %236
%238 = load double*, double** %3
%239 = getelementptr inbounds double, double* %238, i64 5
store double %237, double* %239
%240 = load double, double* %15
%241 = load double*, double** %3
%242 = getelementptr inbounds double, double* %241, i64 8
store double %240, double* %242
br label %243
243: ; preds = %231, %223
%244 = load double*, double** %3
%245 = getelementptr inbounds double, double* %244, i64 4
%246 = load double, double* %245
%247 = load double*, double** %3
%248 = getelementptr inbounds double, double* %247, i64 7
%249 = load double, double* %248
%250 = fcmp ogt double %246, %249
br i1 %250, label %251, label %263
251: ; preds = %243
%252 = load double*, double** %3
%253 = getelementptr inbounds double, double* %252, i64 4
%254 = load double, double* %253
store double %254, double* %16
%255 = load double*, double** %3
%256 = getelementptr inbounds double, double* %255, i64 7
%257 = load double, double* %256
%258 = load double*, double** %3
%259 = getelementptr inbounds double, double* %258, i64 4
store double %257, double* %259
%260 = load double, double* %16
%261 = load double*, double** %3
%262 = getelementptr inbounds double, double* %261, i64 7
store double %260, double* %262
br label %263
263: ; preds = %251, %243
%264 = load double*, double** %3
%265 = getelementptr inbounds double, double* %264, i64 3
%266 = load double, double* %265
%267 = load double*, double** %3
%268 = getelementptr inbounds double, double* %267, i64 6
%269 = load double, double* %268
%270 = fcmp ogt double %266, %269
br i1 %270, label %271, label %283
271: ; preds = %263
%272 = load double*, double** %3
%273 = getelementptr inbounds double, double* %272, i64 3
%274 = load double, double* %273
store double %274, double* %17
%275 = load double*, double** %3
%276 = getelementptr inbounds double, double* %275, i64 6
%277 = load double, double* %276
%278 = load double*, double** %3
%279 = getelementptr inbounds double, double* %278, i64 3
store double %277, double* %279
%280 = load double, double* %17
%281 = load double*, double** %3
%282 = getelementptr inbounds double, double* %281, i64 6
store double %280, double* %282
br label %283
283: ; preds = %271, %263
%284 = load double*, double** %3
%285 = getelementptr inbounds double, double* %284, i64 1
%286 = load double, double* %285
%287 = load double*, double** %3
%288 = getelementptr inbounds double, double* %287, i64 4
%289 = load double, double* %288
%290 = fcmp ogt double %286, %289
br i1 %290, label %291, label %303
291: ; preds = %283
%292 = load double*, double** %3
%293 = getelementptr inbounds double, double* %292, i64 1
%294 = load double, double* %293
store double %294, double* %18
%295 = load double*, double** %3
%296 = getelementptr inbounds double, double* %295, i64 4
%297 = load double, double* %296
%298 = load double*, double** %3
%299 = getelementptr inbounds double, double* %298, i64 1
store double %297, double* %299
%300 = load double, double* %18
%301 = load double*, double** %3
%302 = getelementptr inbounds double, double* %301, i64 4
store double %300, double* %302
br label %303
303: ; preds = %291, %283
%304 = load double*, double** %3
%305 = getelementptr inbounds double, double* %304, i64 2
%306 = load double, double* %305
%307 = load double*, double** %3
%308 = getelementptr inbounds double, double* %307, i64 5
%309 = load double, double* %308
%310 = fcmp ogt double %306, %309
br i1 %310, label %311, label %323
311: ; preds = %303
%312 = load double*, double** %3
%313 = getelementptr inbounds double, double* %312, i64 2
%314 = load double, double* %313
store double %314, double* %19
%315 = load double*, double** %3
%316 = getelementptr inbounds double, double* %315, i64 5
%317 = load double, double* %316
%318 = load double*, double** %3
%319 = getelementptr inbounds double, double* %318, i64 2
store double %317, double* %319
%320 = load double, double* %19
%321 = load double*, double** %3
%322 = getelementptr inbounds double, double* %321, i64 5
store double %320, double* %322
br label %323
323: ; preds = %311, %303
%324 = load double*, double** %3
%325 = getelementptr inbounds double, double* %324, i64 4
%326 = load double, double* %325
%327 = load double*, double** %3
%328 = getelementptr inbounds double, double* %327, i64 7
%329 = load double, double* %328
%330 = fcmp ogt double %326, %329
br i1 %330, label %331, label %343
331: ; preds = %323
%332 = load double*, double** %3
%333 = getelementptr inbounds double, double* %332, i64 4
%334 = load double, double* %333
store double %334, double* %20
%335 = load double*, double** %3
%336 = getelementptr inbounds double, double* %335, i64 7
%337 = load double, double* %336
%338 = load double*, double** %3
%339 = getelementptr inbounds double, double* %338, i64 4
store double %337, double* %339
%340 = load double, double* %20
%341 = load double*, double** %3
%342 = getelementptr inbounds double, double* %341, i64 7
store double %340, double* %342
br label %343
343: ; preds = %331, %323
%344 = load double*, double** %3
%345 = getelementptr inbounds double, double* %344, i64 4
%346 = load double, double* %345
%347 = load double*, double** %3
%348 = getelementptr inbounds double, double* %347, i64 2
%349 = load double, double* %348
%350 = fcmp ogt double %346, %349
br i1 %350, label %351, label %363
351: ; preds = %343
%352 = load double*, double** %3
%353 = getelementptr inbounds double, double* %352, i64 4
%354 = load double, double* %353
store double %354, double* %21
%355 = load double*, double** %3
%356 = getelementptr inbounds double, double* %355, i64 2
%357 = load double, double* %356
%358 = load double*, double** %3
%359 = getelementptr inbounds double, double* %358, i64 4
store double %357, double* %359
%360 = load double, double* %21
%361 = load double*, double** %3
%362 = getelementptr inbounds double, double* %361, i64 2
store double %360, double* %362
br label %363
363: ; preds = %351, %343
%364 = load double*, double** %3
%365 = getelementptr inbounds double, double* %364, i64 6
%366 = load double, double* %365
%367 = load double*, double** %3
%368 = getelementptr inbounds double, double* %367, i64 4
%369 = load double, double* %368
%370 = fcmp ogt double %366, %369
br i1 %370, label %371, label %383
371: ; preds = %363
%372 = load double*, double** %3
%373 = getelementptr inbounds double, double* %372, i64 6
%374 = load double, double* %373
store double %374, double* %22
%375 = load double*, double** %3
%376 = getelementptr inbounds double, double* %375, i64 4
%377 = load double, double* %376
%378 = load double*, double** %3
%379 = getelementptr inbounds double, double* %378, i64 6
store double %377, double* %379
%380 = load double, double* %22
%381 = load double*, double** %3
%382 = getelementptr inbounds double, double* %381, i64 4
store double %380, double* %382
br label %383
383: ; preds = %371, %363
%384 = load double*, double** %3
%385 = getelementptr inbounds double, double* %384, i64 4
%386 = load double, double* %385
%387 = load double*, double** %3
%388 = getelementptr inbounds double, double* %387, i64 2
%389 = load double, double* %388
%390 = fcmp ogt double %386, %389
br i1 %390, label %391, label %403
391: ; preds = %383
%392 = load double*, double** %3
%393 = getelementptr inbounds double, double* %392, i64 4
%394 = load double, double* %393
store double %394, double* %23
%395 = load double*, double** %3
%396 = getelementptr inbounds double, double* %395, i64 2
%397 = load double, double* %396
%398 = load double*, double** %3
%399 = getelementptr inbounds double, double* %398, i64 4
store double %397, double* %399
%400 = load double, double* %23
%401 = load double*, double** %3
%402 = getelementptr inbounds double, double* %401, i64 2
store double %400, double* %402
br label %403
403: ; preds = %391, %383
%404 = load double*, double** %3
%405 = getelementptr inbounds double, double* %404, i64 4
%406 = load double, double* %405
ret double %406
}

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