// File: millanek[P]Dsuite/./Dsuite_utils.h
// Function: double jackknive_std_err<std::vector<double, std::allocator<double>>>(std::vector<double, std::allocator<double>>&)
double jackknive_std_err(T& vector) {
    if (vector.size() < 5) {
        throw "WARNING: Fewer than five blocks to calculate jackknife!!";
    }
    std::vector<double> jackkniveAverages;
    std::vector<double> JregionDs; JregionDs.resize(vector.size()-1);
    for (std::vector<double>::size_type i = 0; i != vector.size(); i++) {
        // std::cerr << "copying " << i << std::endl;
        copy_except(i, vector, JregionDs);
        jackkniveAverages.push_back(vector_average(JregionDs));
        JregionDs.clear(); JregionDs.resize(vector.size()-1);
    }
    double jackkniveOverallMean = vector_average(jackkniveAverages);
    double sum = 0;
    for (int i = 0; i < jackkniveAverages.size(); i++) {
        sum += std::pow((jackkniveAverages[i] - jackkniveOverallMean), 2.0);
    }
    double var = ((double)(jackkniveAverages.size()-1)/(double)jackkniveAverages.size()) * sum;
    double Dstd_err = std::sqrt(var);
    return Dstd_err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x10e50
cmpq $0x5, %rax
jae 0x3d065
movl $0x8, %edi
callq 0x82a0
movq %rax, %rdi
leaq 0x4c872(%rip), %rax     # 0x898c4
movq %rax, (%rdi)
movq 0x81f14(%rip), %rsi     # 0xbef70
xorl %eax, %eax
movl %eax, %edx
callq 0x89f0
leaq -0x20(%rbp), %rdi
callq 0x10800
leaq -0x38(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x10800
movq -0x8(%rbp), %rdi
callq 0x10e50
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x3d370
jmp 0x3d09b
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x10e50
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
je 0x3d18e
movl -0x50(%rbp), %edi
movq -0x8(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x3d400
jmp 0x3d0dc
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x110a0
jmp 0x3d0eb
leaq -0x70(%rbp), %rdi
callq 0x10fe0
movsd %xmm0, -0xc8(%rbp)
jmp 0x3d0fe
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x117b0
jmp 0x3d11a
leaq -0x70(%rbp), %rdi
callq 0x10930
leaq -0x38(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x3d4e0
movq -0x8(%rbp), %rdi
callq 0x10e50
movq -0xd0(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x3d370
jmp 0x3d150
jmp 0x3d152
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x3d0a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3d354
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x10930
jmp 0x3d354
leaq -0x90(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x110a0
jmp 0x3d1a0
leaq -0x90(%rbp), %rdi
callq 0x10fe0
movsd %xmm0, -0xd8(%rbp)
jmp 0x3d1b6
leaq -0x90(%rbp), %rdi
callq 0x10930
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movslq -0x9c(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x10e50
movq %rax, %rcx
movq -0xe0(%rbp), %rax
cmpq %rcx, %rax
jae 0x3d26e
movslq -0x9c(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x107e0
movsd (%rax), %xmm0
subsd -0x78(%rbp), %xmm0
movsd 0x4b295(%rip), %xmm1    # 0x884c0
callq 0x8a20
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x3d1e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x10930
jmp 0x3d354
leaq -0x20(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x10e50
movq -0x118(%rbp), %rdi
decq %rax
movq %rax, %xmm0
movaps 0x4b1ec(%rip), %xmm1    # 0x88480
movaps %xmm1, -0x110(%rbp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x4b1e9(%rip), %xmm1    # 0x88490
movaps %xmm1, -0x100(%rbp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0xf0(%rbp)
callq 0x10e50
movaps -0x110(%rbp), %xmm3
movaps -0x100(%rbp), %xmm2
movsd -0xf0(%rbp), %xmm0
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
mulsd -0x98(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x8470
movsd %xmm0, -0xb0(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x10930
leaq -0x20(%rbp), %rdi
callq 0x10930
movsd -0xe8(%rbp), %xmm0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x10930
leaq -0x20(%rbp), %rdi
callq 0x10930
movq -0x40(%rbp), %rdi
callq 0x8a50
nop