// File: fjamour[P]icentral/src/utility.cc
// Function: simple_stats(std::vector<double, std::allocator<double>>, double&, double&, double&, double&, double&)
void simple_stats(vector<double> vec,
        double& mean,
        double& stddev,
        double& median,
        double& min,
        double& max)
{
    sort(vec.begin(), vec.end());
    min = *(min_element(vec.begin(), vec.end()));
    max = *(max_element(vec.begin(), vec.end()));
    double sum = accumulate(vec.begin(), vec.end(), 0.0);
    mean = sum/vec.size();
    median = vec[vec.size()/2];
    
    double sum_2 = 0;
    for(int i = 0; i < vec.size(); ++i)
        sum_2 += ((vec[i]-mean)*(vec[i]-mean));
    stddev = sqrt(sum_2/vec.size());
    
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0x28(%rsp)
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq %rdx, 0xb0(%rsp)
movq %rcx, 0xa8(%rsp)
movq %r8, 0xa0(%rsp)
movq %r9, 0x98(%rsp)
callq 0xf760
movq 0x28(%rsp), %rdi
movq %rax, 0x90(%rsp)
callq 0xf790
movq %rax, 0x88(%rsp)
movq 0x90(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x78ac0
movq 0x28(%rsp), %rdi
callq 0xf760
movq 0x28(%rsp), %rdi
movq %rax, 0x78(%rsp)
callq 0xf790
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x78b00
movq %rax, 0x80(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x50c00
movq 0x28(%rsp), %rdi
movsd (%rax), %xmm0
movq 0xa0(%rsp), %rax
movsd %xmm0, (%rax)
callq 0xf760
movq 0x28(%rsp), %rdi
movq %rax, 0x60(%rsp)
callq 0xf790
movq %rax, 0x58(%rsp)
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x78b50
movq %rax, 0x68(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x50c00
movq 0x28(%rsp), %rdi
movsd (%rax), %xmm0
movq 0x98(%rsp), %rax
movsd %xmm0, (%rax)
callq 0xf760
movq 0x28(%rsp), %rdi
movq %rax, 0x48(%rsp)
callq 0xf790
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
xorps %xmm0, %xmm0
callq 0x78ba0
movq 0x28(%rsp), %rdi
movsd %xmm0, 0x50(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
callq 0xfa10
movsd 0x20(%rsp), %xmm0
movq 0x28(%rsp), %rdi
movq %rax, %xmm1
movaps 0x2a2f(%rip), %xmm2     # 0x7b2b0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x2a33(%rip), %xmm2     # 0x7b2c0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0xb8(%rsp), %rax
movsd %xmm0, (%rax)
callq 0xfa10
movq 0x28(%rsp), %rdi
movq %rax, %rsi
shrq %rsi
callq 0xfa30
movsd (%rax), %xmm0
movq 0xa8(%rsp), %rax
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movq 0x28(%rsp), %rdi
movslq 0x34(%rsp), %rax
movq %rax, 0x18(%rsp)
callq 0xfa10
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x78971
movq 0x28(%rsp), %rdi
movslq 0x34(%rsp), %rsi
callq 0xfa30
movq 0x28(%rsp), %rdi
movsd (%rax), %xmm0
movq 0xb8(%rsp), %rax
subsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0x34(%rsp), %rsi
callq 0xfa30
movsd 0x10(%rsp), %xmm0
movsd (%rax), %xmm2
movq 0xb8(%rsp), %rax
subsd (%rax), %xmm2
movsd 0x38(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x788e2
movq 0x28(%rsp), %rdi
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0xfa10
movsd 0x8(%rsp), %xmm0
movq %rax, %xmm1
movaps 0x2917(%rip), %xmm2     # 0x7b2b0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x291b(%rip), %xmm2     # 0x7b2c0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x9570
movq 0xb0(%rsp), %rax
movsd %xmm0, (%rax)
addq $0xc8, %rsp
retq
nopw %cs:(%rax,%rax)