// File: qmmlib[P]QmmLibrary/linear.cpp
// Function: solve_l2r_lr_dual(problem const*, double*, double, double, double)
void solve_l2r_lr_dual(const problem *prob, double *w, double eps, double Cp, double Cn)
{
	int l = prob->l;
	int w_size = prob->n;
	int i, s, iter = 0;
	double *xTx = new double[l];
	int max_iter = 1000;
	int *index = new int[l];		
	double *alpha = new double[2*l]; // store alpha and C - alpha
	schar *y = new schar[l];	
	int max_inner_iter = 100; // for inner Newton
	double innereps = 1e-2; 
	double innereps_min = min(1e-8, eps);
	double upper_bound[3] = {Cn, 0, Cp};

	for(i=0; i<l; i++)
	{
		if(prob->y[i] > 0)
		{
			y[i] = +1; 
		}
		else
		{
			y[i] = -1;
		}
	}
		
	// Initial alpha can be set here. Note that
	// 0 < alpha[i] < upper_bound[GETI(i)]
	// alpha[2*i] + alpha[2*i+1] = upper_bound[GETI(i)]
	for(i=0; i<l; i++)
	{
		alpha[2*i] = min(0.001*upper_bound[GETI(i)], 1e-8);
		alpha[2*i+1] = upper_bound[GETI(i)] - alpha[2*i];
	}

	for(i=0; i<w_size; i++)
		w[i] = 0;
	for(i=0; i<l; i++)
	{
		xTx[i] = 0;
		feature_node *xi = prob->x[i];
		while (xi->index != -1)
		{
			double val = xi->value;
			xTx[i] += val*val;
			w[xi->index-1] += y[i]*alpha[2*i]*val;
			xi++;
		}
		index[i] = i;
	}

	while (iter < max_iter)
	{
		for (i=0; i<l; i++)
		{
			int j = i+rand()%(l-i);
			swap(index[i], index[j]);
		}
		int newton_iter = 0;
		double Gmax = 0;
		for (s=0; s<l; s++)
		{
			i = index[s];
			schar yi = y[i];
			double C = upper_bound[GETI(i)];
			double ywTx = 0, xisq = xTx[i];
			feature_node *xi = prob->x[i];
			while (xi->index != -1)
			{
				ywTx += w[xi->index-1]*xi->value;
				xi++;
			}
			ywTx *= y[i];
			double a = xisq, b = ywTx;

			// Decide to minimize g_1(z) or g_2(z)
			int ind1 = 2*i, ind2 = 2*i+1, sign = 1;
			if(0.5*a*(alpha[ind2]-alpha[ind1])+b < 0) 
			{
				ind1 = 2*i+1;
				ind2 = 2*i;
				sign = -1;
			}

			//  g_t(z) = z*log(z) + (C-z)*log(C-z) + 0.5a(z-alpha_old)^2 + sign*b(z-alpha_old)
			double alpha_old = alpha[ind1];
			double z = alpha_old;
			if(C - z < 0.5 * C) 
				z = 0.1*z;
			double gp = a*(z-alpha_old)+sign*b+log(z/(C-z));
			Gmax = max(Gmax, fabs(gp));

			// Newton method on the sub-problem
			const double eta = 0.1; // xi in the paper
			int inner_iter = 0;
			while (inner_iter <= max_inner_iter) 
			{
				if(fabs(gp) < innereps)
					break;
				double gpp = a + C/(C-z)/z;
				double tmpz = z - gp/gpp;
				if(tmpz <= 0) 
					z *= eta;
				else // tmpz in (0, C)
					z = tmpz;
				gp = a*(z-alpha_old)+sign*b+log(z/(C-z));
				newton_iter++;
				inner_iter++;
			}

			if(inner_iter > 0) // update w
			{
				alpha[ind1] = z;
				alpha[ind2] = C-z;
				xi = prob->x[i];
				while (xi->index != -1)
				{
					w[xi->index-1] += sign*(z-alpha_old)*yi*xi->value;
					xi++;
				}  
			}
		}

		iter++;
		if(iter % 10 == 0)
			info(".");

		if(Gmax < eps) 
			break;

		if(newton_iter <= l/10) 
			innereps = max(innereps_min, 0.1*innereps);

	}

	info("\noptimization finished, #iter = %d\n",iter);
	if (iter >= max_iter)
		info("\nWARNING: reaching max number of iterations\nUsing -s 0 may be faster (also see FAQ)\n\n");

	// calculate objective value
	
	double v = 0;
	for(i=0; i<w_size; i++)
		v += w[i] * w[i];
	v *= 0.5;
	for(i=0; i<l; i++)
		v += alpha[2*i] * log(alpha[2*i]) + alpha[2*i+1] * log(alpha[2*i+1]) 
			- upper_bound[GETI(i)] * log(upper_bound[GETI(i)]);
	info("Objective value = %lf\n", v);

	delete [] xTx;
	delete [] alpha;
	delete [] y;
	delete [] index;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x20(%rbp)
movsd %xmm2, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movslq -0x2c(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, -0x48(%rbp)
movl $0x3e8, -0x4c(%rbp)     # imm = 0x3E8
movslq -0x2c(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, -0x58(%rbp)
movl -0x2c(%rbp), %eax
shll %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, -0x60(%rbp)
movslq -0x2c(%rbp), %rdi
callq 0x3030
movq %rax, -0x68(%rbp)
movl $0x64, -0x6c(%rbp)
movsd 0x1a9c3(%rip), %xmm0    # 0x24010
movsd %xmm0, -0x78(%rbp)
movsd -0x18(%rbp), %xmm1
movsd 0x1bc41(%rip), %xmm0    # 0x252a0
callq 0x82a0
movsd %xmm0, -0x80(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x96de
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x96c5
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb $0x1, (%rax,%rcx)
jmp 0x96d1
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb $-0x1, (%rax,%rcx)
jmp 0x96d3
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9695
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x977e
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $0x1, %eax
cltq
movsd 0x1a90e(%rip), %xmm0    # 0x24018
mulsd -0xa0(%rbp,%rax,8), %xmm0
movsd 0x1bb85(%rip), %xmm1    # 0x252a0
callq 0x82a0
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $0x1, %eax
cltq
movsd -0xa0(%rbp,%rax,8), %xmm0
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x96e5
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x97a8
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9785
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x98b1
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x9895
movq -0xa8(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd -0xb0(%rbp), %xmm2
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm0
movsd -0xb0(%rbp), %xmm2
movq -0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0xa8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xa8(%rbp)
jmp 0x97e2
movl -0x34(%rbp), %edx
movq -0x58(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x97af
jmp 0x98b3
movl -0x3c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x9ec9
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x9924
movl -0x34(%rbp), %eax
movl %eax, -0x14c(%rbp)
callq 0x30b0
movl -0x2c(%rbp), %ecx
subl -0x34(%rbp), %ecx
cltd
idivl %ecx
movl -0x14c(%rbp), %eax
addl %edx, %eax
movl %eax, -0xb4(%rbp)
movq -0x58(%rbp), %rdi
movslq -0x34(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x58(%rbp), %rsi
movslq -0xb4(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x9420
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x98c6
movl $0x0, -0xb8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc0(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x9e49
movq -0x58(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0xc1(%rbp)
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $0x1, %eax
cltq
movsd -0xa0(%rbp,%rax,8), %xmm0
movsd %xmm0, -0xd0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd8(%rbp)
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xe0(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x9a20
movq -0x10(%rbp), %rax
movq -0xe8(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0xe8(%rbp), %rax
movsd 0x8(%rax), %xmm2
movsd -0xd8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movq -0xe8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xe8(%rbp)
jmp 0x99c4
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
mulsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
movl -0x34(%rbp), %eax
shll %eax
movl %eax, -0xfc(%rbp)
movl -0x34(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0x100(%rbp)
movl $0x1, -0x104(%rbp)
movsd 0x1a595(%rip), %xmm1    # 0x24020
mulsd -0xf0(%rbp), %xmm1
movq -0x60(%rbp), %rax
movslq -0x100(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x60(%rbp), %rax
movslq -0xfc(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm2
movsd -0xf8(%rbp), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x9aef
movl -0x34(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0xfc(%rbp)
movl -0x34(%rbp), %eax
shll %eax
movl %eax, -0x100(%rbp)
movl $0xffffffff, -0x104(%rbp) # imm = 0xFFFFFFFF
movq -0x60(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x110(%rbp)
movsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movsd -0xd0(%rbp), %xmm1
subsd -0x118(%rbp), %xmm1
movsd 0x1a4f1(%rip), %xmm0    # 0x24020
mulsd -0xd0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x9b55
movsd 0x1a4f3(%rip), %xmm0    # 0x24038
mulsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movsd -0xf0(%rbp), %xmm0
movsd -0x118(%rbp), %xmm2
subsd -0x110(%rbp), %xmm2
cvtsi2sdl -0x104(%rbp), %xmm1
mulsd -0xf8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0x118(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
subsd -0x118(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x3220
movaps %xmm0, %xmm1
movsd -0x158(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd -0x120(%rbp), %xmm1
movaps 0x1b544(%rip), %xmm2    # 0x25120
pand %xmm2, %xmm1
callq 0x93e0
movsd %xmm0, -0xc0(%rbp)
movsd 0x1a443(%rip), %xmm0    # 0x24038
movsd %xmm0, -0x128(%rbp)
movl $0x0, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jg 0x9d5f
movsd -0x120(%rbp), %xmm1
movaps 0x1b4fb(%rip), %xmm0    # 0x25120
pand %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x9c39
jmp 0x9d5f
movsd -0xf0(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
movsd -0xd0(%rbp), %xmm2
subsd -0x118(%rbp), %xmm2
divsd %xmm2, %xmm1
divsd -0x118(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x138(%rbp)
movsd -0x118(%rbp), %xmm0
movsd -0x120(%rbp), %xmm1
divsd -0x138(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x140(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x140(%rbp), %xmm0
jb 0x9cbc
movsd 0x1a38e(%rip), %xmm0    # 0x24038
mulsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
jmp 0x9ccc
movsd -0x140(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movsd -0xf0(%rbp), %xmm0
movsd -0x118(%rbp), %xmm2
subsd -0x110(%rbp), %xmm2
cvtsi2sdl -0x104(%rbp), %xmm1
mulsd -0xf8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x160(%rbp)
movsd -0x118(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
subsd -0x118(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x3220
movaps %xmm0, %xmm1
movsd -0x160(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x9c07
cmpl $0x0, -0x12c(%rbp)
jle 0x9e39
movsd -0x118(%rbp), %xmm0
movq -0x60(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xd0(%rbp), %xmm0
subsd -0x118(%rbp), %xmm0
movq -0x60(%rbp), %rax
movslq -0x100(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x9e37
cvtsi2sdl -0x104(%rbp), %xmm0
movsd -0x118(%rbp), %xmm1
subsd -0x110(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsbl -0xc1(%rbp), %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movq -0xe8(%rbp), %rax
movsd 0x8(%rax), %xmm2
movq -0x10(%rbp), %rax
movq -0xe8(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0xe8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xe8(%rbp)
jmp 0x9dbb
jmp 0x9e39
jmp 0x9e3b
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x9940
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x9e70
leaq 0x1b90a(%rip), %rdi     # 0x25773
movb $0x0, %al
callq 0x9490
movsd -0xc0(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x9e85
jmp 0x9ec9
movl -0xb8(%rbp), %eax
movl %eax, -0x164(%rbp)
movl -0x2c(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x164(%rbp), %eax
cmpl %ecx, %eax
jg 0x9ec4
movsd -0x80(%rbp), %xmm0
movsd 0x1a183(%rip), %xmm1    # 0x24038
mulsd -0x78(%rbp), %xmm1
callq 0x93e0
movsd %xmm0, -0x78(%rbp)
jmp 0x98b3
movl -0x3c(%rbp), %esi
leaq 0x1b527(%rip), %rdi     # 0x253fa
movb $0x0, %al
callq 0x9490
movl -0x3c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jl 0x9ef0
leaq 0x1b583(%rip), %rdi     # 0x2546c
movb $0x0, %al
callq 0x9490
xorps %xmm0, %xmm0
movsd %xmm0, -0x148(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x9f47
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x148(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x148(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9f02
movsd 0x1a0d1(%rip), %xmm0    # 0x24020
mulsd -0x148(%rbp), %xmm0
movsd %xmm0, -0x148(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0xa09e
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x180(%rbp)
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x3220
movsd %xmm0, -0x188(%rbp)
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x190(%rbp)
movq -0x60(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x3220
movsd -0x190(%rbp), %xmm1
movsd -0x188(%rbp), %xmm2
movaps %xmm0, %xmm3
movsd -0x180(%rbp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x178(%rbp)
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $0x1, %eax
cltq
movsd -0xa0(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x170(%rbp)
movq -0x68(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $0x1, %eax
cltq
movsd -0xa0(%rbp,%rax,8), %xmm0
callq 0x3220
movsd -0x178(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x170(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x148(%rbp), %xmm0
movsd %xmm0, -0x148(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x9f66
movsd -0x148(%rbp), %xmm0
leaq 0x1b39e(%rip), %rdi     # 0x2544b
movb $0x1, %al
callq 0x9490
movq -0x48(%rbp), %rax
movq %rax, -0x198(%rbp)
cmpq $0x0, %rax
je 0xa0d1
movq -0x198(%rbp), %rdi
callq 0x33b0
movq -0x60(%rbp), %rax
movq %rax, -0x1a0(%rbp)
cmpq $0x0, %rax
je 0xa0ee
movq -0x1a0(%rbp), %rdi
callq 0x33b0
movq -0x68(%rbp), %rax
movq %rax, -0x1a8(%rbp)
cmpq $0x0, %rax
je 0xa10b
movq -0x1a8(%rbp), %rdi
callq 0x33b0
movq -0x58(%rbp), %rax
movq %rax, -0x1b0(%rbp)
cmpq $0x0, %rax
je 0xa128
movq -0x1b0(%rbp), %rdi
callq 0x33b0
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw %cs:(%rax,%rax)