// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/common.c
// Function: doubleBoxWhiskerCalc
void doubleBoxWhiskerCalc(int count, double *array, double *retMin,
                          double *retQ1, double *retMedian, double *retQ3, double *retMax)
/* Calculate what you need to draw a box and whiskers plot from an array of doubles. */
{
if (count <= 0)
    errAbort("doubleBoxWhiskerCalc needs a positive number, not %d for count", count);
if (count == 1)
    {
    *retMin = *retQ1 = *retMedian = *retQ3 = *retMax = array[0];
    return;
    }
doubleSort(count, array);
double min = array[0];
double max = array[count-1];
double median;
int halfCount = count>>1;
if ((count&1) == 1)
    median = array[halfCount];
else
    {
    median = (array[halfCount] + array[halfCount-1]) * 0.5;
    }
double q1, q3;
if (count <= 3)
    {
    q1 = 0.5 * (median + min);
    q3 = 0.5 * (median + max);
    }
else
    {
    int q1Ix = count/4;
    int q3Ix = count - 1 - q1Ix;
    verbose(4, "count %d, q1Ix %d, q3Ix %d\n", count, q1Ix, q3Ix);
    q1 = array[q1Ix];
    q3 = array[q3Ix];
    }
*retMin = min;
*retQ1 = q1;
*retMedian = median;
*retQ3 = q3;
*retMax = max;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x10(%rbp), %rax
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x0, -0x4(%rbp)
jg 0x2b17a
movl -0x4(%rbp), %esi
leaq 0xaea4f(%rip), %rdi     # 0xd9bc2
movb $0x0, %al
callq 0x35d40
cmpl $0x1, -0x4(%rbp)
jne 0x2b1b5
movq -0x10(%rbp), %rax
movsd (%rax), %xmm0
movq 0x10(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x30(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x2b316
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2b000
movq -0x10(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x4(%rbp), %eax
sarl %eax
movl %eax, -0x4c(%rbp)
movl -0x4(%rbp), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x2b20c
movq -0x10(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x2b23c
movq -0x10(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addsd (%rax,%rcx,8), %xmm0
movsd 0xada05(%rip), %xmm1    # 0xd8c38
mulsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
cmpl $0x3, -0x4(%rbp)
jg 0x2b27a
movsd -0x48(%rbp), %xmm1
addsd -0x38(%rbp), %xmm1
movsd 0xad9e4(%rip), %xmm0    # 0xd8c38
mulsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x48(%rbp), %xmm1
addsd -0x40(%rbp), %xmm1
movsd 0xad9c9(%rip), %xmm0    # 0xd8c38
mulsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x2b2d5
movl -0x4(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, -0x64(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
subl -0x64(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x4(%rbp), %edx
movl -0x64(%rbp), %ecx
movl -0x68(%rbp), %r8d
movl $0x4, %edi
leaq 0xae957(%rip), %rsi     # 0xd9c01
movb $0x0, %al
callq 0x60040
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x38(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x58(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x48(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x60(%rbp), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x40(%rbp), %xmm0
movq 0x10(%rbp), %rax
movsd %xmm0, (%rax)
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)