void partial_quickersort_double(array, lower, upper) register double array[];
register int lower, upper;
{
  register int i, j;
  register double temp, pivot;
  if (upper - lower > 15) {
    temp = (array[lower]);
    (array[lower]) = (array[(upper + lower) / 2]);
    (array[(upper + lower) / 2]) = temp;
    i = lower;
    j = upper + 1;
    pivot = array[lower];
    while (1) {
      do
        i++;
      while (((array[i]) < (pivot)));
      do
        j--;
      while (((array[j]) > (pivot)));
      if (j < i)
        break;
      temp = (array[i]);
      (array[i]) = (array[j]);
      (array[j]) = temp;
    }
    temp = (array[lower]);
    (array[lower]) = (array[j]);
    (array[j]) = temp;
    partial_quickersort_double(array, lower, j - 1);
    partial_quickersort_double(array, i, upper);
  }
}


x86 assembly (clang, -O0):
<partial_quickersort_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0xf,%eax
jle    12c1 <partial_quickersort_double+0x1b1>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11c3 <partial_quickersort_double+0xb3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     11c3 <partial_quickersort_double+0xb3>
jmp    11ed <partial_quickersort_double+0xdd>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x28(%rbp),%xmm0
ja     11ed <partial_quickersort_double+0xdd>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121f <partial_quickersort_double+0x10f>
jmp    1262 <partial_quickersort_double+0x152>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11be <partial_quickersort_double+0xae>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
call   1030 <partial_quickersort_double@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partial_quickersort_double@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<partial_quickersort_double>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%eax
sub    %esi,%eax
cmp    $0x10,%eax
jl     11f8 <partial_quickersort_double+0xe8>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x1(%r14),%r15d
lea    0x8(%rdi),%r12
jmp    1167 <partial_quickersort_double+0x57>
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm2,(%rbx,%rsi,8)
movsd  %xmm0,(%rcx)
add    $0xffffffff,%edx
mov    %rbx,%rdi
call   1030 <partial_quickersort_double@plt>
mov    %r14d,%eax
sub    %ebp,%eax
cmp    $0xf,%eax
jle    11f8 <partial_quickersort_double+0xe8>
movslq %ebp,%rsi
movsd  (%rbx,%rsi,8),%xmm0
lea    (%rsi,%r14,1),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
movsd  (%rbx,%rax,8),%xmm1
movsd  %xmm1,(%rbx,%rsi,8)
movsd  %xmm0,(%rbx,%rax,8)
movsd  (%rbx,%rsi,8),%xmm0
mov    %r15d,%edx
cs nopw 0x0(%rax,%rax,1)
movslq %ebp,%rax
lea    (%r12,%rax,8),%rax
nopw   0x0(%rax,%rax,1)
movsd  (%rax),%xmm1
add    $0x1,%ebp
add    $0x8,%rax
ucomisd %xmm1,%xmm0
ja     11b0 <partial_quickersort_double+0xa0>
movslq %edx,%rcx
lea    (%rbx,%rcx,8),%rcx
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rcx),%xmm2
add    $0xfffffffffffffff8,%rcx
add    $0xffffffff,%edx
ucomisd %xmm0,%xmm2
ja     11d0 <partial_quickersort_double+0xc0>
lea    0x1(%rdx),%edi
cmp    %ebp,%edi
jle    1140 <partial_quickersort_double+0x30>
movsd  %xmm2,-0x8(%rax)
movsd  %xmm1,(%rcx)
jmp    11a0 <partial_quickersort_double+0x90>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @partial_quickersort_double(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = sub nsw i32 %11, %12
%14 = icmp sgt i32 %13, 15
br i1 %14, label %15, label %125
15: ; preds = %3
%16 = load double*, double** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
store double %20, double* %9
%21 = load double*, double** %4
%22 = load i32, i32* %6
%23 = load i32, i32* %5
%24 = add nsw i32 %22, %23
%25 = sdiv i32 %24, 2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %21, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %4
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
store double %28, double* %32
%33 = load double, double* %9
%34 = load double*, double** %4
%35 = load i32, i32* %6
%36 = load i32, i32* %5
%37 = add nsw i32 %35, %36
%38 = sdiv i32 %37, 2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %34, i64 %39
store double %33, double* %40
%41 = load i32, i32* %5
store i32 %41, i32* %7
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
%44 = load double*, double** %4
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
store double %48, double* %10
br label %49
49: ; preds = %15, %78
br label %50
50: ; preds = %53, %49
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %53
53: ; preds = %50
%54 = load double*, double** %4
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %54, i64 %56
%58 = load double, double* %57
%59 = load double, double* %10
%60 = fcmp olt double %58, %59
br i1 %60, label %50, label %61
61: ; preds = %53
br label %62
62: ; preds = %65, %61
%63 = load i32, i32* %8
%64 = add nsw i32 %63, -1
store i32 %64, i32* %8
br label %65
65: ; preds = %62
%66 = load double*, double** %4
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
%70 = load double, double* %69
%71 = load double, double* %10
%72 = fcmp ogt double %70, %71
br i1 %72, label %62, label %73
73: ; preds = %65
%74 = load i32, i32* %8
%75 = load i32, i32* %7
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %78
77: ; preds = %73
br label %98
78: ; preds = %73
%79 = load double*, double** %4
%80 = load i32, i32* %7
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
store double %83, double* %9
%84 = load double*, double** %4
%85 = load i32, i32* %8
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = load double*, double** %4
%90 = load i32, i32* %7
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
store double %88, double* %92
%93 = load double, double* %9
%94 = load double*, double** %4
%95 = load i32, i32* %8
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
store double %93, double* %97
br label %49
98: ; preds = %77
%99 = load double*, double** %4
%100 = load i32, i32* %5
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
%103 = load double, double* %102
store double %103, double* %9
%104 = load double*, double** %4
%105 = load i32, i32* %8
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = load double*, double** %4
%110 = load i32, i32* %5
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
store double %108, double* %112
%113 = load double, double* %9
%114 = load double*, double** %4
%115 = load i32, i32* %8
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %114, i64 %116
store double %113, double* %117
%118 = load double*, double** %4
%119 = load i32, i32* %5
%120 = load i32, i32* %8
%121 = sub nsw i32 %120, 1
%122 = load double*, double** %4
%123 = load i32, i32* %7
%124 = load i32, i32* %6
br label %125
125: ; preds = %98, %3
ret void
}

LLVM IR (-O2):
define void @partial_quickersort_double(double* %0, i32 %1, i32 %2) {
%4 = sub nsw i32 %2, %1
%5 = icmp sgt i32 %4, 15
br i1 %5, label %6, label %52
6: ; preds = %3
%7 = add nsw i32 %2, 1
br label %8
8: ; preds = %6, %45
%9 = phi i32 [ %1, %6 ], [ %46, %45 ]
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = add nsw i32 %9, %2
%14 = sdiv i32 %13, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %0, i64 %15
%17 = load double, double* %16
store double %17, double* %11
store double %12, double* %16
%18 = load double, double* %11
br label %19
19: ; preds = %43, %8
%20 = phi i32 [ %7, %8 ], [ %44, %43 ]
%21 = phi i32 [ %9, %8 ], [ %31, %43 ]
%22 = sext i32 %21 to i64
br label %23
23: ; preds = %23, %19
%24 = phi i64 [ %25, %23 ], [ %22, %19 ]
%25 = add nsw i64 %24, 1
%26 = getelementptr inbounds double, double* %0, i64 %25
%27 = load double, double* %26
%28 = fcmp olt double %27, %18
br i1 %28, label %23, label %29
29: ; preds = %23
%30 = getelementptr inbounds double, double* %0, i64 %25
%31 = trunc i64 %25 to i32
%32 = sext i32 %20 to i64
br label %33
33: ; preds = %29, %33
%34 = phi i64 [ %32, %29 ], [ %35, %33 ]
%35 = add i64 %34, -1
%36 = getelementptr inbounds double, double* %0, i64 %35
%37 = load double, double* %36
%38 = fcmp ogt double %37, %18
br i1 %38, label %33, label %39
39: ; preds = %33
%40 = getelementptr inbounds double, double* %0, i64 %35
%41 = trunc i64 %34 to i32
%42 = icmp sgt i32 %41, %31
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = trunc i64 %35 to i32
store double %37, double* %30
store double %27, double* %40
br label %19
45: ; preds = %39
%46 = trunc i64 %25 to i32
%47 = trunc i64 %34 to i32
%48 = load double, double* %11
store double %37, double* %11
store double %48, double* %40
%49 = add nsw i32 %47, -2
tail call void @partial_quickersort_double(double* %0, i32 %9, i32 %49)
%50 = sub nsw i32 %2, %46
%51 = icmp sgt i32 %50, 15
br i1 %51, label %8, label %52
52: ; preds = %45, %3
ret void
}