// File: bobverity[P]MavericK/exhaustive.cpp
// Function: exhaustive_noAdmix(globals&, int)
void exhaustive_noAdmix(globals &globals, int Kindex) {
    int K = globals.Kmin+Kindex;
    
    // initialise group
    vector<int> group(globals.n,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]);
        }
    }
    
    // populate alleleCounts array and calculate starting likelihood
    double logLike=0;
    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++) {
                if (globals.data[ind][l][p]!=0) {
                    logLike += log(alleleCounts[group[ind]-1][l][globals.data[ind][l][p]-1] + globals.lambda) - log(alleleCountsTotals[group[ind]-1][l] + globals.J[l]*globals.lambda);
                    alleleCounts[group[ind]-1][l][globals.data[ind][l][p]-1]++;
                    alleleCountsTotals[group[ind]-1][l]++;
                }
            }
        }
    }
    double combined_logLike = logLike -globals.n*log(double(K));
    combined_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 individuals
        for (int ind=0; ind<globals.n; ind++) {
            
            // if group allocation for this individual has changed
            if (newGroup[ind]!=group[ind]) {
                
                // subtract old group from allele counts and likelihood
                for (int l=0; l<globals.loci; l++) {
                    for (int p=0; p<globals.ploidy_vec[ind]; p++) {
                        if (globals.data[ind][l][p]!=0) {
                            alleleCountsTotals[group[ind]-1][l]--;
                            alleleCounts[group[ind]-1][l][globals.data[ind][l][p]-1]--;
                            logLike -= log(alleleCounts[group[ind]-1][l][globals.data[ind][l][p]-1] + globals.lambda) - log(alleleCountsTotals[group[ind]-1][l] + globals.J[l]*globals.lambda);
                        }
                    }
                }
                
                // add new group to allele counts and likelihood
                for (int l=0; l<globals.loci; l++) {
                    for (int p=0; p<globals.ploidy_vec[ind]; p++) {
                        if (globals.data[ind][l][p]!=0) {
                            logLike += log(alleleCounts[newGroup[ind]-1][l][globals.data[ind][l][p]-1] + globals.lambda) - log(alleleCountsTotals[newGroup[ind]-1][l] + globals.J[l]*globals.lambda);
                            alleleCounts[newGroup[ind]-1][l][globals.data[ind][l][p]-1]++;
                            alleleCountsTotals[newGroup[ind]-1][l]++;
                        }
                    }
                }
                
            }
        }
        
        // update group
        group = newGroup;
        
        // some combinatorics to account for searching unique partitions only (see Notes.c for details)
        combined_logLike = logLike -globals.n*log(double(K));
        uniques = *max_element(begin(group),end(group));
        combined_logLike += my_lgamma(double(K)+1)-my_lgamma(double(K)-double(uniques)+1);
        
        // add to running sum
        logLike_total = logSum(logLike_total, combined_logLike);
    
    }
    
    globals.logEvidence_exhaustive[Kindex] = logLike_total;
    
}

// Assembly:
subq $0x298, %rsp            # imm = 0x298
movq %rdi, 0x290(%rsp)
movl %esi, 0x28c(%rsp)
movq 0x290(%rsp), %rax
movl 0x2bc8(%rax), %eax
movl 0x28c(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x288(%rsp)
movq 0x290(%rsp), %rax
movslq 0x2d18(%rax), %rax
movq %rax, 0x130(%rsp)
movl $0x1, 0x26c(%rsp)
leaq 0x26b(%rsp), %rdi
movq %rdi, 0x138(%rsp)
callq 0xc5e0
movq 0x130(%rsp), %rsi
movq 0x138(%rsp), %rcx
leaq 0x270(%rsp), %rdi
leaq 0x26c(%rsp), %rdx
callq 0xc5f0
jmp 0x22f92
leaq 0x26b(%rsp), %rdi
callq 0xc670
leaq 0x240(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0xc8f0
jmp 0x22fb6
movslq 0x288(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x227(%rsp), %rdi
movq %rdi, 0x128(%rsp)
callq 0x168b0
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
leaq 0x228(%rsp), %rdi
callq 0x168c0
jmp 0x22ffa
leaq 0x227(%rsp), %rdi
callq 0x169e0
movslq 0x288(%rsp), %rax
movq %rax, 0x110(%rsp)
leaq 0x207(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x169f0
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
leaq 0x208(%rsp), %rdi
callq 0x16a00
jmp 0x2304b
leaq 0x207(%rsp), %rdi
callq 0x16b20
movl $0x0, 0x200(%rsp)
movl 0x200(%rsp), %eax
cmpl 0x288(%rsp), %eax
jge 0x2338e
movq 0x290(%rsp), %rax
movslq 0x2d1c(%rax), %rax
movq %rax, 0x100(%rsp)
leaq 0x1e7(%rsp), %rdi
movq %rdi, 0x108(%rsp)
callq 0x169f0
movq 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
leaq 0x1e8(%rsp), %rdi
callq 0x16a00
jmp 0x230c2
movslq 0x200(%rsp), %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
leaq 0x1e8(%rsp), %rsi
movq %rsi, 0xe8(%rsp)
callq 0x16a80
movq 0xe8(%rsp), %rdi
callq 0x16ac0
leaq 0x1e7(%rsp), %rdi
callq 0x16b20
movq 0x290(%rsp), %rax
movslq 0x2d1c(%rax), %rax
movq %rax, 0xf0(%rsp)
leaq 0x1c7(%rsp), %rdi
movq %rdi, 0xf8(%rsp)
callq 0xc5e0
movq 0xf0(%rsp), %rsi
movq 0xf8(%rsp), %rdx
leaq 0x1c8(%rsp), %rdi
callq 0xc7b0
jmp 0x23154
movslq 0x200(%rsp), %rsi
leaq 0x208(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
leaq 0x1c8(%rsp), %rsi
callq 0xc6a0
leaq 0x1c8(%rsp), %rdi
callq 0xc6e0
leaq 0x1c7(%rsp), %rdi
callq 0xc670
movl $0x0, 0x1c0(%rsp)
movl 0x1c0(%rsp), %eax
movq 0x290(%rsp), %rcx
cmpl 0x2d1c(%rcx), %eax
jge 0x23376
movq 0x290(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x1c0(%rsp), %rsi
callq 0x8ba0
movslq (%rax), %rax
movq %rax, 0xd8(%rsp)
leaq 0x1a7(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
callq 0xc5e0
movq 0xd8(%rsp), %rsi
movq 0xe0(%rsp), %rdx
leaq 0x1a8(%rsp), %rdi
callq 0xc7b0
jmp 0x23214
movslq 0x200(%rsp), %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x1c0(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
leaq 0x1a8(%rsp), %rsi
callq 0xc6a0
leaq 0x1a8(%rsp), %rdi
callq 0xc6e0
leaq 0x1a7(%rsp), %rdi
callq 0xc670
movl 0x1c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c0(%rsp)
jmp 0x2319e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
leaq 0x26b(%rsp), %rdi
callq 0xc670
jmp 0x240e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
jmp 0x240d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
leaq 0x227(%rsp), %rdi
callq 0x169e0
jmp 0x240c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
leaq 0x207(%rsp), %rdi
callq 0x16b20
jmp 0x240bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
leaq 0x1e7(%rsp), %rdi
callq 0x16b20
jmp 0x240ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
leaq 0x1c7(%rsp), %rdi
callq 0xc670
jmp 0x240ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
leaq 0x1a7(%rsp), %rdi
callq 0xc670
jmp 0x240ae
jmp 0x23378
movl 0x200(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x200(%rsp)
jmp 0x23063
xorps %xmm0, %xmm0
movsd %xmm0, 0x198(%rsp)
movl $0x0, 0x194(%rsp)
movl 0x194(%rsp), %eax
movq 0x290(%rsp), %rcx
cmpl 0x2d18(%rcx), %eax
jge 0x236f9
movl $0x0, 0x190(%rsp)
movl 0x190(%rsp), %eax
movq 0x290(%rsp), %rcx
cmpl 0x2d1c(%rcx), %eax
jge 0x236e1
movl $0x0, 0x18c(%rsp)
movl 0x18c(%rsp), %eax
movl %eax, 0xd4(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2cd0, %rdi           # imm = 0x2CD0
movslq 0x194(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0xd4(%rsp), %eax
cmpl (%rcx), %eax
jge 0x236c9
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x194(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x190(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x18c(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x236b1
movslq 0x194(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x190(%rsp), %rsi
callq 0x8c60
movq %rax, 0xb0(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x194(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x190(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x18c(%rsp), %rsi
callq 0x8ba0
movq 0xb0(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movq 0x290(%rsp), %rax
addsd 0x2c50(%rax), %xmm0
callq 0x4390
movsd %xmm0, 0xc0(%rsp)
movslq 0x194(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x208(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x190(%rsp), %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0xb8(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x190(%rsp), %rsi
callq 0x8ba0
movsd 0xb8(%rsp), %xmm1
cvtsi2sdl (%rax), %xmm0
movq 0x290(%rsp), %rax
movsd 0x2c50(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0xc0(%rsp), %xmm0
subsd %xmm1, %xmm0
addsd 0x198(%rsp), %xmm0
movsd %xmm0, 0x198(%rsp)
movslq 0x194(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x190(%rsp), %rsi
callq 0x8c60
movq %rax, 0xc8(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x194(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x190(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x18c(%rsp), %rsi
callq 0x8ba0
movq 0xc8(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x194(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x208(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x190(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x236b3
movl 0x18c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18c(%rsp)
jmp 0x233f1
jmp 0x236cb
movl 0x190(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x190(%rsp)
jmp 0x233cb
jmp 0x236e3
movl 0x194(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x194(%rsp)
jmp 0x233a5
movsd 0x198(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0x290(%rsp), %rax
cvtsi2sdl 0x2d18(%rax), %xmm0
movsd %xmm0, 0xa8(%rsp)
cvtsi2sdl 0x288(%rsp), %xmm0
callq 0x4390
movsd 0xa0(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0xa8(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x180(%rsp)
cvtsi2sdl 0x288(%rsp), %xmm0
callq 0x4390
addsd 0x180(%rsp), %xmm0
movsd %xmm0, 0x180(%rsp)
movl $0x0, 0x17c(%rsp)
movsd 0x180(%rsp), %xmm0
movsd %xmm0, 0x170(%rsp)
leaq 0x270(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x2403d
movl 0x288(%rsp), %esi
leaq 0x240(%rsp), %rdi
callq 0x35ce0
jmp 0x237dc
leaq 0x240(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8ba0
cmpl $0x0, (%rax)
jne 0x23810
jmp 0x2403d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x260(%rsp)
movl %eax, 0x25c(%rsp)
jmp 0x240ae
movl $0x0, 0x16c(%rsp)
movl 0x16c(%rsp), %eax
movq 0x290(%rsp), %rcx
cmpl 0x2d18(%rcx), %eax
jge 0x23eb4
movslq 0x16c(%rsp), %rsi
leaq 0x240(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
movl %eax, 0x9c(%rsp)
movslq 0x16c(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movq %rax, %rcx
movl 0x9c(%rsp), %eax
cmpl (%rcx), %eax
je 0x23e9c
movl $0x0, 0x168(%rsp)
movl 0x168(%rsp), %eax
movq 0x290(%rsp), %rcx
cmpl 0x2d1c(%rcx), %eax
jge 0x23b97
movl $0x0, 0x164(%rsp)
movl 0x164(%rsp), %eax
movl %eax, 0x98(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2cd0, %rdi           # imm = 0x2CD0
movslq 0x16c(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0x98(%rsp), %eax
cmpl (%rcx), %eax
jge 0x23b7f
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x16c(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x164(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x23b67
movslq 0x16c(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x208(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movslq 0x16c(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8c60
movq %rax, 0x78(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x16c(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x164(%rsp), %rsi
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 0x16c(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8c60
movq %rax, 0x80(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x16c(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x164(%rsp), %rsi
callq 0x8ba0
movq 0x80(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movq 0x290(%rsp), %rax
addsd 0x2c50(%rax), %xmm0
callq 0x4390
movsd %xmm0, 0x90(%rsp)
movslq 0x16c(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x208(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x168(%rsp), %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x168(%rsp), %rsi
callq 0x8ba0
movsd 0x88(%rsp), %xmm1
cvtsi2sdl (%rax), %xmm0
movq 0x290(%rsp), %rax
movsd 0x2c50(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movsd 0x90(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x198(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x198(%rsp)
jmp 0x23b69
movl 0x164(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x164(%rsp)
jmp 0x238ac
jmp 0x23b81
movl 0x168(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x168(%rsp)
jmp 0x23886
movl $0x0, 0x160(%rsp)
movl 0x160(%rsp), %eax
movq 0x290(%rsp), %rcx
cmpl 0x2d1c(%rcx), %eax
jge 0x23e9a
movl $0x0, 0x15c(%rsp)
movl 0x15c(%rsp), %eax
movl %eax, 0x74(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2cd0, %rdi           # imm = 0x2CD0
movslq 0x16c(%rsp), %rsi
callq 0x8ba0
movq %rax, %rcx
movl 0x74(%rsp), %eax
cmpl (%rcx), %eax
jge 0x23e82
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x16c(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x15c(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
je 0x23e6a
movslq 0x16c(%rsp), %rsi
leaq 0x240(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8c60
movq %rax, 0x50(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x16c(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x15c(%rsp), %rsi
callq 0x8ba0
movq 0x50(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movq 0x290(%rsp), %rax
addsd 0x2c50(%rax), %xmm0
callq 0x4390
movsd %xmm0, 0x60(%rsp)
movslq 0x16c(%rsp), %rsi
leaq 0x240(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x208(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8ba0
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d20, %rdi           # imm = 0x2D20
movslq 0x160(%rsp), %rsi
callq 0x8ba0
movsd 0x58(%rsp), %xmm1
cvtsi2sdl (%rax), %xmm0
movq 0x290(%rsp), %rax
movsd 0x2c50(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4390
movaps %xmm0, %xmm1
movsd 0x60(%rsp), %xmm0
subsd %xmm1, %xmm0
addsd 0x198(%rsp), %xmm0
movsd %xmm0, 0x198(%rsp)
movslq 0x16c(%rsp), %rsi
leaq 0x240(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8c40
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8c60
movq %rax, 0x68(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2d00, %rdi           # imm = 0x2D00
movslq 0x16c(%rsp), %rsi
callq 0x8c40
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8c60
movq %rax, %rdi
movslq 0x15c(%rsp), %rsi
callq 0x8ba0
movq 0x68(%rsp), %rdi
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movslq 0x16c(%rsp), %rsi
leaq 0x240(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x208(%rsp), %rdi
callq 0x8c60
movq %rax, %rdi
movslq 0x160(%rsp), %rsi
callq 0x8ba0
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x23e6c
movl 0x15c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x15c(%rsp)
jmp 0x23bc8
jmp 0x23e84
movl 0x160(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x160(%rsp)
jmp 0x23ba2
jmp 0x23e9c
jmp 0x23e9e
movl 0x16c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x16c(%rsp)
jmp 0x2381b
leaq 0x270(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x16330
jmp 0x23ecb
movsd 0x198(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x290(%rsp), %rax
cvtsi2sdl 0x2d18(%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
cvtsi2sdl 0x288(%rsp), %xmm0
callq 0x4390
movsd 0x38(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x40(%rsp), %xmm0
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x180(%rsp)
leaq 0x270(%rsp), %rdi
callq 0x258c0
movq %rax, 0x48(%rsp)
jmp 0x23f32
movq 0x48(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x270(%rsp), %rdi
callq 0x258f0
movq %rax, 0x30(%rsp)
jmp 0x23f53
movq 0x30(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x148(%rsp), %rdi
movq 0x140(%rsp), %rsi
callq 0x25870
movq %rax, 0x28(%rsp)
jmp 0x23f7c
movq 0x28(%rsp), %rax
movq %rax, 0x150(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x25920
movl (%rax), %eax
movl %eax, 0x17c(%rsp)
cvtsi2sdl 0x288(%rsp), %xmm0
movsd 0x38250(%rip), %xmm1    # 0x5c200
movsd %xmm1, 0x10(%rsp)
addsd %xmm1, %xmm0
callq 0x4340
movsd 0x10(%rsp), %xmm1
movsd %xmm0, 0x18(%rsp)
cvtsi2sdl 0x288(%rsp), %xmm0
cvtsi2sdl 0x17c(%rsp), %xmm2
subsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4340
movsd 0x18(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x180(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x180(%rsp)
movsd 0x170(%rsp), %xmm0
movsd 0x180(%rsp), %xmm1
callq 0x339b0
movsd %xmm0, 0x20(%rsp)
jmp 0x24029
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x170(%rsp)
jmp 0x237ac
movsd 0x170(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x290(%rsp), %rdi
addq $0x2e00, %rdi           # imm = 0x2E00
movslq 0x28c(%rsp), %rsi
callq 0x8c20
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
leaq 0x208(%rsp), %rdi
callq 0x16ac0
leaq 0x228(%rsp), %rdi
callq 0x16980
leaq 0x240(%rsp), %rdi
callq 0xc6e0
leaq 0x270(%rsp), %rdi
callq 0xc6e0
addq $0x298, %rsp            # imm = 0x298
retq
leaq 0x208(%rsp), %rdi
callq 0x16ac0
leaq 0x228(%rsp), %rdi
callq 0x16980
leaq 0x240(%rsp), %rdi
callq 0xc6e0
leaq 0x270(%rsp), %rdi
callq 0xc6e0
movq 0x260(%rsp), %rdi
callq 0x4730
nop