// File: bobverity[P]MavericK/MCMCobject_admixture.cpp
// Function: MCMCobject_admixture::group_update_indLevel()
void MCMCobject_admixture::group_update_indLevel() {
    
    double logLike_old;
    double logLike_new;
    double propose_logProb_old;
    double propose_logProb_new;
    double MH_diff;
    double rand1;
    int thisGroup;
    
    // loop over all individuals
    groupIndex=-1;
    for (int ind=0; ind<n; ind++) {
        
        // subtract all gene copies in this individual and calculate likelihood of current grouping at the same time
        logLike_old = 0;
        propose_logProb_old = 0;
        for (int l=0; l<loci; l++) {
            for (int p=0; p<ploidy_vec[ind]; p++) {
                thisData = data[ind][l][p];
                thisGroup = group[ind][l][p];
                
                // subtract this gene copy from allele counts and admix counts
                if (thisData!=0) {   // if not missing data
                    alleleCounts[thisGroup-1][l][thisData-1]--;
                    alleleCountsTotals[thisGroup-1][l]--;
                    
                    admixCounts[ind][thisGroup-1]--;
                    admixCountsTotals[ind]--;
                }
                
                // calculate probability of this gene copy from all demes
                probVecSum = 0;
                for (int k=0; k<K; k++) {
                    if (thisData==0) {
                        logProbVec[k] = 0;
                    } else {
                        thisAlleleCounts = alleleCounts[k][l][thisData-1];
                        thisAlleleCountsTotals = alleleCountsTotals[k][l];
                        if ((thisAlleleCounts<int(1e4)) && (thisAlleleCountsTotals<int(1e4))) {
                            logProbVec[k] = beta*log_lookup_0[thisAlleleCounts] - beta*log_lookup[thisAlleleCountsTotals][J[l]-1];
                        } else {
                            logProbVec[k] = beta*log((thisAlleleCounts + lambda)/double(thisAlleleCountsTotals + J[l]*lambda));
                        }
                    }
                    probVec[k] = double(admixCounts[ind][k]+alpha)*exp(logProbVec[k]);
                    probVecSum += probVec[k];
                }
                
                // calculate probability of chosen grouping
                propose_logProb_old += log(probVec[thisGroup-1]/probVecSum);
                logLike_old += log(probVec[thisGroup-1]);
                
            }
        }
        
        // propose a new grouping and calculate likelihood
        logLike_new = 0;
        propose_logProb_new = 0;
        for (int l=0; l<loci; l++) {
            for (int p=0; p<ploidy_vec[ind]; p++) {
                thisData = data[ind][l][p];
                
                // calculate probability of this gene copy from all demes
                probVecSum = 0;
                for (int k=0; k<K; k++) {
                    if (thisData==0) {
                        logProbVec[k] = 0;
                    } else {
                        thisAlleleCounts = alleleCounts[k][l][thisData-1];
                        thisAlleleCountsTotals = alleleCountsTotals[k][l];
                        if ((thisAlleleCounts<int(1e4)) && (thisAlleleCountsTotals<int(1e4))) {
                            logProbVec[k] = beta*log_lookup_0[thisAlleleCounts] - beta*log_lookup[thisAlleleCountsTotals][J[l]-1];
                        } else {
                            logProbVec[k] = beta*log((thisAlleleCounts + lambda)/double(thisAlleleCountsTotals + J[l]*lambda));
                        }
                    }
                    probVec[k] = double(admixCounts[ind][k]+alpha)*exp(logProbVec[k]);
                    probVecSum += probVec[k];
                }
                
                // resample grouping
                group_propose[ind][l][p] = sample1(probVec, probVecSum);
                
                // calculate probability of new grouping
                propose_logProb_new += log(probVec[group_propose[ind][l][p]-1]/probVecSum);
                logLike_new += log(probVec[group_propose[ind][l][p]-1]);
                
                // add this gene copy to allele counts and admix counts
                if (thisData!=0) {   // if not missing data
                    thisGroup = group_propose[ind][l][p];
                    alleleCounts[thisGroup-1][l][thisData-1]++;
                    alleleCountsTotals[thisGroup-1][l]++;
                    
                    admixCounts[ind][thisGroup-1]++;
                    admixCountsTotals[ind]++;
                }
            }
        }
        
        // Metropolis-Hastings step. If accept then stick with new grouping, otherwise revert back
        MH_diff = (logLike_new - propose_logProb_new) - (logLike_old - propose_logProb_old);
        rand1 = runif1(0,1);
        if (log(rand1)<MH_diff) {
            
            // accept move
            for (int l=0; l<loci; l++) {
                for (int p=0; p<ploidy_vec[ind]; p++) {
                    groupIndex++;
                    linearGroup[groupIndex] = group_propose[ind][l][p];
                    group[ind][l][p] = group_propose[ind][l][p];
                }
            }
            
        } else {
            
            // reject move
            for (int l=0; l<loci; l++) {
                for (int p=0; p<ploidy_vec[ind]; p++) {
                    groupIndex++;
                    thisData = data[ind][l][p];
                    if (thisData!=0) {   // if not missing data
                        
                        // subtract new group
                        thisGroup = group_propose[ind][l][p];
                        alleleCounts[thisGroup-1][l][thisData-1]--;
                        alleleCountsTotals[thisGroup-1][l]--;
                        
                        admixCounts[ind][thisGroup-1]--;
                        admixCountsTotals[ind]--;
                        
                        // reinstate old group
                        thisGroup = group[ind][l][p];
                        alleleCounts[thisGroup-1][l][thisData-1]++;
                        alleleCountsTotals[thisGroup-1][l]++;
                        
                        admixCounts[ind][thisGroup-1]++;
                        admixCountsTotals[ind]++;
                    }
                    
                }
            }
            
        }
        
    }   // end loop over individuals
    
}

// Assembly:
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x150(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0xe8(%rsp)
movl $0xffffffff, 0x108(%rax) # imm = 0xFFFFFFFF
movl $0x0, 0x118(%rsp)
movq 0xe8(%rsp), %rcx
movl 0x118(%rsp), %eax
cmpl 0x20(%rcx), %eax
jge 0x145aa
xorps %xmm0, %xmm0
movsd %xmm0, 0x148(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x138(%rsp)
movl $0x0, 0x114(%rsp)
movq 0xe8(%rsp), %rcx
movl 0x114(%rsp), %eax
cmpl 0x24(%rcx), %eax
jge 0x138f3
movl $0x0, 0x110(%rsp)
movq 0xe8(%rsp), %rdi
movl 0x110(%rsp), %eax
movl %eax, 0xe4(%rsp)
addq $0x40, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0xe4(%rsp), %eax
cmpl (%rcx), %eax
jge 0x138db
movq 0xe8(%rsp), %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x110(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0xb0(%rdi)
addq $0xd8, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x110(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0x11c(%rsp)
cmpl $0x0, 0xb0(%rax)
je 0x1343c
movq 0xe8(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movq 0xe8(%rsp), %rax
movl 0xb0(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x128, %rdi            # imm = 0x128
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x188, %rdi            # imm = 0x188
movslq 0x118(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x1a0, %rdi            # imm = 0x1A0
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq 0xe8(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x278(%rax)
movl $0x0, 0x10c(%rsp)
movq 0xe8(%rsp), %rcx
movl 0x10c(%rsp), %eax
cmpl 0x1c(%rcx), %eax
jge 0x1383a
movq 0xe8(%rsp), %rax
cmpl $0x0, 0xb0(%rax)
jne 0x134ab
movq 0xe8(%rsp), %rdi
addq $0x238, %rdi            # imm = 0x238
movslq 0x10c(%rsp), %rsi
callq 0x8c20
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x13741
movq 0xe8(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movslq 0x10c(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movq 0xe8(%rsp), %rax
movl 0xb0(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0xb4(%rdi)
addq $0x128, %rdi            # imm = 0x128
movslq 0x10c(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0xb8(%rax)
cmpl $0x2710, 0xb4(%rax)     # imm = 0x2710
jge 0x13675
movq 0xe8(%rsp), %rax
cmpl $0x2710, 0xb8(%rax)     # imm = 0x2710
jge 0x13675
movq 0xe8(%rsp), %rax
movsd 0x98(%rax), %xmm0
movsd %xmm0, 0xc8(%rsp)
movslq 0xb4(%rax), %rsi
leaq 0x59eaf(%rip), %rdi     # 0x6d438
callq 0x8c20
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0xd0(%rsp)
movsd 0x98(%rax), %xmm0
movsd %xmm0, 0xc0(%rsp)
movslq 0xb8(%rax), %rsi
leaq 0x59e5b(%rip), %rdi     # 0x6d420
callq 0x8bc0
movq 0xe8(%rsp), %rdi
movq %rax, 0xb8(%rsp)
addq $0x28, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8ba0
movq 0xb8(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c20
movsd 0xc0(%rsp), %xmm1
movsd 0xc8(%rsp), %xmm0
movsd 0xd0(%rsp), %xmm2
movq 0xe8(%rsp), %rdi
mulsd (%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xd8(%rsp)
addq $0x238, %rdi            # imm = 0x238
movslq 0x10c(%rsp), %rsi
callq 0x8c20
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x1373f
movq 0xe8(%rsp), %rdi
movsd 0x98(%rdi), %xmm0
movsd %xmm0, 0xa8(%rsp)
cvtsi2sdl 0xb4(%rdi), %xmm0
addsd 0x78(%rdi), %xmm0
movsd %xmm0, 0xa0(%rsp)
cvtsi2sdl 0xb8(%rdi), %xmm0
movsd %xmm0, 0x98(%rsp)
addq $0x28, %rdi
movslq 0x114(%rsp), %rsi
callq 0x8ba0
movsd 0x98(%rsp), %xmm2
movsd 0xa0(%rsp), %xmm0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
cvtsi2sdl (%rcx), %xmm1
movsd 0x78(%rax), %xmm3
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x4390
movq 0xe8(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0xa8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xb0(%rsp)
addq $0x238, %rdi            # imm = 0x238
movslq 0x10c(%rsp), %rsi
callq 0x8c20
movsd 0xb0(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x13741
movq 0xe8(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
movslq 0x118(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x10c(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
cvtsi2sdl (%rax), %xmm0
addsd 0x88(%rdi), %xmm0
movsd %xmm0, 0x88(%rsp)
addq $0x238, %rdi            # imm = 0x238
movslq 0x10c(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
callq 0x4760
movq 0xe8(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x88(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rsp)
addq $0x260, %rdi            # imm = 0x260
movslq 0x10c(%rsp), %rsi
callq 0x8c20
movsd 0x90(%rsp), %xmm0
movq 0xe8(%rsp), %rdi
movsd %xmm0, (%rax)
addq $0x260, %rdi            # imm = 0x260
movslq 0x10c(%rsp), %rsi
callq 0x8c20
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movsd (%rcx), %xmm0
addsd 0x278(%rax), %xmm0
movsd %xmm0, 0x278(%rax)
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x1345a
movq 0xe8(%rsp), %rdi
addq $0x260, %rdi            # imm = 0x260
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c20
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movsd (%rcx), %xmm0
divsd 0x278(%rax), %xmm0
callq 0x4390
movq 0xe8(%rsp), %rdi
addsd 0x138(%rsp), %xmm0
movsd %xmm0, 0x138(%rsp)
addq $0x260, %rdi            # imm = 0x260
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c20
movsd (%rax), %xmm0
callq 0x4390
addsd 0x148(%rsp), %xmm0
movsd %xmm0, 0x148(%rsp)
movl 0x110(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x110(%rsp)
jmp 0x13282
jmp 0x138dd
movl 0x114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x114(%rsp)
jmp 0x1325f
xorps %xmm0, %xmm0
movsd %xmm0, 0x140(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x130(%rsp)
movl $0x0, 0x108(%rsp)
movq 0xe8(%rsp), %rcx
movl 0x108(%rsp), %eax
cmpl 0x24(%rcx), %eax
jge 0x14045
movl $0x0, 0x104(%rsp)
movq 0xe8(%rsp), %rdi
movl 0x104(%rsp), %eax
movl %eax, 0x84(%rsp)
addq $0x40, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0x84(%rsp), %eax
cmpl (%rcx), %eax
jge 0x1402d
movq 0xe8(%rsp), %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x104(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0xb0(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x278(%rax)
movl $0x0, 0x100(%rsp)
movq 0xe8(%rsp), %rcx
movl 0x100(%rsp), %eax
cmpl 0x1c(%rcx), %eax
jge 0x13d6e
movq 0xe8(%rsp), %rax
cmpl $0x0, 0xb0(%rax)
jne 0x13a21
movq 0xe8(%rsp), %rdi
addq $0x238, %rdi            # imm = 0x238
movslq 0x100(%rsp), %rsi
callq 0x8c20
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x13c81
movq 0xe8(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
movslq 0x100(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movq 0xe8(%rsp), %rax
movl 0xb0(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0xb4(%rdi)
addq $0x128, %rdi            # imm = 0x128
movslq 0x100(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0xb8(%rax)
cmpl $0x2710, 0xb4(%rax)     # imm = 0x2710
jge 0x13bcd
movq 0xe8(%rsp), %rax
cmpl $0x2710, 0xb8(%rax)     # imm = 0x2710
jge 0x13bcd
movq 0xe8(%rsp), %rax
movsd 0x98(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movslq 0xb4(%rax), %rsi
leaq 0x5993c(%rip), %rdi     # 0x6d438
callq 0x8c20
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x98(%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movslq 0xb8(%rax), %rsi
leaq 0x598ee(%rip), %rdi     # 0x6d420
callq 0x8bc0
movq 0xe8(%rsp), %rdi
movq %rax, 0x58(%rsp)
addq $0x28, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8ba0
movq 0x58(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c20
movsd 0x60(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
movsd 0x70(%rsp), %xmm2
movq 0xe8(%rsp), %rdi
mulsd (%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
addq $0x238, %rdi            # imm = 0x238
movslq 0x100(%rsp), %rsi
callq 0x8c20
movsd 0x78(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x13c7f
movq 0xe8(%rsp), %rdi
movsd 0x98(%rdi), %xmm0
movsd %xmm0, 0x48(%rsp)
cvtsi2sdl 0xb4(%rdi), %xmm0
addsd 0x78(%rdi), %xmm0
movsd %xmm0, 0x40(%rsp)
cvtsi2sdl 0xb8(%rdi), %xmm0
movsd %xmm0, 0x38(%rsp)
addq $0x28, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8ba0
movsd 0x38(%rsp), %xmm2
movsd 0x40(%rsp), %xmm0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
cvtsi2sdl (%rcx), %xmm1
movsd 0x78(%rax), %xmm3
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x4390
movq 0xe8(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
addq $0x238, %rdi            # imm = 0x238
movslq 0x100(%rsp), %rsi
callq 0x8c20
movsd 0x50(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x13c81
movq 0xe8(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
movslq 0x118(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x100(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
cvtsi2sdl (%rax), %xmm0
addsd 0x88(%rdi), %xmm0
movsd %xmm0, 0x28(%rsp)
addq $0x238, %rdi            # imm = 0x238
movslq 0x100(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
callq 0x4760
movq 0xe8(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
addq $0x260, %rdi            # imm = 0x260
movslq 0x100(%rsp), %rsi
callq 0x8c20
movsd 0x30(%rsp), %xmm0
movq 0xe8(%rsp), %rdi
movsd %xmm0, (%rax)
addq $0x260, %rdi            # imm = 0x260
movslq 0x100(%rsp), %rsi
callq 0x8c20
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movsd (%rcx), %xmm0
addsd 0x278(%rax), %xmm0
movsd %xmm0, 0x278(%rax)
movl 0x100(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x100(%rsp)
jmp 0x139d0
movq 0xe8(%rsp), %rax
movq %rax, %rdi
addq $0x260, %rdi            # imm = 0x260
movsd 0x278(%rax), %xmm0
callq 0x39240
movq 0xe8(%rsp), %rdi
movl %eax, 0x14(%rsp)
addq $0xf0, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x104(%rsp), %rsi
callq 0x8ba0
movl 0x14(%rsp), %ecx
movq 0xe8(%rsp), %rdi
movl %ecx, (%rax)
movq %rdi, %rax
addq $0x260, %rax            # imm = 0x260
movq %rax, 0x18(%rsp)
addq $0xf0, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x104(%rsp), %rsi
callq 0x8ba0
movq 0x18(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c20
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movsd (%rcx), %xmm0
divsd 0x278(%rax), %xmm0
callq 0x4390
movq 0xe8(%rsp), %rdi
addsd 0x130(%rsp), %xmm0
movsd %xmm0, 0x130(%rsp)
movq %rdi, %rax
addq $0x260, %rax            # imm = 0x260
movq %rax, 0x20(%rsp)
addq $0xf0, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x104(%rsp), %rsi
callq 0x8ba0
movq 0x20(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c20
movsd (%rax), %xmm0
callq 0x4390
movq 0xe8(%rsp), %rax
addsd 0x140(%rsp), %xmm0
movsd %xmm0, 0x140(%rsp)
cmpl $0x0, 0xb0(%rax)
je 0x14015
movq 0xe8(%rsp), %rdi
addq $0xf0, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x104(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x11c(%rsp)
addq $0x110, %rdi            # imm = 0x110
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movq 0xe8(%rsp), %rax
movl 0xb0(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x128, %rdi            # imm = 0x128
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x188, %rdi            # imm = 0x188
movslq 0x118(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x1a0, %rdi            # imm = 0x1A0
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x14017
movl 0x104(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x104(%rsp)
jmp 0x13939
jmp 0x1402f
movl 0x108(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x108(%rsp)
jmp 0x13916
movsd 0x140(%rsp), %xmm0
subsd 0x130(%rsp), %xmm0
movsd 0x148(%rsp), %xmm1
subsd 0x138(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x128(%rsp)
xorps %xmm0, %xmm0
movsd 0x4817f(%rip), %xmm1    # 0x5c200
callq 0x39150
movsd %xmm0, 0x120(%rsp)
movsd 0x120(%rsp), %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0x128(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x14243
movl $0x0, 0xfc(%rsp)
movq 0xe8(%rsp), %rcx
movl 0xfc(%rsp), %eax
cmpl 0x24(%rcx), %eax
jge 0x1423e
movl $0x0, 0xf8(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xf8(%rsp), %eax
movl %eax, 0x10(%rsp)
addq $0x40, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0x10(%rsp), %eax
cmpl (%rcx), %eax
jge 0x14226
movq 0xe8(%rsp), %rdi
movl 0x108(%rdi), %eax
addl $0x1, %eax
movl %eax, 0x108(%rdi)
addq $0xf0, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xfc(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf8(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0x8(%rsp)
movq %rax, %rdi
addq $0xc0, %rdi
movslq 0x108(%rax), %rsi
callq 0x8ba0
movl 0x8(%rsp), %ecx
movq 0xe8(%rsp), %rdi
movl %ecx, (%rax)
addq $0xf0, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xfc(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf8(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0xc(%rsp)
addq $0xd8, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xfc(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf8(%rsp), %rsi
callq 0x8ba0
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
movl 0xf8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf8(%rsp)
jmp 0x140e1
jmp 0x14228
movl 0xfc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xfc(%rsp)
jmp 0x140be
jmp 0x14592
movl $0x0, 0xf4(%rsp)
movq 0xe8(%rsp), %rcx
movl 0xf4(%rsp), %eax
cmpl 0x24(%rcx), %eax
jge 0x14590
movl $0x0, 0xf0(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xf0(%rsp), %eax
movl %eax, 0x4(%rsp)
addq $0x40, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0x4(%rsp), %eax
cmpl (%rcx), %eax
jge 0x14578
movq 0xe8(%rsp), %rdi
movl 0x108(%rdi), %eax
addl $0x1, %eax
movl %eax, 0x108(%rdi)
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xf4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf0(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movq 0xe8(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0xb0(%rax)
cmpl $0x0, 0xb0(%rax)
je 0x14560
movq 0xe8(%rsp), %rdi
addq $0xf0, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xf4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf0(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x11c(%rsp)
addq $0x110, %rdi            # imm = 0x110
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xf4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movq 0xe8(%rsp), %rax
movl 0xb0(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x128, %rdi            # imm = 0x128
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf4(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x188, %rdi            # imm = 0x188
movslq 0x118(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x1a0, %rdi            # imm = 0x1A0
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0xd8, %rdi
movslq 0x118(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xf4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf0(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x11c(%rsp)
addq $0x110, %rdi            # imm = 0x110
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0xf4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movq 0xe8(%rsp), %rax
movl 0xb0(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x128, %rdi            # imm = 0x128
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0xf4(%rsp), %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x188, %rdi            # imm = 0x188
movslq 0x118(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movl 0x11c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x1a0, %rdi            # imm = 0x1A0
movslq 0x118(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x14562
movl 0xf0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf0(%rsp)
jmp 0x14271
jmp 0x1457a
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf4(%rsp)
jmp 0x1424e
jmp 0x14592
jmp 0x14594
movl 0x118(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x118(%rsp)
jmp 0x13224
addq $0x158, %rsp            # imm = 0x158
retq
nopw %cs:(%rax,%rax)