// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/svmsolve.c
// Function: do_shrinking
void do_shrinking(Solverptr s)
{
 /*Last Changed 28.04.2005*/
	int i, j, k;
	double Gm1, Gm2;
	if (select_working_set(s, &i, &j) != 0) 
		 return;
	Gm1 = -s->y[j] * s->G[j];
	Gm2 = s->y[i] * s->G[i];
	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] >= Gm2) 
								 continue;
			 }
		 else 
				 if (is_upper_bound(s, k))
					 {
			    if (s->y[k] == +1)
							 {
				     if (s->G[k] >= Gm2) 
										 continue;
							 }
			    else	
								 if (s->G[k] >= Gm1) 
										 continue;
					 }
		   else 
						 continue;
		 --s->active_size;
		 solver_swap_index(s, k, s->active_size);
		 --k;	
	 }
	/* unshrink, check all variables again before final iterations*/
	if (s->unshrinked || -(Gm1 + Gm2) > 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] < Gm2) 
								 continue;
			 }
		 else 
				 if (is_upper_bound(s, k))
					 {
			    if (s->y[k] == +1)
							 {
				     if (s->G[k] < Gm2) 
										 continue;
							 }
			    else	
								 if (s->G[k] < Gm1) 
										 continue;
					 } 
		   else 
						 continue;
		 solver_swap_index(s, k, s->active_size);
		 s->active_size++;
		 ++k;	
	 }
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x14(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x96305
testl %eax, %eax
jne 0x967f2
movq 0x8(%rbx), %rax
movslq 0x10(%rsp), %rcx
movsbl (%rax,%rcx), %edx
negl %edx
cvtsi2sd %edx, %xmm0
movq 0x10(%rbx), %rdx
mulsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0x14(%rsp), %rcx
movsbl (%rax,%rcx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%rsp)
movl (%rbx), %edx
testl %edx, %edx
jle 0x967c6
xorl %ebp, %ebp
movq 0x18(%rbx), %rcx
movslq %ebp, %rax
movzbl (%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x967aa
testl %ecx, %ecx
jne 0x967a2
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
xorpd 0xfa4a(%rip), %xmm0     # 0xa61d0
jne 0x967bd
ucomisd 0x8(%rsp), %xmm0
jae 0x967a2
decl %edx
movl %edx, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x95fe7
decl %ebp
movl (%rbx), %edx
incl %ebp
cmpl %edx, %ebp
jl 0x96759
jmp 0x967c6
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
jne 0x96788
ucomisd (%rsp), %xmm0
jb 0x96790
jmp 0x967a2
cmpl $0x0, 0x7c(%rbx)
jne 0x967f2
movsd 0x8(%rsp), %xmm0
addsd (%rsp), %xmm0
xorpd 0xf9f1(%rip), %xmm0     # 0xa61d0
movsd 0x48(%rbx), %xmm1
mulsd 0x115cc(%rip), %xmm1    # 0xa7db8
ucomisd %xmm1, %xmm0
jbe 0x967f9
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
movl $0x1, 0x7c(%rbx)
movq %rbx, %rdi
callq 0x960c2
movl (%rbx), %edx
movl 0x78(%rbx), %ebp
cmpl %edx, %ebp
jle 0x967f2
movslq %ebp, %rax
leaq -0x1(%rax), %rsi
movq 0x18(%rbx), %rcx
movzbl -0x1(%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x9684f
testl %ecx, %ecx
jne 0x9686f
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, -0x1(%rcx,%rax)
movsd -0x8(%rdi,%rax,8), %xmm0
xorpd 0xf98b(%rip), %xmm0     # 0xa61d0
jne 0x96864
movsd 0x8(%rsp), %xmm1
jmp 0x96869
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, -0x1(%rcx,%rax)
movsd -0x8(%rdi,%rax,8), %xmm0
jne 0x96847
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x96873
movl %esi, %ebp
jmp 0x9680d
movq %rbx, %rdi
callq 0x95fe7
movl (%rbx), %edx
incl %edx
movl %edx, (%rbx)
jmp 0x9680d