// File: ekg[P]tsvtools/tsvbootstrap.cpp
// Function: subsetavg(std::vector<std::vector<double, std::allocator<double>>*, std::allocator<std::vector<double, std::allocator<double>>*>>&)
vector<double> subsetavg(vector<vector<double>* >& subset) {

    vector<double> sums;
    vector<int> counts;

    vector<vector<double>* >::iterator s = subset.begin();
    for (int i = 0; i < (*s)->size(); ++i) {
        sums.push_back((*s)->at(i));
        counts.push_back(1);
    }
    ++s;

    for (; s != subset.end(); ++s) {
        const vector<double>& record = **s;
        for (int i = 0; i < record.size(); ++i) {
            sums.at(i) += record.at(i);
            ++counts.at(i);
        }
    }

    vector<double> results;
    for (int i = 0; i < counts.size(); ++i) {
        if (counts.at(i) != 0) {
            results.push_back(sums.at(i) / counts.at(i));
        } else {
            results.push_back(0);
        }
    }

    return results;

}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x68(%rsp)
movq %rdi, %rax
movq %rax, 0x70(%rsp)
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x3970
leaq 0xc8(%rsp), %rdi
callq 0x3980
movq 0xf8(%rsp), %rdi
callq 0x3990
movq %rax, 0xc0(%rsp)
movl $0x0, 0xbc(%rsp)
movslq 0xbc(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x39c0
movq (%rax), %rdi
callq 0x39d0
movq %rax, %rcx
movq 0x60(%rsp), %rax
cmpq %rcx, %rax
jae 0x2d5c
leaq 0xc0(%rsp), %rdi
callq 0x39c0
movq (%rax), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x3a60
movq %rax, 0x58(%rsp)
jmp 0x2cf5
movq 0x58(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x39f0
jmp 0x2d09
movl $0x1, 0xa8(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3aa0
jmp 0x2d2b
jmp 0x2d2d
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0x2c9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x301c
leaq 0xc0(%rsp), %rdi
callq 0x3ad0
movq 0xf8(%rsp), %rdi
callq 0x3b30
movq %rax, 0xa0(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x3af0
testb $0x1, %al
jne 0x2d9c
jmp 0x2e9a
leaq 0xc0(%rsp), %rdi
callq 0x39c0
movq (%rax), %rax
movq %rax, 0x98(%rsp)
movl $0x0, 0x94(%rsp)
movslq 0x94(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x98(%rsp), %rdi
callq 0x39d0
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
jae 0x2e86
movq 0x98(%rsp), %rdi
movslq 0x94(%rsp), %rsi
callq 0x3b60
movq %rax, 0x48(%rsp)
jmp 0x2e06
movq 0x48(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movslq 0x94(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x3a60
movq %rax, 0x40(%rsp)
jmp 0x2e31
movq 0x40(%rsp), %rax
movsd 0x38(%rsp), %xmm1
movsd (%rax), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movslq 0x94(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x3ba0
movq %rax, 0x30(%rsp)
jmp 0x2e64
movq 0x30(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl 0x94(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x94(%rsp)
jmp 0x2dbf
jmp 0x2e88
leaq 0xc0(%rsp), %rdi
callq 0x3ad0
jmp 0x2d69
movq 0x68(%rsp), %rdi
movb $0x0, 0x93(%rsp)
callq 0x3970
movl $0x0, 0x8c(%rsp)
movslq 0x8c(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x3be0
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jae 0x2fd9
movslq 0x8c(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x3ba0
movq %rax, 0x20(%rsp)
jmp 0x2efe
movq 0x20(%rsp), %rax
cmpl $0x0, (%rax)
je 0x2fa5
movslq 0x8c(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x3a60
movq %rax, 0x18(%rsp)
jmp 0x2f28
movq 0x18(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0x8c(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x3ba0
movq %rax, 0x10(%rsp)
jmp 0x2f53
movq 0x68(%rsp), %rdi
movsd 0x8(%rsp), %xmm0
movq 0x10(%rsp), %rax
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
leaq 0x80(%rsp), %rsi
callq 0x3c00
jmp 0x2f83
jmp 0x2fc1
movq 0x68(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
callq 0x3c30
jmp 0x301c
movq 0x68(%rsp), %rdi
movq $0x0, 0x78(%rsp)
leaq 0x78(%rsp), %rsi
callq 0x3c00
jmp 0x2fbf
jmp 0x2fc1
jmp 0x2fc3
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x2eb7
movb $0x1, 0x93(%rsp)
testb $0x1, 0x93(%rsp)
jne 0x2ff5
movq 0x68(%rsp), %rdi
callq 0x3c30
leaq 0xc8(%rsp), %rdi
callq 0x3c90
leaq 0xe0(%rsp), %rdi
callq 0x3c30
movq 0x70(%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
retq
leaq 0xc8(%rsp), %rdi
callq 0x3c90
leaq 0xe0(%rsp), %rdi
callq 0x3c30
movq 0xb0(%rsp), %rdi
callq 0x23b0
nopw %cs:(%rax,%rax)