// File: bobverity[P]MavericK/exhaustive.cpp
// Function: exhaustive_admix_fixedAlpha(globals&, int, double)
double exhaustive_admix_fixedAlpha(globals &globals, int Kindex, double alpha) {
    int K = globals.Kmin+Kindex;
    
    // initialise group
    int geneCopies = sum(globals.ploidy_vec)*globals.loci;
    vector<int> group(geneCopies,1);
    vector<int> newGroup = group;
    
    // initialise alleleCounts array
    vector< vector< vector<int> > > alleleCounts(K);
    vector< vector<int> > alleleCountsTotals(K);
    for (int k=0; k<K; k++) {
        alleleCounts[k] = vector< vector<int> >(globals.loci);
        alleleCountsTotals[k] = vector<int>(globals.loci);
        for (int l=0; l<globals.loci; l++) {
            alleleCounts[k][l] = vector<int>(globals.J[l]);
        }
    }
    
    // initialise admixCounts array
    vector< vector<int> > admixCounts(globals.n, vector<int>(K));
    vector<int> admixCountsTotals(globals.n);
    
    // populate alleleCounts and admixCounts arrays and calculate starting likelihood
    double logLike=0;
    int linearIndex=-1;
    for (int ind=0; ind<globals.n; ind++) {
        for (int l=0; l<globals.loci; l++) {
            for (int p=0; p<globals.ploidy_vec[ind]; p++) {
                linearIndex++;
                if (globals.data[ind][l][p]!=0) {
                    logLike += log(alleleCounts[group[linearIndex]-1][l][globals.data[ind][l][p]-1] + globals.lambda) - log(alleleCountsTotals[group[linearIndex]-1][l] + globals.J[l]*globals.lambda);
                    alleleCounts[group[linearIndex]-1][l][globals.data[ind][l][p]-1]++;
                    alleleCountsTotals[group[linearIndex]-1][l]++;
                    
                    logLike += log(admixCounts[ind][group[linearIndex]-1] + alpha) - log(admixCountsTotals[ind] + K*alpha);
                    admixCounts[ind][group[linearIndex]-1]++;
                    admixCountsTotals[ind]++;
                }
            }
        }
    }
    double combined_logLike = logLike + log(double(K));
    
    // loop through all possible groupings
    int uniques = 0;  // number of unique elements in group. Forms part of combinatorial constant needed to calculate correct likelihood when only searching over unique partitions (see Notes.c for details)
    double logLike_total = combined_logLike;
    while (group[0]!=0) {
        
        increment_restrictedGrowth(newGroup,K);
        if (newGroup[0]==0)
            break;
        
        // loop through all gene copies
        linearIndex=-1;
        for (int ind=0; ind<globals.n; ind++) {
            for (int l=0; l<globals.loci; l++) {
                for (int p=0; p<globals.ploidy_vec[ind]; p++) {
                    linearIndex++;
                    
                    // if group allocation for this gene copy has changed
                    if (newGroup[linearIndex]!=group[linearIndex]) {
                        
                        // subtract old group from allele counts, admix counts and likelihood
                        if (globals.data[ind][l][p]!=0) {
                            alleleCountsTotals[group[linearIndex]-1][l]--;
                            alleleCounts[group[linearIndex]-1][l][globals.data[ind][l][p]-1]--;
                            logLike -= log(alleleCounts[group[linearIndex]-1][l][globals.data[ind][l][p]-1] + globals.lambda) - log(alleleCountsTotals[group[linearIndex]-1][l] + globals.J[l]*globals.lambda);
                            
                            admixCountsTotals[ind]--;
                            admixCounts[ind][group[linearIndex]-1]--;
                            logLike -= log(admixCounts[ind][group[linearIndex]-1] + alpha) - log(admixCountsTotals[ind] + K*alpha);
                        }
                        
                        // add new group to allele counts, admix counts and likelihood
                        if (globals.data[ind][l][p]!=0) {
                            logLike += log(alleleCounts[newGroup[linearIndex]-1][l][globals.data[ind][l][p]-1] + globals.lambda) - log(alleleCountsTotals[newGroup[linearIndex]-1][l] + globals.J[l]*globals.lambda);
                            alleleCounts[newGroup[linearIndex]-1][l][globals.data[ind][l][p]-1]++;
                            alleleCountsTotals[newGroup[linearIndex]-1][l]++;
                            
                            logLike += log(admixCounts[ind][newGroup[linearIndex]-1] + alpha) - log(admixCountsTotals[ind] + K*alpha);
                            admixCounts[ind][newGroup[linearIndex]-1]++;
                            admixCountsTotals[ind]++;
                        }
                        
                    }
                    
                } // p
            } // l
        } // ind
        
        // update group
        group = newGroup;
        
        // some combinatorics to account for searching unique partitions only (see Notes.c for details)
        uniques = *max_element(begin(group),end(group));
        combined_logLike = logLike + my_lgamma(double(K)+1)-my_lgamma(double(K)-double(uniques)+1);
        
        // add to running sum
        logLike_total = logSum(logLike_total, combined_logLike);
    }
    
    return(logLike_total);
}

// Assembly:
subq $0x358, %rsp            # imm = 0x358
movq %rdi, 0x350(%rsp)
movl %esi, 0x34c(%rsp)
movsd %xmm0, 0x340(%rsp)
movq 0x350(%rsp), %rax
movl 0x2bc8(%rax), %eax
movl 0x34c(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x33c(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2cd0, %rdi           # imm = 0x2CD0
callq 0x8c80
movq 0x350(%rsp), %rcx
movl 0x2d1c(%rcx), %ecx
imull %ecx, %eax
movl %eax, 0x338(%rsp)
movslq 0x338(%rsp), %rax
movq %rax, 0x190(%rsp)
movl $0x1, 0x31c(%rsp)
leaq 0x31b(%rsp), %rdi
movq %rdi, 0x198(%rsp)
callq 0xc5e0
movq 0x190(%rsp), %rsi
movq 0x198(%rsp), %rcx
leaq 0x320(%rsp), %rdi
leaq 0x31c(%rsp), %rdx
callq 0xc5f0
jmp 0x24300
leaq 0x31b(%rsp), %rdi
callq 0xc670
leaq 0x2f0(%rsp), %rdi
leaq 0x320(%rsp), %rsi
callq 0xc8f0
jmp 0x24324
movslq 0x33c(%rsp), %rax
movq %rax, 0x180(%rsp)
leaq 0x2d7(%rsp), %rdi
movq %rdi, 0x188(%rsp)
callq 0x168b0
movq 0x180(%rsp), %rsi
movq 0x188(%rsp), %rdx
leaq 0x2d8(%rsp), %rdi
callq 0x168c0
jmp 0x24368
leaq 0x2d7(%rsp), %rdi
callq 0x169e0
movslq 0x33c(%rsp), %rax
movq %rax, 0x170(%rsp)
leaq 0x2b7(%rsp), %rdi
movq %rdi, 0x178(%rsp)
callq 0x169f0
movq 0x170(%rsp), %rsi
movq 0x178(%rsp), %rdx
leaq 0x2b8(%rsp), %rdi
callq 0x16a00
jmp 0x243b9
leaq 0x2b7(%rsp), %rdi
callq 0x16b20
movl $0x0, 0x2b0(%rsp)
movl 0x2b0(%rsp), %eax
cmpl 0x33c(%rsp), %eax
jge 0x246fc
movq 0x350(%rsp), %rax
movslq 0x2d1c(%rax), %rax
movq %rax, 0x160(%rsp)
leaq 0x297(%rsp), %rdi
movq %rdi, 0x168(%rsp)
callq 0x169f0
movq 0x160(%rsp), %rsi
movq 0x168(%rsp), %rdx
leaq 0x298(%rsp), %rdi
callq 0x16a00
jmp 0x24430
movslq 0x2b0(%rsp), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
leaq 0x298(%rsp), %rsi
movq %rsi, 0x148(%rsp)
callq 0x16a80
movq 0x148(%rsp), %rdi
callq 0x16ac0
leaq 0x297(%rsp), %rdi
callq 0x16b20
movq 0x350(%rsp), %rax
movslq 0x2d1c(%rax), %rax
movq %rax, 0x150(%rsp)
leaq 0x277(%rsp), %rdi
movq %rdi, 0x158(%rsp)
callq 0xc5e0
movq 0x150(%rsp), %rsi
movq 0x158(%rsp), %rdx
leaq 0x278(%rsp), %rdi
callq 0xc7b0
jmp 0x244c2
movslq 0x2b0(%rsp), %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
leaq 0x278(%rsp), %rsi
callq 0xc6a0
leaq 0x278(%rsp), %rdi
callq 0xc6e0
leaq 0x277(%rsp), %rdi
callq 0xc670
movl $0x0, 0x270(%rsp)
movl 0x270(%rsp), %eax
movq 0x350(%rsp), %rcx
cmpl 0x2d1c(%rcx), %eax
jge 0x246e4
movq 0x350(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x270(%rsp), %rsi
callq 0x8ba0
movslq (%rax), %rax
movq %rax, 0x138(%rsp)
leaq 0x257(%rsp), %rdi
movq %rdi, 0x140(%rsp)
callq 0xc5e0
movq 0x138(%rsp), %rsi
movq 0x140(%rsp), %rdx
leaq 0x258(%rsp), %rdi
callq 0xc7b0
jmp 0x24582
movslq 0x2b0(%rsp), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x270(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
leaq 0x258(%rsp), %rsi
callq 0xc6a0
leaq 0x258(%rsp), %rdi
callq 0xc6e0
leaq 0x257(%rsp), %rdi
callq 0xc670
movl 0x270(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x270(%rsp)
jmp 0x2450c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x31b(%rsp), %rdi
callq 0xc670
jmp 0x25862
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
jmp 0x25855
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x2d7(%rsp), %rdi
callq 0x169e0
jmp 0x25848
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x2b7(%rsp), %rdi
callq 0x16b20
jmp 0x2583b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x297(%rsp), %rdi
callq 0x16b20
jmp 0x2582e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x277(%rsp), %rdi
callq 0xc670
jmp 0x2582e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x257(%rsp), %rdi
callq 0xc670
jmp 0x2582e
jmp 0x246e6
movl 0x2b0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2b0(%rsp)
jmp 0x243d1
movq 0x350(%rsp), %rax
movslq 0x2d18(%rax), %rax
movq %rax, 0x120(%rsp)
movslq 0x33c(%rsp), %rax
movq %rax, 0x128(%rsp)
leaq 0x21f(%rsp), %rdi
movq %rdi, 0x130(%rsp)
callq 0xc5e0
movq 0x128(%rsp), %rsi
movq 0x130(%rsp), %rdx
leaq 0x220(%rsp), %rdi
callq 0xc7b0
jmp 0x24757
leaq 0x21e(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x169f0
movq 0x120(%rsp), %rsi
movq 0x118(%rsp), %rcx
leaq 0x238(%rsp), %rdi
leaq 0x220(%rsp), %rdx
callq 0x16b30
jmp 0x24793
leaq 0x21e(%rsp), %rdi
callq 0x16b20
leaq 0x220(%rsp), %rdi
callq 0xc6e0
leaq 0x21f(%rsp), %rdi
callq 0xc670
movq 0x350(%rsp), %rax
movslq 0x2d18(%rax), %rax
movq %rax, 0x108(%rsp)
leaq 0x1ff(%rsp), %rdi
movq %rdi, 0x110(%rsp)
callq 0xc5e0
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rdx
leaq 0x200(%rsp), %rdi
callq 0xc7b0
jmp 0x24805
leaq 0x1ff(%rsp), %rdi
callq 0xc670
xorps %xmm0, %xmm0
movsd %xmm0, 0x1f0(%rsp)
movl $0xffffffff, 0x1ec(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x1e8(%rsp)
movl 0x1e8(%rsp), %eax
movq 0x350(%rsp), %rcx
cmpl 0x2d18(%rcx), %eax
jge 0x24d3d
movl $0x0, 0x1e4(%rsp)
movl 0x1e4(%rsp), %eax
movq 0x350(%rsp), %rcx
cmpl 0x2d1c(%rcx), %eax
jge 0x24d25
movl $0x0, 0x1e0(%rsp)
movl 0x1e0(%rsp), %eax
movl %eax, 0x104(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2cd0, %rdi           # imm = 0x2CD0
movslq 0x1e8(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0x104(%rsp), %eax
cmpl (%rcx), %eax
jge 0x24d0d
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1e8(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1e4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1e0(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x24cf5
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x1e4(%rsp), %rsi
callq 0x8c60
movq %rax, 0xc8(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1e8(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1e4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1e0(%rsp), %rsi
callq 0x8ba0
movq 0xc8(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movq 0x350(%rsp), %rax
addsd 0x2c50(%rax), %xmm0
callq 0x4390
movsd %xmm0, 0xd8(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x1e4(%rsp), %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0xd0(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x1e4(%rsp), %rsi
callq 0x8ba0
movsd 0xd0(%rsp), %xmm1
cvtsi2sdl (%rax), %xmm0
movq 0x350(%rsp), %rax
movsd 0x2c50(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0xd8(%rsp), %xmm0
subsd %xmm1, %xmm0
addsd 0x1f0(%rsp), %xmm0
movsd %xmm0, 0x1f0(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x1e4(%rsp), %rsi
callq 0x8c60
movq %rax, 0xe0(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1e8(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1e4(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1e0(%rsp), %rsi
callq 0x8ba0
movq 0xe0(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x1e4(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x1e8(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x8c60
movq %rax, 0xe8(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movq 0xe8(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
addsd 0x340(%rsp), %xmm0
callq 0x4390
movsd %xmm0, 0xf0(%rsp)
movslq 0x1e8(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm1
cvtsi2sdl 0x33c(%rsp), %xmm0
movsd 0x340(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0xf0(%rsp), %xmm0
subsd %xmm1, %xmm0
addsd 0x1f0(%rsp), %xmm0
movsd %xmm0, 0x1f0(%rsp)
movslq 0x1e8(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x8c60
movq %rax, 0xf8(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movq 0xf8(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x1e8(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x24cf5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
jmp 0x24cbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x21e(%rsp), %rdi
callq 0x16b20
leaq 0x220(%rsp), %rdi
callq 0xc6e0
leaq 0x21f(%rsp), %rdi
callq 0xc670
jmp 0x2582e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x1ff(%rsp), %rdi
callq 0xc670
jmp 0x25821
jmp 0x24cf7
movl 0x1e0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e0(%rsp)
jmp 0x24880
jmp 0x24d0f
movl 0x1e4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e4(%rsp)
jmp 0x2485a
jmp 0x24d27
movl 0x1e8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e8(%rsp)
jmp 0x24834
movsd 0x1f0(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
cvtsi2sdl 0x33c(%rsp), %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0xc0(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x1d8(%rsp)
movl $0x0, 0x1d4(%rsp)
movsd 0x1d8(%rsp), %xmm0
movsd %xmm0, 0x1c8(%rsp)
leaq 0x320(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x257b6
movl 0x33c(%rsp), %esi
leaq 0x2f0(%rsp), %rdi
callq 0x35ce0
jmp 0x24dc3
leaq 0x2f0(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8ba0
cmpl $0x0, (%rax)
jne 0x24e04
jmp 0x257b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x310(%rsp)
movl %eax, 0x30c(%rsp)
leaq 0x200(%rsp), %rdi
callq 0xc6e0
jmp 0x25821
movl $0xffffffff, 0x1ec(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x1c4(%rsp)
movl 0x1c4(%rsp), %eax
movq 0x350(%rsp), %rcx
cmpl 0x2d18(%rcx), %eax
jge 0x2566e
movl $0x0, 0x1c0(%rsp)
movl 0x1c0(%rsp), %eax
movq 0x350(%rsp), %rcx
cmpl 0x2d1c(%rcx), %eax
jge 0x25656
movl $0x0, 0x1bc(%rsp)
movl 0x1bc(%rsp), %eax
movl %eax, 0xbc(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2cd0, %rdi           # imm = 0x2CD0
movslq 0x1c4(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0xbc(%rsp), %eax
cmpl (%rcx), %eax
jge 0x2563e
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
movl %eax, 0xb8(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movq %rax, %rcx
movl 0xb8(%rsp), %eax
cmpl (%rcx), %eax
je 0x25626
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1c4(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x252a4
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, 0x80(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1c4(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8ba0
movq 0x80(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, 0x88(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1c4(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8ba0
movq 0x88(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movq 0x350(%rsp), %rax
addsd 0x2c50(%rax), %xmm0
callq 0x4390
movsd %xmm0, 0x98(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x90(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x1c0(%rsp), %rsi
callq 0x8ba0
movsd 0x90(%rsp), %xmm1
cvtsi2sdl (%rax), %xmm0
movq 0x350(%rsp), %rax
movsd 0x2c50(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movsd 0x98(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x1f0(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x1f0(%rsp)
movslq 0x1c4(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x8ba0
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movslq 0x1c4(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x8c60
movq %rax, 0xa0(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movq 0xa0(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movslq 0x1c4(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x8c60
movq %rax, 0xa8(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x8ba0
movq 0xa8(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
addsd 0x340(%rsp), %xmm0
callq 0x4390
movsd %xmm0, 0xb0(%rsp)
movslq 0x1c4(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm1
cvtsi2sdl 0x33c(%rsp), %xmm0
movsd 0x340(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movsd 0xb0(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x1f0(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x1f0(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1c4(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x25624
movslq 0x1ec(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, 0x48(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1c4(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8ba0
movq 0x48(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movq 0x350(%rsp), %rax
addsd 0x2c50(%rax), %xmm0
callq 0x4390
movsd %xmm0, 0x58(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x1c0(%rsp), %rsi
callq 0x8ba0
movsd 0x50(%rsp), %xmm1
cvtsi2sdl (%rax), %xmm0
movq 0x350(%rsp), %rax
movsd 0x2c50(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0x58(%rsp), %xmm0
subsd %xmm1, %xmm0
addsd 0x1f0(%rsp), %xmm0
movsd %xmm0, 0x1f0(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, 0x60(%rsp)
movq 0x350(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x1c4(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x1bc(%rsp), %rsi
callq 0x8ba0
movq 0x60(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x1ec(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x2b8(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x1c4(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x8c60
movq %rax, 0x68(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x8ba0
movq 0x68(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
addsd 0x340(%rsp), %xmm0
callq 0x4390
movsd %xmm0, 0x70(%rsp)
movslq 0x1c4(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm1
cvtsi2sdl 0x33c(%rsp), %xmm0
movsd 0x340(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0x70(%rsp), %xmm0
subsd %xmm1, %xmm0
addsd 0x1f0(%rsp), %xmm0
movsd %xmm0, 0x1f0(%rsp)
movslq 0x1c4(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x8c60
movq %rax, 0x78(%rsp)
movslq 0x1ec(%rsp), %rsi
leaq 0x2f0(%rsp), %rdi
callq 0x8ba0
movq 0x78(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x1c4(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x25626
jmp 0x25628
movl 0x1bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1bc(%rsp)
jmp 0x24e66
jmp 0x25640
movl 0x1c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c0(%rsp)
jmp 0x24e40
jmp 0x25658
movl 0x1c4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c4(%rsp)
jmp 0x24e1a
leaq 0x320(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
callq 0x16330
jmp 0x25685
leaq 0x320(%rsp), %rdi
callq 0x258c0
movq %rax, 0x40(%rsp)
jmp 0x25699
movq 0x40(%rsp), %rax
movq %rax, 0x1a8(%rsp)
leaq 0x320(%rsp), %rdi
callq 0x258f0
movq %rax, 0x38(%rsp)
jmp 0x256ba
movq 0x38(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movq 0x1a8(%rsp), %rdi
movq 0x1a0(%rsp), %rsi
callq 0x25870
movq %rax, 0x30(%rsp)
jmp 0x256e3
movq 0x30(%rsp), %rax
movq %rax, 0x1b0(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0x25920
movl (%rax), %eax
movl %eax, 0x1d4(%rsp)
movsd 0x1f0(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
cvtsi2sdl 0x33c(%rsp), %xmm0
movsd 0x36ada(%rip), %xmm1    # 0x5c200
movsd %xmm1, 0x10(%rsp)
addsd %xmm1, %xmm0
callq 0x4340
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x20(%rsp)
cvtsi2sdl 0x33c(%rsp), %xmm0
cvtsi2sdl 0x1d4(%rsp), %xmm2
subsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4340
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x1d8(%rsp)
movsd 0x1c8(%rsp), %xmm0
movsd 0x1d8(%rsp), %xmm1
callq 0x339b0
movsd %xmm0, 0x28(%rsp)
jmp 0x257a2
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x1c8(%rsp)
jmp 0x24d93
movsd 0x1c8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x200(%rsp), %rdi
callq 0xc6e0
leaq 0x238(%rsp), %rdi
callq 0x16ac0
leaq 0x2b8(%rsp), %rdi
callq 0x16ac0
leaq 0x2d8(%rsp), %rdi
callq 0x16980
leaq 0x2f0(%rsp), %rdi
callq 0xc6e0
leaq 0x320(%rsp), %rdi
callq 0xc6e0
movsd 0x8(%rsp), %xmm0
addq $0x358, %rsp            # imm = 0x358
retq
leaq 0x238(%rsp), %rdi
callq 0x16ac0
leaq 0x2b8(%rsp), %rdi
callq 0x16ac0
leaq 0x2d8(%rsp), %rdi
callq 0x16980
leaq 0x2f0(%rsp), %rdi
callq 0xc6e0
leaq 0x320(%rsp), %rdi
callq 0xc6e0
movq 0x310(%rsp), %rdi
callq 0x4730
nop