// File: /workspace/github_cpp_makefile_star2_O2/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::doConjugateLinearStepBig(FitBit**, int)
NUMBER HMMProblem::doConjugateLinearStepBig(FitBit **fbs, NCAT nfbs) {
	NPAR i=0, j=0, m=0;
    NPAR nS = this->p->nS, nO = this->p->nO;
    NCAT q=0;
    
    // compute beta_gradient_direction
    NUMBER beta_grad = 0, beta_grad_num = 0, beta_grad_den = 0;

    for(q=0;q<nfbs;q++) {
	// first scale down gradients
        fbs[q]->doLog10ScaleGentleByRow(FBS_GRAD);
    
        
        switch (this->p->solver_setting) {
            case 1: // Fletcher-Reeves
                for(i=0; i<nS; i++)
                {
                    if(fbs[q]->pi != NULL) {
                        beta_grad_num += fbs[q]->gradPI  [i]*fbs[q]->gradPI  [i];
                        beta_grad_den += fbs[q]->gradPIm1[i]*fbs[q]->gradPIm1[i];
                    }
                    if(fbs[q]->A  != NULL)
                        for(j=0; j<nS; j++) {
                            beta_grad_num += fbs[q]->gradA  [i][j]*fbs[q]->gradA  [i][j];
                            beta_grad_den += fbs[q]->gradAm1[i][j]*fbs[q]->gradAm1[i][j];
                        }
                    if(fbs[q]->B  != NULL)
                        for(m=0; m<nO; m++) {
                            beta_grad_num += fbs[q]->gradB  [i][m]*fbs[q]->gradB  [i][m];
                            beta_grad_den += fbs[q]->gradBm1[i][m]*fbs[q]->gradBm1[i][m];
                        }
                }
                break;
            case 2: // Polak–Ribiere
                for(i=0; i<nS; i++)
                {
                    if(fbs[q]->pi != NULL) {
                        beta_grad_num += -fbs[q]->gradPI[i]*(-fbs[q]->gradPI[i] + fbs[q]->gradPIm1[i]);
                        beta_grad_den +=  fbs[q]->gradPIm1[i]*fbs[q]->gradPIm1[i];
                    }
                    if(fbs[q]->A != NULL)
                        for(j=0; j<nS; j++) {
                            beta_grad_num += -fbs[q]->gradA[i][j]*(-fbs[q]->gradA[i][j] + fbs[q]->gradAm1[i][j]);
                            beta_grad_den +=  fbs[q]->gradAm1[i][j]*fbs[q]->gradAm1[i][j];
                        }
                    if(fbs[q]->B  != NULL)
                        for(m=0; m<nO; m++) {
                            beta_grad_num += -fbs[q]->gradB[i][j]*(-fbs[q]->gradB[i][j] + fbs[q]->gradBm1[i][j]);
                            beta_grad_den +=  fbs[q]->gradBm1[i][m]*fbs[q]->gradBm1[i][m];
                        }
                }
                break;
            case 3: // Hestenes-Stiefel
                for(i=0; i<nS; i++)
                {
                    if(fbs[q]->pi != NULL) {
                        beta_grad_num += -fbs[q]->gradPI[i]*( -fbs[q]->gradPI[i] + fbs[q]->gradPIm1[i]);
                        beta_grad_den +=  fbs[q]->dirPIm1[i]*(-fbs[q]->gradPI[i] + fbs[q]->gradPIm1[i]);
                    }
                    if(fbs[q]->A  != NULL)
                        for(j=0; j<nS; j++) {
                            beta_grad_num += -fbs[q]->gradA[i][j]*( -fbs[q]->gradA[i][j] + fbs[q]->gradAm1[i][j]);
                            beta_grad_den +=  fbs[q]->dirAm1[i][j]*(-fbs[q]->gradA[i][j] + fbs[q]->gradAm1[i][j]);
                        }
                    if(fbs[q]->B  != NULL)
                        for(m=0; m<nO; m++) {
                            beta_grad_num += -fbs[q]->gradB[i][j]*( -fbs[q]->gradB[i][j] + fbs[q]->gradBm1[i][j]);
                            beta_grad_den +=  fbs[q]->dirBm1[i][m]*(-fbs[q]->gradB[i][j] + fbs[q]->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(fbs[q]->pi != NULL) fbs[q]->dirPIm1[i] = -fbs[q]->gradPI[i] + beta_grad * fbs[q]->dirPIm1[i];
            if(fbs[q]->A  != NULL) for(j=0; j<nS; j++) fbs[q]->dirAm1[i][j] = -fbs[q]->gradA[i][j] + beta_grad * fbs[q]->dirAm1[i][j];
            if(fbs[q]->B  != NULL) for(m=0; m<nO; m++) fbs[q]->dirBm1[i][m] = -fbs[q]->gradB[i][m] + beta_grad * fbs[q]->dirBm1[i][m];
        }
        // scale down direction
        fbs[q]->doLog10ScaleGentleByRow(FBS_DIRm1);
        
        fbs[q]->init(FBS_PARcopy);
    }// all fbs
        
	NUMBER e = this->p->ArmijoSeed; // step seed
	bool compliesArmijo = false;
	NUMBER f_xk = HMMProblem::getSumLogPOPara(this->p->nSeq, this->p->k_data);
	NUMBER f_xkplus1 = 0;
	
	NUMBER p_k_by_neg_p_k = 0;
    for(q=0;q<nfbs;q++) {
        fbs[q]->copy(FBS_PAR, FBS_PARcopy);
        // compute p_k * -p_k >>>> now current gradient by current direction
        for(i=0; i<nS; i++)
        {
            if(fbs[q]->pi != NULL) p_k_by_neg_p_k = fbs[q]->gradPI[i]*fbs[q]->dirPIm1[i];
            if(fbs[q]->A  != NULL) for(j=0; j<nS; j++) p_k_by_neg_p_k = fbs[q]->gradA[i][j]*fbs[q]->dirAm1[i][j];
            if(fbs[q]->B  != NULL) for(m=0; m<nO; m++) p_k_by_neg_p_k = fbs[q]->gradB[i][m]*fbs[q]->dirBm1[i][m];
        }
    }
    
	int iter = 0; // limit iter steps to 20, actually now 10, via ArmijoMinStep
	while( !compliesArmijo && e > this->p->ArmijoMinStep) {
        for(q=0;q<nfbs;q++) {
            // update
            for(i=0; i<nS; i++) {
                if(fbs[q]->pi != NULL) fbs[q]->pi[i] = fbs[q]->PIcopy[i] + e * fbs[q]->dirPIm1[i];
                if(fbs[q]->A  != NULL)
                    for(j=0; j<nS; j++)
                        fbs[q]->A[i][j] = fbs[q]->Acopy[i][j] + e * fbs[q]->dirAm1[i][j];
                if(fbs[q]->B  != NULL)
                    for(m=0; m<nO; m++)
                        fbs[q]->B[i][m] = fbs[q]->Bcopy[i][m] + e * fbs[q]->dirBm1[i][m];
            }
            // scale
            if( !this->hasNon01Constraints() || fbs[q]->observe_non01_boundaries==0 ) {
                if(fbs[q]->pi != NULL) projectsimplex(fbs[q]->pi, nS);
                for(i=0; i<nS; i++) {
                    if(fbs[q]->A != NULL) projectsimplex(fbs[q]->A[i], nS);
                    if(fbs[q]->B != NULL) projectsimplex(fbs[q]->B[i], nO);
                }
            } else {
                if(fbs[q]->pi != NULL) projectsimplexbounded(fbs[q]->pi, this->getLbPI(), this->getUbPI(), nS);
                for(i=0; i<nS; i++) {
                    if(fbs[q]->A != NULL) projectsimplexbounded(fbs[q]->A[i], this->getLbA()[i], this->getUbA()[i], nS);
                    if(fbs[q]->B != NULL) projectsimplexbounded(fbs[q]->B[i], this->getLbB()[i], this->getUbB()[i], nO);
                }
            }
        }
		// recompute alpha and p(O|param)
		computeAlphaAndPOParam(this->p->nSeq, this->p->k_data);
		// compute f(x_{k+1})
		f_xkplus1 = HMMProblem::getSumLogPOPara(this->p->nSeq, this->p->k_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;
        for(q=0;q<nfbs;q++) fbs[q]->copy(FBS_PARcopy, FBS_PAR);
    }
    //    RecycleFitData(xndat, x_data, this->p);
    return f_xkplus1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, 0x28(%rsp)
movq 0x88(%rdi), %rax
movl 0x8b8(%rax), %r12d
movzbl 0x8b9(%rax), %esi
xorl %eax, %eax
testb %r12b, %r12b
movl %r12d, 0x44(%rsp)
cmovlel %eax, %r12d
movl $0xff, %ecx
movl %r12d, %r13d
andl %ecx, %r13d
testb %sil, %sil
movl %esi, 0xc(%rsp)
movl %esi, %ebx
cmovlel %eax, %ebx
testl %edx, %edx
cmovlel %eax, %edx
movq %rdx, 0x30(%rsp)
andl %ecx, %ebx
xorpd %xmm0, %xmm0
xorl %eax, %eax
xorl %ebp, %ebp
cmpq 0x30(%rsp), %rax
je 0x133aa
movapd %xmm0, 0x10(%rsp)
movq %rax, %r15
movq (%r14,%rax,8), %rdi
pushq $0x3
popq %rsi
callq 0x8f0e
movq 0x28(%rsp), %rax
movq 0x88(%rax), %rax
movzbl 0x40(%rax), %eax
cmpl $0x1, %eax
je 0x130e1
cmpl $0x2, %eax
movapd 0x10(%rsp), %xmm3
je 0x13192
cmpl $0x3, %eax
movapd 0x19967(%rip), %xmm2    # 0x2c940
jne 0x13289
movq %r15, %r9
xorl %eax, %eax
cmpq %r13, %rax
je 0x132aa
movq (%r14,%r9,8), %rcx
cmpq $0x0, 0x10(%rcx)
je 0x1302a
movq 0x58(%rcx), %rdx
movq 0x70(%rcx), %rsi
movsd (%rdx,%rax,8), %xmm0
movsd (%rsi,%rax,8), %xmm1
subsd %xmm0, %xmm1
xorpd %xmm2, %xmm0
movq 0xd0(%rcx), %rdx
movhpd (%rdx,%rax,8), %xmm0    # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
addpd %xmm1, %xmm3
cmpq $0x0, 0x18(%rcx)
je 0x1307e
xorl %edx, %edx
cmpq %rdx, %r13
je 0x1307b
movq 0x60(%rcx), %rsi
movq 0x78(%rcx), %rdi
movq (%rsi,%rax,8), %rsi
movsd (%rsi,%rdx,8), %xmm0
movq (%rdi,%rax,8), %rsi
movsd (%rsi,%rdx,8), %xmm1
subsd %xmm0, %xmm1
xorpd %xmm2, %xmm0
movq 0xd8(%rcx), %rsi
movq (%rsi,%rax,8), %rsi
movhpd (%rsi,%rdx,8), %xmm0    # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
addpd %xmm1, %xmm3
incq %rdx
jmp 0x13033
movl %r12d, %ebp
cmpq $0x0, 0x20(%rcx)
je 0x130d9
movzbl %bpl, %edx
shll $0x3, %edx
xorl %esi, %esi
cmpq %rsi, %rbx
je 0x130d9
movq 0x68(%rcx), %rdi
movq 0x80(%rcx), %r8
movq (%rdi,%rax,8), %rdi
movsd (%rdi,%rdx), %xmm0
movq (%r8,%rax,8), %rdi
movsd (%rdi,%rdx), %xmm1
subsd %xmm0, %xmm1
xorpd %xmm2, %xmm0
movq 0xe0(%rcx), %rdi
movq (%rdi,%rax,8), %rdi
movhpd (%rdi,%rsi,8), %xmm0    # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
addpd %xmm1, %xmm3
incq %rsi
jmp 0x1308e
incq %rax
jmp 0x12fe4
xorl %eax, %eax
movapd 0x10(%rsp), %xmm3
movq %r15, %r8
cmpq %r13, %rax
je 0x132aa
movq (%r14,%r8,8), %rcx
cmpq $0x0, 0x10(%rcx)
je 0x1311a
movq 0x58(%rcx), %rdx
movq 0x70(%rcx), %rsi
movsd (%rdx,%rax,8), %xmm0
movhpd (%rsi,%rax,8), %xmm0    # xmm0 = xmm0[0],mem[0]
mulpd %xmm0, %xmm0
addpd %xmm0, %xmm3
cmpq $0x0, 0x18(%rcx)
je 0x13152
xorl %edx, %edx
cmpq %rdx, %r13
je 0x1314f
movq 0x60(%rcx), %rsi
movq 0x78(%rcx), %rdi
movq (%rsi,%rax,8), %rsi
movq (%rdi,%rax,8), %rdi
movsd (%rsi,%rdx,8), %xmm0
movhpd (%rdi,%rdx,8), %xmm0    # xmm0 = xmm0[0],mem[0]
mulpd %xmm0, %xmm0
addpd %xmm0, %xmm3
incq %rdx
jmp 0x13123
movl %r12d, %ebp
cmpq $0x0, 0x20(%rcx)
je 0x1318a
xorl %edx, %edx
cmpq %rdx, %rbx
je 0x1318a
movq 0x68(%rcx), %rsi
movq 0x80(%rcx), %rdi
movq (%rsi,%rax,8), %rsi
movq (%rdi,%rax,8), %rdi
movsd (%rsi,%rdx,8), %xmm0
movhpd (%rdi,%rdx,8), %xmm0    # xmm0 = xmm0[0],mem[0]
mulpd %xmm0, %xmm0
addpd %xmm0, %xmm3
incq %rdx
jmp 0x1315b
incq %rax
jmp 0x130ec
xorl %eax, %eax
movapd 0x197a4(%rip), %xmm4    # 0x2c940
movq %r15, %r9
cmpq %r13, %rax
je 0x132aa
movq (%r14,%r9,8), %rcx
cmpq $0x0, 0x10(%rcx)
je 0x131e1
movq 0x58(%rcx), %rdx
movq 0x70(%rcx), %rsi
movsd (%rdx,%rax,8), %xmm0
movsd (%rsi,%rax,8), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
xorpd %xmm4, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
mulpd %xmm0, %xmm2
addpd %xmm2, %xmm3
cmpq $0x0, 0x18(%rcx)
je 0x1322d
xorl %edx, %edx
cmpq %rdx, %r13
je 0x1322a
movq 0x60(%rcx), %rsi
movq 0x78(%rcx), %rdi
movq (%rsi,%rax,8), %rsi
movsd (%rsi,%rdx,8), %xmm0
movq (%rdi,%rax,8), %rsi
movsd (%rsi,%rdx,8), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
xorpd %xmm4, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
mulpd %xmm0, %xmm2
addpd %xmm2, %xmm3
incq %rdx
jmp 0x131ea
movl %r12d, %ebp
cmpq $0x0, 0x20(%rcx)
je 0x13281
movzbl %bpl, %edx
shll $0x3, %edx
xorl %esi, %esi
cmpq %rsi, %rbx
je 0x13281
movq 0x68(%rcx), %rdi
movq 0x80(%rcx), %r8
movq (%rdi,%rax,8), %rdi
movsd (%rdi,%rdx), %xmm0
movq (%r8,%rax,8), %rdi
movsd (%rdi,%rdx), %xmm1
subsd %xmm0, %xmm1
xorpd %xmm4, %xmm0
movsd (%rdi,%rsi,8), %xmm2
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
mulpd %xmm0, %xmm1
addpd %xmm1, %xmm3
incq %rsi
jmp 0x1323d
incq %rax
jmp 0x1319f
movsbl %al, %edx
movq 0x25d45(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
leaq 0x1a578(%rip), %rsi     # 0x2d815
xorl %eax, %eax
callq 0x4350
movapd 0x10(%rsp), %xmm3
movapd %xmm3, 0x10(%rsp)
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
callq 0x67cb
movapd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
cmplesd %xmm1, %xmm0
andpd %xmm1, %xmm0
movq (%r14,%r15,8), %rdi
xorl %eax, %eax
cmpq %r13, %rax
je 0x13385
cmpq $0x0, 0x10(%rdi)
je 0x13308
movq 0x58(%rdi), %rcx
movq 0xd0(%rdi), %rdx
movsd (%rdx,%rax,8), %xmm1
mulsd %xmm0, %xmm1
subsd (%rcx,%rax,8), %xmm1
movsd %xmm1, (%rdx,%rax,8)
cmpq $0x0, 0x18(%rdi)
je 0x13344
xorl %ecx, %ecx
cmpq %rcx, %r13
je 0x13341
movq 0x60(%rdi), %rdx
movq 0xd8(%rdi), %rsi
movq (%rdx,%rax,8), %rdx
movq (%rsi,%rax,8), %rsi
movsd (%rsi,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
subsd (%rdx,%rcx,8), %xmm1
movsd %xmm1, (%rsi,%rcx,8)
incq %rcx
jmp 0x13311
movl %r12d, %ebp
cmpq $0x0, 0x20(%rdi)
je 0x1337d
xorl %ecx, %ecx
cmpq %rcx, %rbx
je 0x1337d
movq 0x68(%rdi), %rdx
movq 0xe0(%rdi), %rsi
movq (%rdx,%rax,8), %rdx
movq (%rsi,%rax,8), %rsi
movsd (%rsi,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
subsd (%rdx,%rcx,8), %xmm1
movsd %xmm1, (%rsi,%rcx,8)
incq %rcx
jmp 0x1334d
incq %rax
jmp 0x132da
pushq $0x6
popq %rsi
callq 0x8f0e
movq (%r14,%r15,8), %rdi
pushq $0x5
popq %rsi
callq 0x878c
movq %r15, %rax
movapd 0x10(%rsp), %xmm0
incq %rax
jmp 0x12f86
movq 0x28(%rsp), %rax
movq 0x88(%rax), %rax
movsd 0x968(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x8dc(%rax), %esi
movq 0x8f0(%rax), %rdx
callq 0xe400
movsd 0x10(%rsp), %xmm1
movsd %xmm0, 0x50(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
xorl %r15d, %r15d
pushq $0x1
popq %rbp
pushq $0x5
popq %r12
cmpq 0x30(%rsp), %r15
je 0x134bc
movq (%r14,%r15,8), %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x88b6
xorl %eax, %eax
movsd 0x38(%rsp), %xmm0
cmpq %r13, %rax
je 0x134a8
movq (%r14,%r15,8), %rcx
cmpq $0x0, 0x10(%rcx)
je 0x13440
movq 0x58(%rcx), %rdx
movq 0xd0(%rcx), %rsi
movsd (%rdx,%rax,8), %xmm0
mulsd (%rsi,%rax,8), %xmm0
cmpq $0x0, 0x18(%rcx)
je 0x13470
xorl %edx, %edx
cmpq %rdx, %r13
je 0x13470
movq 0x60(%rcx), %rsi
movq 0xd8(%rcx), %rdi
movq (%rsi,%rax,8), %rsi
movsd (%rsi,%rdx,8), %xmm0
movq (%rdi,%rax,8), %rsi
mulsd (%rsi,%rdx,8), %xmm0
incq %rdx
jmp 0x13449
cmpq $0x0, 0x20(%rcx)
je 0x134a0
xorl %edx, %edx
cmpq %rdx, %rbx
je 0x134a0
movq 0x68(%rcx), %rsi
movq 0xe0(%rcx), %rdi
movq (%rsi,%rax,8), %rsi
movsd (%rsi,%rdx,8), %xmm0
movq (%rdi,%rax,8), %rsi
mulsd (%rsi,%rdx,8), %xmm0
incq %rdx
jmp 0x13479
incq %rax
jmp 0x13417
movsd %xmm0, 0x38(%rsp)
incq %r15
movsd 0x10(%rsp), %xmm1
jmp 0x133f6
xorpd %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
movsbl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movsbl 0x44(%rsp), %r12d
xorl %eax, %eax
testb $0x1, %al
jne 0x137cf
movq 0x28(%rsp), %rax
movq 0x88(%rax), %rax
ucomisd 0x970(%rax), %xmm1
jbe 0x137ac
xorl %r15d, %r15d
movsd %xmm1, 0x10(%rsp)
cmpq 0x30(%rsp), %r15
je 0x13729
xorl %eax, %eax
cmpq %r13, %rax
je 0x135d4
movq (%r14,%r15,8), %rcx
movq 0x10(%rcx), %rdx
testq %rdx, %rdx
je 0x13546
movq 0xa0(%rcx), %rsi
movq 0xd0(%rcx), %rdi
movsd (%rdi,%rax,8), %xmm0
mulsd %xmm1, %xmm0
addsd (%rsi,%rax,8), %xmm0
movsd %xmm0, (%rdx,%rax,8)
movq 0x18(%rcx), %rdx
testq %rdx, %rdx
je 0x13589
xorl %esi, %esi
cmpq %rsi, %r13
je 0x13589
movq 0xa8(%rcx), %rdi
movq 0xd8(%rcx), %r8
movq (%rdi,%rax,8), %rdi
movq (%r8,%rax,8), %r8
movsd (%r8,%rsi,8), %xmm0
mulsd %xmm1, %xmm0
addsd (%rdi,%rsi,8), %xmm0
movq (%rdx,%rax,8), %rdi
movsd %xmm0, (%rdi,%rsi,8)
incq %rsi
jmp 0x13551
movq 0x20(%rcx), %rdx
testq %rdx, %rdx
je 0x135cc
xorl %esi, %esi
cmpq %rsi, %rbx
je 0x135cc
movq 0xb0(%rcx), %rdi
movq 0xe0(%rcx), %r8
movq (%rdi,%rax,8), %rdi
movq (%r8,%rax,8), %r8
movsd (%r8,%rsi,8), %xmm0
mulsd %xmm1, %xmm0
addsd (%rdi,%rsi,8), %xmm0
movq (%rdx,%rax,8), %rdi
movsd %xmm0, (%rdi,%rsi,8)
incq %rsi
jmp 0x13594
incq %rax
jmp 0x1350f
movq (%r14,%r15,8), %rax
movq 0x28(%rsp), %rcx
cmpb $0x1, 0x80(%rcx)
jne 0x136bf
cmpb $0x0, 0xf9(%rax)
je 0x136bf
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1361b
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rsi
movq 0x68(%rax), %rdx
movl %r12d, %ecx
callq 0x5d80
movsd 0x10(%rsp), %xmm1
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x13721
movq (%r14,%r15,8), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x13672
movq (%rcx,%rbp,8), %rdi
movq 0x28(%rsp), %rcx
cmpb $0x0, 0x80(%rcx)
movq 0x58(%rcx), %rax
movl $0x0, %edx
cmoveq %rdx, %rax
movq (%rax,%rbp,8), %rsi
movq 0x70(%rcx), %rax
cmoveq %rdx, %rax
movq (%rax,%rbp,8), %rdx
movl %r12d, %ecx
callq 0x5d80
movsd 0x10(%rsp), %xmm1
movq (%r14,%r15,8), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x136b7
movq (%rax,%rbp,8), %rdi
movq 0x28(%rsp), %rcx
cmpb $0x0, 0x80(%rcx)
movq 0x60(%rcx), %rax
movl $0x0, %edx
cmoveq %rdx, %rax
movq (%rax,%rbp,8), %rsi
movq 0x78(%rcx), %rax
cmoveq %rdx, %rax
movq (%rax,%rbp,8), %rdx
movl 0xc(%rsp), %ecx
callq 0x5d80
movsd 0x10(%rsp), %xmm1
incq %rbp
jmp 0x1361d
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x136d6
movl %r12d, %esi
callq 0x5600
movsd 0x10(%rsp), %xmm1
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x13721
movq (%r14,%r15,8), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x13700
movq (%rcx,%rbp,8), %rdi
movl %r12d, %esi
callq 0x5600
movsd 0x10(%rsp), %xmm1
movq (%r14,%r15,8), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x1371c
movq (%rax,%rbp,8), %rdi
movl 0xc(%rsp), %esi
callq 0x5600
movsd 0x10(%rsp), %xmm1
incq %rbp
jmp 0x136d8
incq %r15
jmp 0x13502
movq 0x28(%rsp), %r15
movq 0x88(%r15), %rax
movl 0x8dc(%rax), %esi
movq 0x8f0(%rax), %rdx
movq %r15, %rdi
callq 0xe7b0
movq 0x88(%r15), %r15
movl 0x8dc(%r15), %esi
movq 0x8f0(%r15), %rdx
callq 0xe400
movsd 0x10(%rsp), %xmm1
movsd 0x950(%r15), %xmm2
mulsd %xmm1, %xmm2
mulsd 0x38(%rsp), %xmm2
addsd 0x50(%rsp), %xmm2
movsd %xmm0, 0x48(%rsp)
ucomisd %xmm0, %xmm2
setae %al
movsd 0x19158(%rip), %xmm0    # 0x2c8f0
jae 0x137a3
movsd 0x960(%r15), %xmm0
divsd %xmm0, %xmm1
jmp 0x134d7
xorl %ebx, %ebx
pushq $0x5
popq %rbp
pushq $0x1
popq %r15
cmpq %rbx, 0x30(%rsp)
je 0x137cf
movq (%r14,%rbx,8), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x88b6
incq %rbx
jmp 0x137b5
movsd 0x48(%rsp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq