// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblemSlicedA.cpp
// Function: HMMProblemSlicedA::doConjugateLinearStep(FitBitSlicedA*)
NUMBER HMMProblemSlicedA::doConjugateLinearStep(FitBitSlicedA *fb) {
	NPAR i=0, j=0, m=0, z=0;
    NPAR nS = this->p->nS, nO = this->p->nO, nZ = this->p->nZ;
	// first scale down gradients
    fb->doLog10ScaleGentle(FBS_GRAD);
    
    // compute beta_gradient_direction
    NUMBER beta_grad = 0, beta_grad_num = 0, beta_grad_den = 0;
    
    switch (this->p->solver_setting) {
        case 1: // Fletcher-Reeves
            for(i=0; i<nS; i++)
            {
                if(fb->pi != NULL) {
                    beta_grad_num += fb->gradPI  [i]*fb->gradPI   [i];
                    beta_grad_den += fb->gradPIm1[i]*fb->gradPIm1[i];
                }
                if(fb->A  != NULL)
                    for(z=0; z<nZ; z++)
                        for(j=0; j<nS; j++) {
                            beta_grad_num += fb->gradA  [z][i][j]*fb->gradA  [z][i][j];
                            beta_grad_den += fb->gradAm1[z][i][j]*fb->gradAm1[z][i][j];
                        }
                if(fb->B  != NULL)
                    for(m=0; m<nO; m++) {
                        beta_grad_num += fb->gradB  [i][m]*fb->gradB  [i][m];
                        beta_grad_den += fb->gradBm1[i][m]*fb->gradBm1[i][m];
                    }
            }
            break;
        case 2: // Polak–Ribiere
            for(i=0; i<nS; i++)
            {
                if(fb->pi != NULL) {
                    beta_grad_num += -fb->gradPI  [i]*(-fb->gradPI  [i] + fb->gradPIm1[i]);
                    beta_grad_den +=  fb->gradPIm1[i]*  fb->gradPIm1[i];
                }
                if(fb->A != NULL)
                    for(z=0; z<nZ; z++)
                        for(j=0; j<nS; j++) {
                            beta_grad_num += -fb->gradA  [z][i][j]*(-fb->gradA[z][i][j] + fb->gradAm1[z][i][j]);
                            beta_grad_den +=  fb->gradAm1[z][i][j]*fb->gradAm1[z][i][j];
                        }
                if(fb->B  != NULL)
                    for(m=0; m<nO; m++) {
                        beta_grad_num += -fb->gradB  [i][j]*(-fb->gradB  [i][j] + fb->gradBm1[i][j]);
                        beta_grad_den +=  fb->gradBm1[i][m]*  fb->gradBm1[i][m];
                    }
            }
            break;
        case 3: // Hestenes-Stiefel
            for(i=0; i<nS; i++)
            {
                if(fb->pi != NULL) {
                    beta_grad_num += -fb->gradPI [i]*(-fb->gradPI[i] + fb->gradPIm1[i]);
                    beta_grad_den +=  fb->dirPIm1[i]*(-fb->gradPI[i] + fb->gradPIm1[i]);
                }
                if(fb->A  != NULL)
                    for(z=0; z<nZ; z++)
                        for(j=0; j<nS; j++) {
                            beta_grad_num += -fb->gradA [z][i][j]*(-fb->gradA[z][i][j] + fb->gradAm1[z][i][j]);
                            beta_grad_den +=  fb->dirAm1[z][i][j]*(-fb->gradA[z][i][j] + fb->gradAm1[z][i][j]);
                        }
                if(fb->B  != NULL)
                    for(m=0; m<nO; m++) {
                        beta_grad_num += -fb->gradB [i][j]*(-fb->gradB[i][j] + fb->gradBm1[i][j]);
                        beta_grad_den +=  fb->dirBm1[i][m]*(-fb->gradB[i][j] + fb->gradBm1[i][j]);
                    }
            }
            break;
        case 4: // Dai-Yuan
            for(i=0; i<nS; i++)
            {
                if(fb->pi != NULL) {
                    beta_grad_num += -fb->gradPI  [i]*fb->gradPI  [i];
                    beta_grad_den +=  fb->dirPIm1[i]*(-fb->gradPI[i] + fb->gradPIm1[i]);
                }
                if(fb->A  != NULL)
                    for(j=0; j<nS; j++)
                        for(z=0; z<nZ; z++){
                            beta_grad_num += -fb->gradA [z][i][j]*fb->gradA  [z][i][j];
                            beta_grad_den +=  fb->dirAm1[z][i][j]*(-fb->gradA[z][i][j] + fb->gradAm1[z][i][j]);
                        }
                if(fb->B  != NULL)
                    for(m=0; m<nO; m++) {
                        beta_grad_num += -fb->gradB [i][m]*fb->gradB  [i][m];
                        beta_grad_den +=  fb->dirBm1[i][m]*(-fb->gradB[i][j] + fb->gradBm1[i][j]);
                    }
            }
            break;
        default:
            fprintf(stderr,"Wrong stepping algorithm (%d) specified for Conjugate Gradient Descent\n",this->p->solver_setting);
            break;
    }
    beta_grad = beta_grad_num / safe0num(beta_grad_den);
    beta_grad = (beta_grad>=0)?beta_grad:0;
	
    // compute new direction (in place of old)
	for(i=0; i<nS; i++)
	{
        if(fb->pi != NULL) {
            fb->dirPIm1[i] = -fb->gradPI[i] + beta_grad * fb->dirPIm1[i];
        }
        if(fb->A  != NULL) {
            for(z=0; z<nZ; z++) {
                for(j=0; j<nS; j++) {
                    fb->dirAm1[z][i][j] = -fb->gradA[z][i][j] + beta_grad * fb->dirAm1[z][i][j];
                }
            }
        }
        if(fb->B  != NULL) {
            for(m=0; m<nO; m++) {
                fb->dirBm1[i][m] = -fb->gradB[i][m] + beta_grad * fb->dirBm1[i][m];
            }
        }
	}
	// scale down direction
    fb->doLog10ScaleGentle(FBS_DIRm1);
    
    fb->init(FBS_PARcopy);
    
	NUMBER e = this->p->ArmijoSeed; // step seed
	bool compliesArmijo = false;
	NUMBER f_xk = HMMProblemSlicedA::getSumLogPOPara(fb->xndat, fb->x_data);
	NUMBER f_xkplus1 = 0;
	
    fb->copy(FBS_PAR, FBS_PARcopy);
	// compute p_k * -p_k >>>> now current gradient by current direction
	NUMBER p_k_by_neg_p_k = 0;
	for(i=0; i<nS; i++)
	{
        if(fb->pi != NULL) {
            p_k_by_neg_p_k = fb->gradPI[i]*fb->dirPIm1[i];
        }
        if(fb->A  != NULL) {
            for(z=0; z<nZ; z++) {
                for(j=0; j<nS; j++) {
                    p_k_by_neg_p_k = fb->gradA[z][i][j]*fb->dirAm1[z][i][j];
                }
            }
        }
        if(fb->B  != NULL) {
            for(m=0; m<nO; m++) {
                p_k_by_neg_p_k = fb->gradB[i][m]*fb->dirBm1[i][m];
            }
        }
	}
	int iter = 0; // limit iter steps to 20, actually now 10, via ArmijoMinStep
	while( !compliesArmijo && e > this->p->ArmijoMinStep) {
		// update
		for(i=0; i<nS; i++) {
            if(fb->pi != NULL) {
                fb->pi[i] = fb->PIcopy[i] + e * fb->dirPIm1[i];
            }
            if(fb->A  != NULL) {
                for(z=0; z<nZ; z++) {
                    for(j=0; j<nS; j++) {
                        fb->A[z][i][j] = fb->Acopy[z][i][j] + e * fb->dirAm1[z][i][j];
                    }
                }
            }
            if(fb->B  != NULL) {
                for(m=0; m<nO; m++) {
                    fb->B[i][m] = fb->Bcopy[i][m] + e * fb->dirBm1[i][m];
                }
            }
		}
		// scale
		if( !this->hasNon01Constraints() ) {
            if(fb->pi != NULL) {
                projectsimplex(fb->pi, nS);
            }
            for(i=0; i<nS; i++) {
                if(fb->A != NULL) {
                    for(z=0; z<nZ; z++) {
                        projectsimplex(fb->A[z][i], nS);
                    }
                }
                if(fb->B != NULL) {
                    projectsimplex(fb->B[i], nS);
                }
			}
		} else {
            if(fb->pi != NULL) {
                projectsimplexbounded(fb->pi, this->getLbPI(), this->getUbPI(), nS);
            }
            for(i=0; i<nS; i++) {
                if(fb->A != NULL) {
                    for(z=0; z<nZ; z++) {
                        projectsimplexbounded(fb->A[z][i], this->getLbA()[z][i], this->getUbA()[z][i], nS); // tag is currently fit slice
                    }
                }
                if(fb->B != NULL) {
                    projectsimplexbounded(fb->B[i], this->getLbB()[i], this->getUbB()[i], nS);
                }
            }
		}
		// recompute alpha and p(O|param)
		computeAlphaAndPOParam(fb->xndat, fb->x_data);
		// compute f(x_{k+1})
		f_xkplus1 = HMMProblemSlicedA::getSumLogPOPara(fb->xndat, fb->x_data);
		// compute Armijo compliance
		compliesArmijo = (f_xkplus1 <= (f_xk + (this->p->ArmijoC1 * e * p_k_by_neg_p_k)));
		e /= (compliesArmijo)?1:this->p->ArmijoReduceFactor;
		iter++;
	} // armijo loop
    if(!compliesArmijo) { // failed to step away from initial, reinstate the inital parameters
        e = 0;
        fb->copy(FBS_PARcopy, FBS_PAR);
    }
    //    RecycleFitData(xndat, x_data, this->p);
    fb->destroy(FBS_PARcopy);
    return f_xkplus1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r12
movq %rdi, %rbx
movq 0x88(%rdi), %rax
movb 0x8b8(%rax), %cl
movb %cl, 0xf(%rsp)
movzbl %cl, %r13d
movzbl 0x8b9(%rax), %r15d
movzbl 0x8c8(%rax), %ebp
movq %rsi, %rdi
movl $0x3, %esi
callq 0xc742
movq 0x88(%rbx), %rax
movzbl 0x40(%rax), %eax
leal -0x1(%rax), %ecx
cmpl $0x3, %ecx
movq %r12, 0x20(%rsp)
movq %rbx, 0x10(%rsp)
ja 0x2e5b6
leaq 0x7b55(%rip), %rax      # 0x35be8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpb $0x0, 0xf(%rsp)
jle 0x2e5d1
movq 0x10(%r12), %rax
cmpq $0x0, 0x18(%r12)
sete %sil
testb %bpl, %bpl
setle %cl
cmpq $0x0, 0x20(%r12)
sete %dil
testb %r15b, %r15b
setle %dl
orb %sil, %cl
orb %dil, %dl
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorpd %xmm5, %xmm5
testq %rax, %rax
je 0x2e106
movq 0x58(%r12), %rdi
movq 0x70(%r12), %r8
movsd (%rdi,%rsi,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm5
movsd (%r8,%rsi,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
testb %cl, %cl
jne 0x2e155
movq 0x60(%r12), %rdi
movq 0x78(%r12), %r8
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
movq (%r10,%rsi,8), %r10
movq (%r8,%r9,8), %r11
movq (%r11,%rsi,8), %r11
xorl %ebx, %ebx
movsd (%r10,%rbx,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm5
movsd (%r11,%rbx,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rbx
cmpq %rbx, %r13
jne 0x2e129
incq %r9
cmpq %rbp, %r9
jne 0x2e117
testb %dl, %dl
je 0x2e160
movq 0x10(%rsp), %rbx
jmp 0x2e1a1
movq 0x68(%r12), %rdi
movq 0x80(%r12), %r8
movq (%rdi,%rsi,8), %rdi
movq (%r8,%rsi,8), %r8
xorl %r9d, %r9d
movq 0x10(%rsp), %rbx
movsd (%rdi,%r9,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm5
movsd (%r8,%r9,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %r9
cmpq %r9, %r15
jne 0x2e17d
incq %rsi
cmpq %r13, %rsi
jne 0x2e0dc
jmp 0x2e5d9
cmpb $0x0, 0xf(%rsp)
jle 0x2e5d1
cmpq $0x0, 0x18(%r12)
movq 0x10(%r12), %rax
sete %sil
testb %bpl, %bpl
setle %cl
cmpq $0x0, 0x20(%r12)
sete %dil
testb %r15b, %r15b
setle %dl
orb %sil, %cl
orb %dil, %dl
xorpd %xmm0, %xmm0
xorl %esi, %esi
movapd 0x674a(%rip), %xmm1     # 0x34940
xorpd %xmm5, %xmm5
xorl %edi, %edi
testq %rax, %rax
je 0x2e235
movq 0x58(%r12), %r8
movq 0x70(%r12), %r9
movsd (%r8,%rsi,8), %xmm2
movsd (%r9,%rsi,8), %xmm3
subsd %xmm2, %xmm3
mulsd %xmm3, %xmm2
subsd %xmm2, %xmm5
movq 0xb8(%r12), %r8
mulsd (%r8,%rsi,8), %xmm3
addsd %xmm3, %xmm0
testb %cl, %cl
jne 0x2e2aa
movq 0x60(%r12), %rdi
movq 0x78(%r12), %r8
movq 0xc0(%r12), %r9
xorl %r10d, %r10d
movq (%rdi,%r10,8), %r11
movq (%r11,%rsi,8), %r11
movq (%r8,%r10,8), %rbx
movq (%rbx,%rsi,8), %rbx
movq (%r9,%r10,8), %r14
movq (%r14,%rsi,8), %r14
xorl %r12d, %r12d
movsd (%r11,%r12,8), %xmm2
movsd (%rbx,%r12,8), %xmm3
subsd %xmm2, %xmm3
mulsd %xmm3, %xmm2
mulsd (%r14,%r12,8), %xmm3
subsd %xmm2, %xmm5
addsd %xmm3, %xmm0
incq %r12
cmpq %r12, %r13
jne 0x2e269
incq %r10
cmpq %rbp, %r10
jne 0x2e24e
movb 0xf(%rsp), %dil
movq 0x20(%rsp), %r12
movq 0x10(%rsp), %rbx
testb %dl, %dl
jne 0x2e308
movq 0x68(%r12), %r8
movq 0x80(%r12), %r9
movq (%r8,%rsi,8), %r8
movsbq %dil, %r10
movsd (%r8,%r10,8), %xmm2
movq (%r9,%rsi,8), %r8
movsd (%r8,%r10,8), %xmm3
subsd %xmm2, %xmm3
xorpd %xmm1, %xmm2
movq 0xc8(%r12), %r8
movq (%r8,%rsi,8), %r8
mulsd %xmm3, %xmm2
xorl %r9d, %r9d
addsd %xmm2, %xmm5
movsd (%r8,%r9,8), %xmm4
mulsd %xmm3, %xmm4
addsd %xmm4, %xmm0
incq %r9
cmpq %r9, %r15
jne 0x2e2ee
incq %rsi
cmpq %r13, %rsi
jne 0x2e1fc
jmp 0x2e5d9
cmpb $0x0, 0xf(%rsp)
jle 0x2e5d1
movq 0x10(%r12), %rax
movq 0x18(%r12), %rcx
cmpq $0x0, 0x20(%r12)
sete %sil
testb %r15b, %r15b
setle %dl
orb %sil, %dl
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorl %edi, %edi
xorpd %xmm5, %xmm5
xorl %r8d, %r8d
testq %rax, %rax
je 0x2e389
movq 0x58(%r12), %r9
movq 0x70(%r12), %r10
movsd (%r9,%rdi,8), %xmm1
movsd (%r10,%rdi,8), %xmm2
subsd %xmm1, %xmm2
mulsd %xmm1, %xmm1
subsd %xmm1, %xmm5
movq 0xb8(%r12), %r9
mulsd (%r9,%rdi,8), %xmm2
addsd %xmm2, %xmm0
movzbl %r8b, %r8d
testq %rcx, %rcx
cmovnel %esi, %r8d
je 0x2e406
xorl %r8d, %r8d
testb %bpl, %bpl
jle 0x2e3f4
movq 0x60(%r12), %r9
movq 0x78(%r12), %r10
movq 0xc0(%r12), %r11
xorl %ebx, %ebx
movq (%r9,%rbx,8), %r14
movq (%r14,%rdi,8), %r14
movsd (%r14,%r8,8), %xmm1
movq (%r10,%rbx,8), %r14
movq (%r14,%rdi,8), %r14
movsd (%r14,%r8,8), %xmm2
subsd %xmm1, %xmm2
mulsd %xmm1, %xmm1
movq (%r11,%rbx,8), %r14
movq (%r14,%rdi,8), %r14
mulsd (%r14,%r8,8), %xmm2
subsd %xmm1, %xmm5
addsd %xmm2, %xmm0
incq %rbx
cmpq %rbx, %rbp
jne 0x2e3b2
incq %r8
cmpq %r13, %r8
jne 0x2e399
movb 0xf(%rsp), %r8b
movq 0x10(%rsp), %rbx
testb %dl, %dl
jne 0x2e467
movq 0x68(%r12), %r9
movq 0x80(%r12), %r11
movq (%r9,%rdi,8), %r9
movq 0xc8(%r12), %r10
movq (%r10,%rdi,8), %r10
movsbq %r8b, %rbx
movq (%r11,%rdi,8), %r11
movsd (%r11,%rbx,8), %xmm1
subsd (%r9,%rbx,8), %xmm1
movq 0x10(%rsp), %rbx
xorl %r11d, %r11d
movsd (%r9,%r11,8), %xmm2
mulsd %xmm2, %xmm2
subsd %xmm2, %xmm5
movsd (%r10,%r11,8), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm2, %xmm0
incq %r11
cmpq %r11, %r15
jne 0x2e443
incq %rdi
cmpq %r13, %rdi
jne 0x2e350
jmp 0x2e5d9
cmpb $0x0, 0xf(%rsp)
jle 0x2e5d1
cmpq $0x0, 0x18(%r12)
movq 0x10(%r12), %rax
sete %sil
testb %bpl, %bpl
setle %cl
cmpq $0x0, 0x20(%r12)
sete %dil
testb %r15b, %r15b
setle %dl
orb %sil, %cl
orb %dil, %dl
xorpd %xmm0, %xmm0
xorl %esi, %esi
movapd 0x6484(%rip), %xmm1     # 0x34940
xorpd %xmm5, %xmm5
xorl %edi, %edi
testq %rax, %rax
je 0x2e4f5
movq 0x58(%r12), %r8
movq 0x70(%r12), %r9
movsd (%r8,%rsi,8), %xmm2
movsd (%r9,%rsi,8), %xmm3
movapd %xmm3, %xmm4
subsd %xmm2, %xmm4
mulsd %xmm2, %xmm4
subsd %xmm4, %xmm5
mulsd %xmm3, %xmm3
addsd %xmm3, %xmm0
testb %cl, %cl
jne 0x2e556
movq 0x60(%r12), %rdi
movq 0x78(%r12), %r8
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
movq (%r10,%rsi,8), %r10
movq (%r8,%r9,8), %r11
movq (%r11,%rsi,8), %r11
xorl %ebx, %ebx
movsd (%r10,%rbx,8), %xmm2
movsd (%r11,%rbx,8), %xmm3
movapd %xmm3, %xmm4
subsd %xmm2, %xmm4
mulsd %xmm2, %xmm4
subsd %xmm4, %xmm5
mulsd %xmm3, %xmm3
addsd %xmm3, %xmm0
incq %rbx
cmpq %rbx, %r13
jne 0x2e518
incq %r9
cmpq %rbp, %r9
jne 0x2e506
movb 0xf(%rsp), %dil
movq 0x10(%rsp), %rbx
testb %dl, %dl
jne 0x2e5a8
movq 0x68(%r12), %r8
movq 0x80(%r12), %r9
movq (%r8,%rsi,8), %r8
movsbq %dil, %r10
movsd (%r8,%r10,8), %xmm2
movq (%r9,%rsi,8), %r8
movsd (%r8,%r10,8), %xmm3
subsd %xmm2, %xmm3
xorpd %xmm1, %xmm2
mulsd %xmm3, %xmm2
xorl %r9d, %r9d
addsd %xmm2, %xmm5
movsd (%r8,%r9,8), %xmm3
mulsd %xmm3, %xmm3
addsd %xmm3, %xmm0
incq %r9
cmpq %r9, %r15
jne 0x2e58e
incq %rsi
cmpq %r13, %rsi
jne 0x2e4c2
jmp 0x2e5d9
movsbl %al, %edx
movq 0x11a18(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x71bb(%rip), %rsi      # 0x35785
xorl %eax, %eax
callq 0x4330
xorpd %xmm5, %xmm5
xorpd %xmm0, %xmm0
movapd %xmm5, 0x30(%rsp)
callq 0x8d88
cmpb $0x0, 0xf(%rsp)
jle 0x2e6f1
movapd 0x30(%rsp), %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
cmplesd %xmm1, %xmm0
andpd %xmm1, %xmm0
cmpq $0x0, 0x18(%r12)
movq 0x10(%r12), %rax
sete %sil
testb %bpl, %bpl
setle %cl
cmpq $0x0, 0x20(%r12)
sete %dil
testb %r15b, %r15b
setle %dl
orb %sil, %cl
orb %dil, %dl
xorl %esi, %esi
testq %rax, %rax
je 0x2e65a
movq 0x58(%r12), %rdi
movq 0xb8(%r12), %r8
movsd (%r8,%rsi,8), %xmm1
mulsd %xmm0, %xmm1
subsd (%rdi,%rsi,8), %xmm1
movsd %xmm1, (%r8,%rsi,8)
testb %cl, %cl
jne 0x2e6a6
movq 0x60(%r12), %rdi
movq 0xc0(%r12), %r8
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
movq (%r10,%rsi,8), %r10
movq (%r8,%r9,8), %r11
movq (%r11,%rsi,8), %r11
xorl %ebx, %ebx
movsd (%r11,%rbx,8), %xmm1
mulsd %xmm0, %xmm1
subsd (%r10,%rbx,8), %xmm1
movsd %xmm1, (%r11,%rbx,8)
incq %rbx
cmpq %rbx, %r13
jne 0x2e680
incq %r9
cmpq %rbp, %r9
jne 0x2e66e
testb %dl, %dl
jne 0x2e6e0
movq 0x68(%r12), %rdi
movq 0xc8(%r12), %r8
movq (%rdi,%rsi,8), %rdi
movq (%r8,%rsi,8), %r8
xorl %r9d, %r9d
movsd (%r8,%r9,8), %xmm1
mulsd %xmm0, %xmm1
subsd (%rdi,%r9,8), %xmm1
movsd %xmm1, (%r8,%r9,8)
incq %r9
cmpq %r9, %r15
jne 0x2e6c2
incq %rsi
cmpq %r13, %rsi
movq 0x10(%rsp), %rbx
jne 0x2e633
movq %r12, %rdi
movl $0x6, %esi
callq 0xc742
movq %r12, %rdi
movl $0x5, %esi
callq 0xc350
movq 0x88(%rbx), %rax
movsd 0x968(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movl 0xd0(%r12), %esi
movq 0xd8(%r12), %rdx
movq %rbx, %rdi
callq 0x1161c
movsd %xmm0, 0x50(%rsp)
movq %r12, %rdi
movl $0x1, %esi
movl $0x5, %edx
callq 0xc47a
xorpd %xmm2, %xmm2
cmpb $0x0, 0xf(%rsp)
jle 0x2e828
movsbq 0xf(%rsp), %rax
movq 0x10(%r12), %rcx
cmpq $0x0, 0x18(%r12)
sete %dil
testb %bpl, %bpl
setle %dl
cmpq $0x0, 0x20(%r12)
sete %r8b
testb %r15b, %r15b
setle %sil
leal -0x1(%r15), %r9d
orb %dil, %dl
orb %r8b, %sil
movsbq %r9b, %rdi
xorl %r8d, %r8d
testq %rcx, %rcx
je 0x2e7ba
movq 0x58(%r12), %r9
movq 0xb8(%r12), %r10
movsd (%r9,%r8,8), %xmm2
mulsd (%r10,%r8,8), %xmm2
testb %dl, %dl
jne 0x2e7f6
xorl %r9d, %r9d
incq %r9
cmpq %r9, %rbp
jne 0x2e7c1
movq 0x60(%r12), %r10
movq 0xc0(%r12), %r11
movq -0x8(%r10,%r9,8), %r10
movq (%r10,%r8,8), %r10
movsd -0x8(%r10,%rax,8), %xmm2
movq -0x8(%r11,%r9,8), %r9
movq (%r9,%r8,8), %r9
mulsd -0x8(%r9,%rax,8), %xmm2
testb %sil, %sil
jne 0x2e81c
movq 0x68(%r12), %r9
movq 0xc8(%r12), %r10
movq (%r9,%r8,8), %r9
movsd (%r9,%rdi,8), %xmm2
movq (%r10,%r8,8), %r9
mulsd (%r9,%rdi,8), %xmm2
incq %r8
cmpq %r13, %r8
jne 0x2e79c
movq 0x88(%rbx), %rax
movsd 0x28(%rsp), %xmm3
ucomisd 0x970(%rax), %xmm3
jbe 0x2ebb8
movq %rbp, 0x18(%rsp)
movq %r15, 0x40(%rsp)
movsd %xmm2, 0x48(%rsp)
cmpb $0x0, 0xf(%rsp)
jle 0x2e96d
testb %r15b, %r15b
setle %sil
testb %bpl, %bpl
setle %r8b
movq 0x10(%r12), %rax
movq 0x18(%r12), %rcx
testq %rcx, %rcx
sete %dl
movq 0x20(%r12), %rdi
movq %rdi, %rbx
testq %rdi, %rdi
sete %dil
orb %r8b, %dl
orb %sil, %dil
xorl %r8d, %r8d
testq %rax, %rax
je 0x2e8bf
movq 0x88(%r12), %rsi
movq 0xb8(%r12), %r9
movsd (%r9,%r8,8), %xmm0
mulsd %xmm3, %xmm0
addsd (%rsi,%r8,8), %xmm0
movsd %xmm0, (%rax,%r8,8)
testb %dl, %dl
jne 0x2e91b
movq 0x20(%rsp), %rsi
movq 0x90(%rsi), %r9
movq 0xc0(%rsi), %r10
xorl %r11d, %r11d
movq (%r9,%r11,8), %rsi
movq (%rsi,%r8,8), %r14
movq (%r10,%r11,8), %rsi
movq (%rsi,%r8,8), %r12
movq (%rcx,%r11,8), %rsi
movq (%rsi,%r8,8), %rbp
xorl %esi, %esi
movsd (%r12,%rsi,8), %xmm0
mulsd %xmm3, %xmm0
addsd (%r14,%rsi,8), %xmm0
movsd %xmm0, (%rbp,%rsi,8)
incq %rsi
cmpq %rsi, %r13
jne 0x2e8f3
incq %r11
cmpq 0x18(%rsp), %r11
jne 0x2e8d9
testb %dil, %dil
movq 0x20(%rsp), %r12
jne 0x2e961
movq 0x98(%r12), %rsi
movq 0xc8(%r12), %r10
movq (%rsi,%r8,8), %r9
movq (%r10,%r8,8), %r10
movq (%rbx,%r8,8), %r11
xorl %esi, %esi
movsd (%r10,%rsi,8), %xmm0
mulsd %xmm3, %xmm0
addsd (%r9,%rsi,8), %xmm0
movsd %xmm0, (%r11,%rsi,8)
incq %rsi
cmpq %rsi, %r15
jne 0x2e943
incq %r8
cmpq %r13, %r8
jne 0x2e894
movsd %xmm3, 0x28(%rsp)
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x114a8
movsbl 0xf(%rsp), %ebp
testb %al, %al
movl %ebp, 0x30(%rsp)
je 0x2eaa1
movq 0x10(%r12), %r12
testq %r12, %r12
je 0x2e9be
movq %rbx, %rdi
callq 0x11516
movq %rax, %r14
movq %rbx, %rdi
callq 0x1154c
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
movl %ebp, %ecx
callq 0x79f5
cmpb $0x0, 0xf(%rsp)
movq 0x20(%rsp), %r12
jle 0x2eb1b
xorl %ebp, %ebp
cmpq $0x0, 0x18(%r12)
movq %r12, %rbx
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %rax
movl $0x0, %edx
movl 0x30(%rsp), %ecx
je 0x2ea4d
testb %al, %al
jle 0x2ea4d
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
cmpb $0x0, 0x80(%r14)
movq (%rax,%r12,8), %rax
movq 0x98(%r14), %rsi
cmoveq %rdx, %rsi
movq (%rax,%rbp,8), %rdi
movq (%rsi,%r12,8), %rax
movq (%rax,%rbp,8), %rsi
movq 0xa0(%r14), %rax
cmoveq %rdx, %rax
movq (%rax,%r12,8), %rax
movq (%rax,%rbp,8), %rdx
movq %rbp, %r15
movl %ecx, %ebp
callq 0x79f5
movq 0x18(%rsp), %rax
movl %ebp, %ecx
movq %r15, %rbp
xorl %edx, %edx
incq %r12
cmpq %r12, %rax
jne 0x2e9f5
movq 0x20(%rbx), %rax
testq %rax, %rax
movq %rbx, %r12
je 0x2ea8e
movq (%rax,%rbp,8), %r14
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x1153a
movq (%rax,%rbp,8), %r12
movq %rbx, %rdi
callq 0x11570
movq (%rax,%rbp,8), %rdx
movq %r14, %rdi
movq %r12, %rsi
movq 0x20(%rsp), %r12
movl 0x30(%rsp), %ecx
callq 0x79f5
incq %rbp
cmpq %r13, %rbp
movq 0x40(%rsp), %r15
jne 0x2e9d0
jmp 0x2eb1b
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0x2eab2
movl %ebp, %esi
callq 0x692d
cmpb $0x0, 0xf(%rsp)
jle 0x2eb1b
xorl %r14d, %r14d
cmpq $0x0, 0x18(%r12)
movq %r12, %rbx
movq 0x18(%rsp), %rbp
movl 0x30(%rsp), %r15d
je 0x2eaf5
testb %bpl, %bpl
jle 0x2eaf5
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r14,8), %rdi
movl %r15d, %esi
callq 0x692d
incq %r12
cmpq %r12, %rbp
jne 0x2ead9
movq 0x20(%rbx), %rax
testq %rax, %rax
movq %rbx, %r12
je 0x2eb0e
movq (%rax,%r14,8), %rdi
movl 0x30(%rsp), %esi
callq 0x692d
incq %r14
cmpq %r13, %r14
movq 0x40(%rsp), %r15
jne 0x2eabc
movl 0xd0(%r12), %esi
movq 0xd8(%r12), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x2bfa8
movl 0xd0(%r12), %esi
movq 0xd8(%r12), %rdx
movq %rbx, %rdi
callq 0x1161c
movq 0x88(%rbx), %rcx
movsd 0x950(%rcx), %xmm4
movsd 0x28(%rsp), %xmm3
mulsd %xmm3, %xmm4
movsd 0x48(%rsp), %xmm2
mulsd %xmm2, %xmm4
addsd 0x50(%rsp), %xmm4
ucomisd %xmm0, %xmm4
setae %al
movsd 0x5d68(%rip), %xmm1     # 0x348f0
jae 0x2eb92
movsd 0x960(%rcx), %xmm1
ucomisd %xmm0, %xmm4
movq 0x18(%rsp), %rbp
jae 0x2ebdc
divsd %xmm1, %xmm3
movq 0x88(%rbx), %rcx
ucomisd 0x970(%rcx), %xmm3
ja 0x2e853
jmp 0x2ebbe
xorpd %xmm0, %xmm0
xorl %eax, %eax
movsd %xmm0, 0x18(%rsp)
testb %al, %al
jne 0x2ebe2
movq %r12, %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0xc47a
jmp 0x2ebe2
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movl $0x5, %esi
callq 0xc400
movsd 0x18(%rsp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq