// File: /workspace/github_c_makefile_star2_O1/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, %r15
leaq 0xd0(%rsp), %rbp
movslq (%rbp), %r13
movsd 0x130(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
leaq 0x2093e(%rip), %r12     # 0xae980
movq %r13, %rdi
movq %r12, %rsi
movl $0x5, %edx
callq 0x390f5
movq %rax, %r14
movl $0x88, %edi
movq %r12, %rsi
movl $0x6, %edx
callq 0x390f5
testq %r13, %r13
jle 0x8e093
xorl %edx, %edx
xorpd %xmm0, %xmm0
movq 0x8(%rbp), %rcx
movsd (%rcx,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
setbe %cl
negb %cl
orb $0x1, %cl
movb %cl, (%r14,%rdx)
incq %rdx
cmpq %rdx, %r13
jne 0x8e072
movq %rax, 0x90(%rsp)
testl %r13d, %r13d
movsd 0x88(%rsp), %xmm3
jle 0x8e100
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
mulsd %xmm0, %xmm3
mulsd 0x14c5b(%rip), %xmm3    # 0xa2d18
xorl %eax, %eax
movsd 0x14459(%rip), %xmm0    # 0xa2520
movapd %xmm3, %xmm1
cmpb $0x1, (%r14,%rax)
jne 0x8e0e6
movapd %xmm3, %xmm2
minsd %xmm0, %xmm2
movsd %xmm2, (%r15,%rax,8)
subsd %xmm2, %xmm3
jmp 0x8e0f8
movapd %xmm1, %xmm2
minsd %xmm0, %xmm2
movsd %xmm2, (%r15,%rax,8)
subsd %xmm2, %xmm1
incq %rax
cmpq %rax, %r13
jne 0x8e0cb
leaq (,%r13,8), %r12
leaq 0x20871(%rip), %rsi     # 0xae980
movq %r12, %rdi
movl $0x19, %edx
callq 0x390f5
testl %r13d, %r13d
movq %rax, 0x88(%rsp)
jle 0x8e13e
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x4050
movq 0x88(%rsp), %rax
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 0x143af(%rip), %xmm0    # 0xa2520
movq 0x90(%rsp), %r12
movq %r12, %rdi
movl %r13d, %esi
xorl %edx, %edx
movq %rax, %rcx
movq %r14, %r8
movq %r15, %r9
movapd %xmm0, %xmm1
callq 0x949bb
movsd 0x20(%rbx), %xmm0
testl %r13d, %r13d
jle 0x8e1c3
xorl %eax, %eax
movsbl (%r14,%rax), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
divsd %xmm0, %xmm1
mulsd (%r15,%rax,8), %xmm1
movsd %xmm1, (%r15,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x8e19f
movsd (%rbx), %xmm1
movsd 0x8(%rbx), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, 0x8(%rbx)
movsd 0x14343(%rip), %xmm2    # 0xa2520
divsd %xmm0, %xmm2
mulsd %xmm0, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx)
movsd %xmm2, 0x10(%rbx)
movsd %xmm2, 0x18(%rbx)
movq %r12, %rdi
callq 0x39194
movq %r14, %rdi
callq 0x39194
movq 0x88(%rsp), %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x39194