// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movslq (%rdi), %rdx
testq %rdx, %rdx
jle 0x965b5
movq 0x18(%rbx), %rax
movsd 0x146b9(%rip), %xmm7    # 0xaab18
xorl %ecx, %ecx
movapd 0xfd67(%rip), %xmm0     # 0xa61d0
movapd %xmm7, %xmm5
movapd %xmm7, %xmm4
movapd %xmm7, %xmm6
movb (%rax,%rcx), %sil
cmpb $0x1, %sil
jne 0x96485
movapd %xmm7, %xmm1
jmp 0x964b8
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r8
cmpb $0x1, (%rdi,%rcx)
movsd (%r8,%rcx,8), %xmm1
xorpd %xmm0, %xmm1
jne 0x964a5
ucomisd %xmm7, %xmm1
jbe 0x964af
jmp 0x964b3
ucomisd %xmm4, %xmm1
jbe 0x964af
movapd %xmm1, %xmm4
movapd %xmm7, %xmm1
testb %sil, %sil
je 0x964eb
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdi
cmpb $0x1, (%rsi,%rcx)
movsd (%rdi,%rcx,8), %xmm2
jne 0x964db
ucomisd %xmm5, %xmm2
jbe 0x964eb
movapd %xmm1, %xmm7
movapd %xmm2, %xmm5
jmp 0x964ef
ucomisd %xmm6, %xmm2
jbe 0x964eb
movapd %xmm1, %xmm7
movapd %xmm2, %xmm6
jmp 0x964ef
movapd %xmm1, %xmm7
incq %rcx
cmpq %rcx, %rdx
jne 0x96475
movapd 0xfccd(%rip), %xmm0     # 0xa61d0
xorpd %xmm0, %xmm7
xorpd %xmm0, %xmm4
testl %edx, %edx
jle 0x965cd
xorl %ebp, %ebp
movapd %xmm4, 0x20(%rsp)
movsd %xmm5, 0x8(%rsp)
movsd %xmm6, (%rsp)
movapd %xmm7, 0x10(%rsp)
movq 0x18(%rbx), %rcx
movslq %ebp, %rax
movzbl (%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x9655b
testl %ecx, %ecx
jne 0x965a5
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
jne 0x96576
ucomisd %xmm0, %xmm5
jb 0x9657c
jmp 0x965a5
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
jne 0x965ad
ucomisd %xmm7, %xmm0
jb 0x9657c
jmp 0x965a5
ucomisd %xmm0, %xmm6
jae 0x965a5
decl %edx
movl %edx, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x95fe7
movapd 0x10(%rsp), %xmm7
movsd (%rsp), %xmm6
movsd 0x8(%rsp), %xmm5
movapd 0x20(%rsp), %xmm4
decl %ebp
movl (%rbx), %edx
incl %ebp
cmpl %edx, %ebp
jl 0x9652c
jmp 0x965cd
ucomisd %xmm4, %xmm0
jb 0x9657c
jmp 0x965a5
movsd 0x1455b(%rip), %xmm5    # 0xaab18
movsd 0x1455b(%rip), %xmm4    # 0xaab20
movapd %xmm4, %xmm7
movapd %xmm5, %xmm6
cmpl $0x0, 0x7c(%rbx)
jne 0x9661b
movapd %xmm7, %xmm0
subsd %xmm5, %xmm0
movapd %xmm4, %xmm1
subsd %xmm6, %xmm1
movapd %xmm0, %xmm2
cmpunordsd %xmm0, %xmm2
movapd %xmm2, %xmm3
andpd %xmm1, %xmm3
minsd %xmm0, %xmm1
andnpd %xmm1, %xmm2
orpd %xmm3, %xmm2
xorpd 0xfbc8(%rip), %xmm2     # 0xa61d0
movsd 0x48(%rbx), %xmm0
mulsd 0x117a3(%rip), %xmm0    # 0xa7db8
ucomisd %xmm0, %xmm2
jbe 0x96622
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
movl $0x1, 0x7c(%rbx)
movq %rbx, %rdi
movapd %xmm4, 0x20(%rsp)
movsd %xmm5, 0x8(%rsp)
movsd %xmm6, (%rsp)
movapd %xmm7, 0x10(%rsp)
callq 0x960c2
movapd 0x10(%rsp), %xmm4
movsd (%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
movapd 0x20(%rsp), %xmm1
movl (%rbx), %edx
movl 0x78(%rbx), %ebp
cmpl %edx, %ebp
jle 0x9661b
movslq %ebp, %rax
leaq -0x1(%rax), %rsi
movq 0x18(%rbx), %rcx
movzbl -0x1(%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x966a0
testl %ecx, %ecx
jne 0x9669c
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, -0x1(%rcx,%rax)
movsd -0x8(%rdi,%rax,8), %xmm0
jne 0x966bd
ucomisd %xmm2, %xmm0
jbe 0x966c3
movl %esi, %ebp
jmp 0x96664
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, -0x1(%rcx,%rax)
movsd -0x8(%rdi,%rax,8), %xmm0
jne 0x966ed
ucomisd %xmm0, %xmm4
ja 0x9669c
jmp 0x966c3
ucomisd %xmm3, %xmm0
ja 0x9669c
movq %rbx, %rdi
callq 0x95fe7
movapd 0x10(%rsp), %xmm4
movsd (%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
movapd 0x20(%rsp), %xmm1
movl (%rbx), %edx
incl %edx
movl %edx, (%rbx)
jmp 0x96664
ucomisd %xmm0, %xmm1
ja 0x9669c
jmp 0x966c3