// File: bobverity[P]MavericK/mainMCMC.cpp
// Function: mainMCMC_admixture(globals&, int)
void mainMCMC_admixture(globals &globals, int Kindex) {
    int K = globals.Kmin+Kindex;
    
    // define temporary Qmatrix objects for calculating mean and sd over mainRepeats
    vector< vector< vector<double> > > Qmatrix_gene_allReps(globals.geneCopies, vector< vector<double> >(K, vector<double>(globals.mainRepeats)));
    vector< vector< vector<double> > > Qmatrix_ind_allReps(globals.n, vector< vector<double> >(K, vector<double>(globals.mainRepeats)));
    vector< vector< vector<double> > > Qmatrix_pop_allReps(globals.uniquePops.size(), vector< vector<double> >(K, vector<double>(globals.mainRepeats)));
    
    // define MCMC object
    MCMCobject_admixture mainMCMC(globals, Kindex, globals.mainBurnin, globals.mainSamples, globals.mainThinning, 1.0);
    
    // repeat analysis multiple times
    for (int mainRep=0; mainRep<globals.mainRepeats; mainRep++) {
        coutAndLog("  analysis "+to_string((long long)mainRep+1)+" of "+to_string((long long)globals.mainRepeats)+"\n", globals.outputLog_on, globals.outputLog_fileStream);
        
        // perform MCMC
        if (mainRep==0) {
            mainMCMC.reset(true);
        } else {
            mainMCMC.reset(false);
        }
		mainMCMC.perform_MCMC(globals, true, false, globals.fixLabels_on, globals.outputLikelihood_on, globals.outputPosteriorGrouping_on, mainRep);
        
        // save Qmatrix values
        if (globals.fixLabels_on) {
            for (int i=0; i<globals.geneCopies; i++) {
                for (int k=0; k<K; k++) {
                    Qmatrix_gene_allReps[i][k][mainRep] = mainMCMC.Qmatrix_gene[i][k];
                    /*
                    if (k!=0)
                        globals.junk_fileStream << "\t";
                    globals.junk_fileStream << mainMCMC.Qmatrix_gene[i][k];
                    */
                }
                //globals.junk_fileStream << "\n";
            }
            for (int i=0; i<globals.n; i++) {
                for (int k=0; k<K; k++) {
                    Qmatrix_ind_allReps[i][k][mainRep] = mainMCMC.Qmatrix_ind[i][k];
                }
            }
            if (globals.outputQmatrix_pop_on) {
                for (int i=0; i<int(globals.uniquePops.size()); i++) {
                    for (int k=0; k<K; k++) {
                        Qmatrix_pop_allReps[i][k][mainRep] = mainMCMC.Qmatrix_pop[i][k];
                    }
                }
            }
        }
        
        // save harmonic mean of marginal likelihoods
        globals.logEvidence_harmonic[Kindex][mainRep] = mainMCMC.harmonic;
        
        // calculate Structure estimator from joint likelihoods
        globals.structure_loglike_mean[Kindex][mainRep] = mainMCMC.logLikeJoint_sum/double(globals.mainSamples);
        globals.structure_loglike_var[Kindex][mainRep] = mainMCMC.logLikeJoint_sumSquared/double(globals.mainSamples) - globals.structure_loglike_mean[Kindex][mainRep]*globals.structure_loglike_mean[Kindex][mainRep];
        globals.logEvidence_structure[Kindex][mainRep] = globals.structure_loglike_mean[Kindex][mainRep] - 0.5*globals.structure_loglike_var[Kindex][mainRep];
        
        // calculate elements of Evanno's delta K for the *previous* iteration
        if (Kindex>0)
            globals.L_1[Kindex][mainRep] = globals.logEvidence_structure[Kindex][mainRep]-globals.logEvidence_structure[Kindex-1][mainRep];
        if (Kindex>1) {
            globals.L_2[Kindex-1][mainRep] = abs(globals.L_1[Kindex][mainRep]-globals.L_1[Kindex-1][mainRep]);
        }
        
    }
    
    // save Qmatrices
    if (globals.fixLabels_on) {
        for (int i=0; i<globals.geneCopies; i++) {
            for (int k=0; k<K; k++) {
                globals.Qmatrix_gene[Kindex][i][k] = mean(Qmatrix_gene_allReps[i][k]);
                globals.QmatrixError_gene[Kindex][i][k] = sqrt(var(Qmatrix_gene_allReps[i][k])/double(globals.mainRepeats));
            }
        }
        for (int i=0; i<globals.n; i++) {
            for (int k=0; k<K; k++) {
                globals.Qmatrix_ind[Kindex][i][k] = mean(Qmatrix_ind_allReps[i][k]);
                globals.QmatrixError_ind[Kindex][i][k] = sqrt(var(Qmatrix_ind_allReps[i][k]));
            }
        }
        if (globals.outputQmatrix_pop_on) {
            for (int i=0; i<int(globals.uniquePops.size()); i++) {
                for (int k=0; k<K; k++) {
                    globals.Qmatrix_pop[Kindex][i][k] = mean(Qmatrix_pop_allReps[i][k]);
                    globals.QmatrixError_pop[Kindex][i][k] = sqrt(var(Qmatrix_pop_allReps[i][k]));
                }
            }
        }
    }
    
    // calculate grand mean and standard error of harmonic mean estimator
    globals.logEvidence_harmonic_grandMean[Kindex] = mean(globals.logEvidence_harmonic[Kindex]);
    if (globals.mainRepeats>1) {
        globals.logEvidence_harmonic_grandSE[Kindex] = sqrt(var(globals.logEvidence_harmonic[Kindex], 0, true)/globals.mainRepeats);
    }
    
    // calculate grand mean and standard error of Structure estimator
    globals.logEvidence_structure_grandMean[Kindex] = mean(globals.logEvidence_structure[Kindex]);
    if (globals.mainRepeats>1) {
        globals.logEvidence_structure_grandSE[Kindex] = sqrt(var(globals.logEvidence_structure[Kindex], 0, true)/globals.mainRepeats);
    }
    
    // finalise calculation of Evanno's delta K for *previous* iteration
    if (Kindex>1) {
        globals.delta_K[Kindex-1] = mean(globals.L_2[Kindex-1])/sqrt(var(globals.logEvidence_structure[Kindex-1], 0, true));
    }
    
}

// Assembly:
subq $0x7a8, %rsp            # imm = 0x7A8
movq %rdi, 0x7a0(%rsp)
movl %esi, 0x79c(%rsp)
movq 0x7a0(%rsp), %rax
movl 0x2bc8(%rax), %eax
movl 0x79c(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x798(%rsp)
movq 0x7a0(%rsp), %rax
movslq 0x2d50(%rax), %rcx
movq %rcx, 0x198(%rsp)
movslq 0x798(%rsp), %rcx
movq %rcx, 0x1a0(%rsp)
movslq 0x2c0c(%rax), %rax
movq %rax, 0x1a8(%rsp)
leaq 0x74f(%rsp), %rdi
movq %rdi, 0x1b0(%rsp)
callq 0x8780
movq 0x1a8(%rsp), %rsi
movq 0x1b0(%rsp), %rdx
leaq 0x750(%rsp), %rdi
callq 0x8790
jmp 0x31bde
leaq 0x73b(%rsp), %rdi
movq %rdi, 0x190(%rsp)
callq 0x8810
movq 0x1a0(%rsp), %rsi
movq 0x190(%rsp), %rcx
leaq 0x768(%rsp), %rdi
leaq 0x750(%rsp), %rdx
callq 0x8820
jmp 0x31c1a
leaq 0x73a(%rsp), %rdi
movq %rdi, 0x188(%rsp)
callq 0x8920
movq 0x198(%rsp), %rsi
movq 0x188(%rsp), %rcx
leaq 0x780(%rsp), %rdi
leaq 0x768(%rsp), %rdx
callq 0x332e0
jmp 0x31c56
leaq 0x73a(%rsp), %rdi
callq 0x89b0
leaq 0x768(%rsp), %rdi
callq 0x8b40
leaq 0x73b(%rsp), %rdi
callq 0x88a0
leaq 0x750(%rsp), %rdi
callq 0x88b0
leaq 0x74f(%rsp), %rdi
callq 0x8910
movq 0x7a0(%rsp), %rax
movslq 0x2d18(%rax), %rcx
movq %rcx, 0x168(%rsp)
movslq 0x798(%rsp), %rcx
movq %rcx, 0x170(%rsp)
movslq 0x2c0c(%rax), %rax
movq %rax, 0x178(%rsp)
leaq 0x6ef(%rsp), %rdi
movq %rdi, 0x180(%rsp)
callq 0x8780
movq 0x178(%rsp), %rsi
movq 0x180(%rsp), %rdx
leaq 0x6f0(%rsp), %rdi
callq 0x8790
jmp 0x31d01
leaq 0x6ee(%rsp), %rdi
movq %rdi, 0x160(%rsp)
callq 0x8810
movq 0x170(%rsp), %rsi
movq 0x160(%rsp), %rcx
leaq 0x708(%rsp), %rdi
leaq 0x6f0(%rsp), %rdx
callq 0x8820
jmp 0x31d3d
leaq 0x6ed(%rsp), %rdi
movq %rdi, 0x158(%rsp)
callq 0x8920
movq 0x168(%rsp), %rsi
movq 0x158(%rsp), %rcx
leaq 0x720(%rsp), %rdi
leaq 0x708(%rsp), %rdx
callq 0x332e0
jmp 0x31d79
leaq 0x6ed(%rsp), %rdi
callq 0x89b0
leaq 0x708(%rsp), %rdi
callq 0x8b40
leaq 0x6ee(%rsp), %rdi
callq 0x88a0
leaq 0x6f0(%rsp), %rdi
callq 0x88b0
leaq 0x6ef(%rsp), %rdi
callq 0x8910
movq 0x7a0(%rsp), %rdi
addq $0x2c88, %rdi           # imm = 0x2C88
callq 0x16bb0
movq %rax, 0x138(%rsp)
movslq 0x798(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x7a0(%rsp), %rax
movslq 0x2c0c(%rax), %rax
movq %rax, 0x148(%rsp)
leaq 0x69f(%rsp), %rdi
movq %rdi, 0x150(%rsp)
callq 0x8780
movq 0x148(%rsp), %rsi
movq 0x150(%rsp), %rdx
leaq 0x6a0(%rsp), %rdi
callq 0x8790
jmp 0x31e31
leaq 0x69e(%rsp), %rdi
movq %rdi, 0x130(%rsp)
callq 0x8810
movq 0x140(%rsp), %rsi
movq 0x130(%rsp), %rcx
leaq 0x6b8(%rsp), %rdi
leaq 0x6a0(%rsp), %rdx
callq 0x8820
jmp 0x31e6d
leaq 0x69d(%rsp), %rdi
movq %rdi, 0x128(%rsp)
callq 0x8920
movq 0x138(%rsp), %rsi
movq 0x128(%rsp), %rcx
leaq 0x6d0(%rsp), %rdi
leaq 0x6b8(%rsp), %rdx
callq 0x332e0
jmp 0x31ea9
leaq 0x69d(%rsp), %rdi
callq 0x89b0
leaq 0x6b8(%rsp), %rdi
callq 0x8b40
leaq 0x69e(%rsp), %rdi
callq 0x88a0
leaq 0x6a0(%rsp), %rdi
callq 0x88b0
leaq 0x69f(%rsp), %rdi
callq 0x8910
movq 0x7a0(%rsp), %rsi
movl 0x79c(%rsp), %edx
movl 0x2c10(%rsi), %ecx
movl 0x2c14(%rsi), %r8d
movl 0x2c18(%rsi), %r9d
leaq 0x2b0(%rsp), %rdi
movsd 0x2a2e3(%rip), %xmm0    # 0x5c200
callq 0xe460
jmp 0x31f24
movl $0x0, 0x2ac(%rsp)
movl 0x2ac(%rsp), %eax
movq 0x7a0(%rsp), %rcx
cmpl 0x2c0c(%rcx), %eax
jge 0x32ad2
movslq 0x2ac(%rsp), %rsi
incq %rsi
leaq 0x208(%rsp), %rdi
callq 0xcb30
jmp 0x31f64
leaq 0x2ab95(%rip), %rsi     # 0x5cb00
leaq 0x228(%rsp), %rdi
leaq 0x208(%rsp), %rdx
callq 0xcae0
jmp 0x31f82
leaq 0x2ab83(%rip), %rdx     # 0x5cb0c
leaq 0x248(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x22900
jmp 0x31fa0
movq 0x7a0(%rsp), %rax
movslq 0x2c0c(%rax), %rsi
leaq 0x1e8(%rsp), %rdi
callq 0xcb30
jmp 0x31fbe
leaq 0x268(%rsp), %rdi
leaq 0x248(%rsp), %rsi
leaq 0x1e8(%rsp), %rdx
callq 0xc9f0
jmp 0x31fdd
leaq 0x2a8ae(%rip), %rdx     # 0x5c892
leaq 0x288(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0x22900
jmp 0x31ffb
movq 0x7a0(%rsp), %rax
movq %rax, %rdx
addq $0x970, %rdx            # imm = 0x970
movzbl 0x2c3c(%rax), %esi
andl $0x1, %esi
leaq 0x288(%rsp), %rdi
callq 0x3a160
jmp 0x32026
leaq 0x288(%rsp), %rdi
callq 0x4270
leaq 0x268(%rsp), %rdi
callq 0x4270
leaq 0x1e8(%rsp), %rdi
callq 0x4270
leaq 0x248(%rsp), %rdi
callq 0x4270
leaq 0x228(%rsp), %rdi
callq 0x4270
leaq 0x208(%rsp), %rdi
callq 0x4270
cmpl $0x0, 0x2ac(%rsp)
jne 0x3233a
leaq 0x2b0(%rsp), %rdi
movl $0x1, %esi
callq 0x10860
jmp 0x32096
jmp 0x3234d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x3210f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x320f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
leaq 0x73a(%rsp), %rdi
callq 0x89b0
leaq 0x768(%rsp), %rdi
callq 0x8b40
leaq 0x73b(%rsp), %rdi
callq 0x88a0
leaq 0x750(%rsp), %rdi
callq 0x88b0
leaq 0x74f(%rsp), %rdi
callq 0x8910
jmp 0x332c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x32195
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x3217b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
leaq 0x6ed(%rsp), %rdi
callq 0x89b0
leaq 0x708(%rsp), %rdi
callq 0x8b40
leaq 0x6ee(%rsp), %rdi
callq 0x88a0
leaq 0x6f0(%rsp), %rdi
callq 0x88b0
leaq 0x6ef(%rsp), %rdi
callq 0x8910
jmp 0x332b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x3221b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x32201
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
leaq 0x69d(%rsp), %rdi
callq 0x89b0
leaq 0x6b8(%rsp), %rdi
callq 0x8b40
leaq 0x69e(%rsp), %rdi
callq 0x88a0
leaq 0x6a0(%rsp), %rdi
callq 0x88b0
leaq 0x69f(%rsp), %rdi
callq 0x8910
jmp 0x332aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x3329d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x33290
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x32328
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x3231b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x3230e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x32301
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
jmp 0x322f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x740(%rsp)
movl %eax, 0x73c(%rsp)
leaq 0x288(%rsp), %rdi
callq 0x4270
leaq 0x268(%rsp), %rdi
callq 0x4270
leaq 0x1e8(%rsp), %rdi
callq 0x4270
leaq 0x248(%rsp), %rdi
callq 0x4270
leaq 0x228(%rsp), %rdi
callq 0x4270
leaq 0x208(%rsp), %rdi
callq 0x4270
jmp 0x33290
leaq 0x2b0(%rsp), %rdi
xorl %esi, %esi
callq 0x10860
jmp 0x3234b
jmp 0x3234d
movq 0x7a0(%rsp), %rsi
movl 0x2ac(%rsp), %edx
movzbl 0x2c3d(%rsi), %r9d
movzbl 0x2c4f(%rsi), %r8d
movzbl 0x2c48(%rsi), %ecx
movq %rsp, %rax
movl %edx, 0x8(%rax)
andl $0x1, %ecx
movl %ecx, (%rax)
andl $0x1, %r8d
andl $0x1, %r9d
leaq 0x2b0(%rsp), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x11ca0
jmp 0x3239c
movq 0x7a0(%rsp), %rax
testb $0x1, 0x2c4f(%rax)
je 0x326ad
movl $0x0, 0x1e4(%rsp)
movl 0x1e4(%rsp), %eax
movq 0x7a0(%rsp), %rcx
cmpl 0x2d50(%rcx), %eax
jge 0x3249f
movl $0x0, 0x1e0(%rsp)
movl 0x1e0(%rsp), %eax
cmpl 0x798(%rsp), %eax
jge 0x32487
leaq 0x2b0(%rsp), %rdi
addq $0x2f8, %rdi            # imm = 0x2F8
movslq 0x1e4(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1e0(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0x120(%rsp)
movslq 0x1e4(%rsp), %rsi
leaq 0x780(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1e0(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0x120(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x1e0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e0(%rsp)
jmp 0x323e2
jmp 0x32489
movl 0x1e4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e4(%rsp)
jmp 0x323bc
movl $0x0, 0x1dc(%rsp)
movl 0x1dc(%rsp), %eax
movq 0x7a0(%rsp), %rcx
cmpl 0x2d18(%rcx), %eax
jge 0x3258d
movl $0x0, 0x1d8(%rsp)
movl 0x1d8(%rsp), %eax
cmpl 0x798(%rsp), %eax
jge 0x32575
leaq 0x2b0(%rsp), %rdi
addq $0x310, %rdi            # imm = 0x310
movslq 0x1dc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1d8(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0x118(%rsp)
movslq 0x1dc(%rsp), %rsi
leaq 0x720(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1d8(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0x118(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x1d8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d8(%rsp)
jmp 0x324d0
jmp 0x32577
movl 0x1dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1dc(%rsp)
jmp 0x324aa
movq 0x7a0(%rsp), %rax
testb $0x1, 0x2c3f(%rax)
je 0x326ab
movl $0x0, 0x1d4(%rsp)
movl 0x1d4(%rsp), %eax
movl %eax, 0x114(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2c88, %rdi           # imm = 0x2C88
callq 0x16bb0
movq %rax, %rcx
movl 0x114(%rsp), %eax
cmpl %ecx, %eax
jge 0x326a9
movl $0x0, 0x1d0(%rsp)
movl 0x1d0(%rsp), %eax
cmpl 0x798(%rsp), %eax
jge 0x32691
leaq 0x2b0(%rsp), %rdi
addq $0x328, %rdi            # imm = 0x328
movslq 0x1d4(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0x108(%rsp)
movslq 0x1d4(%rsp), %rsi
leaq 0x6d0(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0x108(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x1d0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d0(%rsp)
jmp 0x325ec
jmp 0x32693
movl 0x1d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d4(%rsp)
jmp 0x325ad
jmp 0x326ab
jmp 0x326ad
movsd 0x4e0(%rsp), %xmm0
movsd %xmm0, 0xd0(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e18, %rdi           # imm = 0x2E18
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x4d0(%rsp), %xmm0
movq 0x7a0(%rsp), %rax
cvtsi2sdl 0x2c14(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xd8(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e60, %rdi           # imm = 0x2E60
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x4d8(%rsp), %xmm0
movq 0x7a0(%rsp), %rax
cvtsi2sdl 0x2c14(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xe8(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e60, %rdi           # imm = 0x2E60
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0xe0(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e60, %rdi           # imm = 0x2E60
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xe0(%rsp), %xmm0
movsd 0xe8(%rsp), %xmm1
movsd (%rax), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xf0(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e78, %rdi           # imm = 0x2E78
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xf0(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x7a0(%rsp), %rdi
addq $0x2e60, %rdi           # imm = 0x2E60
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0xf8(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e78, %rdi           # imm = 0x2E78
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xf8(%rsp), %xmm1
movsd (%rax), %xmm0
movsd 0x2a1f5(%rip), %xmm2    # 0x5cac8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x100(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e90, %rdi           # imm = 0x2E90
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0x100(%rsp), %xmm0
movsd %xmm0, (%rax)
cmpl $0x0, 0x79c(%rsp)
jle 0x329e4
movq 0x7a0(%rsp), %rdi
addq $0x2e90, %rdi           # imm = 0x2E90
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0xc0(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e90, %rdi           # imm = 0x2E90
movl 0x79c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xc0(%rsp), %xmm0
subsd (%rax), %xmm0
movsd %xmm0, 0xc8(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x30d8, %rdi           # imm = 0x30D8
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xc8(%rsp), %xmm0
movsd %xmm0, (%rax)
cmpl $0x1, 0x79c(%rsp)
jle 0x32aba
movq 0x7a0(%rsp), %rdi
addq $0x30d8, %rdi           # imm = 0x30D8
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0xb0(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x30d8, %rdi           # imm = 0x30D8
movl 0x79c(%rsp), %eax
decl %eax
movslq %eax, %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xb0(%rsp), %xmm0
movsd (%rax), %xmm1
subsd %xmm1, %xmm0
callq 0x33360
movsd %xmm0, 0xb8(%rsp)
jmp 0x32a7c
movq 0x7a0(%rsp), %rdi
addq $0x30f0, %rdi           # imm = 0x30F0
movl 0x79c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x2ac(%rsp), %rsi
callq 0x8c20
movsd 0xb8(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x32abc
movl 0x2ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2ac(%rsp)
jmp 0x31f2f
movq 0x7a0(%rsp), %rax
testb $0x1, 0x2c4f(%rax)
je 0x32fd1
movl $0x0, 0x1cc(%rsp)
movl 0x1cc(%rsp), %eax
movq 0x7a0(%rsp), %rcx
cmpl 0x2d50(%rcx), %eax
jge 0x32c8f
movl $0x0, 0x1c8(%rsp)
movl 0x1c8(%rsp), %eax
cmpl 0x798(%rsp), %eax
jge 0x32c77
movslq 0x1cc(%rsp), %rsi
leaq 0x780(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1c8(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x33380
movsd %xmm0, 0xa8(%rsp)
jmp 0x32b64
movq 0x7a0(%rsp), %rdi
addq $0x2d70, %rdi           # imm = 0x2D70
movslq 0x79c(%rsp), %rsi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1c8(%rsp), %rsi
callq 0x8c20
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, (%rax)
movslq 0x1cc(%rsp), %rsi
leaq 0x780(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1c8(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
xorps %xmm0, %xmm0
movl $0x1, %esi
callq 0x333e0
movsd %xmm0, 0xa0(%rsp)
jmp 0x32bed
movsd 0xa0(%rsp), %xmm0
movq 0x7a0(%rsp), %rax
cvtsi2sdl 0x2c0c(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x4370
movsd %xmm0, 0x98(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2d88, %rdi           # imm = 0x2D88
movslq 0x79c(%rsp), %rsi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1c8(%rsp), %rsi
callq 0x8c20
movsd 0x98(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x1c8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c8(%rsp)
jmp 0x32b18
jmp 0x32c79
movl 0x1cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1cc(%rsp)
jmp 0x32af2
movl $0x0, 0x1c4(%rsp)
movl 0x1c4(%rsp), %eax
movq 0x7a0(%rsp), %rcx
cmpl 0x2d18(%rcx), %eax
jge 0x32e23
movl $0x0, 0x1c0(%rsp)
movl 0x1c0(%rsp), %eax
cmpl 0x798(%rsp), %eax
jge 0x32e0b
movslq 0x1c4(%rsp), %rsi
leaq 0x720(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x33380
movsd %xmm0, 0x90(%rsp)
jmp 0x32d0c
movq 0x7a0(%rsp), %rdi
addq $0x2da0, %rdi           # imm = 0x2DA0
movslq 0x79c(%rsp), %rsi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1c4(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c20
movsd 0x90(%rsp), %xmm0
movsd %xmm0, (%rax)
movslq 0x1c4(%rsp), %rsi
leaq 0x720(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
xorps %xmm0, %xmm0
movl $0x1, %esi
callq 0x333e0
movsd %xmm0, 0x88(%rsp)
jmp 0x32d95
movsd 0x88(%rsp), %xmm0
callq 0x4370
movsd %xmm0, 0x80(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2db8, %rdi           # imm = 0x2DB8
movslq 0x79c(%rsp), %rsi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1c4(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c20
movsd 0x80(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x1c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c0(%rsp)
jmp 0x32cc0
jmp 0x32e0d
movl 0x1c4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c4(%rsp)
jmp 0x32c9a
movq 0x7a0(%rsp), %rax
testb $0x1, 0x2c3f(%rax)
je 0x32fcf
movl $0x0, 0x1bc(%rsp)
movl 0x1bc(%rsp), %eax
movl %eax, 0x7c(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2c88, %rdi           # imm = 0x2C88
callq 0x16bb0
movq %rax, %rcx
movl 0x7c(%rsp), %eax
cmpl %ecx, %eax
jge 0x32fcd
movl $0x0, 0x1b8(%rsp)
movl 0x1b8(%rsp), %eax
cmpl 0x798(%rsp), %eax
jge 0x32fb5
movslq 0x1bc(%rsp), %rsi
leaq 0x6d0(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1b8(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x33380
movsd %xmm0, 0x70(%rsp)
jmp 0x32ec5
movq 0x7a0(%rsp), %rdi
addq $0x2dd0, %rdi           # imm = 0x2DD0
movslq 0x79c(%rsp), %rsi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1b8(%rsp), %rsi
callq 0x8c20
movsd 0x70(%rsp), %xmm0
movsd %xmm0, (%rax)
movslq 0x1bc(%rsp), %rsi
leaq 0x6d0(%rsp), %rdi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1b8(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
xorps %xmm0, %xmm0
movl $0x1, %esi
callq 0x333e0
movsd %xmm0, 0x68(%rsp)
jmp 0x32f48
movsd 0x68(%rsp), %xmm0
callq 0x4370
movsd %xmm0, 0x60(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2de8, %rdi           # imm = 0x2DE8
movslq 0x79c(%rsp), %rsi
callq 0x8ae0
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x1b8(%rsp), %rsi
callq 0x8c20
movsd 0x60(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x1b8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b8(%rsp)
jmp 0x32e7c
jmp 0x32fb7
movl 0x1bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1bc(%rsp)
jmp 0x32e43
jmp 0x32fcf
jmp 0x32fd1
movq 0x7a0(%rsp), %rdi
addq $0x2e18, %rdi           # imm = 0x2E18
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x33380
movsd %xmm0, 0x58(%rsp)
jmp 0x32ffd
movq 0x7a0(%rsp), %rdi
addq $0x2e30, %rdi           # imm = 0x2E30
movslq 0x79c(%rsp), %rsi
callq 0x8c20
movsd 0x58(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x7a0(%rsp), %rax
cmpl $0x1, 0x2c0c(%rax)
jle 0x330b3
movq 0x7a0(%rsp), %rdi
addq $0x2e18, %rdi           # imm = 0x2E18
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
xorps %xmm0, %xmm0
movl $0x1, %esi
callq 0x333e0
movsd %xmm0, 0x50(%rsp)
jmp 0x33068
movsd 0x50(%rsp), %xmm0
movq 0x7a0(%rsp), %rax
cvtsi2sdl 0x2c0c(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x4370
movsd %xmm0, 0x48(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2e48, %rdi           # imm = 0x2E48
movslq 0x79c(%rsp), %rsi
callq 0x8c20
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x7a0(%rsp), %rdi
addq $0x2e90, %rdi           # imm = 0x2E90
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x33380
movsd %xmm0, 0x40(%rsp)
jmp 0x330df
movq 0x7a0(%rsp), %rdi
addq $0x2ea8, %rdi           # imm = 0x2EA8
movslq 0x79c(%rsp), %rsi
callq 0x8c20
movsd 0x40(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x7a0(%rsp), %rax
cmpl $0x1, 0x2c0c(%rax)
jle 0x33195
movq 0x7a0(%rsp), %rdi
addq $0x2e90, %rdi           # imm = 0x2E90
movslq 0x79c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
xorps %xmm0, %xmm0
movl $0x1, %esi
callq 0x333e0
movsd %xmm0, 0x38(%rsp)
jmp 0x3314a
movsd 0x38(%rsp), %xmm0
movq 0x7a0(%rsp), %rax
cvtsi2sdl 0x2c0c(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x4370
movsd %xmm0, 0x30(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x2ec0, %rdi           # imm = 0x2EC0
movslq 0x79c(%rsp), %rsi
callq 0x8c20
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
cmpl $0x1, 0x79c(%rsp)
jle 0x33254
movq 0x7a0(%rsp), %rdi
addq $0x30f0, %rdi           # imm = 0x30F0
movl 0x79c(%rsp), %eax
decl %eax
movslq %eax, %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x33380
movsd %xmm0, 0x28(%rsp)
jmp 0x331d3
movq 0x7a0(%rsp), %rdi
addq $0x2e90, %rdi           # imm = 0x2E90
movl 0x79c(%rsp), %eax
decl %eax
movslq %eax, %rsi
callq 0x8bc0
movq %rax, %rdi
xorps %xmm0, %xmm0
movl $0x1, %esi
callq 0x333e0
movsd %xmm0, 0x20(%rsp)
jmp 0x3320b
movsd 0x20(%rsp), %xmm0
callq 0x4370
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x7a0(%rsp), %rdi
addq $0x3108, %rdi           # imm = 0x3108
movl 0x79c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8c20
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
leaq 0x2b0(%rsp), %rdi
callq 0x22c40
leaq 0x6d0(%rsp), %rdi
callq 0x8a00
leaq 0x720(%rsp), %rdi
callq 0x8a00
leaq 0x780(%rsp), %rdi
callq 0x8a00
addq $0x7a8, %rsp            # imm = 0x7A8
retq
leaq 0x2b0(%rsp), %rdi
callq 0x22c40
leaq 0x6d0(%rsp), %rdi
callq 0x8a00
leaq 0x720(%rsp), %rdi
callq 0x8a00
leaq 0x780(%rsp), %rdi
callq 0x8a00
movq 0x740(%rsp), %rdi
callq 0x4730
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)