#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 */

/* Variables and functions */
int /*<<< orphan*/ doubleSort(int, double *);
void doubleBoxWhiskerCalc(int count, double *array, double *retMin,
                          double *retQ1, double *retMedian, double *retQ3,
                          double *retMax) {
  doubleSort(count, array);
  *retMin = array[0];
  *retQ1 = array[(count + 2) / 4];
  int halfCount = count >> 1;
  if ((count & 1) == 1)
    *retMedian = array[halfCount];
  else {
    *retMedian = (array[halfCount] + array[halfCount - 1]) * 0.5;
  }
  *retQ3 = array[(3 * count + 2) / 4];
  *retMax = array[count - 1];
}


x86 assembly (clang, -O0):
<doubleBoxWhiskerCalc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <doubleSort@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    11ad <doubleBoxWhiskerCalc+0x9d>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11e0 <doubleBoxWhiskerCalc+0xd0>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  0xe2c(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
imul   $0x3,-0x4(%rbp),%eax
add    $0x2,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleBoxWhiskerCalc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r12
mov    %rcx,%r13
mov    %rdx,%rbp
mov    %rsi,%r15
mov    %edi,%ebx
call   1030 <doubleSort@plt>
movsd  (%r15),%xmm0
movsd  %xmm0,0x0(%rbp)
lea    0x2(%rbx),%eax
lea    0x5(%rbx),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x2,%ecx
movslq %ecx,%rax
movsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,0x0(%r13)
mov    %ebx,%eax
sar    %eax
cltq
movsd  (%r15,%rax,8),%xmm0
test   $0x1,%bl
jne    1178 <doubleBoxWhiskerCalc+0x68>
addsd  -0x8(%r15,%rax,8),%xmm0
mulsd  0xe88(%rip),%xmm0
lea    (%rbx,%rbx,2),%eax
add    $0x2,%eax
lea    (%rbx,%rbx,2),%ecx
add    $0x5,%ecx
test   %eax,%eax
cmovns %eax,%ecx
movsd  %xmm0,(%r12)
sar    $0x2,%ecx
movslq %ecx,%rax
movsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,(%r14)
movslq %ebx,%rax
movsd  -0x8(%r15,%rax,8),%xmm0
mov    0x40(%rsp),%rax
movsd  %xmm0,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @doubleBoxWhiskerCalc(i32 %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6) {
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
store i32 %0, i32* %8
store double* %1, double** %9
store double* %2, double** %10
store double* %3, double** %11
store double* %4, double** %12
store double* %5, double** %13
store double* %6, double** %14
%16 = load i32, i32* %8
%17 = load double*, double** %9
%18 = call i32 @doubleSort(i32 %16, double* %17)
%19 = load double*, double** %9
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = load double*, double** %10
store double %21, double* %22
%23 = load double*, double** %9
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 2
%26 = sdiv i32 %25, 4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %23, i64 %27
%29 = load double, double* %28
%30 = load double*, double** %11
store double %29, double* %30
%31 = load i32, i32* %8
%32 = ashr i32 %31, 1
store i32 %32, i32* %15
%33 = load i32, i32* %8
%34 = and i32 %33, 1
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %43
36: ; preds = %7
%37 = load double*, double** %9
%38 = load i32, i32* %15
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %12
store double %41, double* %42
br label %58
43: ; preds = %7
%44 = load double*, double** %9
%45 = load i32, i32* %15
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
%49 = load double*, double** %9
%50 = load i32, i32* %15
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %49, i64 %52
%54 = load double, double* %53
%55 = fadd double %48, %54
%56 = fmul double %55, 5.000000e-01
%57 = load double*, double** %12
store double %56, double* %57
br label %58
58: ; preds = %43, %36
%59 = load double*, double** %9
%60 = load i32, i32* %8
%61 = mul nsw i32 3, %60
%62 = add nsw i32 %61, 2
%63 = sdiv i32 %62, 4
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %59, i64 %64
%66 = load double, double* %65
%67 = load double*, double** %13
store double %66, double* %67
%68 = load double*, double** %9
%69 = load i32, i32* %8
%70 = sub nsw i32 %69, 1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %68, i64 %71
%73 = load double, double* %72
%74 = load double*, double** %14
store double %73, double* %74
ret void
}

LLVM IR (-O2):
define void @doubleBoxWhiskerCalc(i32 %0, double* %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = tail call i32 @doubleSort(i32 %0, double* %1)
%9 = load double, double* %1
store double %9, double* %2
%10 = add nsw i32 %0, 2
%11 = sdiv i32 %10, 4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds double, double* %1, i64 %12
%14 = load double, double* %13
store double %14, double* %3
%15 = ashr i32 %0, 1
%16 = and i32 %0, 1
%17 = icmp eq i32 %16, 0
%18 = sext i32 %15 to i64
%19 = getelementptr inbounds double, double* %1, i64 %18
%20 = load double, double* %19
br i1 %17, label %21, label %28
21: ; preds = %7
%22 = add nsw i32 %15, -1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %1, i64 %23
%25 = load double, double* %24
%26 = fadd double %20, %25
%27 = fmul double %26, 5.000000e-01
br label %28
28: ; preds = %7, %21
%29 = phi double [ %27, %21 ], [ %20, %7 ]
store double %29, double* %4
%30 = mul nsw i32 %0, 3
%31 = add nsw i32 %30, 2
%32 = sdiv i32 %31, 4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %1, i64 %33
%35 = load double, double* %34
store double %35, double* %5
%36 = add nsw i32 %0, -1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %1, i64 %37
%39 = load double, double* %38
store double %39, double* %6
ret void
}