// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/svmsolve.c
// Function: nu_do_shrinking
void nu_do_shrinking(Solverptr s)
{
	/*Last Changed 29.04.2005*/
	double Gmax1 = -DBL_MAX, Gmax2 = -DBL_MAX, Gmax3 = -DBL_MAX, Gmax4 = -DBL_MAX, Gm1, Gm2, Gm3, Gm4;	
	int k;
	for (k = 0; k < s->active_size; k++)
	 {
	 	if (!is_upper_bound(s, k))
			 {
			  if (s->y[k] == +1)
				 	{
				   if (-s->G[k] > Gmax1) 
								 Gmax1 = -s->G[k];
					 }
			  else	
						 if (-s->G[k] > Gmax3) 
								 Gmax3 = -s->G[k];
			 }
		 if (!is_lower_bound(s, k))
			 {
		  	if (s->y[k] == +1)
					 {	
				   if (s->G[k] > Gmax2) 
								 Gmax2 = s->G[k];
					 }
			  else	
						 if (s->G[k] > Gmax4) 
								 Gmax4 = s->G[k];
			 }
	 }
 Gm1 = -Gmax2;
 Gm2 = -Gmax1;
	Gm3 = -Gmax4;
	Gm4 = -Gmax3;
	for (k = 0; k < s->active_size; k++)
	 {
		 if (is_lower_bound(s, k))
			 {
		  	if (s->y[k] == +1)
					 {
				   if (-s->G[k] >= Gm1) 
								 continue;
					 }
			  else	
						 if (-s->G[k] >= Gm3)  
								 continue;
			 }
		 else 
				 if (is_upper_bound(s, k))
					 {
			    if (s->y[k] == +1)
							 {
				     if (s->G[k] >= Gm2) 
										 continue;
							 }
			    else	
								 if (s->G[k] >= Gm4) 
										 continue;
					 }
		   else 
						 continue;
		 --s->active_size;
		 solver_swap_index(s, k, s->active_size);
		 --k;	
	 }
	if (s->unshrinked || fmax(-(Gm1+Gm2), -(Gm3+Gm4)) > s->eps * 10) 
		 return;
	s->unshrinked = 1;
	reconstruct_gradient(s);
	for (k = s->l - 1; k >= s->active_size; k--)
	 {
	 	if (is_lower_bound(s, k))
			 {
			  if (s->y[k] == +1)
					 {
				   if (-s->G[k] < Gm1) 
								 continue;
					 }
			  else	
						 if (-s->G[k] < Gm3) 
								 continue;
			 }
		 else 
				 if (is_upper_bound(s, k))
					 {
			    if (s->y[k] == +1)
							 {
				     if (s->G[k] < Gm2) 
										 continue;
							 }
			    else	
								 if (s->G[k] < Gm4) 
										 continue;
					 }
		   else 
						 continue;
		 solver_swap_index(s, k, s->active_size);
		 s->active_size++;
		 ++k;	
	 }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movl (%rdi), %edx
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
movsd 0x12c99(%rip), %xmm3    # 0x9aa48
movapd 0xe419(%rip), %xmm0     # 0x961d0
movapd %xmm3, (%rsp)
movapd %xmm3, %xmm4
movapd %xmm3, %xmm2
cmpq %rax, %rcx
je 0x87e4f
movq 0x18(%rbx), %rsi
movb (%rsi,%rax), %sil
cmpb $0x1, %sil
jne 0x87de1
movapd %xmm2, %xmm1
jmp 0x87e16
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r8
cmpb $0x1, (%rdi,%rax)
movsd (%r8,%rax,8), %xmm1
xorpd %xmm0, %xmm1
jne 0x87e01
ucomisd %xmm2, %xmm1
jbe 0x87e0d
jmp 0x87e11
ucomisd (%rsp), %xmm1
jbe 0x87e0d
movapd %xmm1, (%rsp)
movapd %xmm2, %xmm1
testb %sil, %sil
je 0x87e3b
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdi
cmpb $0x1, (%rsi,%rax)
movsd (%rdi,%rax,8), %xmm2
jne 0x87e31
ucomisd %xmm4, %xmm2
jbe 0x87e3b
jmp 0x87e3f
ucomisd %xmm3, %xmm2
jbe 0x87e3b
movapd %xmm2, %xmm3
movapd %xmm4, %xmm2
incq %rax
movapd %xmm2, %xmm4
movapd %xmm1, %xmm2
jmp 0x87dc4
movapd 0xe379(%rip), %xmm0     # 0x961d0
xorpd %xmm0, %xmm2
movapd (%rsp), %xmm1
xorpd %xmm0, %xmm1
movapd %xmm1, (%rsp)
xorl %ebp, %ebp
movsd %xmm3, 0x18(%rsp)
movsd %xmm4, 0x10(%rsp)
movapd %xmm2, 0x20(%rsp)
cmpl %edx, %ebp
jge 0x87f06
movq 0x18(%rbx), %rcx
movslq %ebp, %rax
movzbl (%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x87eb4
testl %ecx, %ecx
jne 0x87ef9
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
jne 0x87ecf
ucomisd %xmm0, %xmm4
jb 0x87ed5
jmp 0x87ef9
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
jne 0x87efd
ucomisd %xmm2, %xmm0
jb 0x87ed5
jmp 0x87ef9
ucomisd %xmm0, %xmm3
jae 0x87ef9
decl %edx
movl %edx, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x87963
movapd 0x20(%rsp), %xmm2
movsd 0x10(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
decl %ebp
movl (%rbx), %edx
incl %ebp
jmp 0x87e7d
ucomisd (%rsp), %xmm0
jb 0x87ed5
jmp 0x87ef9
cmpl $0x0, 0x7c(%rbx)
jne 0x87f3d
movapd %xmm2, %xmm0
subsd %xmm4, %xmm0
movapd (%rsp), %xmm1
subsd %xmm3, %xmm1
callq 0x34c95
xorpd 0xe2a6(%rip), %xmm0     # 0x961d0
movsd 0x48(%rbx), %xmm1
mulsd 0xfe01(%rip), %xmm1     # 0x97d38
ucomisd %xmm1, %xmm0
jbe 0x87f46
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x1, 0x7c(%rbx)
movq %rbx, %rdi
callq 0x87a3e
movl (%rbx), %edx
movl 0x78(%rbx), %r14d
movl %r14d, %esi
movsd 0x18(%rsp), %xmm1
movsd 0x10(%rsp), %xmm3
movapd 0x20(%rsp), %xmm4
cmpl %edx, %esi
jle 0x87f3d
movl %esi, %r14d
leal -0x1(%r14), %esi
movq 0x18(%rbx), %rcx
movslq %esi, %rax
movzbl (%rcx,%rax), %ecx
testl %ecx, %ecx
je 0x87faa
cmpl $0x1, %ecx
jne 0x87f70
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, (%rcx,%rax)
movsd (%rdi,%rax,8), %xmm0
jne 0x87fc5
ucomisd %xmm0, %xmm4
ja 0x87f70
jmp 0x87fd8
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, (%rcx,%rax)
movsd (%rdi,%rax,8), %xmm0
jne 0x87fd2
ucomisd %xmm3, %xmm0
ja 0x87f70
jmp 0x87fd8
movapd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
ja 0x87f70
jmp 0x87fd8
ucomisd %xmm1, %xmm0
ja 0x87f70
movq %rbx, %rdi
callq 0x87963
movl (%rbx), %edx
incl %edx
movl %edx, (%rbx)
jmp 0x87f5b