// File: /workspace/github_cpp_makefile_star2_O3/bobverity[P]MavericK/MCMCobject_admixture.cpp
// Function: MCMCobject_admixture::reset(bool)
void MCMCobject_admixture::reset(bool reset_Qmatrix_running) {
    
    // reset likelihoods
    logLikeGroup = 0;
    logLikeGroup_sum = 0;
    logLikeGroup_store = vector<double>(samples);
    logLikeGroup_sumSquared = 0;
    logLikeJoint = 0;
    logLikeJoint_sum = 0;
    logLikeJoint_sumSquared = 0;
    harmonic = log(double(0));
    
    // reset Qmatrices
    logQmatrix_gene_old = vector< vector<double> >(geneCopies, vector<double>(K));
    logQmatrix_gene_new = vector< vector<double> >(geneCopies, vector<double>(K));
    Qmatrix_gene_new = vector< vector<double> >(geneCopies, vector<double>(K));
    if (reset_Qmatrix_running) {
        logQmatrix_gene_running = vector< vector<double> >(geneCopies, vector<double>(K,-log(double(K))));
    }
    
    logQmatrix_gene = vector< vector<double> >(geneCopies, vector<double>(K, log(double(0))));
    Qmatrix_gene = vector< vector<double> >(geneCopies, vector<double>(K));
    Qmatrix_ind = vector< vector<double> >(n, vector<double>(K));
    Qmatrix_pop = vector< vector<double> >(uniquePops.size(), vector<double>(K));
    
    // initialise group with random allocation
    vector<double> equalK(K,1/double(K));
    groupIndex=-1;
    for (int i=0; i<n; i++) {
        for (int l=0; l<loci; l++) {
            for (int p=0; p<ploidy_vec[i]; p++) {
                groupIndex++;
                linearGroup[groupIndex] = sample1(equalK,1.0);
                group[i][l][p] = linearGroup[groupIndex];
            }
        }
    }
    
    // zero allele counts and admix counts
    for (int k=0; k<K; k++) {
        alleleCountsTotals[k] = vector<int>(loci);
        for (int l=0; l<loci; l++) {
            alleleCounts[k][l] = vector<int>(J[l]);
        }
    }
    admixCounts = vector< vector<int> > (n,vector<int>(K));
    admixCountsTotals = vector<int> (n);
    
    // populate allele counts and admix counts
    groupIndex=-1;
    for (int ind=0; ind<n; ind++) {
        for (int l=0; l<loci; l++) {
            for (int p=0; p<ploidy_vec[ind]; p++) {
                groupIndex++;
                if (data[ind][l][p]!=0) {
                    alleleCounts[linearGroup[groupIndex]-1][l][data[ind][l][p]-1]++;
                    alleleCountsTotals[linearGroup[groupIndex]-1][l]++;
                    
                    admixCounts[ind][linearGroup[groupIndex]-1]++;
                    admixCountsTotals[ind]++;
                }
            }
        }
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x1e8(%rdi)
movslq 0xa8(%rdi), %rsi
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %rdx
movq %r14, %rdi
callq 0x588e
movq 0x1f8(%rbx), %rdi
movapd (%r14), %xmm0
movupd %xmm0, 0x1f8(%rbx)
movq 0x10(%r14), %rax
movq %rax, 0x208(%rbx)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
testq %rdi, %rdi
je 0x83b8
callq 0x3310
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x83b8
callq 0x3310
xorpd %xmm0, %xmm0
movupd %xmm0, 0x220(%rbx)
movupd %xmm0, 0x210(%rbx)
xorpd %xmm0, %xmm0
callq 0x3290
movsd %xmm0, 0x230(%rbx)
movslq 0x70(%rbx), %r14
movslq 0x1c(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x588e
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x290(%rbx), %rax
leaq 0x50(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x290(%rbx)
movupd 0x280(%rbx), %xmm1
movupd %xmm0, 0x280(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8471
callq 0x3310
movslq 0x70(%rbx), %r14
movslq 0x1c(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x588e
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x2a8(%rbx), %rax
leaq 0x50(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x2a8(%rbx)
movupd 0x298(%rbx), %xmm1
movupd %xmm0, 0x298(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8505
callq 0x3310
movslq 0x70(%rbx), %r14
movslq 0x1c(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x588e
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x2c0(%rbx), %rax
leaq 0x50(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x2c0(%rbx)
movupd 0x2b0(%rbx), %xmm1
movupd %xmm0, 0x2b0(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8599
callq 0x3310
testb %bpl, %bpl
je 0x8657
movslq 0x70(%rbx), %r14
movslq 0x1c(%rbx), %r15
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
callq 0x3290
xorpd 0x2da81(%rip), %xmm0    # 0x36040
leaq 0x70(%rsp), %rdx
movlpd %xmm0, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0xe(%rsp), %rcx
movq %r15, %rsi
callq 0x5b2e
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xf(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x2d8(%rbx), %rax
leaq 0x50(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x2d8(%rbx)
movupd 0x2c8(%rbx), %xmm1
movupd %xmm0, 0x2c8(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8657
callq 0x3310
movslq 0x70(%rbx), %r14
movslq 0x1c(%rbx), %r15
xorpd %xmm0, %xmm0
callq 0x3290
leaq 0x70(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0xe(%rsp), %rcx
movq %r15, %rsi
callq 0x5b2e
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xf(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x2f0(%rbx), %rax
leaq 0x50(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x2f0(%rbx)
movupd 0x2e0(%rbx), %xmm1
movupd %xmm0, 0x2e0(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8700
callq 0x3310
movslq 0x70(%rbx), %r14
movslq 0x1c(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x588e
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x308(%rbx), %rax
leaq 0x50(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x308(%rbx)
movupd 0x2f8(%rbx), %xmm1
movupd %xmm0, 0x2f8(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8794
callq 0x3310
movslq 0x20(%rbx), %r14
movslq 0x1c(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x588e
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x320(%rbx), %rax
leaq 0x50(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x320(%rbx)
movupd 0x310(%rbx), %xmm1
movupd %xmm0, 0x310(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8828
callq 0x3310
movq 0x58(%rbx), %r15
movq 0x60(%rbx), %r14
movslq 0x1c(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x588e
subq %r15, %r14
sarq $0x5, %r14
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r14, %rsi
callq 0x591c
movq 0x338(%rbx), %rax
leaq 0x50(%rsp), %r14
movaps (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x338(%rbx)
movups 0x328(%rbx), %xmm1
movups %xmm0, 0x328(%rbx)
leaq 0x30(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x5ae8
movq %r14, %rdi
callq 0x5ae8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x88c1
callq 0x3310
movslq 0x1c(%rbx), %rsi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movsd 0x2d98c(%rip), %xmm1    # 0x36260
divsd %xmm0, %xmm1
leaq 0x30(%rsp), %rdx
movsd %xmm1, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rcx
callq 0x5b2e
movl $0xffffffff, 0x108(%rbx) # imm = 0xFFFFFFFF
movl 0x20(%rbx), %ebp
testl %ebp, %ebp
jle 0x89a9
movl 0x24(%rbx), %eax
xorl %r15d, %r15d
testl %eax, %eax
jle 0x899a
movq 0x40(%rbx), %rcx
leaq (%r15,%r15,2), %r12
xorl %r13d, %r13d
cmpl $0x0, (%rcx,%r15,4)
jle 0x898c
leaq (,%r13,2), %rbp
addq %r13, %rbp
xorl %r14d, %r14d
incl 0x108(%rbx)
leaq 0x50(%rsp), %rdi
movsd 0x2d91a(%rip), %xmm0    # 0x36260
callq 0x1d2d5
movslq 0x108(%rbx), %rcx
movq 0xc0(%rbx), %rdx
movl %eax, (%rdx,%rcx,4)
movslq 0x108(%rbx), %rax
movl (%rdx,%rax,4), %eax
movq 0xd8(%rbx), %rcx
movq (%rcx,%r12,8), %rcx
movq (%rcx,%rbp,8), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
movq 0x40(%rbx), %rcx
movslq (%rcx,%r15,4), %rax
cmpq %rax, %r14
jl 0x8933
movl 0x24(%rbx), %eax
incq %r13
movslq %eax, %rdx
cmpq %rdx, %r13
jl 0x891e
movl 0x20(%rbx), %ebp
incq %r15
movslq %ebp, %rcx
cmpq %rcx, %r15
jl 0x890b
movslq 0x1c(%rbx), %rsi
testq %rsi, %rsi
jle 0x8ac5
movl 0x24(%rbx), %eax
xorl %r12d, %r12d
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r15
movslq %eax, %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x6a48
movq 0x128(%rbx), %rax
leaq (%r12,%r12,2), %r13
movq (%rax,%r13,8), %rdi
movapd 0x30(%rsp), %xmm0
movupd %xmm0, (%rax,%r13,8)
movq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rax,%r13,8)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testq %rdi, %rdi
je 0x8a25
callq 0x3310
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8a25
callq 0x3310
movl 0x24(%rbx), %eax
testl %eax, %eax
jle 0x8ab2
movq %r12, 0x68(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movslq (%rax,%r12,4), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x6a48
movq 0x110(%rbx), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbp), %rdi
movapd 0x30(%rsp), %xmm0
movupd %xmm0, (%rax,%rbp)
movq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rax,%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testq %rdi, %rdi
je 0x8a9d
callq 0x3310
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8a9d
callq 0x3310
incq %r12
movslq 0x24(%rbx), %rax
addq $0x18, %rbp
cmpq %rax, %r12
jl 0x8a3a
movq 0x68(%rsp), %r12
incq %r12
movslq 0x1c(%rbx), %rsi
cmpq %rsi, %r12
jl 0x89c6
movl 0x20(%rbx), %ebp
leaq 0x70(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x6a48
movslq %ebp, %rsi
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0xb3ac
movq 0x198(%rbx), %rax
leaq 0x10(%rsp), %r14
movapd (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x198(%rbx)
movupd 0x188(%rbx), %xmm1
movupd %xmm0, 0x188(%rbx)
leaq 0x30(%rsp), %rdi
movapd %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0xb366
movq %r14, %rdi
callq 0xb366
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x8b51
callq 0x3310
movslq 0x20(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6a48
movq 0x1a0(%rbx), %rdi
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x1a0(%rbx)
movq 0x40(%rsp), %rax
movq %rax, 0x1b0(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testq %rdi, %rdi
je 0x8bad
callq 0x3310
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8bad
callq 0x3310
movl $0xffffffff, 0x108(%rbx) # imm = 0xFFFFFFFF
movl 0x20(%rbx), %edx
testl %edx, %edx
jle 0x8cc3
movq 0x40(%rbx), %rax
movl 0x24(%rbx), %r8d
xorl %ecx, %ecx
testl %r8d, %r8d
jle 0x8cb4
leaq (%rcx,%rcx,2), %rdx
shlq $0x3, %rdx
movq (%rbx), %rsi
addq %rdx, %rsi
movq %rsi, 0x68(%rsp)
movl (%rax,%rcx,4), %ebp
xorl %edi, %edi
testl %ebp, %ebp
jle 0x8ca2
movq 0x68(%rsp), %rsi
movq (%rsi), %rsi
leaq (%rdi,%rdi,2), %r8
movq (%rsi,%r8,8), %r9
movq 0xc0(%rbx), %r10
movq 0x110(%rbx), %r11
addq $-0x18, %r11
movq 0x128(%rbx), %r14
addq $-0x18, %r14
movq 0x188(%rbx), %r15
addq %rdx, %r15
movq 0x1a0(%rbx), %r12
xorl %r13d, %r13d
movslq 0x108(%rbx), %rbp
leal 0x1(%rbp), %esi
movl %esi, 0x108(%rbx)
movslq (%r9,%r13,4), %rsi
testq %rsi, %rsi
je 0x8c92
movslq 0x4(%r10,%rbp,4), %rbp
leaq (%rbp,%rbp,2), %rbp
movq (%r11,%rbp,8), %rbp
movq (%rbp,%r8,8), %rbp
incl -0x4(%rbp,%rsi,4)
movslq 0x108(%rbx), %rsi
movslq (%r10,%rsi,4), %rsi
leaq (%rsi,%rsi,2), %rsi
movq (%r14,%rsi,8), %rsi
incl (%rsi,%rdi,4)
movslq 0x108(%rbx), %rsi
movslq (%r10,%rsi,4), %rsi
movq (%r15), %rbp
incl -0x4(%rbp,%rsi,4)
incl (%r12,%rcx,4)
incq %r13
movslq (%rax,%rcx,4), %rbp
cmpq %rbp, %r13
jl 0x8c36
movl 0x24(%rbx), %r8d
incq %rdi
movslq %r8d, %rsi
cmpq %rsi, %rdi
jl 0x8bed
movl 0x20(%rbx), %edx
incq %rcx
movslq %edx, %rsi
cmpq %rsi, %rcx
jl 0x8bcc
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8cd2
callq 0x3310
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8d1a
jmp 0x8d24
jmp 0x8d2d
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x8d30
callq 0x3310
jmp 0x8d30
jmp 0x8d2d
jmp 0x8d24
jmp 0x8d1a
jmp 0x8d24
jmp 0x8d1a
jmp 0x8d24
jmp 0x8d1a
jmp 0x8d24
jmp 0x8d1a
jmp 0x8d24
jmp 0x8d1a
jmp 0x8d24
jmp 0x8d1a
jmp 0x8d24
movq %rax, %rbx
movq 0x10(%rsp), %rdi
jmp 0x8d35
movq %rax, %rbx
jmp 0x8d3f
jmp 0x8d2d
jmp 0x8d2d
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8d3f
callq 0x3310
movq %rbx, %rdi
callq 0x3580
nop