// File: /workspace/github_c_makefile_star2_O1/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), %rax
testq %rax, %rax
jle 0x93991
movq 0x18(%rbx), %rcx
movsd 0x14195(%rip), %xmm2    # 0xa7a68
xorl %edx, %edx
movapd 0xf8f3(%rip), %xmm0     # 0xa31d0
movapd %xmm2, %xmm1
movapd %xmm2, 0x10(%rsp)
movapd %xmm2, 0x20(%rsp)
movsd %xmm2, 0x8(%rsp)
movb (%rcx,%rdx), %sil
cmpb $0x1, %sil
jne 0x9391d
testb %sil, %sil
je 0x9395b
movq 0x8(%rbx), %rsi
cmpb $0x1, (%rsi,%rdx)
jne 0x93944
movq 0x10(%rbx), %rsi
movsd (%rsi,%rdx,8), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x9395b
jmp 0x9395f
movq 0x8(%rbx), %rdi
cmpb $0x1, (%rdi,%rdx)
jne 0x9396d
movq 0x10(%rbx), %rdi
movsd (%rdi,%rdx,8), %xmm2
xorpd %xmm0, %xmm2
ucomisd 0x20(%rsp), %xmm2
jbe 0x938fd
movapd %xmm2, 0x20(%rsp)
jmp 0x938fd
movq 0x10(%rbx), %rsi
movsd (%rsi,%rdx,8), %xmm2
ucomisd 0x8(%rsp), %xmm2
jbe 0x9395b
movsd %xmm2, 0x8(%rsp)
movapd %xmm1, %xmm2
incq %rdx
movapd %xmm2, %xmm1
cmpq %rdx, %rax
jne 0x938f3
jmp 0x939af
movq 0x10(%rbx), %rdi
movsd (%rdi,%rdx,8), %xmm2
xorpd %xmm0, %xmm2
ucomisd 0x10(%rsp), %xmm2
jbe 0x938fd
movapd %xmm2, 0x10(%rsp)
jmp 0x938fd
movsd 0x140cf(%rip), %xmm0    # 0xa7a68
movapd %xmm0, 0x10(%rsp)
movapd %xmm0, %xmm2
movsd %xmm0, 0x8(%rsp)
movapd %xmm0, 0x20(%rsp)
movapd 0xf819(%rip), %xmm0     # 0xa31d0
movapd 0x20(%rsp), %xmm1
xorpd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movapd 0x10(%rsp), %xmm1
xorpd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movl (%rbx), %edx
testl %edx, %edx
movsd %xmm2, 0x30(%rsp)
jle 0x93a75
xorl %ebp, %ebp
movq 0x18(%rbx), %rcx
movslq %ebp, %rax
movzbl (%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x93a14
testl %ecx, %ecx
jne 0x93a58
movq 0x8(%rbx), %rcx
cmpb $0x1, (%rcx,%rax)
jne 0x93a31
movq 0x10(%rbx), %rcx
ucomisd (%rcx,%rax,8), %xmm2
jb 0x93a42
jmp 0x93a58
movq 0x8(%rbx), %rcx
cmpb $0x1, (%rcx,%rax)
jne 0x93a62
movq 0x10(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
ucomisd 0x20(%rsp), %xmm0
jb 0x93a42
jmp 0x93a58
movq 0x10(%rbx), %rcx
movsd 0x8(%rsp), %xmm0
ucomisd (%rcx,%rax,8), %xmm0
jae 0x93a58
decl %edx
movl %edx, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x934b7
movsd 0x30(%rsp), %xmm2
decl %ebp
incl %ebp
movl (%rbx), %edx
cmpl %edx, %ebp
jl 0x939e9
jmp 0x93a75
movq 0x10(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
ucomisd 0x10(%rsp), %xmm0
jb 0x93a42
jmp 0x93a58
cmpl $0x0, 0x7c(%rbx)
jne 0x93ac9
movapd 0x20(%rsp), %xmm0
subsd %xmm2, %xmm0
movapd 0x10(%rsp), %xmm1
subsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm2
cmpunordsd %xmm0, %xmm2
movapd %xmm2, %xmm3
andpd %xmm1, %xmm3
minsd %xmm0, %xmm1
andnpd %xmm1, %xmm2
orpd %xmm3, %xmm2
xorpd 0xf71a(%rip), %xmm2     # 0xa31d0
movsd 0x48(%rbx), %xmm0
mulsd 0x1126d(%rip), %xmm0    # 0xa4d30
ucomisd %xmm0, %xmm2
jbe 0x93ad0
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
movl $0x1, 0x7c(%rbx)
movq %rbx, %rdi
callq 0x93592
movsd 0x30(%rsp), %xmm1
movl (%rbx), %edx
movl 0x78(%rbx), %ebp
cmpl %edx, %ebp
jle 0x93ac9
movslq %ebp, %rax
leaq -0x1(%rax), %rsi
movq 0x18(%rbx), %rcx
movzbl -0x1(%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x93b23
testl %ecx, %ecx
jne 0x93b6f
movq 0x8(%rbx), %rcx
cmpb $0x1, (%rcx,%rsi)
jne 0x93b39
movq 0x10(%rbx), %rcx
movsd -0x8(%rcx,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x93b4b
jmp 0x93b6f
movq 0x8(%rbx), %rcx
cmpb $0x1, (%rcx,%rsi)
jne 0x93b5d
movq 0x10(%rbx), %rcx
movapd 0x20(%rsp), %xmm0
jmp 0x93b67
movq 0x10(%rbx), %rcx
movsd -0x8(%rcx,%rax,8), %xmm0
ucomisd 0x8(%rsp), %xmm0
ja 0x93b6f
movq %rbx, %rdi
callq 0x934b7
movsd 0x30(%rsp), %xmm1
incl (%rbx)
jmp 0x93b71
movq 0x10(%rbx), %rcx
movapd 0x10(%rsp), %xmm0
ucomisd -0x8(%rcx,%rax,8), %xmm0
jbe 0x93b4b
movl %esi, %ebp
movl (%rbx), %edx
jmp 0x93aea