// File: /workspace/github_c_makefile_star2_O1/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 0x937a1
testl %eax, %eax
jne 0x93c75
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 0x93c49
xorl %ebp, %ebp
movq 0x18(%rbx), %rcx
movslq %ebp, %rax
movzbl (%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x93c2d
testl %ecx, %ecx
jne 0x93c23
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
xorpd 0xf5c7(%rip), %xmm0     # 0xa31d0
jne 0x93c40
ucomisd 0x8(%rsp), %xmm0
jae 0x93c23
decl %edx
movl %edx, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x934b7
decl %ebp
incl %ebp
movl (%rbx), %edx
cmpl %edx, %ebp
jl 0x93bdc
jmp 0x93c49
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
cmpb $0x1, (%rcx,%rax)
movsd (%rsi,%rax,8), %xmm0
jne 0x93c0b
ucomisd (%rsp), %xmm0
jb 0x93c13
jmp 0x93c23
cmpl $0x0, 0x7c(%rbx)
jne 0x93c75
movsd 0x8(%rsp), %xmm0
addsd (%rsp), %xmm0
xorpd 0xf56e(%rip), %xmm0     # 0xa31d0
movsd 0x48(%rbx), %xmm1
mulsd 0x110c1(%rip), %xmm1    # 0xa4d30
ucomisd %xmm1, %xmm0
jbe 0x93c7c
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
movl $0x1, 0x7c(%rbx)
movq %rbx, %rdi
callq 0x93592
movl (%rbx), %edx
movl 0x78(%rbx), %ebp
cmpl %edx, %ebp
jle 0x93c75
movslq %ebp, %rax
leaq -0x1(%rax), %rsi
movq 0x18(%rbx), %rcx
movzbl -0x1(%rcx,%rax), %ecx
cmpl $0x1, %ecx
je 0x93cd2
testl %ecx, %ecx
jne 0x93cf2
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, -0x1(%rcx,%rax)
movsd -0x8(%rdi,%rax,8), %xmm0
xorpd 0xf508(%rip), %xmm0     # 0xa31d0
jne 0x93ce7
movsd 0x8(%rsp), %xmm1
jmp 0x93cec
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdi
cmpb $0x1, -0x1(%rcx,%rax)
movsd -0x8(%rdi,%rax,8), %xmm0
jne 0x93cca
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x93cf6
movl %esi, %ebp
jmp 0x93d00
movq %rbx, %rdi
callq 0x934b7
incl (%rbx)
movl (%rbx), %edx
jmp 0x93c90