// File: bobverity[P]MavericK/MCMCobject_noAdmixture.cpp
// Function: MCMCobject_noAdmixture::reset(bool)
void MCMCobject_noAdmixture::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_ind_old = vector< vector<double> >(n, vector<double>(K));
    logQmatrix_ind_new = vector< vector<double> >(n, vector<double>(K));
    if (reset_Qmatrix_running) {
        logQmatrix_ind_running = vector< vector<double> >(n, vector<double>(K,-log(double(K))));
    }
    
    logQmatrix_ind = vector< vector<double> >(n, vector<double>(K, log(double(0))));
    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));
    for (int i=0; i<n; i++) {
        group[i] = sample1(equalK,1.0);
    }
    
    // zero allele 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]);
        }
    }
    
    // populate allele counts
    for (int ind=0; ind<n; ind++) {
        for (int l=0; l<loci; l++) {
            for (int p=0; p<ploidy_vec[ind]; p++) {
                if (data[ind][l][p]!=0) {
                    alleleCounts[group[ind]-1][l][data[ind][l][p]-1]++;
                    alleleCountsTotals[group[ind]-1][l]++;
                }
            }
        }
    }
    
}

// Assembly:
subq $0x378, %rsp            # imm = 0x378
movb %sil, %al
movq %rdi, 0x370(%rsp)
andb $0x1, %al
movb %al, 0x36f(%rsp)
movq 0x370(%rsp), %rax
movq %rax, 0x148(%rsp)
movq $0x0, 0x120(%rax)
movq $0x0, 0x128(%rax)
movslq 0x88(%rax), %rax
movq %rax, 0x150(%rsp)
leaq 0x34f(%rsp), %rdi
movq %rdi, 0x158(%rsp)
callq 0x8780
movq 0x150(%rsp), %rsi
movq 0x158(%rsp), %rdx
leaq 0x350(%rsp), %rdi
callq 0x8790
jmp 0x1e064
movq 0x148(%rsp), %rdi
addq $0x130, %rdi            # imm = 0x130
leaq 0x350(%rsp), %rsi
movq %rsi, 0x128(%rsp)
callq 0x8be0
movq 0x128(%rsp), %rdi
callq 0x88b0
leaq 0x34f(%rsp), %rdi
callq 0x8910
movq 0x148(%rsp), %rax
movq $0x0, 0x148(%rax)
movq $0x0, 0x150(%rax)
movq $0x0, 0x158(%rax)
movq $0x0, 0x160(%rax)
xorps %xmm0, %xmm0
callq 0x4390
movq 0x148(%rsp), %rax
movsd %xmm0, 0x168(%rax)
movslq 0x20(%rax), %rcx
movq %rcx, 0x130(%rsp)
movslq 0x1c(%rax), %rax
movq %rax, 0x138(%rsp)
leaq 0x307(%rsp), %rdi
movq %rdi, 0x140(%rsp)
callq 0x8780
movq 0x138(%rsp), %rsi
movq 0x140(%rsp), %rdx
leaq 0x308(%rsp), %rdi
callq 0x8790
jmp 0x1e13a
leaq 0x306(%rsp), %rdi
movq %rdi, 0x120(%rsp)
callq 0x8810
movq 0x130(%rsp), %rsi
movq 0x120(%rsp), %rcx
leaq 0x320(%rsp), %rdi
leaq 0x308(%rsp), %rdx
callq 0x8820
jmp 0x1e176
movq 0x148(%rsp), %rdi
addq $0x1b8, %rdi            # imm = 0x1B8
leaq 0x320(%rsp), %rsi
movq %rsi, 0x100(%rsp)
callq 0x8b00
movq 0x100(%rsp), %rdi
callq 0x8b40
leaq 0x306(%rsp), %rdi
callq 0x88a0
leaq 0x308(%rsp), %rdi
callq 0x88b0
leaq 0x307(%rsp), %rdi
callq 0x8910
movq 0x148(%rsp), %rax
movslq 0x20(%rax), %rcx
movq %rcx, 0x108(%rsp)
movslq 0x1c(%rax), %rax
movq %rax, 0x110(%rsp)
leaq 0x2cf(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x8780
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
leaq 0x2d0(%rsp), %rdi
callq 0x8790
jmp 0x1e222
leaq 0x2ce(%rsp), %rdi
movq %rdi, 0xf8(%rsp)
callq 0x8810
movq 0x108(%rsp), %rsi
movq 0xf8(%rsp), %rcx
leaq 0x2e8(%rsp), %rdi
leaq 0x2d0(%rsp), %rdx
callq 0x8820
jmp 0x1e25e
movq 0x148(%rsp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
leaq 0x2e8(%rsp), %rsi
callq 0x8b00
leaq 0x2e8(%rsp), %rdi
callq 0x8b40
leaq 0x2ce(%rsp), %rdi
callq 0x88a0
leaq 0x2d0(%rsp), %rdi
callq 0x88b0
leaq 0x2cf(%rsp), %rdi
callq 0x8910
testb $0x1, 0x36f(%rsp)
je 0x1e4ee
movq 0x148(%rsp), %rax
movslq 0x20(%rax), %rcx
movq %rcx, 0xe0(%rsp)
movslq 0x1c(%rax), %rax
movq %rax, 0xe8(%rsp)
cvtsi2sd %eax, %xmm0
callq 0x4390
movaps 0x3dd44(%rip), %xmm1    # 0x5c030
pxor %xmm1, %xmm0
movlpd %xmm0, 0x290(%rsp)
leaq 0x28f(%rsp), %rdi
movq %rdi, 0xf0(%rsp)
callq 0x8780
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rcx
leaq 0x298(%rsp), %rdi
leaq 0x290(%rsp), %rdx
callq 0x8cf0
jmp 0x1e335
leaq 0x28e(%rsp), %rdi
movq %rdi, 0xd8(%rsp)
callq 0x8810
movq 0xe0(%rsp), %rsi
movq 0xd8(%rsp), %rcx
leaq 0x2b0(%rsp), %rdi
leaq 0x298(%rsp), %rdx
callq 0x8820
jmp 0x1e371
movq 0x148(%rsp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
leaq 0x2b0(%rsp), %rsi
callq 0x8b00
leaq 0x2b0(%rsp), %rdi
callq 0x8b40
leaq 0x28e(%rsp), %rdi
callq 0x88a0
leaq 0x298(%rsp), %rdi
callq 0x88b0
leaq 0x28f(%rsp), %rdi
callq 0x8910
jmp 0x1e4ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x34f(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x1e430
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x306(%rsp), %rdi
callq 0x88a0
leaq 0x308(%rsp), %rdi
callq 0x88b0
leaq 0x307(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x1e486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x2ce(%rsp), %rdi
callq 0x88a0
leaq 0x2d0(%rsp), %rdi
callq 0x88b0
leaq 0x2cf(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x1e4dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x28e(%rsp), %rdi
callq 0x88a0
leaq 0x298(%rsp), %rdi
callq 0x88b0
leaq 0x28f(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq 0x148(%rsp), %rax
movslq 0x20(%rax), %rcx
movq %rcx, 0xc0(%rsp)
movslq 0x1c(%rax), %rax
movq %rax, 0xc8(%rsp)
xorps %xmm0, %xmm0
callq 0x4390
movsd %xmm0, 0x250(%rsp)
leaq 0x24f(%rsp), %rdi
movq %rdi, 0xd0(%rsp)
callq 0x8780
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rcx
leaq 0x258(%rsp), %rdi
leaq 0x250(%rsp), %rdx
callq 0x8cf0
jmp 0x1e55b
leaq 0x24e(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0x8810
movq 0xc0(%rsp), %rsi
movq 0xb8(%rsp), %rcx
leaq 0x270(%rsp), %rdi
leaq 0x258(%rsp), %rdx
callq 0x8820
jmp 0x1e597
movq 0x148(%rsp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq 0x270(%rsp), %rsi
movq %rsi, 0x98(%rsp)
callq 0x8b00
movq 0x98(%rsp), %rdi
callq 0x8b40
leaq 0x24e(%rsp), %rdi
callq 0x88a0
leaq 0x258(%rsp), %rdi
callq 0x88b0
leaq 0x24f(%rsp), %rdi
callq 0x8910
movq 0x148(%rsp), %rax
movslq 0x20(%rax), %rcx
movq %rcx, 0xa0(%rsp)
movslq 0x1c(%rax), %rax
movq %rax, 0xa8(%rsp)
leaq 0x217(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x8780
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
leaq 0x218(%rsp), %rdi
callq 0x8790
jmp 0x1e643
leaq 0x216(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x8810
movq 0xa0(%rsp), %rsi
movq 0x90(%rsp), %rcx
leaq 0x230(%rsp), %rdi
leaq 0x218(%rsp), %rdx
callq 0x8820
jmp 0x1e67f
movq 0x148(%rsp), %rdi
addq $0x218, %rdi            # imm = 0x218
leaq 0x230(%rsp), %rsi
movq %rsi, 0x70(%rsp)
callq 0x8b00
movq 0x70(%rsp), %rdi
callq 0x8b40
leaq 0x216(%rsp), %rdi
callq 0x88a0
leaq 0x218(%rsp), %rdi
callq 0x88b0
leaq 0x217(%rsp), %rdi
callq 0x8910
movq 0x148(%rsp), %rdi
addq $0x58, %rdi
callq 0x16bb0
movq %rax, %rcx
movq 0x148(%rsp), %rax
movq %rcx, 0x78(%rsp)
movslq 0x1c(%rax), %rax
movq %rax, 0x80(%rsp)
leaq 0x1df(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x8780
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
leaq 0x1e0(%rsp), %rdi
callq 0x8790
jmp 0x1e732
leaq 0x1de(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x8810
movq 0x78(%rsp), %rsi
movq 0x68(%rsp), %rcx
leaq 0x1f8(%rsp), %rdi
leaq 0x1e0(%rsp), %rdx
callq 0x8820
jmp 0x1e765
movq 0x148(%rsp), %rdi
addq $0x230, %rdi            # imm = 0x230
leaq 0x1f8(%rsp), %rsi
movq %rsi, 0x50(%rsp)
callq 0x8b00
movq 0x50(%rsp), %rdi
callq 0x8b40
leaq 0x1de(%rsp), %rdi
callq 0x88a0
leaq 0x1e0(%rsp), %rdi
callq 0x88b0
leaq 0x1df(%rsp), %rdi
callq 0x8910
movq 0x148(%rsp), %rax
movslq 0x1c(%rax), %rax
movq %rax, 0x58(%rsp)
cvtsi2sd %eax, %xmm1
movsd 0x3da2c(%rip), %xmm0    # 0x5c200
divsd %xmm1, %xmm0
movsd %xmm0, 0x1b8(%rsp)
leaq 0x1b7(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x8780
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rcx
leaq 0x1c0(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0x8cf0
jmp 0x1e814
leaq 0x1b7(%rsp), %rdi
callq 0x8910
movl $0x0, 0x1b0(%rsp)
movq 0x148(%rsp), %rcx
movl 0x1b0(%rsp), %eax
cmpl 0x20(%rcx), %eax
jge 0x1e9d5
leaq 0x1c0(%rsp), %rdi
movsd 0x3d9ac(%rip), %xmm0    # 0x5c200
callq 0x39240
movl %eax, 0x4c(%rsp)
jmp 0x1e85f
movq 0x148(%rsp), %rdi
addq $0x90, %rdi
movslq 0x1b0(%rsp), %rsi
callq 0x8ba0
movl 0x4c(%rsp), %ecx
movl %ecx, (%rax)
movl 0x1b0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b0(%rsp)
jmp 0x1e82c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x1e8d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x24e(%rsp), %rdi
callq 0x88a0
leaq 0x258(%rsp), %rdi
callq 0x88b0
leaq 0x24f(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x1e92e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x216(%rsp), %rdi
callq 0x88a0
leaq 0x218(%rsp), %rdi
callq 0x88b0
leaq 0x217(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x1e984
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x1de(%rsp), %rdi
callq 0x88a0
leaq 0x1e0(%rsp), %rdi
callq 0x88b0
leaq 0x1df(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x1b7(%rsp), %rdi
callq 0x8910
jmp 0x1edd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x1edca
movl $0x0, 0x1ac(%rsp)
movq 0x148(%rsp), %rcx
movl 0x1ac(%rsp), %eax
cmpl 0x1c(%rcx), %eax
jge 0x1ebb9
movq 0x148(%rsp), %rax
movslq 0x24(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x18f(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0xc5e0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x190(%rsp), %rdi
callq 0xc7b0
jmp 0x1ea34
movq 0x148(%rsp), %rdi
addq $0xc0, %rdi
movslq 0x1ac(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
leaq 0x190(%rsp), %rsi
callq 0xc6a0
leaq 0x190(%rsp), %rdi
callq 0xc6e0
leaq 0x18f(%rsp), %rdi
callq 0xc670
movl $0x0, 0x188(%rsp)
movq 0x148(%rsp), %rcx
movl 0x188(%rsp), %eax
cmpl 0x24(%rcx), %eax
jge 0x1eba1
movq 0x148(%rsp), %rdi
addq $0x28, %rdi
movslq 0x188(%rsp), %rsi
callq 0x8ba0
movslq (%rax), %rax
movq %rax, 0x28(%rsp)
leaq 0x16f(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xc5e0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x170(%rsp), %rdi
callq 0xc7b0
jmp 0x1eae9
movq 0x148(%rsp), %rdi
addq $0xa8, %rdi
movslq 0x1ac(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x188(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
leaq 0x170(%rsp), %rsi
callq 0xc6a0
leaq 0x170(%rsp), %rdi
callq 0xc6e0
leaq 0x16f(%rsp), %rdi
callq 0xc670
movl 0x188(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x188(%rsp)
jmp 0x1ea85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x18f(%rsp), %rdi
callq 0xc670
jmp 0x1edca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
leaq 0x16f(%rsp), %rdi
callq 0xc670
jmp 0x1edca
jmp 0x1eba3
movl 0x1ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ac(%rsp)
jmp 0x1e9e0
movl $0x0, 0x168(%rsp)
movq 0x148(%rsp), %rcx
movl 0x168(%rsp), %eax
cmpl 0x20(%rcx), %eax
jge 0x1edb5
movl $0x0, 0x164(%rsp)
movq 0x148(%rsp), %rcx
movl 0x164(%rsp), %eax
cmpl 0x24(%rcx), %eax
jge 0x1ed9d
movl $0x0, 0x160(%rsp)
movq 0x148(%rsp), %rdi
movl 0x160(%rsp), %eax
movl %eax, 0x24(%rsp)
addq $0x40, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0x24(%rsp), %eax
cmpl (%rcx), %eax
jge 0x1ed85
movq 0x148(%rsp), %rdi
movslq 0x168(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x164(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x1ed6d
movq 0x148(%rsp), %rdi
movq %rdi, %rax
addq $0xa8, %rax
movq %rax, 0x8(%rsp)
addq $0x90, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8ba0
movq 0x8(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x164(%rsp), %rsi
callq 0x8c60
movq 0x148(%rsp), %rdi
movq %rax, 0x10(%rsp)
movslq 0x168(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x164(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8ba0
movq 0x10(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0x148(%rsp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq %rdi, %rax
addq $0xc0, %rax
movq %rax, 0x18(%rsp)
addq $0x90, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8ba0
movq 0x18(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x164(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x1ed6f
movl 0x160(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x160(%rsp)
jmp 0x1ec0a
jmp 0x1ed87
movl 0x164(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x164(%rsp)
jmp 0x1ebe7
jmp 0x1ed9f
movl 0x168(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x168(%rsp)
jmp 0x1ebc4
leaq 0x1c0(%rsp), %rdi
callq 0x88b0
addq $0x378, %rsp            # imm = 0x378
retq
leaq 0x1c0(%rsp), %rdi
callq 0x88b0
movq 0x340(%rsp), %rdi
callq 0x4730
nopw %cs:(%rax,%rax)