// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::doLinearStep(FitBit*)
NUMBER HMMProblem::doLinearStep(FitBit *fb) {
	NPAR i,j,m;
    NPAR nS = fb->nS, nO = this->p->nO;
    fb->doLog10ScaleGentleByRow(FBS_GRAD);
	
    NCAT xndat = fb->xndat;
    struct data **x_data = fb->x_data;
    fb->init(FBS_PARcopy);
    fb->init(FBS_GRADcopy);
    
	NUMBER e = this->p->ArmijoSeed; // step seed
	bool compliesArmijo = false;
	bool compliesWolfe2 = false; // second wolfe condition is turned on, if satisfied - honored, if not, just the 1st is used
    NUMBER e_Armijo = -1; // e (step size) at which Armijo (Wolfe 1) criterion is satisfied, 'cos both criterions are sometimes not met.
    NUMBER f_xkplus1_Armijo = 0; // f_xkplus1_Armijo at which Armijo (Wolfe 1) criterion is satisfied, 'cos both criterions are sometimes not met.
	NUMBER f_xk = HMMProblem::getSumLogPOPara(xndat, x_data);
	NUMBER f_xkplus1 = 0;
	
    fb->copy(FBS_PAR, FBS_PARcopy); // save original parameters
    fb->copy(FBS_GRAD, FBS_GRADcopy); // save original gradient
	// compute p_k * -p_k
	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->gradPI[i];
		if(fb->A  != NULL) for(j=0; j<nS; j++) p_k_by_neg_p_k -= fb->gradA[i][j]*fb->gradA[i][j];
		if(fb->B  != NULL) for(m=0; m<nO; m++) p_k_by_neg_p_k -= fb->gradB[i][m]*fb->gradB[i][m];
	}
    
	int iter = 0; // limit iter steps to 20, via ArmijoMinStep (now 10)
    while( !(compliesArmijo && compliesWolfe2) && e > this->p->ArmijoMinStep) {
		// update
		for(i=0; i<nS; i++) {
            if(fb->pi != NULL) {
                fb->pi[i] = fb->PIcopy[i] - e * fb->gradPIcopy[i];
                if( (fb->pi[i]<0 || fb->pi[i] >1) && (fb->pi[i] > 0) && (fb->pi[i] < 1) ) {
                    fprintf(stderr, "ERROR! pi value is not within [0, 1] range!\n");
                }
            }
            
            if(fb->A  != NULL)
                for(j=0; j<nS; j++) {
                    fb->A[i][j] = fb->Acopy[i][j] - e * fb->gradAcopy[i][j];
                    if( (fb->A[i][j]<0 || fb->A[i][j] >1) && (fb->A[i][j] > 0) && (fb->A[i][j] < 1) ) {
                        fprintf(stderr, "ERROR! A value is not within [0, 1] range!\n");
                    }
                }
            
            if(fb->B  != NULL)
                for(m=0; m<nO; m++) {
                    fb->B[i][m] = fb->Bcopy[i][m] - e * fb->gradBcopy[i][m];
                    if( (fb->B[i][m]<0 || fb->B[i][m] >1) && (fb->B[i][m] > 0) && (fb->B[i][m] < 1) ) {
                        fprintf(stderr, "ERROR! B value is not within [0, 1] range!\n");
                    }
                }
		}
        // project parameters to simplex if needs be
        if(fb->projecttosimplex==1) {
            // scale
            if( !this->hasNon01Constraints() || fb->observe_non01_boundaries==0 ) {
                if(fb->pi != NULL) projectsimplex(fb->pi, nS);
                for(i=0; i<nS; i++) {
                    if(fb->A  != NULL) projectsimplex(fb->A[i], nS);
                    if(fb->B  != NULL) projectsimplex(fb->B[i], nO);
                }
            } else {
                if(fb->pi != NULL) projectsimplexbounded(fb->pi, this->getLbPI(), this->getUbPI(), nS);
                for(i=0; i<nS; i++) {
                    if(fb->A  != NULL) projectsimplexbounded(fb->A[i], this->getLbA()[i], this->getUbA()[i], nS);
                    if(fb->B  != NULL) projectsimplexbounded(fb->B[i], this->getLbB()[i], this->getUbB()[i], nO);
                }
            }
        }
        
		// recompute alpha and p(O|param)
		computeAlphaAndPOParam(xndat, x_data);
		// compute f(x_{k+1})
		f_xkplus1 = HMMProblem::getSumLogPOPara(xndat, x_data);
		// compute Armijo compliance
		compliesArmijo = (f_xkplus1 <= (f_xk + (this->p->ArmijoC1 * e * p_k_by_neg_p_k)));
        
        // compute Wolfe 2
        NUMBER p_k_by_neg_p_kp1 = 0;
        // NDAT ndat = computeGradients(fb);
        fb->doLog10ScaleGentleByRow(FBS_GRAD);
        for(i=0; i<nS; i++)
        {
            if(fb->pi != NULL) p_k_by_neg_p_kp1 -= fb->gradPIcopy[i]*fb->gradPI[i];
            if(fb->A  != NULL) for(j=0; j<nS; j++) p_k_by_neg_p_kp1 -= fb->gradAcopy[i][j]*fb->gradA[i][j];
            if(fb->B  != NULL) for(m=0; m<nO; m++) p_k_by_neg_p_kp1 -= fb->gradBcopy[i][m]*fb->gradB[i][m];
        }
        compliesWolfe2 = (p_k_by_neg_p_kp1 >= this->p->ArmijoC2 * p_k_by_neg_p_k);
        
        if( compliesArmijo && e_Armijo==-1 ){
            e_Armijo = e; // save the first time Armijo is statisfied, in case we'll roll back to it when Wolfe 2 is finnaly not satisfied
            f_xkplus1_Armijo = f_xkplus1;
        }
        
		e /= (compliesArmijo && compliesWolfe2)?1:this->p->ArmijoReduceFactor;
		iter++;
	} // armijo loop
    
//    fb->copy(FBS_GRADcopy, FBS_GRAD); // return the original gradient in its place // unnecessary
    
    if(!compliesArmijo) { // we couldn't step away from current, copy the inital point back
        e = 0;
        fb->copy(FBS_PARcopy, FBS_PAR);
        f_xkplus1 = f_xk;
    } else if(compliesArmijo && !compliesWolfe2) { // we couldn't step away from current, copy the inital point back
        e = e_Armijo; // return the first Armijo-compliant e
        f_xkplus1 = f_xkplus1_Armijo; // return the first Armijo-compliant f_xkplus1
        // create new versions of FBS_PAR using e_Armijo as a step
        fb->copy(FBS_GRADcopy, FBS_GRAD); // return the old gradient
        // update
        for(i=0; i<nS; i++) {
            if(fb->pi != NULL) {
                fb->pi[i] = fb->PIcopy[i] - e * fb->gradPIcopy[i];
                if( (fb->pi[i]<0 || fb->pi[i] >1) && (fb->pi[i] > 0) && (fb->pi[i] < 1) ) {
                    fprintf(stderr, "ERROR! pi value is not within [0, 1] range!\n");
                }
            }
            if(fb->A  != NULL)
                for(j=0; j<nS; j++) {
                    fb->A[i][j] = fb->Acopy[i][j] - e * fb->gradAcopy[i][j];
                    if( (fb->A[i][j]<0 || fb->A[i][j] >1) && (fb->A[i][j] > 0) && (fb->A[i][j] < 1) ) {
                        fprintf(stderr, "ERROR! A value is not within [0, 1] range!\n");
                    }
                }
            if(fb->B  != NULL)
                for(m=0; m<nO; m++) {
                    fb->B[i][m] = fb->Bcopy[i][m] - e * fb->gradBcopy[i][m];
                    if( (fb->B[i][m]<0 || fb->B[i][m] >1) && (fb->B[i][m] > 0) && (fb->B[i][m] < 1) ) {
                        fprintf(stderr, "ERROR! B value is not within [0, 1] range!\n");
                    }
                }
        }
        // project parameters to simplex if needs be
        if(fb->projecttosimplex==1) {
            // scale
            if( !this->hasNon01Constraints() || fb->observe_non01_boundaries==0 ) {
                if(fb->pi != NULL) projectsimplex(fb->pi, nS);
                for(i=0; i<nS; i++) {
                    if(fb->A  != NULL) projectsimplex(fb->A[i], nS);
                    if(fb->B  != NULL) projectsimplex(fb->B[i], nO);
                }
            } else {
                if(fb->pi != NULL) projectsimplexbounded(fb->pi, this->getLbPI(), this->getUbPI(), nS);
                for(i=0; i<nS; i++) {
                    if(fb->A  != NULL) projectsimplexbounded(fb->A[i], this->getLbA()[i], this->getUbA()[i], nS);
                    if(fb->B  != NULL) projectsimplexbounded(fb->B[i], this->getLbB()[i], this->getUbB()[i], nO);
                }
            }
        }
        // ^^^^^ end of create new versions of FBS_PAR using e_Armijo as a step
    }
    fb->destroy(FBS_PARcopy);
    fb->destroy(FBS_GRADcopy);
    return f_xkplus1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x1(%rsi), %r13d
movq 0x88(%rdi), %rax
movzbl 0x8b9(%rax), %ebp
movq %rsi, %rdi
movl $0x3, %esi
callq 0xb70e
movl 0xe8(%rbx), %r15d
movq 0xf0(%rbx), %r12
movq %rbx, %rdi
movl $0x5, %esi
callq 0xaf10
movq %rbx, %rdi
movl $0x9, %esi
callq 0xaf10
movq %r14, 0x8(%rsp)
movq 0x88(%r14), %rax
movq %r12, %r14
xorpd %xmm1, %xmm1
testl %r15d, %r15d
jle 0x182af
xorl %ecx, %ecx
movq (%r14,%rcx,8), %rdx
cmpl $0x0, 0x4(%rdx)
xorpd %xmm0, %xmm0
jne 0x182a3
movsd 0x50(%rdx), %xmm0
addsd %xmm0, %xmm1
incq %rcx
cmpq %rcx, %r15
jne 0x18290
movsd %xmm1, 0x30(%rsp)
movsd 0x968(%rax), %xmm0
movapd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
movl $0x5, %edx
callq 0xb03a
movq %rbx, %rdi
movl $0x3, %esi
movl $0x9, %edx
callq 0xb03a
xorpd %xmm1, %xmm1
testb %r13b, %r13b
jle 0x18379
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
cmpq $0x0, 0x20(%rbx)
sete %sil
testb %bpl, %bpl
setle %dl
orb %sil, %dl
xorl %esi, %esi
testq %rax, %rax
je 0x18326
movq 0x58(%rbx), %rdi
movsd (%rdi,%rsi,8), %xmm0
mulsd %xmm0, %xmm0
subsd %xmm0, %xmm1
testq %rcx, %rcx
je 0x1834c
movq 0x60(%rbx), %rdi
movq (%rdi,%rsi,8), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
mulsd %xmm0, %xmm0
subsd %xmm0, %xmm1
incq %r8
cmpq %r8, %r13
jne 0x18336
testb %dl, %dl
jne 0x18371
movq 0x68(%rbx), %rdi
movq (%rdi,%rsi,8), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
mulsd %xmm0, %xmm0
subsd %xmm0, %xmm1
incq %r8
cmpq %r8, %rbp
jne 0x1835b
incq %rsi
cmpq %r13, %rsi
jne 0x18310
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movapd 0x20(%rsp), %xmm0
ucomisd 0x970(%rax), %xmm0
jbe 0x18888
movsd 0x1b547(%rip), %xmm0    # 0x338e8
movapd %xmm0, 0x50(%rsp)
movsd 0x1b541(%rip), %xmm2    # 0x338f0
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd %xmm1, 0x40(%rsp)
xorpd %xmm1, %xmm1
movq %r14, 0x48(%rsp)
testb %r13b, %r13b
jle 0x18552
movapd 0x20(%rsp), %xmm3
xorpd 0x1b561(%rip), %xmm3    # 0x33940
xorl %r14d, %r14d
movapd %xmm3, 0x10(%rsp)
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x18431
movq 0x88(%rbx), %rcx
movq 0xa0(%rbx), %rdx
movsd (%rcx,%r14,8), %xmm0
mulsd %xmm3, %xmm0
addsd (%rdx,%r14,8), %xmm0
movsd %xmm0, (%rax,%r14,8)
ucomisd %xmm0, %xmm1
ja 0x18421
ucomisd %xmm2, %xmm0
jbe 0x18431
ucomisd %xmm1, %xmm0
jbe 0x18431
ucomisd %xmm0, %xmm2
ja 0x18536
cmpq $0x0, 0x18(%rbx)
je 0x184aa
xorl %r12d, %r12d
movq 0xa8(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x18(%rbx), %rcx
movq 0x90(%rbx), %rdx
movq (%rdx,%r14,8), %rdx
movsd (%rdx,%r12,8), %xmm0
mulsd %xmm3, %xmm0
addsd (%rax,%r12,8), %xmm0
movq (%rcx,%r14,8), %rax
movsd %xmm0, (%rax,%r12,8)
ucomisd %xmm0, %xmm1
ja 0x1847b
ucomisd %xmm2, %xmm0
jbe 0x18487
ucomisd %xmm1, %xmm0
jbe 0x18487
ucomisd %xmm0, %xmm2
ja 0x18491
incq %r12
cmpq %r12, %r13
jne 0x1843b
jmp 0x184aa
callq 0x4c97
movapd 0x10(%rsp), %xmm3
movsd 0x1b44c(%rip), %xmm2    # 0x338f0
xorpd %xmm1, %xmm1
jmp 0x18487
cmpq $0x0, 0x20(%rbx)
je 0x18528
testb %bpl, %bpl
jle 0x18528
xorl %r12d, %r12d
movq 0xb0(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x20(%rbx), %rcx
movq 0x98(%rbx), %rdx
movq (%rdx,%r14,8), %rdx
movsd (%rdx,%r12,8), %xmm0
mulsd %xmm3, %xmm0
addsd (%rax,%r12,8), %xmm0
movq (%rcx,%r14,8), %rax
movsd %xmm0, (%rax,%r12,8)
ucomisd %xmm0, %xmm1
ja 0x184f9
ucomisd %xmm2, %xmm0
jbe 0x18505
ucomisd %xmm1, %xmm0
jbe 0x18505
ucomisd %xmm0, %xmm2
ja 0x1850f
incq %r12
cmpq %r12, %rbp
jne 0x184b9
jmp 0x18528
callq 0x4cb3
movapd 0x10(%rsp), %xmm3
movsd 0x1b3ce(%rip), %xmm2    # 0x338f0
xorpd %xmm1, %xmm1
jmp 0x18505
incq %r14
cmpq %r13, %r14
jne 0x183e8
jmp 0x18552
callq 0x4c7b
movapd 0x10(%rsp), %xmm3
movsd 0x1b3a7(%rip), %xmm2    # 0x338f0
xorpd %xmm1, %xmm1
jmp 0x18431
cmpb $0x1, 0xf8(%rbx)
jne 0x18683
movq 0x8(%rsp), %rax
cmpb $0x0, 0x80(%rax)
je 0x18635
cmpb $0x0, 0xf9(%rbx)
movq 0x10(%rbx), %rdi
je 0x18639
testq %rdi, %rdi
je 0x1859d
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rsi
movq 0x68(%rax), %rdx
movsbl %r13b, %ecx
callq 0x7997
testb %r13b, %r13b
jle 0x18683
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x185e8
movq (%rax,%r14,8), %rdi
movq 0x8(%rsp), %rcx
cmpb $0x0, 0x80(%rcx)
movq 0x58(%rcx), %rax
movl $0x0, %edx
cmoveq %rdx, %rax
movq (%rax,%r14,8), %rsi
movq 0x70(%rcx), %rax
cmoveq %rdx, %rax
movq (%rax,%r14,8), %rdx
movsbl %r13b, %ecx
callq 0x7997
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x18627
movq (%rax,%r14,8), %rdi
movq 0x8(%rsp), %rcx
cmpb $0x0, 0x80(%rcx)
movq 0x60(%rcx), %rax
movl $0x0, %edx
cmoveq %rdx, %rax
movq (%rax,%r14,8), %rsi
movq 0x78(%rcx), %rax
cmoveq %rdx, %rax
movq (%rax,%r14,8), %rdx
movsbl %bpl, %ecx
callq 0x7997
incq %r14
cmpq %r14, %r13
jne 0x185a9
jmp 0x18683
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x18647
movsbl %r13b, %esi
callq 0x6836
testb %r13b, %r13b
jle 0x18683
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x18665
movq (%rax,%r14,8), %rdi
movsbl %r13b, %esi
callq 0x6836
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x1867b
movq (%rax,%r14,8), %rdi
movsbl %bpl, %esi
callq 0x6836
incq %r14
cmpq %r14, %r13
jne 0x1864f
movq 0x8(%rsp), %rdi
movl %r15d, %esi
movq 0x48(%rsp), %r14
movq %r14, %rdx
callq 0x11908
xorpd %xmm3, %xmm3
testl %r15d, %r15d
movsd 0x30(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
jle 0x186ce
xorl %eax, %eax
movq (%r14,%rax,8), %rcx
cmpl $0x0, 0x4(%rcx)
xorpd %xmm0, %xmm0
jne 0x186c2
movsd 0x50(%rcx), %xmm0
addsd %xmm0, %xmm3
incq %rax
cmpq %rax, %r15
jne 0x186af
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsd 0x950(%rax), %xmm0
mulsd 0x20(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movapd %xmm3, 0x10(%rsp)
movapd %xmm0, 0x60(%rsp)
ucomisd %xmm3, %xmm0
setae %r12b
movq %rbx, %rdi
movl $0x3, %esi
callq 0xb70e
testb %r13b, %r13b
movsd 0x1b1d4(%rip), %xmm2    # 0x338f0
movapd 0x50(%rsp), %xmm1
xorpd %xmm3, %xmm3
jle 0x187d8
testb %bpl, %bpl
setle %sil
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
cmpq $0x0, 0x20(%rbx)
sete %dl
orb %sil, %dl
xorl %esi, %esi
testq %rax, %rax
je 0x18767
movq 0x58(%rbx), %rdi
movq 0x88(%rbx), %r8
movsd (%r8,%rsi,8), %xmm0
mulsd (%rdi,%rsi,8), %xmm0
subsd %xmm0, %xmm3
testq %rcx, %rcx
je 0x1879a
movq 0x60(%rbx), %r8
movq 0x90(%rbx), %rdi
movq (%rdi,%rsi,8), %rdi
movq (%r8,%rsi,8), %r8
xorl %r9d, %r9d
movsd (%rdi,%r9,8), %xmm0
mulsd (%r8,%r9,8), %xmm0
subsd %xmm0, %xmm3
incq %r9
cmpq %r9, %r13
jne 0x18782
testb %dl, %dl
jne 0x187cc
movq 0x68(%rbx), %r8
movq 0x98(%rbx), %rdi
movq (%rdi,%rsi,8), %rdi
movq (%r8,%rsi,8), %r8
xorl %r9d, %r9d
movsd (%rdi,%r9,8), %xmm0
mulsd (%r8,%r9,8), %xmm0
subsd %xmm0, %xmm3
incq %r9
cmpq %r9, %rbp
jne 0x187b4
incq %rsi
cmpq %r13, %rsi
jne 0x18748
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rcx
movsd 0x958(%rcx), %xmm0
mulsd 0x40(%rsp), %xmm0
ucomisd %xmm0, %xmm3
setae %al
movapd 0x10(%rsp), %xmm5
movapd 0x60(%rsp), %xmm4
ucomisd %xmm5, %xmm4
jb 0x18815
ucomisd %xmm0, %xmm3
jae 0x18a92
movapd %xmm1, %xmm0
movapd %xmm1, %xmm3
movsd 0x1b0c3(%rip), %xmm1    # 0x338e8
cmpeqpd %xmm1, %xmm0
movapd %xmm5, %xmm1
cmplepd %xmm4, %xmm1
andpd %xmm0, %xmm1
movd %xmm1, %edx
movapd %xmm5, %xmm4
movapd 0x20(%rsp), %xmm6
testb $0x1, %dl
jne 0x18854
movsd 0x38(%rsp), %xmm4
movapd %xmm3, %xmm6
movapd 0x20(%rsp), %xmm0
divsd 0x960(%rcx), %xmm0
movapd %xmm0, 0x20(%rsp)
ucomisd 0x970(%rcx), %xmm0
movapd %xmm6, 0x50(%rsp)
movsd %xmm4, 0x38(%rsp)
xorpd %xmm1, %xmm1
ja 0x183c8
jmp 0x1889d
movsd 0x1b058(%rip), %xmm6    # 0x338e8
xorpd %xmm5, %xmm5
xorl %eax, %eax
xorpd %xmm4, %xmm4
xorl %r12d, %r12d
testb %r12b, %r12b
je 0x18a7a
testb %al, %al
jne 0x18a92
movq %rbx, %rdi
movl $0x9, %esi
movl $0x3, %edx
movapd %xmm4, 0x10(%rsp)
movapd %xmm6, 0x20(%rsp)
callq 0xb03a
movapd 0x20(%rsp), %xmm2
movapd 0x10(%rsp), %xmm1
testb %r13b, %r13b
jle 0x18ac6
xorpd 0x1b057(%rip), %xmm2    # 0x33940
xorl %r15d, %r15d
xorpd %xmm3, %xmm3
movsd 0x1aff8(%rip), %xmm4    # 0x338f0
movapd %xmm2, 0x20(%rsp)
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x18947
movq 0x88(%rbx), %rcx
movq 0xa0(%rbx), %rdx
movsd (%rcx,%r15,8), %xmm0
mulsd %xmm2, %xmm0
addsd (%rdx,%r15,8), %xmm0
movsd %xmm0, (%rax,%r15,8)
ucomisd %xmm0, %xmm3
ja 0x18937
ucomisd %xmm4, %xmm0
jbe 0x18947
ucomisd %xmm3, %xmm0
jbe 0x18947
ucomisd %xmm0, %xmm4
ja 0x18a58
cmpq $0x0, 0x18(%rbx)
je 0x189c6
xorl %r14d, %r14d
movq 0xa8(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x18(%rbx), %rcx
movq 0x90(%rbx), %rdx
movq (%rdx,%r15,8), %rdx
movsd (%rdx,%r14,8), %xmm0
mulsd %xmm2, %xmm0
addsd (%rax,%r14,8), %xmm0
movq (%rcx,%r15,8), %rax
movsd %xmm0, (%rax,%r14,8)
ucomisd %xmm0, %xmm3
ja 0x18991
ucomisd %xmm4, %xmm0
jbe 0x1899d
ucomisd %xmm3, %xmm0
jbe 0x1899d
ucomisd %xmm0, %xmm4
ja 0x189a7
incq %r14
cmpq %r14, %r13
jne 0x18951
jmp 0x189c6
callq 0x4ceb
movsd 0x1af3c(%rip), %xmm4    # 0x338f0
xorpd %xmm3, %xmm3
movapd 0x20(%rsp), %xmm2
movapd 0x10(%rsp), %xmm1
jmp 0x1899d
cmpq $0x0, 0x20(%rbx)
je 0x18a4a
testb %bpl, %bpl
jle 0x18a4a
xorl %r14d, %r14d
movq 0xb0(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x20(%rbx), %rcx
movq 0x98(%rbx), %rdx
movq (%rdx,%r15,8), %rdx
movsd (%rdx,%r14,8), %xmm0
mulsd %xmm2, %xmm0
addsd (%rax,%r14,8), %xmm0
movq (%rcx,%r15,8), %rax
movsd %xmm0, (%rax,%r14,8)
ucomisd %xmm0, %xmm3
ja 0x18a15
ucomisd %xmm4, %xmm0
jbe 0x18a21
ucomisd %xmm3, %xmm0
jbe 0x18a21
ucomisd %xmm0, %xmm4
ja 0x18a2b
incq %r14
cmpq %r14, %rbp
jne 0x189d5
jmp 0x18a4a
callq 0x4d07
movsd 0x1aeb8(%rip), %xmm4    # 0x338f0
xorpd %xmm3, %xmm3
movapd 0x20(%rsp), %xmm2
movapd 0x10(%rsp), %xmm1
jmp 0x18a21
incq %r15
cmpq %r13, %r15
jne 0x188fe
jmp 0x18ac6
callq 0x4ccf
movsd 0x1ae8b(%rip), %xmm4    # 0x338f0
xorpd %xmm3, %xmm3
movapd 0x20(%rsp), %xmm2
movapd 0x10(%rsp), %xmm1
jmp 0x18947
movq %rbx, %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0xb03a
movsd 0x30(%rsp), %xmm5
movapd %xmm5, 0x10(%rsp)
movq %rbx, %rdi
movl $0x5, %esi
callq 0xafc0
movq %rbx, %rdi
movl $0x9, %esi
callq 0xafc0
movaps 0x10(%rsp), %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x1, 0xf8(%rbx)
jne 0x18bb4
movq 0x8(%rsp), %rax
cmpb $0x0, 0x80(%rax)
je 0x18bbd
cmpb $0x0, 0xf9(%rbx)
movq 0x10(%rbx), %rdi
je 0x18bc1
testq %rdi, %rdi
je 0x18b11
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rsi
movq 0x68(%rax), %rdx
movsbl %r13b, %ecx
callq 0x7997
testb %r13b, %r13b
jle 0x18c26
xorl %r14d, %r14d
xorl %r15d, %r15d
movapd 0x10(%rsp), %xmm0
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x18b66
movq (%rax,%r15,8), %rdi
movq 0x8(%rsp), %rcx
cmpb $0x0, 0x80(%rcx)
movq 0x58(%rcx), %rax
cmoveq %r14, %rax
movq (%rax,%r15,8), %rsi
movq 0x70(%rcx), %rax
cmoveq %r14, %rax
movq (%rax,%r15,8), %rdx
movsbl %r13b, %ecx
callq 0x7997
movapd 0x10(%rsp), %xmm0
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x18ba6
movq (%rax,%r15,8), %rdi
movq 0x8(%rsp), %rcx
cmpb $0x0, 0x80(%rcx)
movq 0x60(%rcx), %rax
cmoveq %r14, %rax
movq (%rax,%r15,8), %rsi
movq 0x78(%rcx), %rax
cmoveq %r14, %rax
movq (%rax,%r15,8), %rdx
movsbl %bpl, %ecx
callq 0x7997
movapd 0x10(%rsp), %xmm0
incq %r15
cmpq %r15, %r13
jne 0x18b26
jmp 0x18c1d
movapd %xmm1, %xmm5
jmp 0x18a92
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x18bcf
movsbl %r13b, %esi
callq 0x6836
testb %r13b, %r13b
jle 0x18c26
xorl %r14d, %r14d
movapd 0x10(%rsp), %xmm0
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x18bf9
movq (%rax,%r14,8), %rdi
movsbl %r13b, %esi
callq 0x6836
movapd 0x10(%rsp), %xmm0
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x18c15
movq (%rax,%r14,8), %rdi
movsbl %bpl, %esi
callq 0x6836
movapd 0x10(%rsp), %xmm0
incq %r14
cmpq %r14, %r13
jne 0x18bdd
movapd %xmm0, %xmm5
jmp 0x18a92
movapd 0x10(%rsp), %xmm5
jmp 0x18a92
nop