// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/svm.c
// Function: solve_nu_svc
void solve_nu_svc(Svm_problem prob, Svm_parameter param, double *alpha, Solutioninfoptr si)
{
	/*Last Changed 29.04.2005*/
	Nusolverptr n;
	int i, l = prob.l;
	double nu = param.nu, sum_pos, sum_neg, *zeros, r;
	signed char* y;
	y = safemalloc(l * sizeof(signed char), "solve_nu_svc", 5);
	n = safemalloc(sizeof(Nusolver), "solve_nu_svc", 6);
	for (i = 0; i < l; i++)
		 if (prob.y[i] > 0)
			  y[i] = +1;
		 else
			  y[i] = -1;
	sum_pos = nu * l / 2;
	sum_neg = nu * l / 2;
	for (i = 0; i < l; i++)
		 if (y[i] == +1)
			 {
	  		alpha[i] = fmin(1.0, sum_pos);
			  sum_pos -= alpha[i];
			 }
		 else
			 {
		  	alpha[i] = fmin(1.0, sum_neg);
			  sum_neg -= alpha[i];
			 }
 zeros = safemalloc(l * sizeof(double), "solve_nu_svc", 25);
	for (i = 0; i < l; i++)
		 zeros[i] = 0;
	nu_solve(n, l, QC, zeros, y, alpha, 1.0, 1.0, si, prob, param);
	r = si->r;
	for (i = 0; i < l; i++)
		 alpha[i] *= y[i] / r;
	si->rho /= r;
	si->obj /= (r*r);
	si->upper_bound_p = 1/r;
	si->upper_bound_n = 1/r;
	safe_free(n);
	safe_free(y);
	safe_free(zeros);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, 0x88(%rsp)
movq %rdi, %r15
leaq 0xf0(%rsp), %rax
leaq 0xd0(%rsp), %rbx
movslq (%rbx), %r13
movsd 0x40(%rax), %xmm0
movsd %xmm0, 0x90(%rsp)
leaq 0x1edd8(%rip), %r12     # 0xa1958
pushq $0x5
popq %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x34f59
movq %rax, %r14
pushq $0x6
popq %rdx
movl $0x88, %edi
movq %r12, %rsi
callq 0x34f59
movq %rax, 0x80(%rsp)
xorl %eax, %eax
testl %r13d, %r13d
movl $0x0, %r12d
cmovgl %r13d, %r12d
xorpd %xmm0, %xmm0
cmpq %rax, %r12
je 0x82bdf
movq 0x8(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm1
ucomisd %xmm0, %xmm1
setbe %cl
negb %cl
orb $0x1, %cl
movb %cl, (%r14,%rax)
incq %rax
jmp 0x82bbc
cvtsi2sd %r13d, %xmm0
movsd 0x90(%rsp), %xmm3
mulsd %xmm0, %xmm3
mulsd 0x13127(%rip), %xmm3    # 0x95d20
xorl %eax, %eax
movsd 0x1291d(%rip), %xmm0    # 0x95520
movapd %xmm3, %xmm1
cmpq %rax, %r12
je 0x82c38
cmpb $0x1, (%r14,%rax)
jne 0x82c21
movapd %xmm1, %xmm2
minsd %xmm0, %xmm2
subsd %xmm2, %xmm1
jmp 0x82c2d
movapd %xmm3, %xmm2
minsd %xmm0, %xmm2
subsd %xmm2, %xmm3
movsd %xmm2, (%r15,%rax,8)
incq %rax
jmp 0x82c07
leaq (,%r13,8), %rdi
leaq 0x1ed11(%rip), %rsi     # 0xa1958
pushq $0x19
popq %rdx
callq 0x34f59
movq %rax, %rbp
xorl %eax, %eax
cmpq %rax, %r12
je 0x82c64
andq $0x0, (%rbp,%rax,8)
incq %rax
jmp 0x82c54
leaq 0x28(%rsp), %rdi
pushq $0xb
popq %rcx
leaq 0xf0(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x18(%rsp)
movups %xmm0, 0x8(%rsp)
movq %r13, %rsi
movq 0x88(%rsp), %r13
movq %r13, (%rsp)
xorl %ebx, %ebx
movsd 0x1287f(%rip), %xmm0    # 0x95520
movq 0x80(%rsp), %rdi
xorl %edx, %edx
movq %rbp, %rcx
movq %r14, %r8
movq %r15, %r9
movapd %xmm0, %xmm1
callq 0x88dcb
movsd 0x20(%r13), %xmm0
cmpq %rbx, %r12
je 0x82ce6
movsbl (%r14,%rbx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm0, %xmm1
mulsd (%r15,%rbx,8), %xmm1
movsd %xmm1, (%r15,%rbx,8)
incq %rbx
jmp 0x82cc3
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movq 0x88(%rsp), %rax
movupd (%rax), %xmm2
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
divpd %xmm1, %xmm2
movupd %xmm2, (%rax)
movsd 0x12812(%rip), %xmm1    # 0x95520
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rax)
movsd %xmm1, 0x18(%rax)
movq 0x80(%rsp), %rdi
callq 0x34ff7
movq %r14, %rdi
callq 0x34ff7
movq %rbp, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x34ff7