// File: myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::doLinearStep(FitBitSlicedAB*)
NUMBER HMMProblemSlicedAB::doLinearStep(FitBitSlicedAB *fb) {
	NPAR i,j,m,z;
    NPAR nS = fb->nS, nO = this->p->nO, nZ = this->p->nZ;
    fb->doLog10ScaleGentle(FBS_GRAD);
	
    NCAT xndat = fb->xndat;
    struct data **x_data = fb->x_data;
    fb->init(FBS_PARcopy);
    
	NUMBER e = this->p->ArmijoSeed; // step seed
	bool compliesArmijo = false;
//	bool compliesWolfe2 = false; // second wolfe condition is turned off
	NUMBER f_xk = HMMProblemSlicedAB::getSumLogPOPara(xndat, x_data);
	NUMBER f_xkplus1 = 0;
	
    fb->copy(FBS_PAR, FBS_PARcopy);
	// 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++)
                for(z=0; z<nZ; z++)
                    p_k_by_neg_p_k -= fb->gradA[z][i][j]*fb->gradA[z][i][j];
        if(fb->B  != NULL)
            for(m=0; m<nO; m++)
                for(z=0; z<nZ; z++)
                    p_k_by_neg_p_k -= fb->gradB[z][i][m]*fb->gradB[z][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->gradPI[i];
            if(fb->A  != NULL)
                for(j=0; j<nS; j++)
                    for(z=0; z<nZ; z++)
                        fb->A[z][i][j] = fb->Acopy[z][i][j] - e * fb->gradA[z][i][j];
            if(fb->B  != NULL)
                for(m=0; m<nO; m++)
                    for(z=0; z<nZ; z++)
                        fb->B[z][i][m] = fb->Bcopy[z][i][m] - e * fb->gradB[z][i][m];
        }
        // project parameters to simplex if needs be
        if(fb->projecttosimplex==1) {
            // scale
            if( !this->hasNon01Constraints() ) {
                if(fb->pi != NULL) projectsimplex(fb->pi, nS);
                for(i=0; i<nS; i++) {
                    for(z=0; z<nZ; z++) {
                        if(fb->A  != NULL) projectsimplex(fb->A[z][i], nS);
                        if(fb->B  != NULL) projectsimplex(fb->B[z][i], nS);
                    }
                }
            } else {
                if(fb->pi != NULL) projectsimplexbounded(fb->pi, this->getLbPI(), this->getUbPI(), nS);
                for(i=0; i<nS; i++) {
                    for(z=0; z<nZ; z++) {
                        if(fb->A  != NULL) projectsimplexbounded(fb->A[z][i], this->getLbA()[z][i], this->getUbA()[z][i], nS); // tag is current slice
                        if(fb->B  != NULL) projectsimplexbounded(fb->B[z][i], this->getLbB()[z][i], this->getUbB()[z][i], nO);
                    }
                }
            }
        }
        
		// recompute alpha and p(O|param)
		computeAlphaAndPOParam(xndat, x_data);
		// compute f(x_{k+1})
		f_xkplus1 = HMMProblemSlicedAB::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;
//        computeGradients(fb);
//        fb->doLog10ScaleGentle(FBS_GRAD);
//        for(i=0; i<nS; i++)
//        {
//            if(fb->pi != NULL) p_k_by_neg_p_kp1 -= fb->gradPI[i]*fb->gradPI[i];
//            if(fb->A  != NULL)
//                for(z=0; z<nZ; z++)
//                    for(j=0; j<nS; j++)
//                        p_k_by_neg_p_kp1 -= fb->gradA[z][i][j]*fb->gradA[z][i][j];
//            if(fb->B  != NULL)
//                for(z=0; z<nZ; z++)
//                    for(m=0; m<nO; m++)
//                        p_k_by_neg_p_kp1 -= fb->gradB[z][i][m]*fb->gradB[z][i][m];
//        }
//        compliesWolfe2 = (p_k_by_neg_p_kp1 >= this->p->ArmijoC2 * p_k_by_neg_p_k); // Wolfe condition
//        // OR
//        compliesWolfe2 = fabs(p_k_by_neg_p_kp1) <= fabs(this->p->ArmijoC2 * p_k_by_neg_p_k); // strong Wolfe condition
        
		e /= (compliesArmijo /*&& compliesWolfe2*/)?1:this->p->ArmijoReduceFactor;
		iter++;
	} // armijo loop
    if(!(compliesArmijo /*&& compliesWolfe2*/)) { // we couldn't step away from current, copy the inital point back
        e = 0;
        fb->copy(FBS_PARcopy, FBS_PAR);
        f_xkplus1 = f_xk;
    }
    fb->destroy(FBS_PARcopy);
    return f_xkplus1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rcx
movb 0x1(%rcx), %cl
movb %cl, -0x15(%rbp)
movq 0x88(%rax), %rcx
movb 0x8b9(%rcx), %cl
movb %cl, -0x16(%rbp)
movq 0x88(%rax), %rax
movb 0x8c8(%rax), %al
movb %al, -0x17(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x12c90
movq -0x10(%rbp), %rax
movl 0xd0(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x12130
movq -0x60(%rbp), %rdi
movq 0x88(%rdi), %rax
movsd 0x968(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movb $0x0, -0x31(%rbp)
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rdx
callq 0x1a9f0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
movl $0x5, %edx
callq 0x12890
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movb $0x0, -0x11(%rbp)
movsbl -0x11(%rbp), %eax
movsbl -0x15(%rbp), %ecx
cmpl %ecx, %eax
jge 0x409ac
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x40819
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movsbq -0x11(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movsbq -0x11(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x50(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x408db
movb $0x0, -0x12(%rbp)
movsbl -0x12(%rbp), %eax
movsbl -0x15(%rbp), %ecx
cmpl %ecx, %eax
jge 0x408d9
movb $0x0, -0x14(%rbp)
movsbl -0x14(%rbp), %eax
movsbl -0x17(%rbp), %ecx
cmpl %ecx, %eax
jge 0x408ca
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x12(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x12(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x50(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movb -0x14(%rbp), %al
addb $0x1, %al
movb %al, -0x14(%rbp)
jmp 0x40840
jmp 0x408cc
movb -0x12(%rbp), %al
addb $0x1, %al
movb %al, -0x12(%rbp)
jmp 0x4082c
jmp 0x408db
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x4099d
movb $0x0, -0x13(%rbp)
movsbl -0x13(%rbp), %eax
movsbl -0x16(%rbp), %ecx
cmpl %ecx, %eax
jge 0x4099b
movb $0x0, -0x14(%rbp)
movsbl -0x14(%rbp), %eax
movsbl -0x17(%rbp), %ecx
cmpl %ecx, %eax
jge 0x4098c
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x13(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x13(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x50(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movb -0x14(%rbp), %al
addb $0x1, %al
movb %al, -0x14(%rbp)
jmp 0x40902
jmp 0x4098e
movb -0x13(%rbp), %al
addb $0x1, %al
movb %al, -0x13(%rbp)
jmp 0x408ee
jmp 0x4099d
jmp 0x4099f
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x407b1
movl $0x0, -0x54(%rbp)
xorl %eax, %eax
testb $0x1, -0x31(%rbp)
movb %al, -0x61(%rbp)
jne 0x409dc
movq -0x60(%rbp), %rax
movsd -0x30(%rbp), %xmm0
movq 0x88(%rax), %rax
ucomisd 0x970(%rax), %xmm0
seta %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x409e8
jmp 0x40f60
movb $0x0, -0x11(%rbp)
movsbl -0x11(%rbp), %eax
movsbl -0x15(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40c43
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x40a64
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movsbq -0x11(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0x30(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movsbq -0x11(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movsbq -0x11(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x40b4c
movb $0x0, -0x12(%rbp)
movsbl -0x12(%rbp), %eax
movsbl -0x15(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40b4a
movb $0x0, -0x14(%rbp)
movsbl -0x14(%rbp), %eax
movsbl -0x17(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40b3b
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x12(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0x30(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x12(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x12(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x14(%rbp), %al
addb $0x1, %al
movb %al, -0x14(%rbp)
jmp 0x40a8b
jmp 0x40b3d
movb -0x12(%rbp), %al
addb $0x1, %al
movb %al, -0x12(%rbp)
jmp 0x40a77
jmp 0x40b4c
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x40c34
movb $0x0, -0x13(%rbp)
movsbl -0x13(%rbp), %eax
movsbl -0x16(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40c32
movb $0x0, -0x14(%rbp)
movsbl -0x14(%rbp), %eax
movsbl -0x17(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40c23
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x13(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0x30(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x13(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x13(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x14(%rbp), %al
addb $0x1, %al
movb %al, -0x14(%rbp)
jmp 0x40b73
jmp 0x40c25
movb -0x13(%rbp), %al
addb $0x1, %al
movb %al, -0x13(%rbp)
jmp 0x40b5f
jmp 0x40c34
jmp 0x40c36
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x409ec
movq -0x10(%rbp), %rax
movsbl 0xe0(%rax), %eax
cmpl $0x1, %eax
jne 0x40ea9
movq -0x60(%rbp), %rdi
callq 0x1a4e0
testb $0x1, %al
jne 0x40d24
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x40c84
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movsbl -0x15(%rbp), %esi
callq 0x7980
movb $0x0, -0x11(%rbp)
movsbl -0x11(%rbp), %eax
movsbl -0x15(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40d1f
movb $0x0, -0x14(%rbp)
movsbl -0x14(%rbp), %eax
movsbl -0x17(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40d10
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x40cd6
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movsbl -0x15(%rbp), %esi
callq 0x7980
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x40d04
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movsbl -0x15(%rbp), %esi
callq 0x7980
jmp 0x40d06
movb -0x14(%rbp), %al
addb $0x1, %al
movb %al, -0x14(%rbp)
jmp 0x40c9c
jmp 0x40d12
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x40c88
jmp 0x40ea7
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x40d65
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x39ce0
movq -0x60(%rbp), %rdi
movq %rax, -0x70(%rbp)
callq 0x39da0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq %rax, %rdx
movsbl -0x15(%rbp), %ecx
callq 0x87e0
movb $0x0, -0x11(%rbp)
movsbl -0x11(%rbp), %eax
movsbl -0x15(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40ea5
movb $0x0, -0x14(%rbp)
movsbl -0x14(%rbp), %eax
movsbl -0x17(%rbp), %ecx
cmpl %ecx, %eax
jge 0x40e96
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x40e07
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
callq 0x39d20
movq -0x60(%rbp), %rdi
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
callq 0x39de0
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movsbl -0x15(%rbp), %ecx
callq 0x87e0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x40e87
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
callq 0x39d60
movq -0x60(%rbp), %rdi
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
callq 0x39e20
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
movsbq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x11(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movsbl -0x16(%rbp), %ecx
callq 0x87e0
jmp 0x40e89
movb -0x14(%rbp), %al
addb $0x1, %al
movb %al, -0x14(%rbp)
jmp 0x40d7d
jmp 0x40e98
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x40d69
jmp 0x40ea7
jmp 0x40ea9
movq -0x60(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rdx
callq 0x39fb0
movq -0x60(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rdx
callq 0x1a9f0
movq -0x60(%rbp), %rax
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm1
movsd -0x40(%rbp), %xmm2
movq 0x88(%rax), %rax
movsd 0x950(%rax), %xmm0
mulsd -0x30(%rbp), %xmm0
movsd -0x50(%rbp), %xmm3
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
setae %al
andb $0x1, %al
movb %al, -0x31(%rbp)
testb $0x1, -0x31(%rbp)
je 0x40f21
movsd 0xeaf1(%rip), %xmm0     # 0x4fa08
movsd %xmm0, -0xa0(%rbp)
jmp 0x40f3c
movq -0x60(%rbp), %rax
movq 0x88(%rax), %rax
movsd 0x960(%rax), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xa0(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x409b3
testb $0x1, -0x31(%rbp)
jne 0x40f8b
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0x12890
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x12560
movsd -0x48(%rbp), %xmm0
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)