// File: /workspace/github_cpp_makefile_star2_O1/bobverity[P]MavericK/EM_algorithm.cpp
// Function: EM_noAdmix(globals&, int)
void EM_noAdmix(globals &globals, int Kindex) {
    int K = globals.Kmin+Kindex;
    
    // create empty objects
    vector< vector<double> > logProbMat(globals.n,vector<double>(K));
    double logProbSum;
    vector< vector< vector<double> > > logAlleleFreqs(K);
    double logAlleleFreqsSum;
    double logLike=0;
    double logLike_this_i=0;
    double logLike_this_ik=0;
    
    // initialise logAlleleFreqs and zero global maximum likelihood allele frequencies
    globals.max_alleleFreqs = vector< vector< vector<double> > >(K);
    for (int k=0; k<K; k++) {
        logAlleleFreqs[k] = vector< vector<double> >(globals.loci);
        globals.max_alleleFreqs[k] = vector< vector<double> >(globals.loci);
        for (int l=0; l<globals.loci; l++) {
            logAlleleFreqs[k][l] = vector<double>(globals.J[l]);
            globals.max_alleleFreqs[k][l] = vector<double>(globals.J[l]);
        }
    }
    
    // repeat EM multiple times
    globals.maxLike = log(double(0));
    for (int EMrep=0; EMrep<globals.EMrepeats; EMrep++) {
        
        // initialise random allele frequencies
        for (int k=0; k<K; k++) {
            for (int l=0; l<globals.loci; l++) {
                logAlleleFreqsSum = log(double(0));
                for (int j=0; j<globals.J[l]; j++) {
                    logAlleleFreqs[k][l][j] = log(runif1(0.1,0.9));
                    logAlleleFreqsSum = logSum(logAlleleFreqsSum, logAlleleFreqs[k][l][j]);
                }
                for (int j=0; j<globals.J[l]; j++) {
                    logAlleleFreqs[k][l][j] -= logAlleleFreqsSum;
                }
            }
        }
        
        // EM iterations
        for (int EMiter=0; EMiter<globals.EMiterations; EMiter++) {
            
            // calculate assignment probability matrix
            for (int i=0; i<globals.n; i++) {
                logProbSum = log(double(0));
                for (int k=0; k<K; k++) {
                    logProbMat[i][k] = 0;
                    for (int l=0; l<globals.loci; l++) {
                        for (int p=0; p<globals.ploidy_vec[i]; p++) {
                            if (globals.data[i][l][p]!=0) {
                                logProbMat[i][k] += logAlleleFreqs[k][l][globals.data[i][l][p]-1];
                            }
                        }
                    }
                    logProbSum = logSum(logProbSum, logProbMat[i][k]);
                }
                for (int k=0; k<K; k++) {
                    logProbMat[i][k] -= logProbSum;
                }
            }
            
            // zero allele frequencies
            for (int k=0; k<K; k++) {
                for (int l=0; l<globals.loci; l++) {
                    for (int j=0; j<globals.J[l]; j++) {
                        logAlleleFreqs[k][l][j] = log(double(0));
                    }
                }
            }
            
            // add probability-weighted contribution to allele frequencies
            for (int i=0; i<globals.n; i++) {
                for (int l=0; l<globals.loci; l++) {
                    for (int p=0; p<globals.ploidy_vec[i]; p++) {
                        if (globals.data[i][l][p]!=0) {
                            for (int k=0; k<K; k++) {
                                logAlleleFreqs[k][l][globals.data[i][l][p]-1] = logSum(logAlleleFreqs[k][l][globals.data[i][l][p]-1], logProbMat[i][k]);
                            }
                        }
                    }
                }
            }
            
            // normalise allele frequencies
            for (int k=0; k<K; k++) {
                for (int l=0; l<globals.loci; l++) {
                    logAlleleFreqsSum = log(double(0));
                    for (int j=0; j<globals.J[l]; j++) {
                        // control for underflow
                        if (logAlleleFreqs[k][l][j] < -1e300)
                            logAlleleFreqs[k][l][j] = -1e300;
                        logAlleleFreqsSum = logSum(logAlleleFreqsSum, logAlleleFreqs[k][l][j]);
                    }
                    for (int j=0; j<globals.J[l]; j++) {
                        logAlleleFreqs[k][l][j] -= logAlleleFreqsSum;
                    }
                }
            }
            
        } // end of EM iterations loop
        
        // calculate log-likelihood
        logLike = 0;
        for (int i=0; i<globals.n; i++) {
            logLike_this_i = log(double(0));
            for (int k=0; k<K; k++) {
                logLike_this_ik = 0;
                for (int l=0; l<globals.loci; l++) {
                    for (int p=0; p<globals.ploidy_vec[i]; p++) {
                        if (globals.data[i][l][p]!=0) {
                            logLike_this_ik += logAlleleFreqs[k][l][globals.data[i][l][p]-1];
                        }
                    }
                }
                logLike_this_i = logSum(logLike_this_i, logLike_this_ik - log(double(K)));
            }
            logLike += logLike_this_i;
        }
        
        // replace current values if more likely
        if (logLike>globals.maxLike) {
            globals.maxLike = logLike;
            for (int k=0; k<K; k++) {
                for (int l=0; l<globals.loci; l++) {
                    for (int j=0; j<globals.J[l]; j++) {
                        globals.max_alleleFreqs[k][l][j] = exp(logAlleleFreqs[k][l][j]);
                    }
                }
            }
        }
        
    } // end of repeat EM loop
    
    // calculate model comparison statistics
    if (globals.outputComparisonStatistics_on) {
        
        int freeParameters = K*(sum(globals.J)-globals.loci);
        globals.AIC[Kindex] = 2*freeParameters - 2*globals.maxLike;
        globals.BIC[Kindex] = freeParameters*log(double(globals.n)) - 2*globals.maxLike;
        globals.DIC_Spiegelhalter[Kindex] = -4*globals.structure_loglike_mean[Kindex][0] + 2*globals.maxLike;
        globals.DIC_Gelman[Kindex] = -2*globals.structure_loglike_mean[Kindex][0] + 2*globals.structure_loglike_var[Kindex][0];
        
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbp
movslq 0x2bc8(%rdi), %rbx
movslq %esi, %rax
movq %rax, 0x88(%rsp)
addq %rax, %rbx
movslq 0x2d18(%rdi), %r15
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq %rbx, %rsi
callq 0x5916
leaq 0xa0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x60(%rsp), %rcx
movq %r15, %rsi
callq 0x59a0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3d47
callq 0x3310
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %rbx, %rsi
callq 0x5a30
leaq 0x60(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %rbx, %rsi
callq 0x5a30
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movupd 0x3048(%rbp), %xmm0
movq 0x3058(%rbp), %rax
leaq 0x60(%rsp), %r15
movaps (%r15), %xmm1
movups %xmm1, 0x3048(%rbp)
movq 0x10(%r15), %rcx
movq %rcx, 0x3058(%rbp)
movq 0x10(%rdi), %rcx
movq %rax, 0x10(%rdi)
movapd (%rdi), %xmm1
movapd %xmm0, (%rdi)
movapd %xmm1, (%r15)
movq %rcx, 0x10(%r15)
callq 0x5ab8
movq %r15, %rdi
callq 0x5ab8
movl %ebx, %r13d
movq %rbx, 0x38(%rsp)
testl %ebx, %ebx
movq %r13, 0x30(%rsp)
jle 0x4020
xorl %r12d, %r12d
leaq 0x60(%rsp), %r14
leaq 0x7(%rsp), %r15
leaq 0x10(%rsp), %rbx
movslq 0x2d1c(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x5af2
movq 0x40(%rsp), %rax
movq %r12, 0x8(%rsp)
leaq (%r12,%r12,2), %r12
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movups (%rax,%r12,8), %xmm0
movq 0x10(%rax,%r12,8), %rcx
movaps 0x60(%rsp), %xmm1
movups %xmm1, (%rax,%r12,8)
movq 0x70(%rsp), %rdx
movq %rdx, 0x10(%rax,%r12,8)
movq 0x20(%rsp), %rax
movq %rcx, 0x20(%rsp)
movaps 0x10(%rsp), %xmm1
movaps %xmm0, 0x10(%rsp)
movaps %xmm1, 0x60(%rsp)
movq %rax, 0x70(%rsp)
movq %rbx, %r13
movq %rbx, %rdi
callq 0x5b7a
movq %r14, %rdi
callq 0x5b7a
movslq 0x2d1c(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x5af2
movq 0x3048(%rbp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movupd (%rax,%r12,8), %xmm0
movq 0x10(%rax,%r12,8), %rcx
movaps 0x60(%rsp), %xmm1
movups %xmm1, (%rax,%r12,8)
movq 0x70(%rsp), %rdx
movq %rdx, 0x10(%rax,%r12,8)
movq 0x20(%rsp), %rax
movq %rcx, 0x20(%rsp)
movapd 0x10(%rsp), %xmm1
movapd %xmm0, 0x10(%rsp)
movapd %xmm1, 0x60(%rsp)
movq %rax, 0x70(%rsp)
movq %r13, %rdi
callq 0x5b7a
movq %r14, %rdi
callq 0x5b7a
cmpl $0x0, 0x2d1c(%rbp)
jle 0x4005
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x2d20(%rbp), %rax
movslq (%rax,%r15,4), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5916
movq 0x40(%rsp), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13), %rdi
movaps 0x10(%rsp), %xmm0
movups 0x8(%rax,%r13), %xmm1
movups %xmm0, (%rax,%r13)
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax,%r13)
movq %rdi, 0x10(%rsp)
movups %xmm1, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x3f66
callq 0x3310
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3f75
callq 0x3310
movq 0x2d20(%rbp), %rax
movslq (%rax,%r15,4), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5916
movq 0x3048(%rbp), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13), %rdi
movapd 0x10(%rsp), %xmm0
movupd 0x8(%rax,%r13), %xmm1
movupd %xmm0, (%rax,%r13)
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax,%r13)
movq %rdi, 0x10(%rsp)
movupd %xmm1, 0x18(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x3fdf
callq 0x3310
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3fee
callq 0x3310
incq %r15
movslq 0x2d1c(%rbp), %rax
addq $0x18, %r13
cmpq %rax, %r15
jl 0x3f04
movq 0x8(%rsp), %r12
incq %r12
movq 0x30(%rsp), %r13
cmpq %r13, %r12
leaq 0x7(%rsp), %r15
jne 0x3df5
xorpd %xmm0, %xmm0
callq 0x3290
movsd %xmm0, 0x3040(%rbp)
cmpl $0x0, 0x2c34(%rbp)
movq 0x38(%rsp), %rdi
jle 0x4740
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
movsd %xmm0, 0x98(%rsp)
xorl %eax, %eax
movq %rax, 0x90(%rsp)
testl %edi, %edi
jle 0x4149
xorl %r14d, %r14d
cmpl $0x0, 0x2d1c(%rbp)
jle 0x4138
leaq (%r14,%r14,2), %r13
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
callq 0x3290
movsd %xmm0, 0x8(%rsp)
movq 0x2d20(%rbp), %rax
movl (%rax,%r15,4), %eax
leaq (%r15,%r15,2), %r12
testl %eax, %eax
jle 0x40f4
xorl %ebx, %ebx
movsd 0x32f60(%rip), %xmm0    # 0x37008
movsd 0x32f60(%rip), %xmm1    # 0x37010
callq 0x1d4cc
callq 0x3290
movapd %xmm0, %xmm1
movq 0x40(%rsp), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%r12,8), %rax
movsd %xmm0, (%rax,%rbx,8)
movsd 0x8(%rsp), %xmm0
callq 0x1aa59
movsd %xmm0, 0x8(%rsp)
incq %rbx
movq 0x2d20(%rbp), %rax
movslq (%rax,%r15,4), %rax
cmpq %rax, %rbx
jl 0x40a0
testl %eax, %eax
movsd 0x8(%rsp), %xmm1
jle 0x4125
movq 0x40(%rsp), %rcx
movq (%rcx,%r13,8), %rcx
movq (%rcx,%r12,8), %rcx
movl %eax, %eax
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x410f
incq %r15
movslq 0x2d1c(%rbp), %rax
cmpq %rax, %r15
jl 0x407c
incq %r14
movq 0x30(%rsp), %r13
cmpq %r13, %r14
jne 0x4068
cmpl $0x0, 0x2c38(%rbp)
movq 0x38(%rsp), %r12
jle 0x4550
xorl %eax, %eax
movl %eax, 0x58(%rsp)
cmpl $0x0, 0x2d18(%rbp)
jle 0x4279
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
callq 0x3290
testl %r12d, %r12d
jle 0x4234
xorl %r13d, %r13d
movq 0xa0(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, (%rax,%r13,8)
movslq 0x2d1c(%rbp), %rdx
testq %rdx, %rdx
jle 0x421b
movq 0x2cd0(%rbp), %rsi
movl (%rsi,%r15,4), %esi
shlq $0x3, %rcx
addq 0x2d00(%rbp), %rcx
xorl %edi, %edi
testl %esi, %esi
jle 0x4213
movq (%rcx), %r9
leaq (%rdi,%rdi,2), %r8
movq (%r9,%r8,8), %r9
leaq (,%r13,2), %r10
addq %r13, %r10
shlq $0x3, %r10
addq 0x40(%rsp), %r10
xorl %r11d, %r11d
movslq (%r9,%r11,4), %rbx
testq %rbx, %rbx
je 0x420b
movq (%r10), %r14
movq (%r14,%r8,8), %r14
movsd -0x8(%r14,%rbx,8), %xmm1
addsd (%rax,%r13,8), %xmm1
movsd %xmm1, (%rax,%r13,8)
incq %r11
cmpq %r11, %rsi
jne 0x41e8
incq %rdi
cmpq %rdx, %rdi
jne 0x41c2
movsd (%rax,%r13,8), %xmm1
callq 0x1aa59
incq %r13
cmpq 0x30(%rsp), %r13
jne 0x4186
testl %r12d, %r12d
movq 0x30(%rsp), %r13
jle 0x4266
movq 0xa0(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x4250
incq %r15
movslq 0x2d18(%rbp), %rax
cmpq %rax, %r15
jl 0x4171
testl %r12d, %r12d
jle 0x42ea
xorl %r14d, %r14d
cmpl $0x0, 0x2d1c(%rbp)
jle 0x42e2
xorl %ebx, %ebx
movq 0x2d20(%rbp), %rax
cmpl $0x0, (%rax,%rbx,4)
jle 0x42d3
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
callq 0x3290
movq 0x40(%rsp), %rax
leaq (%r14,%r14,2), %rcx
movq (%rax,%rcx,8), %rax
leaq (%rbx,%rbx,2), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movq 0x2d20(%rbp), %rax
movslq (%rax,%rbx,4), %rax
cmpq %rax, %r15
jl 0x429c
incq %rbx
movslq 0x2d1c(%rbp), %rax
cmpq %rax, %rbx
jl 0x428c
incq %r14
cmpq %r13, %r14
jne 0x4281
cmpl $0x0, 0x2d18(%rbp)
jle 0x444d
xorl %edx, %edx
cmpl $0x0, 0x2d1c(%rbp)
jle 0x443a
movq $0x0, 0x8(%rsp)
movq 0x2cd0(%rbp), %rax
cmpl $0x0, (%rax,%rdx,4)
jle 0x441d
xorl %r12d, %r12d
movq 0x2d00(%rbp), %rax
leaq (%rdx,%rdx,2), %rcx
movq %rcx, 0x80(%rsp)
movq (%rax,%rcx,8), %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, (%rax,%r12,4)
movq %rbp, %r13
je 0x4403
cmpl $0x0, 0x38(%rsp)
jle 0x4403
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x40(%rsp), %rax
movq (%rax,%rbp), %rax
movq 0x8(%rsp), %rcx
leaq (,%rcx,8), %rcx
leaq (%rcx,%rcx,2), %r15
movq 0x2d00(%r13), %rcx
movq %rdx, %r14
leaq (,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
movq (%rcx,%rdx), %rcx
movq (%rcx,%r15), %rcx
movslq (%rcx,%r12,4), %rcx
movq (%rax,%r15), %rax
movsd -0x8(%rax,%rcx,8), %xmm0
movq 0xa0(%rsp), %rax
movq (%rax,%rdx), %rax
movsd (%rax,%rbx,8), %xmm1
callq 0x1aa59
movq 0x40(%rsp), %rax
movq (%rax,%rbp), %rax
movq 0x2d00(%r13), %rcx
movq 0x80(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx,%r15), %rcx
movslq (%rcx,%r12,4), %rcx
movq (%rax,%r15), %rax
movsd %xmm0, -0x8(%rax,%rcx,8)
incq %rbx
addq $0x18, %rbp
cmpq %rbx, 0x30(%rsp)
movq %r14, %rdx
jne 0x4364
incq %r12
movq 0x2cd0(%r13), %rax
movslq (%rax,%rdx,4), %rax
cmpq %rax, %r12
movq %r13, %rbp
jl 0x4323
movq 0x8(%rsp), %rsi
incq %rsi
movslq 0x2d1c(%rbp), %rax
movq %rsi, 0x8(%rsp)
cmpq %rax, %rsi
jl 0x430f
incq %rdx
movslq 0x2d18(%rbp), %rax
cmpq %rax, %rdx
jl 0x42f9
movq 0x38(%rsp), %r12
testl %r12d, %r12d
jle 0x4539
xorl %r15d, %r15d
cmpl $0x0, 0x2d1c(%rbp)
jle 0x452b
xorl %r13d, %r13d
xorpd %xmm0, %xmm0
callq 0x3290
movq 0x2d20(%rbp), %rax
movl (%rax,%r13,4), %eax
testl %eax, %eax
jle 0x44de
xorl %ebx, %ebx
movq 0x40(%rsp), %rax
leaq (%r15,%r15,2), %rcx
movq (%rax,%rcx,8), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
movq (%rax,%rcx,8), %rax
movsd 0x32b6c(%rip), %xmm1    # 0x37018
ucomisd (%rax,%rbx,8), %xmm1
jbe 0x44c1
movabsq $-0x1c81bc377ff8a64, %rcx # imm = 0xFE37E43C8800759C
movq %rcx, (%rax,%rbx,8)
movsd (%rax,%rbx,8), %xmm1
callq 0x1aa59
incq %rbx
movq 0x2d20(%rbp), %rax
movslq (%rax,%r13,4), %rax
cmpq %rax, %rbx
jl 0x4488
testl %eax, %eax
jle 0x4518
movq 0x40(%rsp), %rcx
leaq (%r15,%r15,2), %rdx
movq (%rcx,%rdx,8), %rcx
leaq (,%r13,2), %rdx
addq %r13, %rdx
movq (%rcx,%rdx,8), %rcx
movl %eax, %eax
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x4502
incq %r13
movslq 0x2d1c(%rbp), %rax
cmpq %rax, %r13
jl 0x446e
incq %r15
cmpq 0x30(%rsp), %r15
jne 0x445e
movl 0x58(%rsp), %eax
incl %eax
cmpl 0x2c38(%rbp), %eax
movq 0x30(%rsp), %r13
jl 0x415d
cmpl $0x0, 0x2d18(%rbp)
jle 0x4668
xorpd %xmm1, %xmm1
xorl %r13d, %r13d
movsd %xmm1, 0x58(%rsp)
xorpd %xmm0, %xmm0
callq 0x3290
testl %r12d, %r12d
jle 0x4649
xorl %r15d, %r15d
movslq 0x2d1c(%rbp), %rax
testq %rax, %rax
movsd %xmm0, 0x8(%rsp)
jle 0x4600
movq 0x2cd0(%rbp), %rcx
movl (%rcx,%r13,4), %ecx
leaq (,%r13,2), %rdx
addq %r13, %rdx
shlq $0x3, %rdx
addq 0x2d00(%rbp), %rdx
leaq (%r15,%r15,2), %rsi
shlq $0x3, %rsi
addq 0x40(%rsp), %rsi
xorpd %xmm0, %xmm0
xorl %edi, %edi
testl %ecx, %ecx
jle 0x45f6
movq (%rdx), %r9
leaq (%rdi,%rdi,2), %r8
movq (%r9,%r8,8), %r9
xorl %r10d, %r10d
movslq (%r9,%r10,4), %r11
testq %r11, %r11
je 0x45ee
movq (%rsi), %rbx
movq (%rbx,%r8,8), %rbx
addsd -0x8(%rbx,%r11,8), %xmm0
incq %r10
cmpq %r10, %rcx
jne 0x45d7
incq %rdi
cmpq %rax, %rdi
jne 0x45c5
jmp 0x4604
xorpd %xmm0, %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x98(%rsp), %xmm0
callq 0x3290
movsd 0x80(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x1aa59
incq %r15
cmpq 0x30(%rsp), %r15
movsd 0x58(%rsp), %xmm1
jne 0x457f
jmp 0x464f
movsd 0x58(%rsp), %xmm1
addsd %xmm0, %xmm1
incq %r13
movslq 0x2d18(%rbp), %rax
cmpq %rax, %r13
jl 0x4564
jmp 0x466c
xorpd %xmm1, %xmm1
ucomisd 0x3040(%rbp), %xmm1
jbe 0x4720
movsd %xmm1, 0x3040(%rbp)
cmpl $0x0, 0x38(%rsp)
jle 0x4720
xorl %r14d, %r14d
cmpl $0x0, 0x2d1c(%rbp)
jle 0x4712
xorl %ebx, %ebx
movq 0x2d20(%rbp), %rax
cmpl $0x0, (%rax,%rbx,4)
jle 0x4703
xorl %r15d, %r15d
movq 0x40(%rsp), %rax
leaq (,%r14,8), %rcx
leaq (%rcx,%rcx,2), %r12
movq (%rax,%r12), %rax
leaq (,%rbx,8), %rcx
leaq (%rcx,%rcx,2), %r13
movq (%rax,%r13), %rax
movsd (%rax,%r15,8), %xmm0
callq 0x35a0
movq 0x3048(%rbp), %rax
movq (%rax,%r12), %rax
movq (%rax,%r13), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movq 0x2d20(%rbp), %rax
movslq (%rax,%rbx,4), %rax
cmpq %rax, %r15
jl 0x46ab
incq %rbx
movslq 0x2d1c(%rbp), %rax
cmpq %rax, %rbx
jl 0x469b
incq %r14
cmpq 0x30(%rsp), %r14
jne 0x4690
movq 0x90(%rsp), %rax
incl %eax
cmpl 0x2c34(%rbp), %eax
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %r13
jl 0x4055
cmpb $0x0, 0x2c49(%rbp)
je 0x486b
movq 0x2d20(%rbp), %rcx
movq 0x2d28(%rbp), %rdx
subq %rcx, %rdx
shrq $0x2, %rdx
testl %edx, %edx
jle 0x4785
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %esi, %esi
xorl %eax, %eax
movq 0x88(%rsp), %r14
addl (%rcx,%rsi,4), %eax
incq %rsi
cmpq %rsi, %rdx
jne 0x4778
jmp 0x478f
xorl %eax, %eax
movq 0x88(%rsp), %r14
subl 0x2d1c(%rbp), %eax
imull %edi, %eax
leal (%rax,%rax), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd 0x3040(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movq 0x3078(%rbp), %rcx
leaq (,%r14,8), %rbx
movsd %xmm0, (%rcx,%r14,8)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x2d18(%rbp), %xmm0
callq 0x3290
movsd 0x3040(%rbp), %xmm1
mulsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movq 0x3090(%rbp), %rax
movsd %xmm0, (%rax,%r14,8)
movq 0x2e60(%rbp), %rax
leaq (%rbx,%rbx,2), %rcx
movq (%rax,%rcx), %rax
movsd (%rax), %xmm0
movsd 0x3040(%rbp), %xmm1
addsd %xmm1, %xmm1
mulsd 0x327f2(%rip), %xmm0    # 0x37020
addsd %xmm1, %xmm0
movq 0x30a8(%rbp), %rdx
movsd %xmm0, (%rdx,%r14,8)
movsd (%rax), %xmm0
movq 0x2e78(%rbp), %rax
movq (%rax,%rcx), %rax
movsd (%rax), %xmm1
addsd %xmm1, %xmm1
addsd %xmm0, %xmm0
subsd %xmm0, %xmm1
movq 0x30c0(%rbp), %rax
movsd %xmm1, (%rax,%r14,8)
leaq 0x40(%rsp), %rdi
callq 0x5ab8
leaq 0xa0(%rsp), %rdi
callq 0x5b7a
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x48c4
movq %rax, %rbx
jmp 0x48d1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x48de
callq 0x3310
jmp 0x48de
movq %rax, %rbx
jmp 0x48de
jmp 0x48c4
jmp 0x48c4
jmp 0x48c4
jmp 0x48c4
jmp 0x48c4
jmp 0x48c4
jmp 0x48c4
jmp 0x48c4
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x5ab8
leaq 0xa0(%rsp), %rdi
callq 0x5b7a
movq %rbx, %rdi
callq 0x3580