// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x1c(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x87c61
testl %eax, %eax
jne 0x880e4
movslq 0x18(%rsp), %rax
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdx
movsbl (%rcx,%rax), %esi
negl %esi
cvtsi2sd %esi, %xmm0
mulsd (%rdx,%rax,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0x1c(%rsp), %rax
movsbl (%rcx,%rax), %ecx
cvtsi2sd %ecx, %xmm0
mulsd (%rdx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ebp, %ebp
movl (%rbx), %edx
cmpl %edx, %ebp
jge 0x880b7
movq 0x18(%rbx), %rcx
movslq %ebp, %rax
movzbl (%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x8809a
testl %ecx, %ecx
jne 0x88096
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
xorpd 0xe154(%rip), %xmm0     # 0x961d0
jne 0x880ad
ucomisd 0x10(%rsp), %xmm0
jae 0x88096
decl %edx
movl %edx, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x87963
decl %ebp
incl %ebp
jmp 0x88049
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
jne 0x8807e
ucomisd 0x8(%rsp), %xmm0
jb 0x88086
jmp 0x88096
cmpl $0x0, 0x7c(%rbx)
jne 0x880e4
movsd 0x10(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
xorpd 0xe0ff(%rip), %xmm0     # 0x961d0
movsd 0x48(%rbx), %xmm1
mulsd 0xfc5a(%rip), %xmm1     # 0x97d38
ucomisd %xmm1, %xmm0
jbe 0x880ed
addq $0x20, %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
cmpl %edx, %esi
jle 0x880e4
movl %esi, %r14d
leal -0x1(%r14), %esi
movq 0x18(%rbx), %rcx
movslq %esi, %rax
movzbl (%rcx,%rax), %ecx
testl %ecx, %ecx
je 0x8813f
cmpl $0x1, %ecx
jne 0x88105
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, (%rcx,%rax)
movsd (%rdi,%rax,8), %xmm0
jne 0x8815a
movsd 0x8(%rsp), %xmm1
jmp 0x88160
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, (%rcx,%rax)
movsd (%rdi,%rax,8), %xmm0
xorpd 0xe078(%rip), %xmm0     # 0x961d0
jne 0x88137
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x88105
movq %rbx, %rdi
callq 0x87963
movl (%rbx), %edx
incl %edx
movl %edx, (%rbx)
jmp 0x88102