// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rdi, %r12
leaq 0xf0(%rsp), %rax
leaq 0xd0(%rsp), %rbp
movslq (%rbp), %r13
movsd 0x40(%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
leaq 0x21180(%rip), %r15     # 0xb19f8
movq %r13, %rdi
movq %r15, %rsi
movl $0x5, %edx
callq 0x3a0e1
movq %rax, %r14
movl $0x88, %edi
movq %r15, %rsi
movl $0x6, %edx
callq 0x3a0e1
movq %rax, %r15
testq %r13, %r13
jle 0x90a0b
movq 0x8(%rbp), %rax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movsd (%rax,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
setbe %dl
negb %dl
orb $0x1, %dl
movb %dl, (%r14,%rcx)
incq %rcx
cmpq %rcx, %r13
jne 0x908b3
testl %r13d, %r13d
jle 0x90a0b
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0x88(%rsp), %xmm3
mulsd %xmm0, %xmm3
mulsd 0x15422(%rip), %xmm3    # 0xa5d18
xorl %eax, %eax
movsd 0x14c20(%rip), %xmm0    # 0xa5520
movapd %xmm3, %xmm1
cmpb $0x1, (%r14,%rax)
jne 0x90919
movapd %xmm3, %xmm2
minsd %xmm0, %xmm2
subsd %xmm2, %xmm3
jmp 0x90925
movapd %xmm1, %xmm2
minsd %xmm0, %xmm2
subsd %xmm2, %xmm1
movsd %xmm2, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x90904
movq %r15, 0x88(%rsp)
leaq (,%r13,8), %r15
leaq 0x210ae(%rip), %rsi     # 0xb19f8
movq %r15, %rdi
movl $0x19, %edx
callq 0x3a0e1
testl %r13d, %r13d
jle 0x90ad0
xorl %ebp, %ebp
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, 0x90(%rsp)
callq 0x4050
leaq 0x28(%rsp), %rdi
movl $0xb, %ecx
leaq 0xf0(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xd0(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x18(%rsp)
movups %xmm0, 0x8(%rsp)
movq %rbx, (%rsp)
movsd 0x14b6f(%rip), %xmm0    # 0xa5520
movq 0x88(%rsp), %r15
movq %r15, %rdi
movl %r13d, %esi
xorl %edx, %edx
movq 0x90(%rsp), %rcx
movq %r14, %r8
movq %r12, %r9
movapd %xmm0, %xmm1
callq 0x9755c
movsd 0x20(%rbx), %xmm0
movsbl (%r14,%rbp), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm0, %xmm1
mulsd (%r12,%rbp,8), %xmm1
movsd %xmm1, (%r12,%rbp,8)
incq %rbp
cmpq %rbp, %r13
jne 0x909dd
movq 0x90(%rsp), %r12
jmp 0x90a79
leaq (,%r13,8), %rdi
leaq 0x20fde(%rip), %rsi     # 0xb19f8
movl $0x19, %edx
callq 0x3a0e1
leaq 0x28(%rsp), %rdi
movl $0xb, %ecx
leaq 0xf0(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x18(%rsp)
movups %xmm0, 0x8(%rsp)
movq %rbx, (%rsp)
movsd 0x14ac9(%rip), %xmm0    # 0xa5520
movq %r15, %rdi
movl %r13d, %esi
xorl %edx, %edx
movq %rax, %rcx
movq %r14, %r8
movq %r12, %r9
movapd %xmm0, %xmm1
movq %rax, %r12
callq 0x9755c
movsd 0x20(%rbx), %xmm0
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movupd (%rbx), %xmm2
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
divpd %xmm1, %xmm2
movupd %xmm2, (%rbx)
movsd 0x14a87(%rip), %xmm1    # 0xa5520
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rbx)
movsd %xmm1, 0x18(%rbx)
movq %r15, %rdi
callq 0x3a180
movq %r14, %rdi
callq 0x3a180
movq %r12, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3a180
movq 0x88(%rsp), %r15
jmp 0x90a24