// File: qmmlib[P]QmmLibrary/linear.cpp
// Function: solve_l2r_l1l2_svr(problem const*, double*, parameter const*, int)
static void solve_l2r_l1l2_svr(
	const problem *prob, double *w, const parameter *param,
	int solver_type)
{
	int l = prob->l;
	double C = param->C;
	double p = param->p;
	int w_size = prob->n;
	double eps = param->eps;
	int i, s, iter = 0;
	int max_iter = 1000;
	int active_size = l;
	int *index = new int[l];

	double d, G, H;
	double Gmax_old = INF;
	double Gmax_new, Gnorm1_new;
	double Gnorm1_init;
	double *beta = new double[l];
	double *QD = new double[l];
	double *y = prob->y;

	// L2R_L2LOSS_SVR_DUAL
	double lambda[1], upper_bound[1];
	lambda[0] = 0.5/C;
	upper_bound[0] = INF;

	if(solver_type == L2R_L1LOSS_SVR_DUAL)
	{
		lambda[0] = 0;
		upper_bound[0] = C;
	}

	// Initial beta can be set here. Note that
	// -upper_bound <= beta[i] <= upper_bound
	for(i=0; i<l; i++)
		beta[i] = 0;

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

		index[i] = i;
	}


	while(iter < max_iter)
	{
		Gmax_new = 0;
		Gnorm1_new = 0;

		for(i=0; i<active_size; i++)
		{
			int j = i+rand()%(active_size-i);
			swap(index[i], index[j]);
		}

		for(s=0; s<active_size; s++)
		{
			i = index[s];
			G = -y[i] + lambda[GETI(i)]*beta[i];
			H = QD[i] + lambda[GETI(i)];

			feature_node *xi = prob->x[i];
			while(xi->index != -1)
			{
				int ind = xi->index-1;
				double val = xi->value;
				G += val*w[ind];
				xi++;
			}

			double Gp = G+p;
			double Gn = G-p;
			double violation = 0;
			if(beta[i] == 0)
			{
				if(Gp < 0)
					violation = -Gp;
				else if(Gn > 0)
					violation = Gn;
				else if(Gp>Gmax_old && Gn<-Gmax_old)
				{
					active_size--;
					swap(index[s], index[active_size]);
					s--;
					continue;
				}
			}
			else if(beta[i] >= upper_bound[GETI(i)])
			{
				if(Gp > 0)
					violation = Gp;
				else if(Gp < -Gmax_old)
				{
					active_size--;
					swap(index[s], index[active_size]);
					s--;
					continue;
				}
			}
			else if(beta[i] <= -upper_bound[GETI(i)])
			{
				if(Gn < 0)
					violation = -Gn;
				else if(Gn > Gmax_old)
				{
					active_size--;
					swap(index[s], index[active_size]);
					s--;
					continue;
				}
			}
			else if(beta[i] > 0)
				violation = fabs(Gp);
			else
				violation = fabs(Gn);

			Gmax_new = max(Gmax_new, violation);
			Gnorm1_new += violation;

			// obtain Newton direction d
			if(Gp < H*beta[i])
				d = -Gp/H;
			else if(Gn > H*beta[i])
				d = -Gn/H;
			else
				d = -beta[i];

			if(fabs(d) < 1.0e-12)
				continue;

			double beta_old = beta[i];
			beta[i] = min(max(beta[i]+d, -upper_bound[GETI(i)]), upper_bound[GETI(i)]);
			d = beta[i]-beta_old;

			if(d != 0)
			{
				xi = prob->x[i];
				while(xi->index != -1)
				{
					w[xi->index-1] += d*xi->value;
					xi++;
				}
			}
		}

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

		if(Gnorm1_new <= eps*Gnorm1_init)
		{
			if(active_size == l)
				break;
			else
			{
				active_size = l;
				info("*");
				Gmax_old = INF;
				continue;
			}
		}

		Gmax_old = Gmax_new;
	}

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

	// calculate objective value
	double v = 0;
	int nSV = 0;
	for(i=0; i<w_size; i++)
		v += w[i]*w[i];
	v = 0.5*v;
	for(i=0; i<l; i++)
	{
		v += p*fabs(beta[i]) - y[i]*beta[i] + 0.5*lambda[GETI(i)]*beta[i]*beta[i];
		if(beta[i] != 0)
			nSV++;
	}

	info("Objective value = %lf\n", v);
	info("nSV = %d\n",nSV);

	delete [] beta;
	delete [] QD;
	delete [] index;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsd 0x88(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movsd 0xa8(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movsd 0x80(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x3e8, -0x50(%rbp)     # imm = 0x3E8
movl -0x20(%rbp), %eax
movl %eax, -0x54(%rbp)
movslq -0x20(%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, -0x60(%rbp)
movsd 0x1085b(%rip), %xmm0    # 0x24040
movsd %xmm0, -0x80(%rbp)
movslq -0x20(%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, -0xa0(%rbp)
movslq -0x20(%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, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movsd 0x107c7(%rip), %xmm0    # 0x24020
divsd -0x28(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd 0x107d2(%rip), %xmm0    # 0x24040
movsd %xmm0, -0xc0(%rbp)
cmpl $0xd, -0x1c(%rbp)
jne 0x13894
xorps %xmm0, %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x138c1
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x1389b
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x138eb
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x138c8
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x139e9
movq -0xa8(%rbp), %rax
movslq -0x44(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x139cd
movq -0xc8(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0xd0(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm2
movq -0xa8(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd -0xd0(%rbp), %xmm2
movq -0x10(%rbp), %rax
movq -0xc8(%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 -0xc8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xc8(%rbp)
jmp 0x13928
movl -0x44(%rbp), %edx
movq -0x60(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x138f2
jmp 0x139eb
movl -0x4c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0x14144
xorps %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x90(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x13a72
movl -0x44(%rbp), %eax
movl %eax, -0x120(%rbp)
callq 0x30b0
movl -0x54(%rbp), %ecx
subl -0x44(%rbp), %ecx
cltd
idivl %ecx
movl -0x120(%rbp), %eax
addl %edx, %eax
movl %eax, -0xd4(%rbp)
movq -0x60(%rbp), %rdi
movslq -0x44(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x60(%rbp), %rsi
movslq -0xd4(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x9420
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x13a14
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x140aa
movq -0x60(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movq -0xb0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
movsd -0xb8(%rbp), %xmm0
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0xa8(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x13b83
movq -0xe0(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
movl %eax, -0xe4(%rbp)
movq -0xe0(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0xf0(%rbp), %xmm0
movq -0x10(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x70(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0xe0(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xe0(%rbp)
jmp 0x13b13
movsd -0x70(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
movsd -0x70(%rbp), %xmm0
subsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x108(%rbp)
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x13cad
jp 0x13cad
xorps %xmm0, %xmm0
ucomisd -0xf8(%rbp), %xmm0
jbe 0x13c0e
movsd -0xf8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x108(%rbp)
jmp 0x13ca8
movsd -0x100(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x13c31
movsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
jmp 0x13ca6
movsd -0xf8(%rbp), %xmm0
ucomisd -0x80(%rbp), %xmm0
jbe 0x13ca4
movsd -0x100(%rbp), %xmm1
movsd -0x80(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13ca4
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x60(%rbp), %rdi
movslq -0x48(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x60(%rbp), %rsi
movslq -0x54(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x9420
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1409c
jmp 0x13ca6
jmp 0x13ca8
jmp 0x13e6c
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0xc0(%rbp), %xmm0
jb 0x13d59
movsd -0xf8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x13cee
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
jmp 0x13d54
movsd -0xf8(%rbp), %xmm1
movsd -0x80(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13d52
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x60(%rbp), %rdi
movslq -0x48(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x60(%rbp), %rsi
movslq -0x54(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x9420
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1409c
jmp 0x13d54
jmp 0x13e6a
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0xc0(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
ucomisd %xmm1, %xmm0
jb 0x13e15
xorps %xmm0, %xmm0
ucomisd -0x100(%rbp), %xmm0
jbe 0x13dc8
movsd -0x100(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x108(%rbp)
jmp 0x13e13
movsd -0x100(%rbp), %xmm0
ucomisd -0x80(%rbp), %xmm0
jbe 0x13e11
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x60(%rbp), %rdi
movslq -0x48(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x60(%rbp), %rsi
movslq -0x54(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x9420
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1409c
jmp 0x13e13
jmp 0x13e68
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x13e4b
movsd -0xf8(%rbp), %xmm0
movaps 0x112e3(%rip), %xmm1    # 0x25120
pand %xmm1, %xmm0
movsd %xmm0, -0x108(%rbp)
jmp 0x13e66
movsd -0x100(%rbp), %xmm0
movaps 0x112c6(%rip), %xmm1    # 0x25120
pand %xmm1, %xmm0
movsd %xmm0, -0x108(%rbp)
jmp 0x13e68
jmp 0x13e6a
jmp 0x13e6c
movsd -0x88(%rbp), %xmm0
movsd -0x108(%rbp), %xmm1
callq 0x93e0
movsd %xmm0, -0x88(%rbp)
movsd -0x108(%rbp), %xmm0
addsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0xf8(%rbp), %xmm1
movsd -0x78(%rbp), %xmm0
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x13eef
movsd -0xf8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
jmp 0x13f6b
movsd -0x100(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x13f3d
movsd -0x100(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
jmp 0x13f69
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x68(%rbp)
jmp 0x13f6b
movsd -0x68(%rbp), %xmm1
movaps 0x111a9(%rip), %xmm0    # 0x25120
pand %xmm0, %xmm1
movsd 0x1118d(%rip), %xmm0    # 0x25110
ucomisd %xmm1, %xmm0
jbe 0x13f8e
jmp 0x1409c
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x110(%rbp)
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x68(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
callq 0x93e0
movsd -0xc0(%rbp), %xmm1
callq 0x82a0
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1402b
jp 0x1402b
jmp 0x1409a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x14098
movsd -0x68(%rbp), %xmm0
movq -0xe0(%rbp), %rax
movsd 0x8(%rax), %xmm2
movq -0x10(%rbp), %rax
movq -0xe0(%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 -0xe0(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xe0(%rbp)
jmp 0x14042
jmp 0x1409a
jmp 0x1409c
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x13a79
cmpl $0x0, -0x4c(%rbp)
jne 0x140c0
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x140e7
leaq 0x11693(%rip), %rdi     # 0x25773
movb $0x0, %al
callq 0x9490
movsd -0x90(%rbp), %xmm1
movsd -0x40(%rbp), %xmm0
mulsd -0x98(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x14132
movl -0x54(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x1410c
jmp 0x14144
movl -0x20(%rbp), %eax
movl %eax, -0x54(%rbp)
leaq 0x112df(%rip), %rdi     # 0x253f8
movb $0x0, %al
callq 0x9490
movsd 0xff18(%rip), %xmm0     # 0x24040
movsd %xmm0, -0x80(%rbp)
jmp 0x139eb
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
jmp 0x139eb
movl -0x4c(%rbp), %esi
leaq 0x112ac(%rip), %rdi     # 0x253fa
movb $0x0, %al
callq 0x9490
movl -0x4c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jl 0x1416b
leaq 0x11572(%rip), %rdi     # 0x256d6
movb $0x0, %al
callq 0x9490
xorps %xmm0, %xmm0
movsd %xmm0, -0x118(%rbp)
movl $0x0, -0x11c(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x141cc
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x118(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x118(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x14187
movsd 0xfe4c(%rip), %xmm0     # 0x24020
mulsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x142da
movsd -0x30(%rbp), %xmm1
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movaps 0x10f0d(%rip), %xmm0    # 0x25120
pand %xmm0, %xmm2
movq -0xb0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0xfdc2(%rip), %xmm0     # 0x24020
mulsd -0xb8(%rbp), %xmm0
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movq -0xa0(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x142bb
jp 0x142bb
jmp 0x142ca
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x142cc
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x141eb
movsd -0x118(%rbp), %xmm0
leaq 0x11162(%rip), %rdi     # 0x2544b
movb $0x1, %al
callq 0x9490
movl -0x11c(%rbp), %esi
leaq 0x11165(%rip), %rdi     # 0x25462
movb $0x0, %al
callq 0x9490
movq -0xa0(%rbp), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0x14324
movq -0x128(%rbp), %rdi
callq 0x33b0
movq -0xa8(%rbp), %rax
movq %rax, -0x130(%rbp)
cmpq $0x0, %rax
je 0x14344
movq -0x130(%rbp), %rdi
callq 0x33b0
movq -0x60(%rbp), %rax
movq %rax, -0x138(%rbp)
cmpq $0x0, %rax
je 0x14361
movq -0x138(%rbp), %rdi
callq 0x33b0
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw (%rax,%rax)